I want to create a dll that unload it self in case of some condifiton, meaning
BOOL APIENTRY DllMain( HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
{
if (ul_reason_for_call==DLL_PROCESS_ATTACH)
if (!CheckSomething()) //check if a file doesnt exists for example
FreeLibrary(hModule);
}
I tried it, but i couldnt get it to work. if there is any walk around alternative solution. please tell me, I dont want the process which attached the dll to unload it, I want it to unload it self