__declspec(naked) void __stdcall PlantCall()
{
/
/
push eip
__asm
{
PUSHAD
pushfd
push ebp
mov ebp,esp
SUB esp,
0xc
push eax
pop DWORD PTR[ebp
-
0x8
]
push DWORD PTR[ebp
+
0xc
+
0x24
]
pop DWORD PTR [ebp
-
0xc
]
push DWORD PTR [ebp
+
0x10
+
0x24
]
pop DWORD PTR[ebp
-
0X4
]
PUSH ESP
call MySend
ADD ESP,
0XC
POP EBP
POPFD
POPAD
PUSH ECX
PUSH EBX
PUSH EBP
MOV EBP,[ESP
+
0X10
]
JMP g_dwAddress
}
}
int
Modify40D120()
{
/
/
修改内存属性
unsigned char szBuf[
7
]
=
{
0xe9
,
0x90
,
0x90
,
0x90
,
0x90
,
0x90
,
0x90
};
DWORD dwePro
=
0
;
if
(!VirtualProtect((PVOID)
0X40D120
,
7
, PAGE_EXECUTE_READWRITE, &dwePro))
{
DbgPrint(
"[Test] Modify40d120 Eoor %d\r\n"
, GetLastError());
return
-
1
;
}
/
/
int
nAddress
=
(
int
)PlantCall
-
0x40D120
-
5
;
memcpy(szBuf
+
1
, &nAddress, sizeof(
int
));
memcpy((PVOID)
0X40D120
, szBuf, sizeof(szBuf));
if
(!VirtualProtect((PVOID)
0X40D120
,
7
, dwePro, &dwePro))
{
DbgPrint(
"[Test] Modify40d120 Eoor %d\r\n"
, GetLastError());
return
-
1
;
}
return
0
;
}