Read an ascii string at ``addr``
(self, addr)
| 341 | return self.read_qword(addr) |
| 342 | |
| 343 | def read_string(self, addr): |
| 344 | """Read an ascii string at ``addr``""" |
| 345 | res = [] |
| 346 | read_size = 0x100 |
| 347 | readden = 0 |
| 348 | for i in itertools.count(): |
| 349 | try: |
| 350 | x = self.read_memory(addr + readden, read_size) |
| 351 | except WindowsError as e: |
| 352 | if read_size == 2: |
| 353 | raise |
| 354 | # handle read_wstring at end of page |
| 355 | # Of read failed: read only the half of size |
| 356 | # read_size must remain a multiple of 2 |
| 357 | read_size = read_size // 2 |
| 358 | continue |
| 359 | readden += read_size |
| 360 | if b"\x00" in x: |
| 361 | res.append(x.split(b"\x00", 1)[0]) |
| 362 | break |
| 363 | res.append(x) |
| 364 | return b"".join(res).decode("ascii") |
| 365 | |
| 366 | def read_wstring(self, addr): |
| 367 | """Read a windows UTF16 string at ``addr``""" |
no test coverage detected