Remote Desktop Protocol: Serial and Parallel Port Virtual Channel Extension

Remote Desktop Protocol: Serial and Parallel Port Virtual Channel Extension

[MS-RDPESP]:

Remote Desktop Protocol: Serial and Parallel Port Virtual Channel Extension

Intellectual Property Rights Notice for Open Specifications Documentation

Technical Documentation. Microsoft publishes Open Specifications documentation for protocols, file formats, languages, standards as well as overviews of the interaction among each of these technologies.

Copyrights. This documentation is covered by Microsoft copyrights. Regardless of any other terms that are contained in the terms of use for the Microsoft website that hosts this documentation, you may make copies of it in order to develop implementations of the technologies described in the Open Specifications and may distribute portions of it in your implementations using these technologies or your documentation as necessary to properly document the implementation. You may also distribute in your implementation, with or without modification, any schema, IDL's, or code samples that are included in the documentation. This permission also applies to any documents that are referenced in the Open Specifications.

No Trade Secrets. Microsoft does not claim any trade secret rights in this documentation.

Patents. Microsoft has patents that may cover your implementations of the technologies described in the Open Specifications. Neither this notice nor Microsoft's delivery of the documentation grants any licenses under those or any other Microsoft patents. However, a given Open Specification may be covered by Microsoft Open Specification Promise or the Community Promise. If you would prefer a written license, or if the technologies described in the Open Specifications are not covered by the Open Specifications Promise or Community Promise, as applicable, patent licenses are available by contacting .

Trademarks. The names of companies and products contained in this documentation may be covered by trademarks or similar intellectual property rights. This notice does not grant any licenses under those rights. For a list of Microsoft trademarks, visit

Fictitious Names. The example companies, organizations, products, domain names, e-mail addresses, logos, people, places, and events depicted in this documentation are fictitious. No association with any real company, organization, product, domain name, email address, logo, person, place, or event is intended or should be inferred.

Reservation of Rights. All other rights are reserved, and this notice does not grant any rights other than specifically described above, whether by implication, estoppel, or otherwise.

Tools. The Open Specifications do not require the use of Microsoft programming tools or programming environments in order for you to develop an implementation. If you have access to Microsoft programming tools and environments you are free to take advantage of them. Certain Open Specifications are intended for use in conjunction with publicly available standard specifications and network programming art, and assumes that the reader either is familiar with the aforementioned material or has immediate access to it.

Revision Summary

