ollydbg 1.10
如果传递给 VirtualProtect 的地址位于第一个分配的页面中,则在更改保护属性时自动刷新内存窗口
如果使用 Virtualprotect ollydbg 的内存窗口更改了后续页面的属性,则不会反映它们,因为它将完整分配的大小显示为一个连续的转储
!vprot
仅当您逐页遍历时,windbg才会显示修改后的保护属性
在ollydbg 2.01
内存窗口将自动逐页显示属性更改
一个例子
int _tmain(int argc, _TCHAR* argv[])
{
printf("lets valloc \n");
PCHAR foo;
foo = (PCHAR)VirtualAlloc(0,0x1004,MEM_COMMIT,PAGE_READONLY);
printf("we valloced lets vprot\n");
DWORD oldprot;
if ( (VirtualProtect(foo+0x1000,1,PAGE_EXECUTE_READWRITE,&oldprot) == FALSE) )
{
printf("our vprot failed\n");
return FALSE;
}
if ( (VirtualProtect(foo+0xfff,1,PAGE_EXECUTE_READWRITE,&oldprot) == FALSE) )
{
printf("our vprot failed\n");
return FALSE;
}
printf("we vprotted fine \n");
return 0;
}
ollydbg 1.10 内存窗口显示在 VirtualAlloc 和第一个 Virtualprotect 之后相同
显示只会在第二个 VirtualProtect 之后改变
Memory map, item 19
Address=003A0000
Size=00002000 (8192.)
Owner= 003A0000 (itself)
Section=
Type=Priv 00021002
Access=R
Initial access=R
在第二个 Virtualprotect 之后
Memory map, item 19
Address=003A0000
Size=00002000 (8192.)
Owner= 003A0000 (itself)
Section=
Type=Priv 00021040
**Access=RWE**
Initial access=R
仅当逐页遍历时,windbg 才会显示更改的属性
0:000> g
ModLoad: 5cb70000 5cb96000 C:\WINDOWS\system32\ShimEng.dll
Breakpoint 0 hit
> 8: {
0:000> p
> 9: printf("lets valloc \n");
0:000> p
> 11: foo = (PCHAR)VirtualAlloc(0,0x1004,MEM_COMMIT,PAGE_READONLY);
0:000> p
> 12: printf("we valloced lets vprot\n");
0:000> ?? foo
char * 0x003a0000
""
0:000> !vprot @@c++(foo)
BaseAddress: 003a0000
AllocationBase: 003a0000
AllocationProtect: 00000002 PAGE_READONLY
RegionSize: 00002000
State: 00001000 MEM_COMMIT
Protect: 00000002 PAGE_READONLY
Type: 00020000 MEM_PRIVATE
0:000> p
> 14: if ( (VirtualProtect(foo+0x1000,1,PAGE_EXECUTE_READWRITE,&oldprot) == FALSE) )
0:000> p
> 19: if ( (VirtualProtect(foo+0xfff,1,PAGE_EXECUTE_READWRITE,&oldprot) == FALSE) )
0:000> !vprot @@c++(foo)
BaseAddress: 003a0000
AllocationBase: 003a0000
AllocationProtect: 00000002 PAGE_READONLY
RegionSize: 00001000
State: 00001000 MEM_COMMIT
Protect: 00000002 PAGE_READONLY
Type: 00020000 MEM_PRIVATE
0:000> !vprot (@@c++(foo)+1000)
BaseAddress: 003a1000
AllocationBase: 003a0000
AllocationProtect: 00000002 PAGE_READONLY
RegionSize: 00001000
State: 00001000 MEM_COMMIT
Protect: 00000040 PAGE_EXECUTE_READWRITE
Type: 00020000 MEM_PRIVATE
ollydbg 2.01 将立即显示任何更改,注意内存映射项目编号和地址
Memory map, item 19
Address = 003A0000
Size = 00002000 (8192.)
Owner = 003A0000 (self)
Section =
Contains =
Type = Priv 00021002
Access = R
Initial access = R
Mapped as =
在第一个 Virtualprotect 之后
Memory map, item 20
Address = 003A1000
Size = 00001000 (4096.)
Owner = 003A0000
Section =
Contains =
Type = Priv 00021040
Access = RWE
Initial access = R
Mapped as =