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.

105 lines
2.4 KiB

  1. //+--------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1996 - 2000
  5. //
  6. // File: expolicy.cpp
  7. //
  8. // Contents: Cert Server Policy Module implementation
  9. //
  10. //---------------------------------------------------------------------------
  11. #include "pch.cpp"
  12. #pragma hdrstop
  13. #include "celib.h"
  14. #include "policy.h"
  15. #include "module.h"
  16. CComModule _Module;
  17. BEGIN_OBJECT_MAP(ObjectMap)
  18. OBJECT_ENTRY(CLSID_CCertPolicyExchange, CCertPolicyExchange)
  19. OBJECT_ENTRY(CLSID_CCertManagePolicyModuleExchange, CCertManagePolicyModuleExchange)
  20. END_OBJECT_MAP()
  21. HINSTANCE g_hInstance = NULL;
  22. /////////////////////////////////////////////////////////////////////////////
  23. // DLL Entry Point
  24. extern "C"
  25. BOOL WINAPI
  26. DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
  27. {
  28. switch (dwReason)
  29. {
  30. case DLL_PROCESS_ATTACH:
  31. _Module.Init(ObjectMap, hInstance);
  32. g_hInstance = hInstance;
  33. DisableThreadLibraryCalls(hInstance);
  34. break;
  35. case DLL_PROCESS_DETACH:
  36. _Module.Term();
  37. break;
  38. }
  39. return(TRUE); // ok
  40. }
  41. /////////////////////////////////////////////////////////////////////////////
  42. // Used to determine whether the DLL can be unloaded by OLE
  43. STDAPI
  44. DllCanUnloadNow(void)
  45. {
  46. return(_Module.GetLockCount() == 0? S_OK : S_FALSE);
  47. }
  48. /////////////////////////////////////////////////////////////////////////////
  49. // Returns a class factory to create an object of the requested type
  50. STDAPI
  51. DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
  52. {
  53. return(_Module.GetClassObject(rclsid, riid, ppv));
  54. }
  55. /////////////////////////////////////////////////////////////////////////////
  56. // DllRegisterServer - Adds entries to the system registry
  57. STDAPI
  58. DllRegisterServer(void)
  59. {
  60. // registers object, typelib and all interfaces in typelib
  61. return(_Module.RegisterServer(TRUE));
  62. }
  63. /////////////////////////////////////////////////////////////////////////////
  64. // DllUnregisterServer - Removes entries from the system registry
  65. STDAPI
  66. DllUnregisterServer(void)
  67. {
  68. _Module.UnregisterServer();
  69. return(S_OK);
  70. }
  71. void __RPC_FAR *__RPC_USER
  72. MIDL_user_allocate(size_t cb)
  73. {
  74. return(LocalAlloc(LMEM_FIXED | LMEM_ZEROINIT, cb));
  75. }
  76. void __RPC_USER
  77. MIDL_user_free(void __RPC_FAR *pb)
  78. {
  79. LocalFree(pb);
  80. }