Reads a ctypes structure from the memory of the process. @see: L{read} @type lpBaseAddress: int @param lpBaseAddress: Memory address to begin reading. @type stype: class ctypes.Structure or a subclass. @param stype: Structure definition.
(self, lpBaseAddress, stype)
| 1858 | self.__write_c_type(lpBaseAddress, "=Q", unpackedValue) |
| 1859 | |
| 1860 | def read_structure(self, lpBaseAddress, stype): |
| 1861 | """ |
| 1862 | Reads a ctypes structure from the memory of the process. |
| 1863 | |
| 1864 | @see: L{read} |
| 1865 | |
| 1866 | @type lpBaseAddress: int |
| 1867 | @param lpBaseAddress: Memory address to begin reading. |
| 1868 | |
| 1869 | @type stype: class ctypes.Structure or a subclass. |
| 1870 | @param stype: Structure definition. |
| 1871 | |
| 1872 | @rtype: int |
| 1873 | @return: Structure instance filled in with data |
| 1874 | read from the process memory. |
| 1875 | |
| 1876 | @raise WindowsError: On error an exception is raised. |
| 1877 | """ |
| 1878 | if type(lpBaseAddress) not in (type(0), type(long(0))): |
| 1879 | lpBaseAddress = ctypes.cast(lpBaseAddress, ctypes.c_void_p) |
| 1880 | data = self.read(lpBaseAddress, ctypes.sizeof(stype)) |
| 1881 | buff = ctypes.create_string_buffer(data) |
| 1882 | ptr = ctypes.cast(ctypes.pointer(buff), ctypes.POINTER(stype)) |
| 1883 | return ptr.contents |
| 1884 | |
| 1885 | # XXX TODO |
| 1886 | ## def write_structure(self, lpBaseAddress, sStructure): |
no test coverage detected