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.

209 lines
3.0 KiB

  1. /*++
  2. Copyright (c) 2001 Microsoft Corporation
  3. Module Name:
  4. vtutf8chan.cpp
  5. Abstract:
  6. This module provides the implementation for the VT-UTF8
  7. compatible channels.
  8. Author:
  9. Brian Guarraci (briangu), 2001
  10. Revision History:
  11. --*/
  12. #include <emsapip.h>
  13. #include <emsapi.h>
  14. #include <ntddsac.h>
  15. EMSVTUTF8Channel::EMSVTUTF8Channel(
  16. VOID
  17. )
  18. /*++
  19. Routine Description:
  20. Constructor
  21. Arguments:
  22. None
  23. Return Value:
  24. N/A
  25. --*/
  26. {
  27. }
  28. EMSVTUTF8Channel::~EMSVTUTF8Channel()
  29. /*++
  30. Routine Description:
  31. Desctructor
  32. Arguments:
  33. N/A
  34. Return Value:
  35. N/A
  36. --*/
  37. {
  38. }
  39. EMSVTUTF8Channel*
  40. EMSVTUTF8Channel::Construct(
  41. IN SAC_CHANNEL_OPEN_ATTRIBUTES ChannelAttributes
  42. )
  43. /*++
  44. Routine Description:
  45. Create a new channel object
  46. Arguments:
  47. EMSVTUTF8ChannelName - The name of the newly created channel
  48. Return Value:
  49. Status
  50. TRUE --> pHandle is valid
  51. --*/
  52. {
  53. EMSVTUTF8Channel *Channel;
  54. //
  55. // Force the appropriate channel attributes
  56. //
  57. ChannelAttributes.Type = ChannelTypeVTUTF8;
  58. //
  59. // Attempt to open the channel
  60. //
  61. Channel = (EMSVTUTF8Channel*) EMSChannel::Construct(
  62. ChannelAttributes
  63. );
  64. return Channel;
  65. }
  66. BOOL
  67. EMSVTUTF8Channel::Write(
  68. IN PCWSTR String
  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 SacChannelVTUTF8WriteString(
  81. GetEMSChannelHandle(),
  82. String
  83. );
  84. }
  85. BOOL
  86. EMSVTUTF8Channel::Write(
  87. IN PCWCHAR Buffer,
  88. IN ULONG BufferSize
  89. )
  90. /*++
  91. Routine Description:
  92. Write the given buffer to the specified SAC Channel
  93. Arguments:
  94. String - Unicode string to write
  95. Return Value:
  96. Status
  97. TRUE --> the buffer was sent
  98. --*/
  99. {
  100. return SacChannelVTUTF8Write(
  101. GetEMSChannelHandle(),
  102. Buffer,
  103. BufferSize
  104. );
  105. }
  106. BOOL
  107. EMSVTUTF8Channel::Read(
  108. OUT PWSTR Buffer,
  109. IN ULONG BufferSize,
  110. OUT PULONG ByteCount
  111. )
  112. /*++
  113. Routine Description:
  114. This routine reads data from the channel specified.
  115. Arguments:
  116. Buffer - destination buffer
  117. BufferSize - size of the destination buffer (bytes)
  118. ByteCount - the actual # of byte read
  119. Return Value:
  120. Status
  121. TRUE --> the buffer was sent
  122. --*/
  123. {
  124. return SacChannelVTUTF8Read(
  125. GetEMSChannelHandle(),
  126. Buffer,
  127. BufferSize,
  128. ByteCount
  129. );
  130. }