在下面的代码中,我想读取由 CreateRemoteThread 创建的 LoadLibrayA 的结果。
我会感谢您的帮助,因为这似乎是不可能的,
也许结果可以及时免费阅读,任何建议都会很高兴收到
procedure InjectDLL(hProcess : Cardinal; ADllPath : String);
var
lSize : Cardinal;
hThread : Cardinal;
szLibPath : array [0..MAX_PATH] of char;
pLibRemote : Pointer;
hLibModule : DWORD ;
hKernel32 : HMODULE;
begin
hKernel32 := GetModuleHandle('Kernel32.dll');
FillMemory(@szLibPath, sizeOf(szLibPath), 0);
CopyMemory(@szLibPath, Pointer(ADllPath), length(ADllPath));
pLibRemote :=
VirtualAllocEx(
hProcess,
nil,
sizeOf(szLibPath),
MEM_COMMIT,
PAGE_READWRITE
);
try
WriteProcessMemory(
hProcess,
pLibRemote,
@szLibPath,
sizeOf(szLibPath),
lSize
);
hThread :=
CreateRemoteThread(
hProcess,
nil,
0,
GetProcAddress(hKernel32, 'LoadLibraryA'),
pLibRemote,
0,
lSize
);
try
WaitForSingleObject(hThread, INFINITE);
//------------> HERE I WANT TO READ LoadLibraryA RESULT
GetExitCodeThread(hThread, hLibModule);
finally
// Clean up
CloseHandle(hThread);
end;
finally
VirtualFreeEx(hProcess, pLibRemote, sizeof(szLibPath), MEM_RELEASE);
end;