92 lines
1.8 KiB
C++
92 lines
1.8 KiB
C++
|
// MobsetWeb.cpp : DLL <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD>֡<EFBFBD>
|
|||
|
|
|||
|
|
|||
|
#include "stdafx.h"
|
|||
|
#include "resource.h"
|
|||
|
#include "MobsetWeb_i.h"
|
|||
|
#include "dllmain.h"
|
|||
|
#include "xdlldata.h"
|
|||
|
|
|||
|
|
|||
|
// <20><><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7> DLL <20>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD> OLE ж<>ء<EFBFBD>
|
|||
|
STDAPI DllCanUnloadNow(void)
|
|||
|
{
|
|||
|
#ifdef _MERGE_PROXYSTUB
|
|||
|
HRESULT hr = PrxDllCanUnloadNow();
|
|||
|
if (hr != S_OK)
|
|||
|
return hr;
|
|||
|
#endif
|
|||
|
AFX_MANAGE_STATE(AfxGetStaticModuleState());
|
|||
|
return (AfxDllCanUnloadNow()==S_OK && _AtlModule.GetLockCount()==0) ? S_OK : S_FALSE;
|
|||
|
}
|
|||
|
|
|||
|
// <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><E0B9A4><EFBFBD>Դ<EFBFBD><D4B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>͵Ķ<CDB5><C4B6><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
|
|||
|
{
|
|||
|
#ifdef _MERGE_PROXYSTUB
|
|||
|
if (PrxDllGetClassObject(rclsid, riid, ppv) == S_OK)
|
|||
|
return S_OK;
|
|||
|
#endif
|
|||
|
return _AtlModule.DllGetClassObject(rclsid, riid, ppv);
|
|||
|
}
|
|||
|
|
|||
|
// DllRegisterServer - <20><>ϵͳע<CDB3><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
STDAPI DllRegisterServer(void)
|
|||
|
{
|
|||
|
// ע<><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϳ<EFBFBD><CDBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϳ<EFBFBD><CDBF>е<EFBFBD><D0B5><EFBFBD><EFBFBD>нӿ<D0BD>
|
|||
|
HRESULT hr = _AtlModule.DllRegisterServer();
|
|||
|
#ifdef _MERGE_PROXYSTUB
|
|||
|
if (FAILED(hr))
|
|||
|
return hr;
|
|||
|
hr = PrxDllRegisterServer();
|
|||
|
#endif
|
|||
|
return hr;
|
|||
|
}
|
|||
|
|
|||
|
// DllUnregisterServer - <20><>ϵͳע<CDB3><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƴ<EFBFBD><C6B3>
|
|||
|
STDAPI DllUnregisterServer(void)
|
|||
|
{
|
|||
|
HRESULT hr = _AtlModule.DllUnregisterServer();
|
|||
|
#ifdef _MERGE_PROXYSTUB
|
|||
|
if (FAILED(hr))
|
|||
|
return hr;
|
|||
|
hr = PrxDllRegisterServer();
|
|||
|
if (FAILED(hr))
|
|||
|
return hr;
|
|||
|
hr = PrxDllUnregisterServer();
|
|||
|
#endif
|
|||
|
return hr;
|
|||
|
}
|
|||
|
|
|||
|
// DllInstall - <20><><EFBFBD>û<EFBFBD><C3BB>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵͳע<CDB3><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>/<2F>Ƴ<EFBFBD><C6B3>
|
|||
|
STDAPI DllInstall(BOOL bInstall, LPCWSTR pszCmdLine)
|
|||
|
{
|
|||
|
HRESULT hr = E_FAIL;
|
|||
|
static const wchar_t szUserSwitch[] = L"user";
|
|||
|
|
|||
|
if (pszCmdLine != NULL)
|
|||
|
{
|
|||
|
if (_wcsnicmp(pszCmdLine, szUserSwitch, _countof(szUserSwitch)) == 0)
|
|||
|
{
|
|||
|
ATL::AtlSetPerUserRegistration(true);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
if (bInstall)
|
|||
|
{
|
|||
|
hr = DllRegisterServer();
|
|||
|
if (FAILED(hr))
|
|||
|
{
|
|||
|
DllUnregisterServer();
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
hr = DllUnregisterServer();
|
|||
|
}
|
|||
|
|
|||
|
return hr;
|
|||
|
}
|
|||
|
|
|||
|
|