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.

175 lines
2.5 KiB

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