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.

96 lines
2.6 KiB

  1. // ITrkAdmn.cpp : Implementation of DLL Exports.
  2. // Note: Proxy/Stub Information
  3. // To build a separate proxy/stub DLL,
  4. // run nmake -f ITrkAdmnps.mk in the project directory.
  5. #include "pch.cxx"
  6. #pragma hdrstop
  7. #include <trklib.hxx>
  8. #include <trksvr.hxx>
  9. #include "stdafx.h"
  10. #include "resource.h"
  11. #include "initguid.h"
  12. #include "ITrkAdmn.h"
  13. #include "ITrkAdmn_i.c"
  14. #include "FrcOwn.h"
  15. #include "RestPars.hxx"
  16. #include "Restore.h"
  17. #define TRKDATA_ALLOCATE
  18. #include "trkwks.hxx"
  19. const TCHAR tszKeyNameLinkTrack[] = TEXT("System\\CurrentControlSet\\Services\\TrkWks\\Parameters");
  20. #if DBG
  21. DWORD g_Debug = 0;
  22. CTrkConfiguration g_config;
  23. #endif
  24. CComModule _Module;
  25. BEGIN_OBJECT_MAP(ObjectMap)
  26. OBJECT_ENTRY(CLSID_TrkForceOwnership, CTrkForceOwnership)
  27. OBJECT_ENTRY(CLSID_TrkRestoreNotify, CTrkRestoreNotify)
  28. OBJECT_ENTRY(CLSID_TrkRestoreParser, CRestoreParser)
  29. END_OBJECT_MAP()
  30. /////////////////////////////////////////////////////////////////////////////
  31. // DLL Entry Point
  32. extern "C"
  33. BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
  34. {
  35. if (dwReason == DLL_PROCESS_ATTACH)
  36. {
  37. #if DBG
  38. g_config.Initialize( );
  39. g_Debug = g_config._dwDebugFlags;
  40. TrkDebugCreate( TRK_DBG_FLAGS_WRITE_TO_DBG, "ITrkAdmn" );
  41. #endif
  42. _Module.Init(ObjectMap, hInstance);
  43. DisableThreadLibraryCalls(hInstance);
  44. }
  45. else if (dwReason == DLL_PROCESS_DETACH)
  46. _Module.Term();
  47. return TRUE; // ok
  48. }
  49. /////////////////////////////////////////////////////////////////////////////
  50. // Used to determine whether the DLL can be unloaded by OLE
  51. STDAPI DllCanUnloadNow(void)
  52. {
  53. return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
  54. }
  55. /////////////////////////////////////////////////////////////////////////////
  56. // Returns a class factory to create an object of the requested type
  57. STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
  58. {
  59. return _Module.GetClassObject(rclsid, riid, ppv);
  60. }
  61. /////////////////////////////////////////////////////////////////////////////
  62. // DllRegisterServer - Adds entries to the system registry
  63. STDAPI DllRegisterServer(void)
  64. {
  65. // registers object, typelib and all interfaces in typelib
  66. return _Module.RegisterServer(TRUE);
  67. }
  68. /////////////////////////////////////////////////////////////////////////////
  69. // DllUnregisterServer - Removes entries from the system registry
  70. STDAPI DllUnregisterServer(void)
  71. {
  72. _Module.UnregisterServer();
  73. return S_OK;
  74. }