So, I have this function in my DLL. My DLL automatically gets injected into the wow.exe upon startup. I was curious if I was actually grabbing the session key because I could not derypt/encrypt the first channel you connect to. And I have been spitting out its results.. I don't know if I am not reading the memory at the right time, or if my code is not working because it is inside of a DLL. The code below works 100% because I use it all the time outside of my current project.
Code:
void WOWStealSessionKey(SOCKET s)
{
ProxyList* proxy = getProxy(s, 0, 0);
/*
HINSTANCE hInstance;
HANDLE hProcess;
DWORD dwThreadId, dwProcessId;
HWND hwnd;
hwnd = FindWindow(NULL,"World of Warcraft");
if(!hwnd)
{
MessageBox(NULL, TEXT("Window Not Found"), TEXT("ERROR"), MB_OK);
return;
}
hInstance = (HINSTANCE)GetWindowLong(hwnd, GWL_HINSTANCE);
dwThreadId = GetWindowThreadProcessId(hwnd, &dwProcessId);
hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, dwProcessId);
*/
// Session Key
(D8056C + 508)(D80A74) - 00401000 = 97F064 + (Game Start Location Of Process) = 0xC40064
DWORD LOCATION = 0xC40064;
unsigned char what[1000];
int what_len = 1000;
ReadProcessMemory(GetCurrentProcess(), (void*)LOCATION,what,sizeof(what),0);
printPacket(what,what_len,proxy->id,"WHAT I FOUND IN MEMORY",true); // Show 1000x of 00s
CloseHandle(hProcess);
HMACSHA1(HMAC1,HMAC2,proxy->id);
}
I tried all locations to see if I can get anything besides 1000x 00's. I tried calling it right before and after the first, second, and third packets that are exchanged(both sent and received!). Still, I get a big wall of 00s. I dont really understand why... Unless my session key location is wrong, but this is up to date session key location as of: 4.2.2(14545(release) AUG 23 2011
Im pretty sure I dont need to open the process up and get permission to read memory(since I am already in memory from the DLL) so I also added that in just to double check and I still get the current result. IF I can read the session key, I would be able to at least decrypt and encrypt the first channel. As I have tested my encryption code in game already with just a tool I made.
Any help would be huge for me. P.S. Using MSVC++ 2010 Express under vista 32. If that matters. Also, maybe my address for session key is not right...