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.

142 lines
2.5 KiB

  1. /*++
  2. Copyright (c) 2001 Microsoft Corporation
  3. Module Name:
  4. session.h
  5. Abstract:
  6. Base class for screen scraped sessions.
  7. Author:
  8. Brian Guarraci (briangu), 2001
  9. Revision History:
  10. --*/
  11. #if !defined( _SESSION_H_ )
  12. #define _SESSION_H_
  13. #include <cmnhdr.h>
  14. #include <TChar.h>
  15. #include <Shell.h>
  16. #include <Scraper.h>
  17. #include "iohandler.h"
  18. #include "secio.h"
  19. #include "scraper.h"
  20. extern "C" {
  21. #include <ntddsac.h>
  22. #include <sacapi.h>
  23. }
  24. #define MAX_HANDLES 4
  25. #define DEFAULT_COLS 80
  26. #define DEFAULT_ROWS 24
  27. #define MAX_USERNAME_LENGTH 256
  28. #define MAX_DOMAINNAME_LENGTH 255
  29. #define MAX_PASSWORD_LENGTH 256
  30. // milliseconds
  31. #define MIN_POLL_INTERVAL 100
  32. class CSession {
  33. //
  34. // Primary classes used by the session
  35. //
  36. CShell *m_Shell;
  37. CScraper *m_Scraper;
  38. CSecurityIoHandler *m_ioHandler;
  39. //
  40. // The COL/ROW dimesions of the session
  41. //
  42. WORD m_wCols;
  43. WORD m_wRows;
  44. //
  45. // WaitForIo Attributes
  46. //
  47. BOOL m_bContinueSession;
  48. DWORD m_dwHandleCount;
  49. HANDLE m_rghHandlestoWaitOn[ MAX_HANDLES ];
  50. //
  51. // Events used by the session
  52. //
  53. HANDLE m_ThreadExitEvent;
  54. HANDLE m_SacChannelCloseEvent;
  55. HANDLE m_SacChannelHasNewDataEvent;
  56. HANDLE m_SacChannelLockEvent;
  57. HANDLE m_SacChannelRedrawEvent;
  58. //
  59. // Username and Password of authenticated user
  60. //
  61. WCHAR m_UserName[MAX_USERNAME_LENGTH+1];
  62. WCHAR m_DomainName[MAX_DOMAINNAME_LENGTH+1];
  63. //
  64. // Scrape interval counter
  65. //
  66. DWORD m_dwPollInterval;
  67. //
  68. // User input handler thread attributes
  69. //
  70. HANDLE m_InputThreadHandle;
  71. DWORD m_InputThreadTID;
  72. //
  73. // Worker thread to process user input
  74. //
  75. static unsigned int
  76. InputThread(
  77. PVOID pParam
  78. );
  79. //
  80. // User authentication method
  81. //
  82. BOOL
  83. Authenticate(
  84. OUT PHANDLE phToken
  85. );
  86. //
  87. // Unlock the session
  88. //
  89. BOOL
  90. Unlock(
  91. VOID
  92. );
  93. //
  94. // Lock the session
  95. //
  96. BOOL
  97. Lock(
  98. VOID
  99. );
  100. public:
  101. CSession();
  102. virtual ~CSession();
  103. BOOL Init();
  104. void WaitForIo();
  105. void Shutdown();
  106. void AddHandleToWaitOn( HANDLE );
  107. };
  108. #endif // _SESSION_H_