Source code of Windows XP (NT5)
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.

113 lines
2.6 KiB

  1. //+--------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1996 - 1999
  5. //
  6. // File: certenc.cpp
  7. //
  8. // Contents: Cert Server encode/decode support
  9. //
  10. //---------------------------------------------------------------------------
  11. #include "pch.cpp"
  12. #pragma hdrstop
  13. #include "celib.h"
  14. #include "resource.h"
  15. #include "certenc.h"
  16. #include "adate.h"
  17. #include "along.h"
  18. #include "astring.h"
  19. #include "crldist.h"
  20. #include "altname.h"
  21. #include "bitstr.h"
  22. CComModule _Module;
  23. HMODULE g_hModule;
  24. BEGIN_OBJECT_MAP(ObjectMap)
  25. OBJECT_ENTRY(CLSID_CCertEncodeDateArray, CCertEncodeDateArray)
  26. OBJECT_ENTRY(CLSID_CCertEncodeLongArray, CCertEncodeLongArray)
  27. OBJECT_ENTRY(CLSID_CCertEncodeStringArray, CCertEncodeStringArray)
  28. OBJECT_ENTRY(CLSID_CCertEncodeCRLDistInfo, CCertEncodeCRLDistInfo)
  29. OBJECT_ENTRY(CLSID_CCertEncodeAltName, CCertEncodeAltName)
  30. OBJECT_ENTRY(CLSID_CCertEncodeBitString, CCertEncodeBitString)
  31. END_OBJECT_MAP()
  32. /////////////////////////////////////////////////////////////////////////////
  33. // DLL Entry Point
  34. extern "C"
  35. BOOL WINAPI
  36. DllMain(HINSTANCE hInstance, DWORD dwReason, VOID *lpReserved)
  37. {
  38. g_hModule = hInstance;
  39. if (DLL_PROCESS_ATTACH == dwReason)
  40. {
  41. ceInitErrorMessageText(
  42. hInstance,
  43. IDS_E_UNEXPECTED,
  44. IDS_UNKNOWN_ERROR_CODE);
  45. _Module.Init(ObjectMap, hInstance);
  46. DisableThreadLibraryCalls(hInstance);
  47. }
  48. if (DLL_PROCESS_DETACH == dwReason)
  49. {
  50. _Module.Term();
  51. }
  52. return(TRUE);
  53. }
  54. /////////////////////////////////////////////////////////////////////////////
  55. // Used to determine whether the DLL can be unloaded by OLE
  56. STDAPI
  57. DllCanUnloadNow(VOID)
  58. {
  59. HRESULT hr;
  60. hr = 0 == _Module.GetLockCount()? S_OK : S_FALSE;
  61. return(hr);
  62. }
  63. /////////////////////////////////////////////////////////////////////////////
  64. // Returns a class factory to create an object of the requested type
  65. STDAPI
  66. DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
  67. {
  68. HRESULT hr;
  69. hr = _Module.GetClassObject(rclsid, riid, ppv);
  70. return(hr);
  71. }
  72. /////////////////////////////////////////////////////////////////////////////
  73. // DllRegisterServer - Adds entries to the system registry
  74. STDAPI
  75. DllRegisterServer(VOID)
  76. {
  77. HRESULT hr;
  78. // registers object, typelib and all interfaces in typelib
  79. hr = _Module.RegisterServer(TRUE);
  80. return(hr);
  81. }
  82. /////////////////////////////////////////////////////////////////////////////
  83. // DllUnregisterServer - Removes entries from the system registry
  84. STDAPI
  85. DllUnregisterServer(VOID)
  86. {
  87. _Module.UnregisterServer();
  88. return(S_OK);
  89. }