Date / Revision History / Revision Class / Comments
7/20/2007 / 0.1 / Major / MCPP Milestone 5 Initial Availability
9/28/2007 / 1.0 / Major / Updated and revised the technical content.
10/23/2007 / 1.1 / Minor / Clarified the meaning of the technical content.
11/30/2007 / 1.2 / Minor / Clarified the meaning of the technical content.
1/25/2008 / 1.2.1 / Editorial / Changed language and formatting in the technical content.
3/14/2008 / 1.2.2 / Editorial / Changed language and formatting in the technical content.
5/16/2008 / 1.2.3 / Editorial / Changed language and formatting in the technical content.
6/20/2008 / 1.3 / Minor / Clarified the meaning of the technical content.
7/25/2008 / 1.3.1 / Editorial / Changed language and formatting in the technical content.
8/29/2008 / 1.3.2 / Editorial / Changed language and formatting in the technical content.
10/24/2008 / 1.3.3 / Editorial / Changed language and formatting in the technical content.
12/5/2008 / 1.3.4 / Editorial / Editorial Update.
1/16/2009 / 1.4 / Minor / Clarified the meaning of the technical content.
2/27/2009 / 1.4.1 / Editorial / Changed language and formatting in the technical content.
4/10/2009 / 1.4.2 / Editorial / Changed language and formatting in the technical content.
5/22/2009 / 2.0 / Major / Updated and revised the technical content.
7/2/2009 / 3.0 / Major / Updated and revised the technical content.
8/14/2009 / 4.0 / Major / Updated and revised the technical content.
9/25/2009 / 4.1 / Minor / Clarified the meaning of the technical content.
11/6/2009 / 5.0 / Major / Updated and revised the technical content.
12/18/2009 / 6.0 / Major / Updated and revised the technical content.
1/29/2010 / 6.1 / Minor / Clarified the meaning of the technical content.
3/12/2010 / 6.1.1 / Editorial / Changed language and formatting in the technical content.
4/23/2010 / 6.1.2 / Editorial / Changed language and formatting in the technical content.
6/4/2010 / 6.1.3 / Editorial / Changed language and formatting in the technical content.
7/16/2010 / 6.1.3 / None / No changes to the meaning, language, or formatting of the technical content.
8/27/2010 / 6.1.3 / None / No changes to the meaning, language, or formatting of the technical content.
10/8/2010 / 6.1.3 / None / No changes to the meaning, language, or formatting of the technical content.
11/19/2010 / 6.1.3 / None / No changes to the meaning, language, or formatting of the technical content.
1/7/2011 / 6.1.3 / None / No changes to the meaning, language, or formatting of the technical content.
2/11/2011 / 7.0 / Major / Updated and revised the technical content.
3/25/2011 / 7.0 / None / No changes to the meaning, language, or formatting of the technical content.
5/6/2011 / 7.0 / None / No changes to the meaning, language, or formatting of the technical content.
6/17/2011 / 7.1 / Minor / Clarified the meaning of the technical content.
9/23/2011 / 7.1 / None / No changes to the meaning, language, or formatting of the technical content.
12/16/2011 / 8.0 / Major / Updated and revised the technical content.
3/30/2012 / 8.0 / None / No changes to the meaning, language, or formatting of the technical content.
7/12/2012 / 8.0 / None / No changes to the meaning, language, or formatting of the technical content.
10/25/2012 / 8.0 / None / No changes to the meaning, language, or formatting of the technical content.
1/31/2013 / 8.0 / None / No changes to the meaning, language, or formatting of the technical content.
8/8/2013 / 8.0 / None / No changes to the meaning, language, or formatting of the technical content.
11/14/2013 / 8.0 / None / No changes to the meaning, language, or formatting of the technical content.
2/13/2014 / 8.0 / None / No changes to the meaning, language, or formatting of the technical content.
5/15/2014 / 8.0 / None / No changes to the meaning, language, or formatting of the technical content.
6/30/2015 / 9.0 / Major / Significantly changed the technical content.

Table of Contents

1Introduction

1.1Glossary

1.2References

1.2.1Normative References

1.2.2Informative References

1.3Overview

1.3.1Purpose of Device Redirection Extensions

1.3.2Protocol Initialization

1.4Relationship to Other Protocols

1.5Prerequisites/Preconditions

1.6Applicability Statement

1.7Versioning and Capability Negotiation

1.8Vendor-Extensible Fields

1.9Standards Assignments

2Messages

2.1Transport

2.2Message Syntax

2.2.1Common Data Types

2.2.2Port Redirection Messages

2.2.2.1Client Device List Announce Request

2.2.2.2Server Create Request (DR_PORT_CREATE_REQ)

2.2.2.3Server Close Request (DR_PORT_CLOSE_REQ)

2.2.2.4Server Read Request (DR_PORT_READ_REQ)

2.2.2.5Server Write Request (DR_PORT_WRITE_REQ)

2.2.2.6Server Device Control Request (DR_PORT_CONTROL_REQ)

2.2.2.7Client Create Response (DR_PORT_CREATE_RSP)

2.2.2.8Client Close Response (DR_PORT_CLOSE_RSP)

2.2.2.9Client Read Response (DR_PORT_READ_RSP)

2.2.2.10Client Write Response (DR_PORT_WRITE_RSP)

2.2.2.11Client Device Control Response (DR_PORT_CONTROL_RSP)

3Protocol Details

3.1Common Details

3.1.1Abstract Data Model

3.1.2Timers

3.1.3Initialization

3.1.4Higher-Layer Triggered Events

3.1.5Message Processing Events and Sequencing Rules

3.1.6Timer Events

3.1.7Other Local Events

3.2Client Details

3.2.1Abstract Data Model

3.2.2Timers

3.2.3Initialization

3.2.4Higher-Layer Triggered Events

