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.

83 lines
2.7 KiB

  1. //Copyright (c) Microsoft Corporation. All rights reserved.
  2. // EnCliSvr.h: Definition of the CEnumTelnetClientsSvr class
  3. //
  4. //////////////////////////////////////////////////////////////////////
  5. #if !defined(AFX_ENCLISVR_H__FE9E48A5_A014_11D1_855C_00A0C944138C__INCLUDED_)
  6. #define AFX_ENCLISVR_H__FE9E48A5_A014_11D1_855C_00A0C944138C__INCLUDED_
  7. #if _MSC_VER >= 1000
  8. #pragma once
  9. #endif // _MSC_VER >= 1000
  10. #include <resource.h> // main symbols
  11. #include <ClientInfo.h>
  12. #define MAX_STRING_FROM_itow ( 33 + 1 ) //1 for null char
  13. #ifdef ENUM_PROCESSES
  14. #define SIZE_OF_ONE_SESSION_DATA ( MAX_STRING_FROM_itow*9 + 2 + MAX_PATH * 3 + 5 * MAX_PATH )
  15. #else
  16. #define SIZE_OF_ONE_SESSION_DATA ( MAX_STRING_FROM_itow*9 + 2 + MAX_PATH * 3 )
  17. #endif
  18. /////////////////////////////////////////////////////////////////////////////
  19. // CEnumTelnetClientsSvr
  20. class CEnumTelnetClientsSvr :
  21. public CComObjectRootEx<CComMultiThreadModel>,
  22. public CComCoClass<CEnumTelnetClientsSvr,&CLSID_EnumTelnetClientsSvr>,
  23. public IObjectWithSiteImpl<CEnumTelnetClientsSvr>,
  24. public IGetEnumClients,
  25. public IEnumClients,
  26. public IDispatchImpl<IManageTelnetSessions, &IID_IManageTelnetSessions, &LIBID_TLNTSVRLib>
  27. {
  28. public:
  29. CEnumTelnetClientsSvr() { m_pEnumeration = NULL; }
  30. BEGIN_COM_MAP(CEnumTelnetClientsSvr)
  31. COM_INTERFACE_ENTRY(IGetEnumClients)
  32. COM_INTERFACE_ENTRY(IEnumClients)
  33. COM_INTERFACE_ENTRY(IManageTelnetSessions)
  34. COM_INTERFACE_ENTRY(IDispatch)
  35. END_COM_MAP()
  36. //DECLARE_NOT_AGGREGATABLE(CEnumTelnetClientsSvr)
  37. // Remove the comment from the line above if you don't want your object to
  38. // support aggregation.
  39. DECLARE_REGISTRY_RESOURCEID(IDR_EnumTelnetClientsSvr)
  40. public:
  41. // IEnumClients
  42. STDMETHOD(Clone)(/*[out]*/ IEnumClients** ppenum);
  43. STDMETHOD(Reset)();
  44. STDMETHOD(Skip)(/*[in]*/ ULONG celt);
  45. STDMETHOD(Next)(/*[in]*/ ULONG celt,
  46. /*[out, string]*/ TELNET_CLIENT_INFO** rgelt,
  47. /*[out]*/ ULONG* pceltFetched);
  48. // IGetEnumClients
  49. STDMETHOD(GetEnumClients)(/*[out, retval]*/ IEnumClients** ppretval);
  50. //IManageTelnetSessions
  51. STDMETHOD(GetTelnetSessions)( /*[out, retval]*/ BSTR* );
  52. STDMETHOD(SendMsgToASession)( DWORD, BSTR );
  53. //IManageTelnetSessions && IEnumClients
  54. STDMETHOD(TerminateSession)( DWORD );
  55. private:
  56. bool SendMsg( DWORD, BSTR );
  57. bool EnumClients( CEnumData* pEnumData );
  58. CEnumData* m_pEnumeration;
  59. bool InformTheSession( CClientInfo *, WCHAR [] );
  60. bool AskTheSessionItsDetails( CClientInfo* );
  61. bool AskTheSessionToQuit( CClientInfo* );
  62. public:
  63. //CComObjectRoot overrrides
  64. void FinalRelease();
  65. };
  66. #endif // !defined(AFX_ENCLISVR_H__FE9E48A5_A014_11D1_855C_00A0C944138C__INCLUDED_)