BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved){
if(fdwReason == DLL_PROCESS_ATTACH){
try{
DEP_SYSTEM_POLICY_TYPE isDep = GetSystemDEPPolicy();
if(isDep == 1){
MessageBox(NULL, "Windows Data Execution Prevention is currently in AlwaysOn mode. Gunz cannot start. Please consult the games forum for information on fixing this error.", "Error", MB_OK);
return TRUE;
}
if(isDep == 2 || isDep == 3){
SetProcessDEPPolicy(0);
}
}
catch(...){
MessageBox(NULL, "Unable to detect current DEP Policy. Consider upgrading your operating system to Windows XP Service Pack 3 or newer. If GunZ does not run normally, please consult the games forum for more information. If you are seeing this warning in error, please let me know about it.", "Warning", MB_OK);
}
CreateMutex(NULL, true, "Gunz");
if(GetLastError() == ERROR_ALREADY_EXISTS){
MessageBox(NULL, "GunZ is already running. Please terminate the process before starting a new instance.", NULL, MB_OK);
return TRUE;
}