3.2.5Message Processing Events and Sequencing Rules

3.2.5.1Port Redirection Messages

3.2.5.1.1Sending a Client Device List Announce Request Message

3.2.5.1.2Processing a Server Create Request Message

3.2.5.1.3Processing a Server Close Request Message

3.2.5.1.4Processing a Server Read Request Message

3.2.5.1.5Processing a Server Write Request Message

3.2.5.1.6Processing a Server Device Control Request Message

3.2.5.1.7Sending a Create Response Message

3.2.5.1.8Sending a Close Response Message

3.2.5.1.9Sending a Read Response Message

3.2.5.1.10Sending a Write Response Message

3.2.5.1.11Sending a Device Control Response Message

3.2.6Timer Events

3.2.7Other Local Events

3.3Server Details

3.3.1Abstract Data Model

3.3.2Timers

3.3.3Initialization

3.3.4Higher-Layer Triggered Events

3.3.5Message Processing Events and Sequencing Rules

3.3.5.1Port Redirection Messages

3.3.5.1.1Processing a Client Device List Announce Request Message

3.3.5.1.2Sending a Server Create Request Message

3.3.5.1.3Sending a Server Close Request Message

3.3.5.1.4Sending a Server Write Request Message

3.3.5.1.5Sending a Server Read Request Message

3.3.5.1.6Sending a Server Device Control Request Message

3.3.5.1.7Processing a Client Create Response Message

3.3.5.1.8Processing a Client Close Response Message

3.3.5.1.9Processing a Client Write Response Message

3.3.5.1.10Processing a Client Read Response Message

3.3.5.1.11Processing a Client Device Control Response Message

3.3.6Timer Events

3.3.7Other Local Events

4Protocol Examples

4.1Port Redirection Annotations

4.2Server Create Request Example

4.3Client Create Response Example

4.4IO Operations Examples

5Security

5.1Security Considerations for Implementers

5.2Index of Security Parameters

6Appendix A: Product Behavior

7Change Tracking

8Index

1Introduction

This document specifies the Remote Desktop Protocol: Serial and Parallel Port Virtual Channel Extension. This protocol is used to redirect serial and parallel ports from a terminal client to the terminal server. This allows the server to access client ports as if the connected devices were local to the server.

Sections 1.8, 2, and 3 of this specification are normative and can contain the terms MAY, SHOULD, MUST, MUST NOT, and SHOULD NOT as defined in [RFC2119]. Sections 1.5 and 1.9 are also normative but do not contain those terms. All other sections and examples in this specification are informative.

1.1Glossary

The following terms are specific to this document:

client: A computer on which the remote procedure call (RPC) client is executing.

device control: Driver-specific operations that can be performed on various drivers. Each DeviceIOControl is associated with an operation code (called IoCode) and optionally input and output buffers. Device drivers depending on the IoCode take various actions on the input and output buffers

pseudo device: A virtual device object created by the server to represent a remote device attached to the remote (or client) machine. Applications and drivers on the server interact with this pseudo/virtual device and the server forwards requests to the remote device. Responses from the remote device are returned to the pseudo device, which then forwards them to the applications or drivers interacting with the device. Examples of pseudo devices include the pseudo port device, pseudo printer device, pseudo drive device, pseudo smartcard device, pseudo PnP device, and so on.

remote device: A device that is attached to a remote (or client) machine, in contrast to a device physically attached to a machine.

server: A computer on which the remote procedure call (RPC) server is executing.

terminal client: A client of a terminal server. A terminal client program that runs on the client machine.

terminal server: A computer on which terminal services is running.

MAY, SHOULD, MUST, SHOULD NOT, MUST NOT: These terms (in all caps) are used as defined in [RFC2119]. All statements of optional behavior use either MAY, SHOULD, or SHOULD NOT.

1.2References

Links to a document in the Microsoft Open Specifications library point to the correct section in the most recently published version of the referenced document. However, because individual documents in the library are not updated at the same time, the section numbers in the documents may not match. You can confirm the correct section numbering by checking the Errata.

1.2.1Normative References

We conduct frequent surveys of the normative references to assure their continued availability. If you have any issue with finding a normative reference, please contact . We will assist you in finding the relevant information.

