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.

220 lines
6.3 KiB

  1. /*++
  2. Copyright (c) 1998-2000 Microsoft Corporation
  3. Module Name:
  4. W32DrPRT
  5. Abstract:
  6. This module defines the parent for the Win32 client-side RDP
  7. port redirection "device" class hierarchy, W32DrPRT.
  8. Author:
  9. Tad Brockway 3/23/99
  10. Revision History:
  11. --*/
  12. #ifndef __W32DRPRT_H__
  13. #define __W32DRPRT_H__
  14. #ifdef OS_WINCE
  15. #include "drdevasc.h"
  16. #else
  17. #include "drdevol.h"
  18. #endif
  19. #include "drprt.h"
  20. ///////////////////////////////////////////////////////////////
  21. //
  22. // W32DrPRT
  23. //
  24. // Inherits platform-specific device behavior from
  25. // W32DrDevice. Platform-independent port device behavior
  26. // is inherited from DrPRT.
  27. //
  28. // Subclass off of the async parent device in CE because
  29. // overlapped IO is not supported. Non-overlapped IO doesn't
  30. // work right with the NT serial driver, so we need to use
  31. // overlapped IO in this case.
  32. //
  33. #ifdef OS_WINCE
  34. class W32DrPRT : public W32DrDeviceAsync, DrPRT
  35. #else
  36. class W32DrPRT : public W32DrDeviceOverlapped, DrPRT
  37. #endif
  38. {
  39. protected:
  40. //
  41. // Return back the port handle
  42. //
  43. virtual DRPORTHANDLE GetPortHandle(ULONG FileId);
  44. //
  45. // Return the ID for this port.
  46. //
  47. virtual ULONG GetID() {
  48. return DrDevice::GetID();
  49. }
  50. //
  51. // Return the "parent" TS Device Redirection IO processing object.
  52. //
  53. virtual ProcObj *ProcessObject() {
  54. return DrDevice::ProcessObject();
  55. }
  56. //
  57. // Default IO Request Handler
  58. //
  59. virtual VOID DefaultIORequestMsgHandle(
  60. IN PRDPDR_IOREQUEST_PACKET pIoRequestPacket,
  61. IN NTSTATUS serverReturnStatus
  62. ) {
  63. DrDevice::DefaultIORequestMsgHandle(pIoRequestPacket,
  64. serverReturnStatus);
  65. }
  66. //
  67. // Serial IOCTL Dispatch Functions
  68. //
  69. // These functions are called by DrPRT and handle the platform-
  70. // specific details of satisfying serial IO requests, including sending
  71. // an appropriate response to the server.
  72. //
  73. virtual void SerialSetTimeouts(PRDPDR_IOREQUEST_PACKET pIoReq);
  74. virtual void SerialGetTimeouts(PRDPDR_IOREQUEST_PACKET pIoReq);
  75. virtual void SerialSetChars(PRDPDR_IOREQUEST_PACKET pIoReq);
  76. virtual void SerialGetChars(PRDPDR_IOREQUEST_PACKET pIoReq);
  77. virtual void SerialResetDevice(PRDPDR_IOREQUEST_PACKET pIoReq);
  78. virtual void SerialSetQueueSize(PRDPDR_IOREQUEST_PACKET pIoReq);
  79. virtual void SerialGetWaitMask(PRDPDR_IOREQUEST_PACKET pIoReq);
  80. virtual void SerialSetWaitMask(PRDPDR_IOREQUEST_PACKET pIoReq);
  81. virtual void SerialWaitOnMask(PRDPDR_IOREQUEST_PACKET pIoReq);
  82. virtual void SerialPurge(PRDPDR_IOREQUEST_PACKET pIoReq);
  83. virtual void SerialGetHandflow(PRDPDR_IOREQUEST_PACKET pIoReq);
  84. virtual void SerialSetHandflow(PRDPDR_IOREQUEST_PACKET pIoReq);
  85. virtual void SerialGetModemStatus(PRDPDR_IOREQUEST_PACKET pIoReq);
  86. virtual void SerialGetDTRRTS(PRDPDR_IOREQUEST_PACKET pIoReq);
  87. virtual void SerialGetCommStatus(PRDPDR_IOREQUEST_PACKET pIoReq);
  88. virtual void SerialGetProperties(PRDPDR_IOREQUEST_PACKET pIoReq);
  89. virtual void SerialXoffCounter(PRDPDR_IOREQUEST_PACKET pIoReq);
  90. virtual void SerialLSRMSTInsert(PRDPDR_IOREQUEST_PACKET pIoReq);
  91. virtual void SerialConfigSize(PRDPDR_IOREQUEST_PACKET pIoReq);
  92. virtual void SerialGetConfig(PRDPDR_IOREQUEST_PACKET pIoReq);
  93. virtual void SerialGetStats(PRDPDR_IOREQUEST_PACKET pIoReq);
  94. virtual void SerialClearStats(PRDPDR_IOREQUEST_PACKET pIoReq);
  95. //
  96. // IO Processing Functions
  97. //
  98. // This subclass of DrDevice handles the following IO requests. These
  99. // functions may be overridden in a subclass.
  100. //
  101. // pIoRequestPacket - Request packet received from server.
  102. // packetLen - Length of the packet
  103. //
  104. virtual VOID MsgIrpDeviceControl(
  105. IN PRDPDR_IOREQUEST_PACKET pIoRequestPacket,
  106. IN UINT32 packetLen
  107. );
  108. //
  109. // Async IO Management Functions
  110. //
  111. #ifdef OS_WINCE
  112. static HANDLE _StartWaitOnMaskFunc(W32DRDEV_ASYNCIO_PARAMS *params,
  113. DWORD *status);
  114. HANDLE StartWaitOnMaskFunc(W32DRDEV_ASYNCIO_PARAMS *params,
  115. DWORD *status);
  116. DWORD AsyncWaitOnMaskFunc(W32DRDEV_ASYNCIO_PARAMS *params);
  117. static _ThreadPoolFunc _AsyncWaitOnMaskFunc;
  118. #else
  119. static HANDLE _StartWaitOnMaskFunc(W32DRDEV_OVERLAPPEDIO_PARAMS *params,
  120. DWORD *status);
  121. HANDLE StartWaitOnMaskFunc(W32DRDEV_OVERLAPPEDIO_PARAMS *params,
  122. DWORD *status);
  123. #endif
  124. //
  125. // Fetch initial COM values for a particular port from the INI's.
  126. //
  127. #ifndef OS_WINCE
  128. static BOOL GetIniCommValues(IN LPTSTR pName, IN LPDCB pdcb);
  129. #endif
  130. public:
  131. //
  132. // Constructor/Destructor
  133. //
  134. W32DrPRT(ProcObj *processObject, const DRSTRING portName,
  135. ULONG deviceID, const TCHAR *devicePath);
  136. ~W32DrPRT();
  137. //
  138. // Set a serial port to its initial state.
  139. //
  140. static VOID InitializeSerialPort(TCHAR *portName, HANDLE portHandle);
  141. //
  142. // Return the size (in bytes) of a device announce packet for
  143. // this device.
  144. //
  145. virtual ULONG GetDevAnnounceDataSize()
  146. {
  147. return DrPRT::GetDevAnnounceDataSize();
  148. }
  149. //
  150. // Add a device announce packet for this device to the input
  151. // buffer.
  152. //
  153. virtual VOID GetDevAnnounceData(IN PRDPDR_DEVICE_ANNOUNCE buf)
  154. {
  155. DrPRT::GetDevAnnounceData(buf, GetID(), GetDeviceType());
  156. }
  157. //
  158. // Return whether this class instance is valid.
  159. //
  160. virtual BOOL IsValid()
  161. {
  162. return(W32DrDevice::IsValid() && DrPRT::IsValid());
  163. }
  164. //
  165. // Get basic information about the device.
  166. //
  167. virtual DRSTRING GetName()
  168. {
  169. return DrPRT::GetName();
  170. }
  171. //
  172. // Return the class name.
  173. //
  174. virtual DRSTRING ClassName() { return TEXT("W32DrPRT"); }
  175. };
  176. ///////////////////////////////////////////////////////////////
  177. //
  178. // W32DrPRT Inline Functions
  179. //
  180. #endif