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.
RDPDR_DEVICE struct is copied internally. On success *pid receives a unique identifier for later use with RdpdrUnregisterDevice.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
Server-defined private context pointer.
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:| Flag | Meaning |
|---|---|
RDPDR_DTYP_SERIAL | Serial port |
RDPDR_DTYP_PARALLEL | Parallel port |
RDPDR_DTYP_PRINT | Printer |
RDPDR_DTYP_FILESYSTEM | Drive / filesystem |
RDPDR_DTYP_SMARTCARD | Smartcard |
Channel control
supported.Stops the worker and drains any pending messages.
Intercept callbacks
device->DeviceType to filter.RDPDR_DTYP_FILESYSTEM devices after ReceiveDeviceAnnounce. Use to record the deviceId for subsequent drive operations.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.
desiredAccess and createDisposition use Win32 semantics (GENERIC_READ, OPEN_EXISTING, etc.).length bytes at offset from an open file. Result delivered via OnDriveReadFileComplete.OnDriveQueryDirectoryComplete as FILE_DIRECTORY_INFORMATION structs.Completion callbacks
All drive operations are asynchronous. Results arrive via correspondingOnDrive*Complete callbacks:
| Operation | Completion callback | Extra result |
|---|---|---|
DriveOpenFile | OnDriveOpenFileComplete | fileId |
DriveReadFile | OnDriveReadFileComplete | buffer, length |
DriveWriteFile | OnDriveWriteFileComplete | bytesWritten |
DriveCloseFile | OnDriveCloseFileComplete | — |
DriveDeleteFile | OnDriveDeleteFileComplete | — |
DriveQueryDirectory | OnDriveQueryDirectoryComplete | FILE_DIRECTORY_INFORMATION* |
DriveCreateDirectory | OnDriveCreateDirectoryComplete | — |
DriveDeleteDirectory | OnDriveDeleteDirectoryComplete | — |
DriveRenameFile | OnDriveRenameFileComplete | — |
How the Virtual Filesystem Works
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.Server records devices
OnDriveCreate is called for each filesystem device. Store the deviceId to address subsequent operations.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.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.