3.1.4 Message Processing Events and Sequencing Rules

Only messages of type DR_CONTROL_REQ and DR_CONTROL_RSP (as specified in [MS-RDPEFS] sections 2.2.1.4.5 and 2.2.1.5.5, respectively) are valid for this protocol. All other messages MUST be processed according to the Remote Desktop Protocol: File System Virtual Channel Extension.

Only the control codes specified in the IOCTL Processing Rules in the following table are valid. Invalid packets MUST be dropped without a reply.

 Function number

 Value for IoControlCode

 IRP_MJ_DEVICE_CONTROL request

 Input packet, Output packet

5

0x00090014

SCARD_IOCTL_ESTABLISHCONTEXT

EstablishContext_Call (section 2.2.2.1), EstablishContext_Return (section 2.2.3.2)

6

0x00090018

SCARD_IOCTL_RELEASECONTEXT

Context_Call (section 2.2.2.2), Long_Return (section 2.2.3.3)

7

0x0009001C

SCARD_IOCTL_ISVALIDCONTEXT

Context_Call (section 2.2.2.2), Long_Return (section 2.2.3.3)

8

0x00090020

SCARD_IOCTL_LISTREADERGROUPSA

ListReaderGroups_Call (section 2.2.2.3), ListReaderGroups_Return (section 2.2.3.4)

9

0x00090024

SCARD_IOCTL_LISTREADERGROUPSW

ListReaderGroups_Call (section 2.2.2.3), ListReaderGroups_Return (section 2.2.3.4)

10

0x00090028

SCARD_IOCTL_LISTREADERSA

ListReaders_Call (section 2.2.2.4), ListReaders_Return (section 2.2.3.4)

11

0x0009002C

SCARD_IOCTL_LISTREADERSW

ListReaders_Call (section 2.2.2.4), ListReaders_Return (section 2.2.3.4)

20

0x00090050

SCARD_IOCTL_INTRODUCEREADERGROUPA

ContextAndStringA_Call (section 2.2.2.5), Long_Return (section 2.2.3.3)

21

0x00090054

SCARD_IOCTL_INTRODUCEREADERGROUPW

ContextAndStringW_Call (section 2.2.2.6), Long_Return (section 2.2.3.3)

22

0x00090058

SCARD_IOCTL_FORGETREADERGROUPA

ContextAndStringA_Call (section 2.2.2.5), Long_Return (section 2.2.3.3)

23

0x0009005C

SCARD_IOCTL_FORGETREADERGROUPW

ContextAndStringW_Call (section 2.2.2.6), Long_Return (section 2.2.3.3)

24

0x00090060

SCARD_IOCTL_INTRODUCEREADERA

ContextAndTwoStringA_Call (section 2.2.2.7), Long_Return (section 2.2.3.3)

25

0x00090064

SCARD_IOCTL_INTRODUCEREADERW

ContextAndTwoStringW_Call (section 2.2.2.8), Long_Return (section 2.2.3.3)

26

0x00090068

SCARD_IOCTL_FORGETREADERA

ContextAndStringA_Call (section 2.2.2.5), Long_Return (section 2.2.3.3)

27

0x0009006C

SCARD_IOCTL_FORGETREADERW

ContextAndStringW_Call (section 2.2.2.6), Long_Return (section 2.2.3.3)

28

0x00090070

SCARD_IOCTL_ADDREADERTOGROUPA

ContextAndTwoStringA_Call (section 2.2.2.7), Long_Return (section 2.2.3.3)

29

0x00090074

SCARD_IOCTL_ADDREADERTOGROUPW

ContextAndTwoStringW_Call (section 2.2.2.8), Long_Return (section 2.2.3.3)

30

0x00090078

SCARD_IOCTL_REMOVEREADERFROMGROUPA

ContextAndTwoStringA_Call (section 2.2.2.7), Long_Return (section 2.2.3.3)

31

0x0009007C

SCARD_IOCTL_REMOVEREADERFROMGROUPW

ContextAndTwoStringW_Call (section 2.2.2.8), Long_Return (section 2.2.3.3)

38

0x00090098

SCARD_IOCTL_LOCATECARDSA

LocateCardsA_Call (section 2.2.2.9), LocateCards_Return (section 2.2.3.5)

39

0x0009009C

SCARD_IOCTL_LOCATECARDSW

LocateCardsW_Call (section 2.2.2.10), LocateCards_Return (section 2.2.3.5)

40

0x000900A0

SCARD_IOCTL_GETSTATUSCHANGEA

GetStatusChangeA_Call (section 2.2.2.11), GetStatusChange_Return (section 2.2.3.5)

41

0x000900A4

SCARD_IOCTL_GETSTATUSCHANGEW

GetStatusChangeW_Call (section 2.2.2.12), GetStatusChange_Return (section 2.2.3.5)

42

0x000900A8

SCARD_IOCTL_CANCEL

Context_Call (section 2.2.2.2), Long_Return (section 2.2.3.3)

43

0x000900AC

SCARD_IOCTL_CONNECTA

ConnectA_Call (section 2.2.2.13), Connect_Return (section 2.2.3.8)

44

0x000900B0

SCARD_IOCTL_CONNECTW

ConnectW_Call (section 2.2.2.14), Connect_Return (section 2.2.3.8)

45

0x000900B4

SCARD_IOCTL_RECONNECT

Reconnect_Call (section 2.2.2.15), Reconnect_Return (section 2.2.3.7)

46

0x000900B8

SCARD_IOCTL_DISCONNECT

HCardAndDisposition_Call (section 2.2.2.16), Long_Return (section 2.2.3.3)

47

0x000900BC

