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.

72 lines
1.9 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 2000
  6. //
  7. // File: ausessions.h
  8. // Definition of the Updates class
  9. //
  10. //--------------------------------------------------------------------------
  11. #pragma once
  12. #define MAX_WTS 256 // replace 256 by whatever the limit of TS Client is
  13. #define CDWNO_SESSION -2
  14. #define CMIN_SESSIONS 4
  15. //fixcode: why a structure with only one member
  16. //fixcode: misleading name. fSource will be better
  17. typedef struct _Session_State
  18. {
  19. BOOL fFoundEnumerating;
  20. } SESSION_STATE;
  21. typedef struct _Session_State_Info
  22. {
  23. DWORD dwSessionId;
  24. SESSION_STATE SessionState;
  25. } SESSION_STATE_INFO;
  26. class SESSION_STATUS
  27. {
  28. public:
  29. SESSION_STATUS();
  30. ~SESSION_STATUS();
  31. BOOL Initialize(BOOL fUseCriticalSection, BOOL fAllActiveUsers);
  32. void Clear(void);
  33. BOOL m_FAddSession(DWORD dwSessionId, SESSION_STATE *pSesState);
  34. BOOL m_FGetSessionState(DWORD dwSessionId, SESSION_STATE **pSesState ); //check if dwSessionId is in cache
  35. BOOL m_FDeleteSession(DWORD dwSessionId);
  36. int CSessions(void)
  37. {
  38. return m_iLastSession + 1;
  39. }
  40. BOOL m_FGetNextSession(DWORD *pdwSessionId);
  41. BOOL m_FGetCurrentSession(DWORD *pdwSessionId);
  42. int m_iGetSessionIdAtIndex(int iIndex);
  43. int m_iFindSession(DWORD dwSessionId); //get cache index for dwSessionId
  44. void m_DumpSessions(); // for debug purposes
  45. void m_EraseAll();
  46. BOOL CacheSessionIfAUEnabledAdmin(DWORD dwSessionId, BOOL fFoundEnumerating);
  47. VOID CacheExistingSessions();
  48. void ValidateCachedSessions();
  49. void RebuildSessionCache();
  50. private:
  51. BOOL m_FChangeBufSession(int cSessions);
  52. SESSION_STATE_INFO *m_pSessionStateInfo;
  53. int m_iLastSession;
  54. int m_cAllocBufSessions;
  55. int m_iCurSession;
  56. CRITICAL_SECTION m_csWrite;
  57. BOOL m_fAllActiveUsers; //Admin only otherwise
  58. BOOL m_fInitCS; // whether critical section has been initialized
  59. };
  60. //#define ALL_SESSIONS -2