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.

112 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 "regmacro.h"
  23. CComModule _Module;
  24. BEGIN_OBJECT_MAP(ObjectMap)
  25. OBJECT_ENTRY(CLSID_CSmtpAdmin, CSmtpAdmin)
  26. OBJECT_ENTRY(CLSID_CSmtpAdminService, CSmtpAdminService)
  27. OBJECT_ENTRY(CLSID_CSmtpAdminVirtualServer, CSmtpAdminVirtualServer)
  28. OBJECT_ENTRY(CLSID_CSmtpAdminSessions, CSmtpAdminSessions)
  29. OBJECT_ENTRY(CLSID_CSmtpAdminVirtualDirectory, CSmtpAdminVirtualDirectory)
  30. OBJECT_ENTRY(CLSID_CSmtpAdminAlias, CSmtpAdminAlias)
  31. OBJECT_ENTRY(CLSID_CSmtpAdminUser, CSmtpAdminUser)
  32. OBJECT_ENTRY(CLSID_CSmtpAdminDL, CSmtpAdminDL)
  33. OBJECT_ENTRY(CLSID_CSmtpAdminDomain, CSmtpAdminDomain)
  34. END_OBJECT_MAP()
  35. BEGIN_EXTENSION_REGISTRATION_MAP
  36. EXTENSION_REGISTRATION_MAP_ENTRY(IIsSmtpAlias, SmtpAdminAlias)
  37. EXTENSION_REGISTRATION_MAP_ENTRY(IIsSmtpDomain, SmtpAdminDomain)
  38. EXTENSION_REGISTRATION_MAP_ENTRY(IIsSmtpDL, SmtpAdminDL)
  39. EXTENSION_REGISTRATION_MAP_ENTRY(IIsSmtpSessions, SmtpAdminSessions)
  40. EXTENSION_REGISTRATION_MAP_ENTRY(IIsSmtpUser, SmtpAdminUser)
  41. END_EXTENSION_REGISTRATION_MAP
  42. /////////////////////////////////////////////////////////////////////////////
  43. // DLL Entry Point
  44. extern "C"
  45. BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
  46. {
  47. if (dwReason == DLL_PROCESS_ATTACH)
  48. {
  49. // InitAsyncTrace ();
  50. _Module.Init(ObjectMap, hInstance);
  51. DisableThreadLibraryCalls(hInstance);
  52. }
  53. else if (dwReason == DLL_PROCESS_DETACH) {
  54. // TermAsyncTrace ();
  55. _Module.Term();
  56. }
  57. return TRUE; // ok
  58. }
  59. /////////////////////////////////////////////////////////////////////////////
  60. // Used to determine whether the DLL can be unloaded by OLE
  61. STDAPI DllCanUnloadNow(void)
  62. {
  63. return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
  64. }
  65. /////////////////////////////////////////////////////////////////////////////
  66. // Returns a class factory to create an object of the requested type
  67. STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
  68. {
  69. return _Module.GetClassObject(rclsid, riid, ppv);
  70. }
  71. /////////////////////////////////////////////////////////////////////////////
  72. // DllRegisterServer - Adds entries to the system registry
  73. STDAPI DllRegisterServer(void)
  74. {
  75. // register extensions
  76. RegisterExtensions();
  77. // registers object, typelib and all interfaces in typelib
  78. return(_Module.RegisterServer(TRUE));
  79. }
  80. /////////////////////////////////////////////////////////////////////////////
  81. // DllUnregisterServer - Removes entries from the system registry
  82. STDAPI DllUnregisterServer(void)
  83. {
  84. // register extensions
  85. UnregisterExtensions();
  86. _Module.UnregisterServer();
  87. return S_OK;
  88. }