Skip to content

Commit 370210a

Browse files
committed
Fix a bug in MEMORY_BASIC_INFORMATION64 extended struct + add related test
1 parent 288e87a commit 370210a

File tree

6 files changed

+3781
-3770
lines changed

6 files changed

+3781
-3770
lines changed

ctypes_generation/extended_structs/_MEMORY_BASIC_INFORMATION64.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def Protect(self):
2828

2929
@property
3030
def AllocationProtect(self):
31-
raw_protect = super(_MEMORY_BASIC_INFORMATION32, self).AllocationProtect
31+
raw_protect = super(_MEMORY_BASIC_INFORMATION64, self).AllocationProtect
3232
# Finally make a chooser somewhere ?
3333
return self.PROTECT_MAPPER[raw_protect]
3434

tests/test_process.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,17 @@ def test_read_wstring_end_page(self, proc32_64):
123123
proc32_64.write_memory(addr, "\x00".join(string_to_write))
124124
assert proc32_64.read_wstring(addr) == test_string
125125

126+
def test_query_memory(self, proc32_64):
127+
addr = proc32_64.virtual_alloc(0x2000, prot=gdef.PAGE_EXECUTE_READWRITE)
128+
proc32_64.virtual_protect(addr, 0x2000, gdef.PAGE_READONLY)
129+
meminfo = proc32_64.query_memory(addr + 0x1000)
130+
assert meminfo.AllocationBase == addr
131+
assert meminfo.AllocationProtect == gdef.PAGE_EXECUTE_READWRITE
132+
assert meminfo.BaseAddress == addr + 0x1000
133+
assert meminfo.RegionSize == 0x1000 # 0x2000 - 0x1000
134+
assert meminfo.Type == gdef.MEM_PRIVATE
135+
assert meminfo.Protect == gdef.PAGE_READONLY
136+
126137
# Test native execution
127138
def test_execute_to_proc32(self, proc32):
128139
with proc32.allocated_memory(0x1000) as addr:

windows/generated_def/meta.py

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)