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.

184 lines
4.8 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1994.
  5. //
  6. // File: dmnstart.hxx
  7. //
  8. // Classes: CiDaemon specific data.
  9. //
  10. // History: 12-11-96 srikants Created
  11. //
  12. //----------------------------------------------------------------------------
  13. #pragma once
  14. #include <cifrmcom.hxx>
  15. #include <regevent.hxx>
  16. #include <ciregkey.hxx>
  17. #include <imprsnat.hxx>
  18. #include <perfobj.hxx>
  19. #include <shrdnam.hxx>
  20. class PSerStream;
  21. class PDeSerStream;
  22. const LONGLONG eSigDaemonStartup = 0x54524154534E4D44i64; // "DMNSTART"
  23. //+---------------------------------------------------------------------------
  24. //
  25. // Class: CDaemonStartupData
  26. //
  27. // Purpose: A class to marshall and unmarshall CiDaemon startup
  28. // information that is client specific.
  29. //
  30. // History: 1-06-97 srikants Created
  31. //
  32. //----------------------------------------------------------------------------
  33. class CDaemonStartupData
  34. {
  35. public:
  36. CDaemonStartupData( WCHAR const * pwszCatDir,
  37. WCHAR const * pwszName );
  38. CDaemonStartupData( BYTE const * pbData, ULONG cbData );
  39. ~CDaemonStartupData() {}
  40. BYTE * Serialize( ULONG & cbData ) const;
  41. BOOL IsValid() const { return _fValid; }
  42. WCHAR const * GetCatDir() const { return _xwszCatDir.GetPointer(); }
  43. WCHAR const * GetName() const { return _xwszName.GetPointer(); }
  44. ICiCAdviseStatus * GetAdviseStatus();
  45. private:
  46. void _Serialize( PSerStream & stm ) const;
  47. void _DeSerialize( PDeSerStream & stm );
  48. LONGLONG _sigDaemonStartup; // identification signature
  49. ULONG _ipVirtualServer; // Virtual server ip address
  50. BOOL _fValid; // Set to TRUE when data is valid.
  51. XPtrST<WCHAR> _xwszCatDir; // Pointer to the Catalog directory.
  52. XPtrST<WCHAR> _xwszName; // Name of the catalog
  53. XInterface<ICiCAdviseStatus> _xAdviseStatus;
  54. };
  55. class CCiRegParams;
  56. class CImpersonationTokenCache;
  57. //+---------------------------------------------------------------------------
  58. //
  59. // Class: CCiRegistryEvent
  60. //
  61. // Purpose: Registry change tracker for Ci registry.
  62. //
  63. // History: 12-19-96 srikants Created
  64. //
  65. //----------------------------------------------------------------------------
  66. class CCiRegistryEvent : public CRegChangeEvent
  67. {
  68. public:
  69. CCiRegistryEvent( CCiRegParams & regParams )
  70. : CRegChangeEvent( wcsRegAdminTree ),
  71. _regParams(regParams)
  72. {
  73. }
  74. void DoIt(ICiAdminParams * pICiAdminParams);
  75. private:
  76. CCiRegParams & _regParams;
  77. };
  78. //+---------------------------------------------------------------------------
  79. //
  80. // Class: CClientDaemonWorker
  81. //
  82. // Purpose: A client worker thread in the daemon process. This thread
  83. // tracks the registry and other bookkeeping stuff.
  84. //
  85. // History: 12-19-96 srikants Created
  86. //
  87. //----------------------------------------------------------------------------
  88. class CClientDaemonWorker
  89. {
  90. enum { iThreadControl = 0,
  91. iCiRegistry,
  92. iRescanTC,
  93. cTotal }; // indices of wait handles
  94. public:
  95. CClientDaemonWorker( CDaemonStartupData & startupData,
  96. CSharedNameGen & nameGen,
  97. ICiAdminParams * pICiAdminParams );
  98. ~CClientDaemonWorker()
  99. {
  100. if ( !_fShutdown )
  101. Shutdown();
  102. }
  103. CPerfMon & GetPerfMon() { return _perfMon; }
  104. CCiRegParams & GetRegParams() { return _regParams; }
  105. CImpersonationTokenCache & GetImpersonationCache()
  106. {
  107. return _tokenCache;
  108. }
  109. void Shutdown()
  110. {
  111. _fShutdown = TRUE;
  112. _evtControl.Set();
  113. _controlThread.WaitForDeath();
  114. }
  115. ULONG GetVirtualServerIpAddress() const { return _ipAddress; }
  116. void _DoWork();
  117. private:
  118. static DWORD WINAPI WorkerThread( void * self );
  119. HANDLE _aWait[cTotal]; // Array of registry notify handles.
  120. ULONG _cHandles; // Count of handles valid.
  121. //
  122. // Set to TRUE when shutdown processing is initiated.
  123. //
  124. BOOL _fShutdown;
  125. ULONG _ipAddress; // Virtual Server ip address
  126. CPerfMon _perfMon; // Performance monitor obj.
  127. CCiRegParams _regParams; // Registry parameters
  128. CImpersonationTokenCache _tokenCache; // Network access impersonation
  129. CEventSem _evtRescanTC; // impersonation info stale
  130. CCiRegistryEvent _ciRegChange; // Ci Registry change tracker
  131. CEventSem _evtControl;
  132. CThread _controlThread; // Thread for notifications
  133. XInterface<ICiAdminParams> _xICiAdminParams;
  134. };