rdpdr SVC). It exposes client-side file systems to the RDP server as virtual drives, and enables the server to perform file operations on them.
SVC channel name: rdpdr
Server header: <freerdp/server/rdpdr.h>Client header:
<freerdp/client/rdpdr.h>Protocol types:
<freerdp/channels/rdpdr.h>
Client-Side: Mounting Drives
Drives are exposed to the server from the client command line or via the clientRdpdrClientContext API.
Command-line options
RdpdrClientContext (since version 3.16.0)
typedef struct s_rdpdr_client_context RdpdrClientContext
Obtained via the channel manager after the rdpdr channel loads.
pcRdpdrRegisterDevice
RDPDR_DEVICE struct is copied internally. On success *pid receives a unique identifier for later use with RdpdrUnregisterDevice.pcRdpdrUnregisterDevice
pcRdpdrHotplugDevice
type is RDPDR_HOTPLUG_FIRST_CHECK on startup or RDPDR_HOTPLUG_CHECK_FOR_CHANGES on subsequent checks. Newly discovered devices are announced automatically.Server-Side: RdpdrServerContext
Lifecycle
Key fields
void*
Server-defined private context pointer.
UINT16
Bitmask of supported redirection types. Initially set to indicate what the server supports; updated after client capability exchange to reflect mutual support. Use
RDPDR_DTYP_* flags:Channel control
psRdpdrStart
supported.psRdpdrStop
Stops the worker and drains any pending messages.
Intercept callbacks
psRdpdrReceiveDeviceAnnounce
device->DeviceType to filter.psRdpdrReceiveDeviceRemove
psRdpdrOnDeviceCreate
RDPDR_DTYP_FILESYSTEM devices after ReceiveDeviceAnnounce. Use to record the deviceId for subsequent drive operations.psRdpdrOnDeviceDelete
Drive file operations
The server can perform file operations on redirected drives. Each function takes acallbackData pointer that is echoed back in the completion callback.
psRdpdrDriveOpenFile
desiredAccess and createDisposition use Win32 semantics (GENERIC_READ, OPEN_EXISTING, etc.).psRdpdrDriveReadFile
length bytes at offset from an open file. Result delivered via OnDriveReadFileComplete.psRdpdrDriveWriteFile
psRdpdrDriveCloseFile
psRdpdrDriveDeleteFile
psRdpdrDriveQueryDirectory
OnDriveQueryDirectoryComplete as FILE_DIRECTORY_INFORMATION structs.psRdpdrDriveRenameFile
Completion callbacks
All drive operations are asynchronous. Results arrive via correspondingOnDrive*Complete callbacks:
How the Virtual Filesystem Works
1
Client device announcement
On connection, the RDPDR client sends a
PAKID_CORE_DEVICELIST_ANNOUNCE PDU listing each redirected drive. Each entry carries a DeviceType of RDPDR_DTYP_FILESYSTEM, a DeviceId, and a display name.2
Server records devices
OnDriveCreate is called for each filesystem device. Store the deviceId to address subsequent operations.3
File I/O via IRP
The server issues I/O Request Packets (IRPs) by calling
DriveOpenFile, DriveReadFile, etc. Each IRP is forwarded to the client, which performs the actual file operation using its local OS.4
Completion
The client sends an IRP Response. The RDPDR layer parses it and calls the corresponding
OnDrive*Complete callback with status and result data.The
drive client channel plugin (channels/drive/client/) implements the client-side IRP handling using POSIX file I/O on Linux/macOS and Win32 APIs on Windows.