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.

163 lines
5.0 KiB

  1. /****************************************************************************/
  2. // tssdjet.h
  3. //
  4. // Terminal Server Session Directory Interface Jet RPC provider header.
  5. //
  6. // Copyright (C) 2000 Microsoft Corporation
  7. /****************************************************************************/
  8. #ifndef __TSSDJET_H
  9. #define __TSSDJET_H
  10. #include <tchar.h>
  11. #include "tssd.h"
  12. #include "tssdshrd.h"
  13. #include "srvsetex.h"
  14. #include "jetrpc.h"
  15. #include "synch.h"
  16. /****************************************************************************/
  17. // Defines
  18. /****************************************************************************/
  19. /****************************************************************************/
  20. // Types
  21. /****************************************************************************/
  22. // CTSSessionDirectory
  23. //
  24. // C++ class instantiation of ITSSessionDirectory.
  25. class CTSSessionDirectory : public ITSSessionDirectory,
  26. public IExtendServerSettings, public ITSSessionDirectoryEx
  27. {
  28. private:
  29. long m_RefCount;
  30. BOOL m_bConnected;
  31. HCLIENTINFO m_hCI;
  32. RPC_BINDING_HANDLE m_hRPCBinding;
  33. WCHAR m_StoreServerName[64];
  34. WCHAR m_LocalServerAddress[64];
  35. WCHAR m_ClusterName[64];
  36. // Flags passed in from Termsrv
  37. DWORD m_Flags;
  38. // Private data for UI menus
  39. BOOL m_fEnabled;
  40. // Autorecovery variables
  41. //
  42. // Events
  43. // * m_hSDServerDown - Event that is signalled to awaken recovery thread,
  44. // which wakes up, polls the session directory until it comes back up,
  45. // and then refreshes the database.
  46. // * m_hTerminateRecovery - Recovery thread, when it enters waits, can be
  47. // terminated by the use of this event
  48. //
  49. // Thread Information
  50. // * m_hRecoveryThread - Handle to the recovery thread.
  51. // * m_RecoveryTid - Thread identifier for recovery thread.
  52. //
  53. // Boolean
  54. // * m_bSDIsUp - If this is on then we think the session directory is up.
  55. // * m_sr - Protects m_SDIsUp.
  56. //
  57. // DWORD
  58. // * m_RecoveryTimeout - time in ms between attempts to reestablish
  59. // connection with the session directory.
  60. //
  61. // Function pointer
  62. // * m_repopfn - pointer to the repopulation function in termsrv to call
  63. // when we want an update.
  64. HANDLE m_hSDServerDown;
  65. HANDLE m_hTerminateRecovery;
  66. uintptr_t m_hRecoveryThread;
  67. unsigned m_RecoveryTid;
  68. // m_sr protects SDIsUp flag
  69. SHAREDRESOURCE m_sr;
  70. volatile LONG m_SDIsUp;
  71. // Flag for whether shared reader/writer lock init succeeded. If it doesn't
  72. // succeed, we can't do anything.
  73. BOOL m_LockInitializationSuccessful;
  74. DWORD m_RecoveryTimeout;
  75. DWORD (*m_repopfn)();
  76. // Autorecovery thread
  77. unsigned static __stdcall RecoveryThread(void *);
  78. VOID RecoveryThreadEx();
  79. // Helper functions
  80. DWORD RequestSessDirUpdate();
  81. DWORD ReestablishSessionDirectoryConnection();
  82. void Terminate();
  83. void StartupSD();
  84. void NotifySDServerDown();
  85. boolean EnterSDRpc();
  86. void LeaveSDRpc();
  87. void DisableSDRpcs();
  88. void EnableSDRpcs();
  89. public:
  90. CTSSessionDirectory();
  91. ~CTSSessionDirectory();
  92. // Standard COM methods
  93. HRESULT STDMETHODCALLTYPE QueryInterface(REFIID, void **);
  94. ULONG STDMETHODCALLTYPE AddRef();
  95. ULONG STDMETHODCALLTYPE Release();
  96. // ITSSessionDirectory COM interface
  97. HRESULT STDMETHODCALLTYPE Initialize(LPWSTR, LPWSTR, LPWSTR, LPWSTR,
  98. DWORD, DWORD (*)());
  99. HRESULT STDMETHODCALLTYPE Update(LPWSTR, LPWSTR, LPWSTR, LPWSTR, DWORD);
  100. HRESULT STDMETHODCALLTYPE GetUserDisconnectedSessions(LPWSTR, LPWSTR,
  101. DWORD __RPC_FAR *, TSSD_DisconnectedSessionInfo __RPC_FAR
  102. [TSSD_MaxDisconnectedSessions]);
  103. HRESULT STDMETHODCALLTYPE NotifyCreateLocalSession(
  104. TSSD_CreateSessionInfo __RPC_FAR *);
  105. HRESULT STDMETHODCALLTYPE NotifyDestroyLocalSession(DWORD);
  106. HRESULT STDMETHODCALLTYPE NotifyDisconnectLocalSession(DWORD, FILETIME);
  107. HRESULT STDMETHODCALLTYPE NotifyReconnectLocalSession(
  108. TSSD_ReconnectSessionInfo __RPC_FAR *);
  109. HRESULT STDMETHODCALLTYPE NotifyReconnectPending(WCHAR *);
  110. HRESULT STDMETHODCALLTYPE Repopulate(DWORD, TSSD_RepopulateSessionInfo *);
  111. HRESULT STDMETHODCALLTYPE GetLoadBalanceInfo(LPWSTR, BSTR*);
  112. // IExtendServerSettings COM interface
  113. STDMETHOD(GetAttributeName)(WCHAR *);
  114. STDMETHOD(GetDisplayableValueName)(WCHAR *);
  115. STDMETHOD(InvokeUI)(HWND,PDWORD);
  116. STDMETHOD(GetMenuItems)(int *, PMENUEXTENSION *);
  117. STDMETHOD(ExecMenuCmd)(UINT, HWND, PDWORD);
  118. STDMETHOD(OnHelp)(int *);
  119. BOOL CTSSessionDirectory::CheckSessionDirectorySetting(WCHAR *Setting);
  120. BOOL IsSessionDirectoryEnabled();
  121. BOOL CTSSessionDirectory::IsSessionDirectoryExposeServerIPEnabled();
  122. DWORD SetSessionDirectoryState(WCHAR *, BOOL);
  123. DWORD SetSessionDirectoryEnabledState(BOOL);
  124. DWORD SetSessionDirectoryExposeIPState(BOOL);
  125. void ErrorMessage(HWND hwnd , UINT res , DWORD);
  126. public:
  127. TCHAR m_tchProvider[64];
  128. TCHAR m_tchDataSource[64];
  129. TCHAR m_tchUserId[64];
  130. TCHAR m_tchPassword[64];
  131. };
  132. #endif // __TSSDJET_H