Leaked source code of windows server 2003
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.

93 lines
2.1 KiB

  1. //+--------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1996 - 1999
  5. //
  6. // File: certview.cpp
  7. //
  8. // Contents: CertView database implementation
  9. //
  10. //---------------------------------------------------------------------------
  11. #include "pch.cpp"
  12. #pragma hdrstop
  13. #include <certdb.h>
  14. #include "view.h"
  15. CComModule _Module;
  16. BEGIN_OBJECT_MAP(ObjectMap)
  17. OBJECT_ENTRY(CLSID_CCertView, CCertView)
  18. END_OBJECT_MAP()
  19. HINSTANCE g_hInstance;
  20. /////////////////////////////////////////////////////////////////////////////
  21. // DLL Entry Point
  22. extern "C"
  23. BOOL WINAPI
  24. DllMain(
  25. IN HINSTANCE hInstance,
  26. IN DWORD dwReason,
  27. IN LPVOID /*lpReserved*/)
  28. {
  29. switch (dwReason)
  30. {
  31. case DLL_PROCESS_ATTACH:
  32. g_hInstance = hInstance;
  33. _Module.Init(ObjectMap, hInstance);
  34. DisableThreadLibraryCalls(hInstance);
  35. break;
  36. case DLL_PROCESS_DETACH:
  37. _Module.Term();
  38. break;
  39. }
  40. return(TRUE); // ok
  41. }
  42. /////////////////////////////////////////////////////////////////////////////
  43. // Used to determine whether the DLL can be unloaded by OLE
  44. STDAPI
  45. DllCanUnloadNow(void)
  46. {
  47. return(_Module.GetLockCount() == 0? S_OK : S_FALSE);
  48. }
  49. /////////////////////////////////////////////////////////////////////////////
  50. // Returns a class factory to create an object of the requested type
  51. STDAPI
  52. DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
  53. {
  54. return(_Module.GetClassObject(rclsid, riid, ppv));
  55. }
  56. /////////////////////////////////////////////////////////////////////////////
  57. // DllRegisterServer - Adds entries to the system registry
  58. STDAPI
  59. DllRegisterServer(void)
  60. {
  61. // registers object, typelib and all interfaces in typelib
  62. return(_Module.RegisterServer(TRUE));
  63. }
  64. /////////////////////////////////////////////////////////////////////////////
  65. // DllUnregisterServer - Removes entries from the system registry
  66. STDAPI
  67. DllUnregisterServer(void)
  68. {
  69. _Module.UnregisterServer();
  70. return(S_OK);
  71. }