23 #ifndef FREERDP_CHANNEL_RDPDR_H
24 #define FREERDP_CHANNEL_RDPDR_H
28 #include <winpr/crt.h>
29 #include <winpr/file.h>
30 #include <winpr/synch.h>
31 #include <winpr/thread.h>
32 #include <winpr/stream.h>
33 #include <winpr/interlocked.h>
34 #include <winpr/collections.h>
36 #include <freerdp/api.h>
37 #include <freerdp/types.h>
38 #include <freerdp/settings.h>
49 #define RDPDR_CHANNEL_NAME "rdpdr"
50 #define RDPDR_SVC_CHANNEL_NAME "rdpdr"
52 #define RDPDR_DEVICE_IO_REQUEST_LENGTH 24
53 #define RDPDR_DEVICE_IO_RESPONSE_LENGTH 16
55 #define RDPDR_DEVICE_IO_CONTROL_REQ_HDR_LENGTH 32
56 #define RDPDR_DEVICE_IO_CONTROL_RSP_HDR_LENGTH 4
58 #define RDPDR_VERSION_MAJOR 0x0001
60 #define RDPDR_VERSION_MINOR_RDP50 0x0002
61 #define RDPDR_VERSION_MINOR_RDP51 0x0005
62 #define RDPDR_VERSION_MINOR_RDP52 0x000A
63 #define RDPDR_VERSION_MINOR_RDP6X 0x000C
64 #define RDPDR_VERSION_MINOR_RDP10X 0x000D
69 RDPDR_CTYP_CORE = 0x4472,
70 RDPDR_CTYP_PRN = 0x5052
76 PAKID_CORE_SERVER_ANNOUNCE = 0x496E,
77 PAKID_CORE_CLIENTID_CONFIRM = 0x4343,
78 PAKID_CORE_CLIENT_NAME = 0x434E,
79 PAKID_CORE_DEVICELIST_ANNOUNCE = 0x4441,
80 PAKID_CORE_DEVICE_REPLY = 0x6472,
81 PAKID_CORE_DEVICE_IOREQUEST = 0x4952,
82 PAKID_CORE_DEVICE_IOCOMPLETION = 0x4943,
83 PAKID_CORE_SERVER_CAPABILITY = 0x5350,
84 PAKID_CORE_CLIENT_CAPABILITY = 0x4350,
85 PAKID_CORE_DEVICELIST_REMOVE = 0x444D,
86 PAKID_CORE_USER_LOGGEDON = 0x554C,
87 PAKID_PRN_CACHE_DATA = 0x5043,
88 PAKID_PRN_USING_XPS = 0x5543
94 CAP_GENERAL_TYPE = 0x0001,
95 CAP_PRINTER_TYPE = 0x0002,
96 CAP_PORT_TYPE = 0x0003,
97 CAP_DRIVE_TYPE = 0x0004,
98 CAP_SMARTCARD_TYPE = 0x0005
102 enum RDPDR_CAP_VERSION
104 GENERAL_CAPABILITY_VERSION_01 = 0x00000001,
105 GENERAL_CAPABILITY_VERSION_02 = 0x00000002,
106 PRINT_CAPABILITY_VERSION_01 = 0x00000001,
107 PORT_CAPABILITY_VERSION_01 = 0x00000001,
108 DRIVE_CAPABILITY_VERSION_01 = 0x00000001,
109 DRIVE_CAPABILITY_VERSION_02 = 0x00000002,
110 SMARTCARD_CAPABILITY_VERSION_01 = 0x00000001
116 IRP_MJ_CREATE = 0x00000000,
117 IRP_MJ_CLOSE = 0x00000002,
118 IRP_MJ_READ = 0x00000003,
119 IRP_MJ_WRITE = 0x00000004,
120 IRP_MJ_DEVICE_CONTROL = 0x0000000E,
121 IRP_MJ_QUERY_VOLUME_INFORMATION = 0x0000000A,
122 IRP_MJ_SET_VOLUME_INFORMATION = 0x0000000B,
123 IRP_MJ_QUERY_INFORMATION = 0x00000005,
124 IRP_MJ_SET_INFORMATION = 0x00000006,
125 IRP_MJ_DIRECTORY_CONTROL = 0x0000000C,
126 IRP_MJ_LOCK_CONTROL = 0x00000011
132 IRP_MN_QUERY_DIRECTORY = 0x00000001,
133 IRP_MN_NOTIFY_CHANGE_DIRECTORY = 0x00000002
147 #define RDPDR_MAJOR_RDP_VERSION 1
148 enum RDPDR_MINOR_RDP_VERSION
150 RDPDR_MINOR_RDP_VERSION_5_0 = 0x0002,
151 RDPDR_MINOR_RDP_VERSION_5_1 = 0x0005,
152 RDPDR_MINOR_RDP_VERSION_5_2 = 0x000A,
153 RDPDR_MINOR_RDP_VERSION_6_X = 0x000C,
154 RDPDR_MINOR_RDP_VERSION_13 = 0x000D
158 enum RDPDR_CLIENT_NAME_FLAG
160 RDPDR_CLIENT_NAME_UNICODE = 0x00000001,
161 RDPDR_CLIENT_NAME_ASCII = 0x00000000
165 enum RDPDR_CAPS_IRP_MJ
167 RDPDR_IRP_MJ_CREATE = 0x00000001,
168 RDPDR_IRP_MJ_CLEANUP = 0x00000002,
169 RDPDR_IRP_MJ_CLOSE = 0x00000004,
170 RDPDR_IRP_MJ_READ = 0x00000008,
171 RDPDR_IRP_MJ_WRITE = 0x00000010,
172 RDPDR_IRP_MJ_FLUSH_BUFFERS = 0x00000020,
173 RDPDR_IRP_MJ_SHUTDOWN = 0x00000040,
174 RDPDR_IRP_MJ_DEVICE_CONTROL = 0x00000080,
175 RDPDR_IRP_MJ_QUERY_VOLUME_INFORMATION = 0x00000100,
176 RDPDR_IRP_MJ_SET_VOLUME_INFORMATION = 0x00000200,
177 RDPDR_IRP_MJ_QUERY_INFORMATION = 0x00000400,
178 RDPDR_IRP_MJ_SET_INFORMATION = 0x00000800,
179 RDPDR_IRP_MJ_DIRECTORY_CONTROL = 0x00001000,
180 RDPDR_IRP_MJ_LOCK_CONTROL = 0x00002000,
181 RDPDR_IRP_MJ_QUERY_SECURITY = 0x00004000,
182 RDPDR_IRP_MJ_SET_SECURITY = 0x00008000
188 RDPDR_DEVICE_REMOVE_PDUS = 0x00000001,
189 RDPDR_CLIENT_DISPLAY_NAME_PDU = 0x00000002,
190 RDPDR_USER_LOGGEDON_PDU = 0x00000004
196 ENABLE_ASYNCIO = 0x00000001
202 RDP_LOWIO_OP_SHAREDLOCK = 0x00000002,
203 RDP_LOWIO_OP_EXCLUSIVELOCK = 0x00000003,
204 RDP_LOWIO_OP_UNLOCK = 0x00000004,
205 RDP_LOWIO_OP_UNLOCK_MULTIPLE = 0x00000005
208 enum RDPDR_PRINTER_ANNOUNCE_FLAG
210 RDPDR_PRINTER_ANNOUNCE_FLAG_ASCII = 0x00000001,
211 RDPDR_PRINTER_ANNOUNCE_FLAG_DEFAULTPRINTER = 0x00000002,
212 RDPDR_PRINTER_ANNOUNCE_FLAG_NETWORKPRINTER = 0x00000004,
213 RDPDR_PRINTER_ANNOUNCE_FLAG_TSPRINTER = 0x00000008,
214 RDPDR_PRINTER_ANNOUNCE_FLAG_XPSFORMAT = 0x00000010
223 #if !defined(_WIN32) || (defined(_WIN32) && (_WIN32_WINNT < 0x0600))
224 #define FSCTL_LMR_SET_LINK_TRACKING_INFORMATION 0x1400ec
225 #define FSCTL_PIPE_PEEK 0x11400c
226 #define FSCTL_PIPE_TRANSCEIVE 0x11c017
227 #define FSCTL_PIPE_WAIT 0x110018
228 #define FSCTL_QUERY_ON_DISK_VOLUME_INFO 0x9013c
229 #define FSCTL_QUERY_SPARING_INFO 0x90138
233 #define FSCTL_CREATE_OR_GET_OBJECT_ID 0x900c0
234 #define FSCTL_GET_REPARSE_POINT 0x900a8
235 #define FSCTL_GET_RETRIEVAL_POINTERS 0x90073
236 #define FSCTL_IS_PATHNAME_VALID 0x9002c
237 #define FSCTL_READ_FILE_USN_DATA 0x900eb
238 #define FSCTL_RECALL_FILE 0x90117
239 #define FSCTL_QUERY_FAT_BPB 0x90058
240 #define FSCTL_QUERY_ALLOCATED_RANGES 0x940cf
241 #define FSCTL_SET_COMPRESSION 0x9c040
242 #define FSCTL_SET_ENCRYPTION 0x900D7
243 #define FSCTL_SET_OBJECT_ID 0x90098
244 #define FSCTL_SET_OBJECT_ID_EXTENDED 0x900bc
245 #define FSCTL_SET_REPARSE_POINT 0x900a4
246 #define FSCTL_SET_SPARSE 0x900c4
247 #define FSCTL_SET_ZERO_DATA 0x980c8
248 #define FSCTL_SIS_COPYFILE 0x90100
249 #define FSCTL_WRITE_USN_CLOSE_RECORD 0x900ef
252 #if !defined(_WIN32) || (defined(_WIN32) && (_WIN32_WINNT < 0x0600))
253 #define FSCTL_SET_DEFECT_MANAGEMENT 0x98134
254 #define FSCTL_SET_ZERO_ON_DEALLOCATION 0x90194
261 #define FILE_SUPPORTS_USN_JOURNAL 0x02000000
262 #define FILE_SUPPORTS_OPEN_BY_FILE_ID 0x01000000
263 #define FILE_SUPPORTS_EXTENDED_ATTRIBUTES 0x00800000
264 #define FILE_SUPPORTS_HARD_LINKS 0x00400000
265 #define FILE_SUPPORTS_TRANSACTIONS 0x00200000
266 #define FILE_SEQUENTIAL_WRITE_ONCE 0x00100000
267 #define FILE_READ_ONLY_VOLUME 0x00080000
268 #define FILE_NAMED_STREAMS 0x00040000
269 #define FILE_SUPPORTS_ENCRYPTION 0x00020000
270 #define FILE_SUPPORTS_OBJECT_IDS 0x00010000
271 #define FILE_VOLUME_IS_COMPRESSED 0x00008000
272 #define FILE_SUPPORTS_REMOTE_STORAGE 0x00000100
273 #define FILE_SUPPORTS_REPARSE_POINTS 0x00000080
274 #define FILE_SUPPORTS_SPARSE_FILES 0x00000040
275 #define FILE_VOLUME_QUOTAS 0x00000020
276 #define FILE_FILE_COMPRESSION 0x00000010
277 #define FILE_PERSISTENT_ACLS 0x00000008
278 #define FILE_UNICODE_ON_DISK 0x00000004
279 #define FILE_CASE_PRESERVED_NAMES 0x00000002
280 #define FILE_CASE_SENSITIVE_SEARCH 0x00000001
286 #ifndef FILE_DEVICE_CD_ROM
287 #define FILE_DEVICE_CD_ROM 0x00000002
290 #ifndef FILE_DEVICE_DISK
291 #define FILE_DEVICE_DISK 0x00000007
295 enum FILE_FS_DEVICE_FLAG
297 FILE_REMOVABLE_MEDIA = 0x00000001,
298 FILE_READ_ONLY_DEVICE = 0x00000002,
299 FILE_FLOPPY_DISKETTE = 0x00000004,
300 FILE_WRITE_ONCE_MEDIA = 0x00000008,
301 FILE_REMOTE_DEVICE = 0x00000010,
302 FILE_DEVICE_IS_MOUNTED = 0x00000020,
303 FILE_VIRTUAL_VOLUME = 0x00000040,
304 FILE_DEVICE_SECURE_OPEN = 0x00000100
308 enum FILE_FS_INFORMATION_CLASS
310 FileFsVolumeInformation = 1,
311 FileFsLabelInformation,
312 FileFsSizeInformation,
313 FileFsDeviceInformation,
314 FileFsAttributeInformation,
315 FileFsControlInformation,
316 FileFsFullSizeInformation,
317 FileFsObjectIdInformation,
318 FileFsDriverPathInformation,
319 FileFsMaximumInformation
324 typedef struct S_IRP IRP;
327 typedef UINT (*pcCustomComponentRequest)(DEVICE* device, UINT16 component, UINT16 packetId,
329 typedef UINT (*pcIRPRequest)(DEVICE* device, IRP* irp);
330 typedef UINT (*pcInitDevice)(DEVICE* device);
331 typedef UINT (*pcFreeDevice)(DEVICE* device);
341 pcCustomComponentRequest CustomComponentRequest;
342 pcIRPRequest IRPRequest;
347 typedef UINT (*pcIRPResponse)(IRP* irp);
351 WINPR_SLIST_ENTRY ItemEntry;
357 UINT32 MajorFunction;
358 UINT32 MinorFunction;
364 pcIRPResponse Complete;
365 pcIRPResponse Discard;
375 wListDictionary* devices;
378 typedef UINT (*pcRegisterDevice)(DEVMAN* devman, DEVICE* device);
384 pcRegisterDevice RegisterDevice;
386 rdpContext* rdpcontext;