FSCTL_SRV_REQUEST_RESUME_KEY control code

The FSCTL_SRV_REQUEST_RESUME_KEY control code is used to retrieve an opaque file reference for use with the IOCTL_COPYCHUNK control code.

To perform this operation, call the DeviceIoControl function with the following parameters.

BOOL DeviceIoControl(
  (HANDLE) hDevice,             // handle to device
  FSCTL_SRV_REQUEST_RESUME_KEY, // dwIoControlCode
  NULL,                         // lpInBuffer
  0,                            // nInBufferSize
  (LPVOID) lpOutBuffer,         // output buffer
  (DWORD) nOutBufferSize,       // size of output buffer
  (LPDWORD) lpBytesReturned,    // number of bytes returned
  (LPOVERLAPPED) lpOverlapped   // OVERLAPPED structure
);

Parameters

hDevice [in]

A handle to the file for which the source file key is to be requested. To obtain this handle, call the CreateFile function.

dwIoControlCode [in]

The control code for the operation. Use FSCTL_SRV_REQUEST_RESUME_KEY for this operation.

lpInBuffer

Not used with this operation; set to NULL.

nInBufferSize [in]

Not used with this operation; set to zero.

lpOutBuffer [out]

A pointer to the output buffer, a SRV_REQUEST_RESUME_KEY structure. For more information, see the Remarks section.

nOutBufferSize [in]

The size of the output buffer, in bytes.

lpBytesReturned [out]

A pointer to a variable that receives the size of the data stored in the output buffer, in bytes.

If the output buffer is too small, the call fails, the GetLastError function returns ERROR_INSUFFICIENT_BUFFER, and lpBytesReturned is zero.

If the lpOverlapped parameter is NULL, lpBytesReturned cannot be NULL. Even when an operation returns no output data and the lpOutBuffer parameter is NULL, DeviceIoControl makes use of lpBytesReturned. After such an operation, the value of lpBytesReturned is meaningless.

If lpOverlapped is not NULL, lpBytesReturned can be NULL. If lpOverlapped is not NULL and the operation returns data, lpBytesReturned is meaningless until the overlapped operation has completed. To retrieve the number of bytes returned, call the GetOverlappedResult function. If the hDevice parameter is associated with an I/O completion port, you can retrieve the number of bytes returned by calling the GetQueuedCompletionStatus function.

lpOverlapped [in]

A pointer to an OVERLAPPED structure.

If the hDevice parameter was opened without specifying FILE_FLAG_OVERLAPPED, lpOverlapped is ignored.

If hDevice was opened with the FILE_FLAG_OVERLAPPED flag, the operation is performed as an overlapped (asynchronous) operation. In this case, lpOverlapped must point to a valid OVERLAPPED structure that contains a handle to an event object. Otherwise, the function fails in unpredictable ways.

For overlapped operations, DeviceIoControl returns immediately, and the event object is signaled when the operation has been completed. Otherwise, the function does not return until the operation has been completed or until an error occurs.

Return value

If the operation completes successfully, DeviceIoControl returns a nonzero value.

If the operation fails or is pending, DeviceIoControl returns zero. To get extended error information, call GetLastError.

Remarks

This control code has no associated header file. You must define the control code and data structures as follows.

#define FSCTL_SRV_REQUEST_RESUME_KEY CTL_CODE(FILE_DEVICE_NETWORK_FILE_SYSTEM, 30, METHOD_BUFFERED, FILE_ANY_ACCESS)

typedef struct _SRV_RESUME_KEY {
    UINT64 ResumeKey;
    UINT64 Timestamp;
    UINT64 Pid;
} SRV_RESUME_KEY, *PSRV_RESUME_KEY;

typedef struct _SRV_REQUEST_RESUME_KEY {
    SRV_RESUME_KEY Key;
    ULONG  ContextLength;
    BYTE   Context[1];
} SRV_REQUEST_RESUME_KEY, *PSRV_REQUEST_RESUME_KEY;

These members can be described as follows.

Member Description
ResumeKey
An opaque value that identifies the source file to the server.
Timestamp
An opaque value that identifies the time when the file was opened.
Pid
An opaque value that identifies the process that opened the file.
Key
A SRV_RESUME_KEY structure. To perform a server-side copy operation, use this structure with the IOCTL_COPYCHUNK control code.
ContextLength
This member is reserved for system use; do not use.
Context
This member is reserved for system use; do not use.

 

See also

DeviceIoControl

IOCTL_COPYCHUNK