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.6 KiB

  1. // sync.cpp : Implementation of DLL Exports.
  2. // Note: Proxy/Stub Information
  3. // To build a separate proxy/stub DLL,
  4. // run nmake -f syncps.mk in the project directory.
  5. extern "C" {
  6. #include "nt.h"
  7. #include "ntrtl.h"
  8. #include "nturtl.h"
  9. #include "windows.h"
  10. } // extern "C"
  11. #include <wincrypt.h>
  12. #include "stdafx.h"
  13. #include "resource.h"
  14. #include "initguid.h"
  15. #include "mdsync.h"
  16. #define DEFAULT_TRACE_FLAGS (DEBUG_ERROR)
  17. #include "dbgutil.h"
  18. #include "mdsync_i.c"
  19. #include "MdSync.hxx"
  20. #include "regc.h"
  21. CComModule _Module;
  22. BEGIN_OBJECT_MAP(ObjectMap)
  23. OBJECT_ENTRY(CLSID_MdSync, MdSync)
  24. OBJECT_ENTRY(CLSID_regc, Cregc)
  25. END_OBJECT_MAP()
  26. #ifdef _NO_TRACING_
  27. DECLARE_DEBUG_VARIABLE();
  28. #else
  29. #include <initguid.h>
  30. DEFINE_GUID(IisWpSyncGuid,
  31. 0x784d8920, 0xaa8c, 0x11d2, 0x92, 0x5e, 0x00, 0xc0, 0x4f, 0x72, 0xd9, 0x0e);
  32. #endif
  33. DECLARE_DEBUG_PRINTS_OBJECT();
  34. const CHAR g_pszModuleName[] = "MDSYNC";
  35. /////////////////////////////////////////////////////////////////////////////
  36. // DLL Entry Point
  37. extern "C"
  38. BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
  39. {
  40. if (dwReason == DLL_PROCESS_ATTACH)
  41. {
  42. _Module.Init(ObjectMap, hInstance);
  43. DisableThreadLibraryCalls(hInstance);
  44. #ifdef _NO_TRACING_
  45. CREATE_DEBUG_PRINT_OBJECT(g_pszModuleName);
  46. SET_DEBUG_FLAGS(DEBUG_ERROR);
  47. #else
  48. CREATE_DEBUG_PRINT_OBJECT(g_pszModuleName, IisWpSyncGuid);
  49. #endif
  50. }
  51. else if (dwReason == DLL_PROCESS_DETACH)
  52. {
  53. _Module.Term();
  54. DELETE_DEBUG_PRINT_OBJECT();
  55. }
  56. return TRUE; // ok
  57. }
  58. /////////////////////////////////////////////////////////////////////////////
  59. // Used to determine whether the DLL can be unloaded by OLE
  60. STDAPI DllCanUnloadNow(void)
  61. {
  62. return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
  63. }
  64. /////////////////////////////////////////////////////////////////////////////
  65. // Returns a class factory to create an object of the requested type
  66. STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
  67. {
  68. return _Module.GetClassObject(rclsid, riid, ppv);
  69. }
  70. /////////////////////////////////////////////////////////////////////////////
  71. // DllRegisterServer - Adds entries to the system registry
  72. STDAPI DllRegisterServer(void)
  73. {
  74. // registers object, typelib and all interfaces in typelib
  75. return _Module.RegisterServer(TRUE);
  76. }
  77. /////////////////////////////////////////////////////////////////////////////
  78. // DllUnregisterServer - Removes entries from the system registry
  79. STDAPI DllUnregisterServer(void)
  80. {
  81. _Module.UnregisterServer();
  82. return S_OK;
  83. }