Changeset 60865 in vbox for trunk/src/VBox/Main/src-client/win
- Timestamp:
- May 6, 2016 2:43:04 PM (9 years ago)
- svn:sync-xref-src-repo-rev:
- 107075
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-client/win/dllmain.cpp
r60765 r60865 31 31 * Global Variables * 32 32 *********************************************************************************************************************************/ 33 static ATL::CComModule _Module;33 static ATL::CComModule *g_pAtlComModule; 34 34 35 35 BEGIN_OBJECT_MAP(ObjectMap) … … 50 50 RTR3InitDll(RTR3INIT_FLAGS_UNOBTRUSIVE); 51 51 52 _Module.Init(ObjectMap, hInstance, &LIBID_VirtualBox); 52 g_pAtlComModule = new(ATL::CComModule); 53 if (!g_pAtlComModule) 54 return FALSE; 55 56 g_pAtlComModule->Init(ObjectMap, hInstance, &LIBID_VirtualBox); 53 57 DisableThreadLibraryCalls(hInstance); 54 58 } 55 59 else if (dwReason == DLL_PROCESS_DETACH) 56 60 { 57 _Module.Term(); 61 if (g_pAtlComModule) 62 { 63 g_pAtlComModule->Term(); 64 delete g_pAtlComModule; 65 g_pAtlComModule = NULL; 66 } 58 67 } 59 68 return TRUE; … … 65 74 STDAPI DllCanUnloadNow(void) 66 75 { 67 return (_Module.GetLockCount() == 0) ? S_OK : S_FALSE; 76 AssertReturn(g_pAtlComModule, S_OK); 77 return g_pAtlComModule->GetLockCount() == 0 ? S_OK : S_FALSE; 68 78 } 69 79 … … 73 83 STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv) 74 84 { 75 return _Module.GetClassObject(rclsid, riid, ppv); 85 AssertReturn(g_pAtlComModule, E_UNEXPECTED); 86 return g_pAtlComModule->GetClassObject(rclsid, riid, ppv); 76 87 } 77 88 … … 83 94 #ifndef VBOX_WITH_MIDL_PROXY_STUB 84 95 // registers object, typelib and all interfaces in typelib 85 return _Module.RegisterServer(TRUE); 96 AssertReturn(g_pAtlComModule, E_UNEXPECTED); 97 return g_pAtlComModule->RegisterServer(TRUE); 86 98 #else 87 99 return S_OK; /* VBoxProxyStub does all the work, no need to duplicate it here. */ … … 95 107 { 96 108 #ifndef VBOX_WITH_MIDL_PROXY_STUB 97 HRESULT hrc = _Module.UnregisterServer(TRUE); 109 AssertReturn(g_pAtlComModule, E_UNEXPECTED); 110 HRESULT hrc = g_pAtlComModule->UnregisterServer(TRUE); 98 111 return hrc; 99 112 #else
Note:
See TracChangeset
for help on using the changeset viewer.