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.

178 lines
2.5 KiB

  1. /*++
  2. Copyright (c) 2001 Microsoft Corporation
  3. Module Name:
  4. cmdchan.cpp
  5. Abstract:
  6. This module implements the Cmd console session class that
  7. is used by sacsess.
  8. Author:
  9. Brian Guarraci (briangu), 2001
  10. Revision History:
  11. --*/
  12. #include <emsapip.h>
  13. #include <emsapi.h>
  14. #include <ntddsac.h>
  15. EMSCmdChannel::EMSCmdChannel(
  16. VOID
  17. )
  18. /*++
  19. Routine Description:
  20. Constructor
  21. Arguments:
  22. None
  23. Return Value:
  24. N/A
  25. --*/
  26. {
  27. NOTHING;
  28. }
  29. EMSCmdChannel::~EMSCmdChannel()
  30. /*++
  31. Routine Description:
  32. Desctructor
  33. Arguments:
  34. N/A
  35. Return Value:
  36. N/A
  37. --*/
  38. {
  39. NOTHING;
  40. }
  41. EMSCmdChannel*
  42. EMSCmdChannel::Construct(
  43. IN SAC_CHANNEL_OPEN_ATTRIBUTES ChannelAttributes
  44. )
  45. /*++
  46. Routine Description:
  47. Create a new channel object
  48. Arguments:
  49. EMSCmdChannelName - The name of the newly created channel
  50. Return Value:
  51. Status
  52. TRUE --> pHandle is valid
  53. --*/
  54. {
  55. EMSCmdChannel *Channel;
  56. //
  57. // Force the appropriate channel attributes
  58. //
  59. ChannelAttributes.Type = ChannelTypeCmd;
  60. //
  61. // Attempt to open the channel
  62. //
  63. Channel = (EMSCmdChannel*) EMSChannel::Construct(
  64. ChannelAttributes
  65. );
  66. return Channel;
  67. }
  68. BOOL
  69. EMSCmdChannel::Write(
  70. IN PCBYTE Buffer,
  71. IN ULONG BufferSize
  72. )
  73. /*++
  74. Routine Description:
  75. Write the given buffer to the specified SAC Channel
  76. Arguments:
  77. String - Unicode string to write
  78. Return Value:
  79. Status
  80. TRUE --> the buffer was sent
  81. --*/
  82. {
  83. return SacChannelRawWrite(
  84. GetEMSChannelHandle(),
  85. Buffer,
  86. BufferSize
  87. );
  88. }
  89. BOOL
  90. EMSCmdChannel::Read(
  91. OUT PBYTE Buffer,
  92. IN ULONG BufferSize,
  93. OUT PULONG ByteCount
  94. )
  95. /*++
  96. Routine Description:
  97. This routine reads data from the channel specified.
  98. Arguments:
  99. Buffer - destination buffer
  100. BufferSize - size of the destination buffer (bytes)
  101. ByteCount - the actual # of byte read
  102. Return Value:
  103. Status
  104. TRUE --> the buffer was sent
  105. --*/
  106. {
  107. return SacChannelRawRead(
  108. GetEMSChannelHandle(),
  109. Buffer,
  110. BufferSize,
  111. ByteCount
  112. );
  113. }