Excellent stuff, thanks for providing this.
I'm having some trouble with this ... I have confirmed I am running the appropriate version of WoW as posted in your opening post ... coupled with matching the offsets.
In the block below, lib_base_addr is always zero ... I added the GetLastError check to try and determine the cause ... the returned error is "The Handle is Invalid".
Apparently the GetExitCodeThread is throwing an error and lib_base_addr gets no value.
Thoughts?
Thanks!
Code:
// call LoadLibraryW from the remote process
thread = CreateRemoteThread(process, NULL, 0,
reinterpret_cast<LPTHREAD_START_ROUTINE>(load_lib),
dll_name_addr, 0, NULL);
if (thread == NULL) {
VirtualFreeEx(process, dll_name_addr, 0, MEM_RELEASE);
OutputDebugString(TEXT("CreateRemoteThread failed\n"));
return 0;
}
DWORD lib_base_addr;
WaitForSingleObject(thread, INFINITE);
GetExitCodeThread(thread, &lib_base_addr);
// free space reserved for the dll name in the remote process
VirtualFreeEx(process, dll_name_addr, 0, MEM_RELEASE);
if(lib_base_addr == 0)
{
void *buf;
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, GetLastError(), 0, (LPTSTR) & buf, 0, NULL);
MessageBox(NULL, (LPTSTR) buf, NULL, MB_OK | MB_ICONINFORMATION);
wprintf_s(TEXT("Epic Fail\r\n"));
OutputDebugString(TEXT("Failed to load DLL\n"));
return 0;
}