SCARD_IOCTL_BEGINTRANSACTION

HCardAndDisposition_Call (section 2.2.2.16), Long_Return (section 2.2.3.3)

48

0x000900C0

SCARD_IOCTL_ENDTRANSACTION

HCardAndDisposition_Call (section 2.2.2.16), Long_Return (section 2.2.3.3)

49

0x000900C4

SCARD_IOCTL_STATE

State_Call (section 2.2.2.17), State_Return (section 2.2.3.9)

50

0x000900C8

SCARD_IOCTL_STATUSA

Status_Call (section 2.2.2.18), Status_Return (section 2.2.3.10)

51

0x000900CC

SCARD_IOCTL_STATUSW

Status_Call (section 2.2.2.18), Status_Return (section 2.2.3.10)

52

0x000900D0

SCARD_IOCTL_TRANSMIT

Transmit_Call (section 2.2.2.19), Transmit_Return (section 2.2.3.11)

53

0x000900D4

SCARD_IOCTL_CONTROL

Control_Call (section 2.2.2.20), Control_Return (section 2.2.3.6)

54

0x000900D8

SCARD_IOCTL_GETATTRIB

GetAttrib_Call (section 2.2.2.21), GetAttrib_Return (section 2.2.3.12)

55

0x000900DC

SCARD_IOCTL_SETATTRIB

SetAttrib_Call (section 2.2.2.22), Long_Return (section 2.2.3.3)

56

0x000900E0

SCARD_IOCTL_ACCESSSTARTEDEVENT

ScardAccessStartedEvent_Call (section 2.2.2.30), Long_Return (section 2.2.3.3)

57

0x000900E4

SCARD_IOCTL_RELEASETARTEDEVENT

Not used.

58

0x000900E8

SCARD_IOCTL_LOCATECARDSBYATRA

LocateCardsByATRA_Call (section 2.2.2.23), LocateCards_Return (section 2.2.3.5)

59

0x000900EC

SCARD_IOCTL_LOCATECARDSBYATRW

LocateCardsByATRW_Call (section 2.2.2.24), LocateCards_Return (section 2.2.3.5)

60

0x000900F0

SCARD_IOCTL_READCACHEA

ReadCacheA_Call (section 2.2.2.25), ReadCache_Return (section 2.2.3.1)

61

0x000900F4

SCARD_IOCTL_READCACHEW

ReadCacheW_Call (section 2.2.2.26), ReadCache_Return (section 2.2.3.1)

62

0x000900F8

SCARD_IOCTL_WRITECACHEA

WriteCacheA_Call (section 2.2.2.27), Long_Return (section 2.2.3.3)

63

0x000900FC

SCARD_IOCTL_WRITECACHEW

WriteCacheW_Call (section 2.2.2.28), Long_Return (section 2.2.3.3)

64

0x00090100

SCARD_IOCTL_GETTRANSMITCOUNT

GetTransmitCount_Call (section 2.2.2.29), GetTransmitCount_Return (section 2.2.3.13)

65

0x00090104

SCARD_IOCTL_GETREADERICON

GetReaderIcon_Call (section 2.2.2.31), GetReaderIcon_Return (section 2.2.3.14)

66

0x00090108

SCARD_IOCTL_GETDEVICETYPEID

GetDeviceTypeId_Call (section 2.2.2.32),  

GetDeviceTypeId_Return (section 2.2.3.15)

The TS client MUST be able to process multiple requests simultaneously within the limits of its resources.

Any errors from the Smart Cards for Windows layer MUST be transferred to the TS server and MUST NOT be modified by the TS client. No exceptions are thrown in this protocol.

The following steps MUST be performed on each call packet received:

  1. The IoControlCode MUST be present, as specified in the preceding IOCTL Processing Rules table, for the specific protocol version implemented.<2>

  2. The input data type is interpreted according to the IOCTL Processing Rules table. The data MUST be decoded as specified in [MS-RPCE] section 2.2.6.

  3. Processing MUST be performed according to the corresponding section that follows. On success, it MUST return a structure as specified in the preceding IOCTL Processing Rules table.

  4. If the protocol encounters problems decoding the input or encoding the results, then DR_DEVICE_IOCOMPLETION.IOStatus (as specified in [MS-RDPEFS] section 2.2.1.5) MUST be set to an NTSTATUS code (as specified in [MS-ERREF] section 2.3), the most common of which appear in the following table.

     Return value/code

     Description

    STATUS_NO_MEMORY

    0xC0000017

    Not enough virtual memory or paging file quota is available to complete the specified operation.

    STATUS_UNSUCCESSFUL

    0xC0000001

    The requested operation was unsuccessful.

    STATUS_BUFFER_TOO_SMALL

    0xC0000023

    The buffer is too small to contain the entry. No information has been written to the buffer.

  5. On error, DR_DEVICE_IOCOMPLETION.Parameters.DeviceIOControl.OutputBufferLength MUST be set to zero and DR_DEVICE_IOCOMPLETION.Parameters.DeviceIOControl.OutputBuffer MUST set to NULL.

  6. Otherwise, DR_DEVICE_IOCOMPLETION.IOStatus MUST be set to 0 (STATUS_SUCCESS) and DR_DEVICE_IOCOMPLETION.Parameters.DeviceIOControl.OutputBuffer MUST contain an encoding of the structure (as specified in the preceding Message Processing Events and Sequencing Rules IOCTL Table) as specified in [MS-RPCE] section 2.2.6. DR_DEVICE_IOCOMPLETION.Parameters.DeviceIOControl.OutputBufferLength is the length of the data.

  7. The return packet is then sent according to Remote Desktop Protocol: File System Virtual Channel Extension.