var
CodeBuf:array[0..1023] of Byte;
lpNumberOfBytesWritten:Cardinal;
procedure TestFun();stdcall;
var
i, j:Integer;
begin
for i:=0 to 999 do
begin
for j:=0 to 999 do
begin
//
end;
end;
MessageBox(0, '无聊的函数:)', '提示', MB_OK + MB_ICONQUESTION + MB_TOPMOST);
end;
begin
FillChar(CodeBuf, 1024, $cc);
if WriteProcessMemory( GetCurrentProcess, @TestFun, @CodeBuf, 10, lpNumberOfBytesWritten) = False then
MessageBox(0, '写内存失败.', '提示', MB_OK + MB_ICONQUESTION + MB_TOPMOST);
if ReadProcessMemory( GetCurrentProcess, @TestFun, @CodeBuf, 10, lpNumberOfBytesWritten) = False then
MessageBox(0, '读内存失败.', '提示', MB_OK + MB_ICONQUESTION + MB_TOPMOST);
end.