def loadUnicodeString(va): va = int(va) # https://msdn.microsoft.com/en-us/library/windows/desktop/aa380518(v=vs.85).aspx Length = script.ReadWord(va) va += 2 MaximumLength = script.ReadWord(va) va += 2 if is64bitSystem(): va += 4 Buffer = script.ReadPtr(va) if Length > MaximumLength or not script.IsValidPtr(Buffer): raise DbgException("Corrupted UNICODE_STRING structure") A = array.array("u") A.fromstring(script.Read(Buffer, Length)) return A.tounicode().rstrip(u'\0')
def loadWChars(va, count): A = array.array("u") A.fromstring(script.Read(va, count * 2)) return A.tounicode()
def loadChars(va, count): return script.Read(va, count)
def loadDwords(va, count): A = array.array("I") A.fromstring(script.Read(va, count * 4)) return A.tolist()
def loadBytes(va, count): return list(script.Read(va, count))