MCPcopy Create free account
hub / github.com/fabioz/PyDev.Debugger / read_structure

Method read_structure

pydevd_attach_to_process/winappdbg/process.py:1860–1883  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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):

Callers 8

get_pebMethod · 0.95
get_image_nameMethod · 0.95
get_environment_blockMethod · 0.95
get_tebMethod · 0.80
read_stack_structureMethod · 0.80
read_stack_frameMethod · 0.80

Calls 1

readMethod · 0.95

Tested by

no test coverage detected