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.

91 lines
2.2 KiB

  1. //+--------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1996 - 1999
  5. //
  6. // File: exitsql.cpp
  7. //
  8. // Contents: Cert Server Exit Module implementation
  9. //
  10. //---------------------------------------------------------------------------
  11. #include "pch.cpp"
  12. #pragma hdrstop
  13. #include "celib.h"
  14. #include "exit.h"
  15. #include "module.h"
  16. CComModule _Module;
  17. HINSTANCE g_hInstance;
  18. BEGIN_OBJECT_MAP(ObjectMap)
  19. OBJECT_ENTRY(CLSID_CCertExitSQLSample, CCertExitSQLSample)
  20. OBJECT_ENTRY(CLSID_CCertManageExitModuleSQLSample, CCertManageExitModuleSQLSample)
  21. END_OBJECT_MAP()
  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. g_hInstance = hInstance;
  32. _Module.Init(ObjectMap, 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. }