mirror of https://github.com/tongzx/nt5src
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
1.4 KiB
58 lines
1.4 KiB
#include "stdinc.h"
|
|
|
|
ATL::_ATL_OBJMAP_ENTRY* GetObjectMap();
|
|
const CLSID* GetTypeLibraryId();
|
|
|
|
extern "C"
|
|
BOOL WINAPI _DllMainCRTStartup(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved);
|
|
|
|
extern "C"
|
|
BOOL WINAPI SxApwDllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
|
|
{
|
|
BOOL fSuccess = FALSE;
|
|
if (!_DllMainCRTStartup(hInstance, dwReason, lpReserved))
|
|
goto Exit;
|
|
switch (dwReason)
|
|
{
|
|
default:
|
|
break;
|
|
case DLL_PROCESS_ATTACH:
|
|
GetModule()->Init(GetObjectMap(), hInstance, GetTypeLibraryId());
|
|
DisableThreadLibraryCalls(hInstance);
|
|
break;
|
|
case DLL_PROCESS_DETACH:
|
|
GetModule()->Term();
|
|
break;
|
|
}
|
|
fSuccess = TRUE;
|
|
Exit:
|
|
return fSuccess;
|
|
}
|
|
|
|
STDAPI DllCanUnloadNow(void)
|
|
{
|
|
return (GetModule()->GetLockCount()==0) ? S_OK : S_FALSE;
|
|
}
|
|
|
|
STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
|
|
{
|
|
const CLSID* pclsid = &rclsid;
|
|
if (rclsid == GUID_NULL)
|
|
{ // this is a category bind to a .dll path, take the first clsid
|
|
pclsid = GetObjectMap()->pclsid;
|
|
}
|
|
return GetModule()->GetClassObject(*pclsid, riid, ppv);
|
|
}
|
|
|
|
STDAPI DllRegisterServer(void)
|
|
{
|
|
// registers object, typelib and all interfaces in typelib
|
|
//return GetModule()->RegisterServer(TRUE);
|
|
return S_OK;
|
|
}
|
|
|
|
STDAPI DllUnregisterServer(void)
|
|
{
|
|
//return GetModule()->UnregisterServer(TRUE);
|
|
return S_OK;
|
|
}
|