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.

126 lines
3.1 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. Module Name:
  4. cenumses.hxx
  5. Abstract:
  6. Contains definitions for CWinNTSessionsCollection
  7. and for CWinNTSessionsEnumVar
  8. Author:
  9. Ram Viswanathan (ramv) 02-12-96
  10. Revision History:
  11. --*/
  12. //
  13. // a client name and a User Name uniquely identifies a session, so there is
  14. // no need to carry extraneous information that is provided by NetSessionEnum
  15. // at any Info Level.
  16. //
  17. class CWinNTSessionsEnumVar;
  18. class CWinNTSessionsCollection: INHERIT_TRACKING,
  19. public ISupportErrorInfo,
  20. public IADsCollection
  21. {
  22. public:
  23. /* IUnknown methods */
  24. STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID FAR* ppvObj) ;
  25. DECLARE_STD_REFCOUNTING;
  26. DECLARE_IDispatch_METHODS;
  27. DECLARE_ISupportErrorInfo_METHODS;
  28. DECLARE_IADsCollection_METHODS;
  29. //
  30. // constructor and destructor
  31. //
  32. CWinNTSessionsCollection();
  33. ~CWinNTSessionsCollection();
  34. static HRESULT Create(LPTSTR pszServerADsPath,
  35. LPTSTR pszClientName,
  36. LPTSTR pszUserName,
  37. CWinNTCredentials& Credentials,
  38. CWinNTSessionsCollection ** ppSessionsCollection
  39. );
  40. protected:
  41. CAggregatorDispMgr * _pDispMgr;
  42. CWinNTSessionsEnumVar *_pCSessionsEnumVar;
  43. LPWSTR _pszServerADsPath;
  44. LPWSTR _pszServerName;
  45. LPWSTR _pszClientName;
  46. LPWSTR _pszUserName;
  47. CWinNTCredentials _Credentials;
  48. };
  49. class CWinNTSessionsEnumVar : public CWinNTEnumVariant
  50. {
  51. public:
  52. static HRESULT Create(LPTSTR pszServerADsPath,
  53. LPTSTR pszClientName,
  54. LPTSTR pszUserName,
  55. CWinNTCredentials& _Credentials,
  56. CWinNTSessionsEnumVar FAR* FAR*);
  57. CWinNTSessionsEnumVar();
  58. ~CWinNTSessionsEnumVar();
  59. protected:
  60. LPWSTR _pszServerName;
  61. LPWSTR _pszServerADsPath;
  62. LPWSTR _pszClientName;
  63. LPWSTR _pszUserName;
  64. LONG _lCurrentPosition;
  65. ULONG _cElements;
  66. LONG _lLBound;
  67. DWORD _dwResumeHandle;
  68. DWORD _dwTotalEntries;
  69. LPBYTE _pbSessions;
  70. CWinNTCredentials _Credentials;
  71. STDMETHOD(Next)(
  72. ULONG cElements,
  73. VARIANT FAR* pvar,
  74. ULONG FAR* pcElementFetched
  75. );
  76. };
  77. //
  78. // helper functions
  79. //
  80. HRESULT
  81. SplitIntoUserAndClient(LPTSTR pszSession,
  82. LPTSTR * ppszUserName,
  83. LPTSTR * ppszClientName
  84. );
  85. HRESULT
  86. WinNTEnumSessions(LPTSTR pszServerName,
  87. LPTSTR pszClientName,
  88. LPTSTR pszUserName,
  89. PDWORD pdwEntriesRead,
  90. PDWORD pdwTotalEntries,
  91. PDWORD pdwResumeHandle,
  92. LPBYTE * ppMem
  93. );