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.

115 lines
3.3 KiB

  1. // smtpadm.cpp : Implementation of DLL Exports.
  2. // You will need the NT SUR Beta 2 SDK or VC 4.2 in order to build this
  3. // project. This is because you will need MIDL 3.00.15 or higher and new
  4. // headers and libs. If you have VC 4.2 installed, then everything should
  5. // already be configured correctly.
  6. // Note: Proxy/Stub Information
  7. // To build a separate proxy/stub DLL,
  8. // run nmake -f smtpadmps.mak in the project directory.
  9. #include "stdafx.h"
  10. #include "resource.h"
  11. #include "adsiid.h"
  12. #include "smtpadm.h"
  13. #include "admin.h"
  14. #include "service.h"
  15. #include "virsvr.h"
  16. #include "sessions.h"
  17. #include "vdir.h"
  18. #include "alias.h"
  19. #include "user.h"
  20. #include "dl.h"
  21. #include "domain.h"
  22. #include "webhelp.h"
  23. #include "regmacro.h"
  24. CComModule _Module;
  25. BEGIN_OBJECT_MAP(ObjectMap)
  26. OBJECT_ENTRY(CLSID_CSmtpAdmin, CSmtpAdmin)
  27. OBJECT_ENTRY(CLSID_CSmtpAdminService, CSmtpAdminService)
  28. OBJECT_ENTRY(CLSID_CSmtpAdminVirtualServer, CSmtpAdminVirtualServer)
  29. OBJECT_ENTRY(CLSID_CSmtpAdminSessions, CSmtpAdminSessions)
  30. OBJECT_ENTRY(CLSID_CSmtpAdminVirtualDirectory, CSmtpAdminVirtualDirectory)
  31. OBJECT_ENTRY(CLSID_CSmtpAdminAlias, CSmtpAdminAlias)
  32. OBJECT_ENTRY(CLSID_CSmtpAdminUser, CSmtpAdminUser)
  33. OBJECT_ENTRY(CLSID_CSmtpAdminDL, CSmtpAdminDL)
  34. OBJECT_ENTRY(CLSID_CSmtpAdminDomain, CSmtpAdminDomain)
  35. OBJECT_ENTRY(CLSID_CWebAdminHelper, CWebAdminHelper)
  36. OBJECT_ENTRY(CLSID_CWebAdminHelper, CWebAdminHelper)
  37. END_OBJECT_MAP()
  38. BEGIN_EXTENSION_REGISTRATION_MAP
  39. EXTENSION_REGISTRATION_MAP_ENTRY(IIsSmtpAlias, SmtpAdminAlias)
  40. EXTENSION_REGISTRATION_MAP_ENTRY(IIsSmtpDomain, SmtpAdminDomain)
  41. EXTENSION_REGISTRATION_MAP_ENTRY(IIsSmtpDL, SmtpAdminDL)
  42. EXTENSION_REGISTRATION_MAP_ENTRY(IIsSmtpSessions, SmtpAdminSessions)
  43. EXTENSION_REGISTRATION_MAP_ENTRY(IIsSmtpUser, SmtpAdminUser)
  44. END_EXTENSION_REGISTRATION_MAP
  45. /////////////////////////////////////////////////////////////////////////////
  46. // DLL Entry Point
  47. extern "C"
  48. BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
  49. {
  50. if (dwReason == DLL_PROCESS_ATTACH)
  51. {
  52. // InitAsyncTrace ();
  53. _Module.Init(ObjectMap, hInstance);
  54. DisableThreadLibraryCalls(hInstance);
  55. }
  56. else if (dwReason == DLL_PROCESS_DETACH) {
  57. // TermAsyncTrace ();
  58. _Module.Term();
  59. }
  60. return TRUE; // ok
  61. }
  62. /////////////////////////////////////////////////////////////////////////////
  63. // Used to determine whether the DLL can be unloaded by OLE
  64. STDAPI DllCanUnloadNow(void)
  65. {
  66. return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
  67. }
  68. /////////////////////////////////////////////////////////////////////////////
  69. // Returns a class factory to create an object of the requested type
  70. STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
  71. {
  72. return _Module.GetClassObject(rclsid, riid, ppv);
  73. }
  74. /////////////////////////////////////////////////////////////////////////////
  75. // DllRegisterServer - Adds entries to the system registry
  76. STDAPI DllRegisterServer(void)
  77. {
  78. // register extensions
  79. RegisterExtensions();
  80. // registers object, typelib and all interfaces in typelib
  81. return(_Module.RegisterServer(TRUE));
  82. }
  83. /////////////////////////////////////////////////////////////////////////////
  84. // DllUnregisterServer - Removes entries from the system registry
  85. STDAPI DllUnregisterServer(void)
  86. {
  87. // register extensions
  88. UnregisterExtensions();
  89. _Module.UnregisterServer();
  90. return S_OK;
  91. }