ICP  1
instapi.cpp
Go to the documentation of this file.
1 // instapi.cpp : Implementation of DLL Exports.
2 
3 
4 #include "stdafx.h"
5 #include "resource.h"
6 #include "instapi_i.h"
7 #include "dllmain.h"
8 
9 
10 // Used to determine whether the DLL can be unloaded by OLE.
11 STDAPI DllCanUnloadNow(void)
12 {
13  return _AtlModule.DllCanUnloadNow();
14  }
15 
16 // Returns a class factory to create an object of the requested type.
17 STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
18 {
19  return _AtlModule.DllGetClassObject(rclsid, riid, ppv);
20 }
21 
22 // DllRegisterServer - Adds entries to the system registry.
23 STDAPI DllRegisterServer(void)
24 {
25  // registers object, typelib and all interfaces in typelib
26  HRESULT hr = _AtlModule.DllRegisterServer();
27  return hr;
28 }
29 
30 // DllUnregisterServer - Removes entries from the system registry.
31 STDAPI DllUnregisterServer(void)
32 {
33  HRESULT hr = _AtlModule.DllUnregisterServer();
34  return hr;
35 }
36 
37 // DllInstall - Adds/Removes entries to the system registry per user per machine.
38 STDAPI DllInstall(BOOL bInstall, LPCWSTR pszCmdLine)
39 {
40  HRESULT hr = E_FAIL;
41  static const wchar_t szUserSwitch[] = L"user";
42 
43  if (pszCmdLine != NULL)
44  {
45  if (_wcsnicmp(pszCmdLine, szUserSwitch, _countof(szUserSwitch)) == 0)
46  {
47  ATL::AtlSetPerUserRegistration(true);
48  }
49  }
50 
51  if (bInstall)
52  {
53  hr = DllRegisterServer();
54  if (FAILED(hr))
55  {
57  }
58  }
59  else
60  {
61  hr = DllUnregisterServer();
62  }
63 
64  return hr;
65 }
66 
67 
STDAPI DllCanUnloadNow(void)
Definition: selogcom.cpp:46
STDAPI DllRegisterServer(void)
Definition: selogcom.cpp:61
STDAPI DllInstall(BOOL bInstall, LPCWSTR pszCmdLine)
Definition: instapi.cpp:38
CisisicpModule _AtlModule
Definition: isisicp.cpp:71
STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
Definition: selogcom.cpp:54
STDAPI DllUnregisterServer(void)
Definition: selogcom.cpp:70