Export (0) Print
Expand All

IOCTL_LMR_DISABLE_LOCAL_BUFFERING control code

The IOCTL_LMR_DISABLE_LOCAL_BUFFERING control code disables local client-side in-memory caching of data when reading data from or writing data to a remote file. This is an internally-defined control code not available in a public header.

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


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

Parameters

hDevice [in]

A handle to the remote file. To obtain this handle, call the CreateFile function.

dwIoControlCode [in]

The control code for the operation. Use the value 0x140390 for this operation.

lpInBuffer

Not used, must be NULL.

nInBufferSize [in]

The size of the input buffer, in bytes. Must be zero.

lpOutBuffer [out]

Not used, must be NULL.

nOutBufferSize [in]

The size of the output buffer, in bytes. Must be zero.

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, then 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

The IOCTL_LMR_DISABLE_LOCAL_BUFFERING control code is defined internally by the system as 0x140390 and not in a public header file. It is used by special-purpose applications to disable local client-side in-memory caching of data when reading data from or writing data to a remote file. After local buffering is disabled, the setting remains in effect until all open handles to the file are closed and the redirector cleans up its internal data structures.

General-purpose applications should not use IOCTL_LMR_DISABLE_LOCAL_BUFFERING, because it can result in excessive network traffic and associated loss of performance. The IOCTL_LMR_DISABLE_LOCAL_BUFFERING control code should be used only in specialized applications moving large amounts of data over the network while attempting to maximize use of network bandwidth. For example, the CopyFile and CopyFileEx functions use IOCTL_LMR_DISABLE_LOCAL_BUFFERING to improve large file copy performance.

IOCTL_LMR_DISABLE_LOCAL_BUFFERING is not implemented by local file systems and will fail with the error ERROR_INVALID_FUNCTION. Issuing the IOCTL_LMR_DISABLE_LOCAL_BUFFERING control code on remote directory handles will fail with the error ERROR_NOT_SUPPORTED.

See also

DeviceIoControl

 

 

Community Additions

ADD
Show:
© 2014 Microsoft