dll does not work! WTF?!
I made a dll to inject to diablo 2. First time making a dll so I somewhat copied someones code
. But I dont understand the code makes perfect sense to me it should work but when I inject it to dll with my injector I made my self, ce or winject it doesnt write the text file. Im just doing the text file to check if the dll initialized.
Plox help
. But I dont understand the code makes perfect sense to me it should work but when I inject it to dll with my injector I made my self, ce or winject it doesnt write the text file. Im just doing the text file to check if the dll initialized.Code:
#include "main.h"
#define game "Diablo II"
HWND hWnd;
HANDLE HndThread;
int Thread() {
while(1) {
ofstream file;
file.open("test.txt");
file << "worked";
file.close();
Sleep(1);
}
}
BOOL APIENTRY DllMain(HMODULE hModule,DWORD reason,LPVOID lpReserved) {
if(reason == DLL_PROCESS_ATTACH) {
hWnd = FindWindow(NULL,game);
if(hWnd == NULL) {
return false;
} else {
HndThread = CreateThread(0,0,(LPTHREAD_START_ROUTINE)Thread,NULL,0,NULL);
}
}
return true;
}

now im gonna use BitBlt to draw to the diablo 2 window to make somewhat a menu