[MS-ERREF] Microsoft Corporation, "Windows Error Codes".

[MS-RDPBCGR] Microsoft Corporation, "Remote Desktop Protocol: Basic Connectivity and Graphics Remoting".

[MS-RDPEFS] Microsoft Corporation, "Remote Desktop Protocol: File System Virtual Channel Extension".

[MS-SMB2] Microsoft Corporation, "Server Message Block (SMB) Protocol Versions 2 and 3".

[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, March 1997,

1.2.2Informative References

[MSDN-DeviceTypes] Microsoft Corporation, "Specifying Device Types",

[MSDN-IoCtlCodes] Microsoft Corporation, "Defining I/O Control Codes",

[MSDN-Ntddpar] Microsoft Corporation, "Ntddpar.h",

[MSDN-Ntddser] Microsoft Corporation, "Ntddser.h",

[MSDN-PORTS] Microsoft Corporation, "Serial and Parallel ports",

[MSFT-WDDK] Microsoft Corporation, "Windows Driver Kit Version 7.1.0",

1.3Overview

The Remote Desktop Protocol: Serial and Parallel Port Virtual Channel Extension specifies the communication used to enable the redirection of serial and parallel ports (ports for short) between a terminal client and a terminal server. By redirecting ports from the terminal client to the terminal server, applications running on a server machine can access the remote devices attached to those ports.

1.3.1Purpose of Device Redirection Extensions

This extension enables the redirection of serial and parallel port devices attached to the terminal client. With the redirection, such devices can then be accessed by the applications running on the server.

1.3.2Protocol Initialization

This extension can be considered as a subprotocol within the Remote Desktop Protocol: File System Virtual Channel Extension as specified in [MS-RDPEFS]. It follows the initialization of the Remote Desktop Protocol: File System Virtual Channel Extension to enable port redirection.

1.4Relationship to Other Protocols

This extension can be considered as a subprotocol within Remote Desktop Protocol: File System Virtual Channel Extension as specified in [MS-RDPEFS]. This extension extends the Remote Desktop Protocol: File System Virtual Channel Extension to enable port redirection.

1.5Prerequisites/Preconditions

The Remote Desktop Protocol: Serial and Parallel Port Virtual Channel Extension operates only after the Remote Desktop Protocol: File System Virtual Channel Extension transport, as specified in [MS-RDPEFS], is fully established.

1.6Applicability Statement

The Remote Desktop Protocol: Serial and Parallel Port Virtual Channel Extension is designed to be run within the context of a Remote Desktop Protocol virtual channel established between a client and server. This protocol extension is applicable when applications running on the terminal server need to access the ports physically located on a client machine.

1.7Versioning and Capability Negotiation

This extension relies on the Remote Desktop Protocol: File System Virtual Channel Extension, as specified in [MS-RDPEFS], to perform basic versioning and capability negotiation.

1.8Vendor-Extensible Fields

This protocol uses NTSTATUS values, as defined in [MS-ERREF] section 2.3. Vendors are free to choose their own values for this field, as long as the C bit (0x20000000) is set, indicating it is a customer code.

1.9Standards Assignments

The Remote Desktop Protocol: Serial and Parallel Port Virtual Channel Extension contains no standards assignments.

2Messages

Because this is a subprotocol of Remote Desktop Protocol: File System Virtual Channel Extension, as specified in [MS-RDPEFS], this extension shares messages and common data types already specified in [MS-RDPEFS]. This section describes the messages and data types used by Remote Desktop Protocol: Serial and Parallel Port Virtual Channel Extension.

2.1Transport

All messages MUST be transported over an established Remote Desktop Protocol device extensions channel (as specified in [MS-RDPEFS] section 2.1).

2.2Message Syntax

The following sections contain Remote Desktop Protocol: Serial and Parallel Port Virtual Channel Extension message syntax.

2.2.1Common Data Types

Port redirection uses common data types specified in [MS-RDPEFS] section 2.

2.2.2Port Redirection Messages

This protocol does not define any specific messages. It uses a subset of the messages specified in [MS-RDPEFS] section 2. The messages in the following sections are used by this protocol.

2.2.2.1Client Device List Announce Request

This message is described in [MS-RDPEFS] section 2.2.2.9. The port redirection client generates the elements of type DEVICE_ANNOUNCE (as specified in [MS-RDPEFS] section 2.2.1.3) for the port devices it wants to redirect.

0 / 1 / 2 / 3 / 4 / 5 / 6 / 7 / 8 / 9 / 1
0 / 1 / 2 / 3 / 4 / 5 / 6 / 7 / 8 / 9 / 2
0 / 1 / 2 / 3 / 4 / 5 / 6 / 7 / 8 / 9 / 3
0 / 1
DeviceAnnounceHeader

DeviceAnnounceHeader (4 bytes): For each redirected port a DEVICE_ANNOUNCE header (as specified in [MS-RDPEFS] section 2.2.1.3) is generated by the client port redirection extension.

The header fields are initialized as follows:

DeviceType: Identifies the device. This value MUST be set to RDPDR_DTYP_PARALLEL for parallel ports and RDPDR_DTYP_SERIAL for serial ports.

DeviceId: A unique ID that identifies the announced device. The DeviceId field follows the semantics described in [MS-RDPEFS] section 2.2.1.3.

PreferredDosName: This field follows the semantic described in [MS-RDPEFS] section 2.2.1.3. It describes the name of the port device as it appears on the client. This protocol does not enforce any semantic limitations on port naming. Client and server implementations determine the port naming convention.<1>

DeviceDataLength: Number of bytes in the DeviceData field. For port devices, this value is set to 0.

NoteThe Client Drive Device List Remove message is not supported by the MS-RDPESP protocol.

2.2.2.2Server Create Request (DR_PORT_CREATE_REQ)

This message is sent by the server to open an instance of the port device. The packet for this message is specified in [MS-RDPEFS] section 2.2.1.4.1 (DR_CREATE_REQ). The DeviceId of the DeviceIoRequest field in the DR_CREATE_REQ packet MUST match the DeviceId value that is sent in the Client Device List Announce Request packet.

The PathLength field of the DR_CREATE_REQ packet MUST be set to 0x00000000. This automatically results in setting the packet Path field to empty.

Some of the parameters that are passed with this request (DesiredAccess, AllocationSize, FileAttributes, SharedAccess, Disposition and CreateOptions) are treated as opaque by this protocol. The interpretation of these parameters is determined by the client-side driver. The various possible values are specified in [MS-SMB2] section 2.2.13.

2.2.2.3Server Close Request (DR_PORT_CLOSE_REQ)

This message is sent from the server to close the previously-opened device instance. The packet is specified in [MS-RDPEFS] section 2.2.1.4.2 (DR_CLOSE_REQ).

2.2.2.4Server Read Request (DR_PORT_READ_REQ)

This message is sent from the server to read data from the port device instance. The packet is specified in [MS-RDPEFS] section 2.2.1.4.3 (DR_READ_REQ).

The Offset field in this request MUST be set to 0.

Zero-length request semantics: The protocol allows the client and server to request or to complete read/write operations with the Length field set to zero. The behavior of these requests and their interpretation is determined by the server application and the client driver.

2.2.2.5Server Write Request (DR_PORT_WRITE_REQ)

This message is sent from the server to write data to the port device instance. The packet is specified in [MS-RDPEFS] section 2.2.1.4.4 (DR_WRITE_REQ).

The Offset field in this request MUST be set to 0.

Zero-length request semantics: The protocol allows the client and server to request or to complete read/write operations with the Length field set to zero. The behavior of these requests and their interpretation is determined by the server application and the client driver.

2.2.2.6Server Device Control Request (DR_PORT_CONTROL_REQ)

This message is sent by the server to request a device control operation. The packet is specified in [MS-RDPEFS] section 2.2.1.4.5 (DR_CONTROL_REQ).

The possible values for the IoControlCode member and the corresponding Input and Output buffers applicable to parallel and serial ports are as defined in [MSFT-WDDK], and in [MSDN-PORTS].

Serial and Parallel IOCTL handles applicable to this protocol: