Syntax
Parameters
remoteDeviceType: const char* The UTF-8 device name or IP address to contact. Resolve any saved default before calling this function.
remoteFolderPathType: const char* Optional UTF-8 directory path on the remote device. Null, empty, or
. selects the common root.
directoryOptionsType: const WdRemoteDirectoryOptions* Optional common-root, recursion, and metadata settings. Pass
nullptr for defaults.
searchOptionsType: const WdRemoteDirectorySearchOptions* Optional file and directory name/attribute filters. Pass
nullptr for no filtering.
callbackType: WdRemoteDirectoryCallback The required result or enumeration callback. See Remarks for continuation and lifetime rules.
contextType: void* Optional caller-owned context passed unchanged to the callback.
cancellationHandleType: WdCancellationHandle A cancellation handle created with
WdCreateCancellationHandle. Where optional, pass nullptr if cancellation isn’t needed.
Return value
Type: HRESULT ReturnsS_OK on success; otherwise returns a failure HRESULT. See Error codes.
Remarks
Entries are delivered in traversal-order batches, with UTF-8 paths relative toremoteFolderPath. The root itself isn’t reported; empty directories are reported. Copy entry data before the callback returns if it is needed later. A failed callback result stops processing and is returned as a failure.
The call is synchronous. A null, empty, or . remote path selects the default or named common root. Absolute paths ignore the root alias. ${remoteEnv:NAME} references use the endpoint process environment. With null options, recursion is disabled and metadata isn’t requested.
Use WdCancelRemoteDirectoryEnumeration from another thread to request cancellation. Keep the handle open until enumeration returns. Cancellation before work starts returns S_OK; after work starts, successful cancellation waits for endpoint acknowledgement. Entries already received form a partial listing. An endpoint without the required directory protocol returns WD_E_SERVERTOOOLD.
