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.

103 lines
2.4 KiB

  1. //+--------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1996 - 1999
  5. //
  6. // File: certpsam.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_CCertPolicySample, CCertPolicySample)
  19. OBJECT_ENTRY(CLSID_CCertManagePolicyModuleSample, CCertManagePolicyModuleSample)
  20. END_OBJECT_MAP()
  21. /////////////////////////////////////////////////////////////////////////////
  22. // DLL Entry Point
  23. extern "C"
  24. BOOL WINAPI
  25. DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
  26. {
  27. switch (dwReason)
  28. {
  29. case DLL_PROCESS_ATTACH:
  30. _Module.Init(ObjectMap, hInstance);
  31. DisableThreadLibraryCalls(hInstance);
  32. break;
  33. case DLL_PROCESS_DETACH:
  34. _Module.Term();
  35. break;
  36. }
  37. return(TRUE); // ok
  38. }
  39. /////////////////////////////////////////////////////////////////////////////
  40. // Used to determine whether the DLL can be unloaded by OLE
  41. STDAPI
  42. DllCanUnloadNow(void)
  43. {
  44. return(_Module.GetLockCount() == 0? S_OK : S_FALSE);
  45. }
  46. /////////////////////////////////////////////////////////////////////////////
  47. // Returns a class factory to create an object of the requested type
  48. STDAPI
  49. DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
  50. {
  51. return(_Module.GetClassObject(rclsid, riid, ppv));
  52. }
  53. /////////////////////////////////////////////////////////////////////////////
  54. // DllRegisterServer - Adds entries to the system registry
  55. STDAPI
  56. DllRegisterServer(void)
  57. {
  58. // registers object, typelib and all interfaces in typelib
  59. return(_Module.RegisterServer(TRUE));
  60. }
  61. /////////////////////////////////////////////////////////////////////////////
  62. // DllUnregisterServer - Removes entries from the system registry
  63. STDAPI
  64. DllUnregisterServer(void)
  65. {
  66. _Module.UnregisterServer();
  67. return(S_OK);
  68. }
  69. void __RPC_FAR *__RPC_USER
  70. MIDL_user_allocate(size_t cb)
  71. {
  72. return(LocalAlloc(LMEM_FIXED | LMEM_ZEROINIT, cb));
  73. }
  74. void __RPC_USER
  75. MIDL_user_free(void __RPC_FAR *pb)
  76. {
  77. LocalFree(pb);
  78. }