[This is preliminary documentation and subject to change.]
The WriteFileVlm function writes data to a file. WriteFileVlm is designed solely for asynchronous operation.
BOOL WriteFileVlm(
HANDLE hFile, // handle to output file
PVOID64 lpBuffer, // pointer to input buffer
DWORD nNumberOfBytesToWrite, // number of bytes to write
LPDWORD lpReserved, // reserved, must be NULL
LPOVERLAPPED lpOverlapped // pointer to async. i/o data
);
The buffer pointed to by the lpBuffer parameter must remain valid for the duration of the write operation. The calling process must not use this buffer until the write operation is completed.
For files that support byte offsets, you must specify a byte offset at which to start writing to the file. You specify this offset by setting the Offset and OffsetHigh members of the OVERLAPPED structure. For files that do not support byte offsets, Offset and OffsetHigh are ignored.
WriteFileVlm uses the Internal and InternalHigh members of the OVERLAPPED structure. A process should not change the value of these members.
The OVERLAPPED data structure must remain valid for the duration of the write operation. The structure should not be a variable that can go out of scope while the write operation is pending completion.
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
If part of the output file is locked by another process and the specified operation writes to the locked portion, WriteFileVlm fails.
Accessing the output buffer while a write operation is using the buffer may lead to corruption of the data written from that buffer. Applications must not read from, write to, reallocate, or free the output buffer that a write operation is using until the write operation completes.
WriteFileVlm can fail returning the messages ERROR_INVALID_USER_BUFFER or ERROR_NOT_ENOUGH_MEMORY if there are too many outstanding asynchronous I/O requests.
To cancel all pending asynchronous I/O operations, use the CancelIo function. CancelIo only cancels operations issued by the calling thread for the specified file handle. I/O operations that are canceled complete with the error code ERROR_OPERATION_ABORTED.
If your application attempts to write to a floppy drive that does not have a floppy disk, the operating system displays a message prompting the user to retry the operation. To prevent the system from displaying this message, call the SetErrorMode function with the SEM_NOOPENFILEERRORBOX flag set for the uMode parameter.
Note To guard against an access violation, use structured exception handling to protect any code that writes to or reads from a memory-mapped view. For more information on structured exception handling, see Reading and Writing.
Windows NT: Requires version 5.0 or later.
Windows: Unsupported.
Windows CE: Unsupported.
Header: Declared in winbase.h.
Import Library: Use kernel32.lib.
Memory Management Overview, Memory Management Functions, Very Large Memory (VLM), CancelIo, CreateFile, FileIOCompletionRoutine, GetOverlappedResult, GetQueuedCompletionStatus, HasOverlappedIoCompleted, MsgWaitForMultipleObjectsEx, OVERLAPPED, ReadFileVlm, SetEndOfFile, SetErrorMode, SleepEx, SignalObjectAndWait, WaitForMultipleObjectsEx, WaitForSingleObjectEx, WriteFileEx