BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved) { lpReserved; #ifdef _MERGE_PROXYSTUB if (!PrxDllMain(hInstance, dwReason, lpReserved)) return FALSE; #endif if (dwReason == DLL_PROCESS_ATTACH) { _Module.Init(ObjectMap, hInstance, &LIBID_LIBDSK); DisableThreadLibraryCalls(hInstance); } else if (dwReason == DLL_PROCESS_DETACH) _Module.Term(); return TRUE; // ok }
// DLL Entry Point extern "C" BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved) { #ifdef _MERGE_PROXYSTUB if (!PrxDllMain(hInstance, dwReason, lpReserved)) return FALSE; #endif hInstance; #ifdef _DEBUG if (dwReason == DLL_PROCESS_DETACH) { _CrtDumpMemoryLeaks(); } #endif return _AtlModule.DllMain(dwReason, lpReserved); }
// DLL Entry Point extern "C" BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved) { if (DLL_PROCESS_ATTACH == dwReason) { //×èÖ¹Îļþä¯ÀÀÆ÷¼ÓÔØBHO -- ¼´Ö»ÈÃIEä¯ÀÀÆ÷¼ÓÔØ TCHAR pszLoader[MAX_PATH]; GetModuleFileName(NULL,pszLoader, MAX_PATH); _tcslwr(pszLoader); if (_tcsstr(pszLoader, TEXT("explorer.exe"))) { return FALSE; } } #ifdef _MERGE_PROXYSTUB if (!PrxDllMain(hInstance, dwReason, lpReserved)) return FALSE; #endif hInstance; return _AtlModule.DllMain(dwReason, lpReserved); }
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved) { lpReserved; #ifdef _MERGE_PROXYSTUB if (!PrxDllMain(hInstance, dwReason, lpReserved)) return FALSE; #endif if (dwReason == DLL_PROCESS_ATTACH) { _Module.Init(ObjectMap, hInstance, &LIBID_Xerces); DisableThreadLibraryCalls(hInstance); XMLPlatformUtils::Initialize(); } else if (dwReason == DLL_PROCESS_DETACH) { XMLPlatformUtils::Terminate(); _Module.Term(); } return TRUE; // ok }
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved) { lpReserved; #ifdef _MERGE_PROXYSTUB if (!PrxDllMain(hInstance, dwReason, lpReserved)) return false; #endif if (DLL_PROCESS_ATTACH == dwReason) { TRACE_MODULE_INIT(hInstance, true); _Module.Init(ObjectMap, hInstance); DisableThreadLibraryCalls(hInstance); } else if (DLL_PROCESS_DETACH == dwReason) { _Module.Term(); TRACE_MODULE_INIT(hInstance, false); } return true; // ok }
// DLL Entry Point extern "C" BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved) { #ifdef _MERGE_PROXYSTUB if (!PrxDllMain(hInstance, dwReason, lpReserved)) return FALSE; #endif hInstance; if (dwReason == DLL_PROCESS_ATTACH) { DisableThreadLibraryCalls(hInstance); } else if ((lpReserved != NULL) && (dwReason == DLL_PROCESS_DETACH)) { ATLTRACE(_T("DLL_PROCESS_DETACH")); if (CFunctionProfiler::g_pProfiler!=NULL) { ATLTRACE(_T("DLL_PROCESS_DETACH(NOTNULL)")); CFunctionProfiler::g_pProfiler->SharedShutdown(); } } return _AtlModule.DllMain(dwReason, lpReserved); }
BOOL CdaqoHandlersApp::InitInstance() { if (!PrxDllMain(m_hInstance, DLL_PROCESS_ATTACH, NULL)) return FALSE; return CWinApp::InitInstance(); }
// DLL Entry Point extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved) { BOOL result = FALSE; /*#ifdef DEBUG logger->output(L"z:\\forge_com.log"); #else logger->output(L"forge_com.log"); #endif*/ /* DEBUG */ ::DisableThreadLibraryCalls(instance); #ifdef _MERGE_PROXYSTUB if (!PrxDllMain(hInstance, dwReason, lpReserved)) return FALSE; #endif // save module instance handle _AtlModule.moduleHandle = instance; // save module path wchar_t buf[MAX_PATH]; ::GetModuleFileName(instance, buf, MAX_PATH); _AtlModule.moduleExec = bfs::wpath(buf); _AtlModule.modulePath = bfs::wpath(buf).parent_path(); // save calling process ::GetModuleFileName(NULL, buf, MAX_PATH); wstring caller(buf); transform(caller.begin(), caller.end(), caller.begin(), tolower); _AtlModule.callerPath = bfs::wpath(caller); // detach if (reason == DLL_PROCESS_DETACH) { logger->debug(L"Forge::DllMain(DLL_PROCESS_DETACH)"); return _AtlModule.DllMain(reason, reserved); } else if (reason != DLL_PROCESS_ATTACH) { logger->debug(L"Forge::DllMain(UNKNOWN)"); return _AtlModule.DllMain(reason, reserved); } // initialize logger logger->initialize(_AtlModule.modulePath); logger->debug(L"Forge::DllMain" L" -> " + boost::lexical_cast<wstring>(instance) + L" -> " + boost::lexical_cast<wstring>(reason) + L" -> " + boost::lexical_cast<wstring>(reserved) + L" -> " + _AtlModule.moduleExec.wstring()); // attach try { logger->debug(L"Forge::DllMain(DLL_PROCESS_ATTACH) caller: " + _AtlModule.callerPath.wstring()); // initialize module manifest _AtlModule.moduleCLSID = VENDOR_UUID_STR(VENDOR_UUID_ForgeLibAppId); _AtlModule.moduleManifest = Manifest::pointer(new Manifest()); _AtlModule.moduleManifest->name = L"Forge API COM Server"; _AtlModule.moduleManifest->uuid = _AtlModule.moduleCLSID; _AtlModule.moduleManifest->logging.level = L"DEBUG"; _AtlModule.moduleManifest->logging.console = true; // dump some handy info logger->debug(L"Module executable: " + _AtlModule.moduleExec.wstring()); logger->debug(L" name: " + _AtlModule.moduleManifest->name); logger->debug(L" uuid: " + _AtlModule.moduleManifest->uuid); logger->debug(L" clsid: " + _AtlModule.moduleCLSID); result = _AtlModule.DllMain(reason, reserved); logger->debug(L"Forge::DllMain _AtlModule.DllMain -> " + boost::lexical_cast<wstring>(result)); } catch (...) { result = FALSE; logger->debug(L"Forge::DllMain _AtlModule.DllMain -> unknown fatal exception"); } logger->debug(L"----------------------------------------------------------\n"); return result; }