Microsoft KB Archive/229673

{|
 * width="100%"|

INFO: Non-Buffered File I/O on Windows 2000

 * }

Q229673

-

The information in this article applies to:


 * Microsoft Win32 Application Programming Interface (API), included with:
 * the operating system: Microsoft Windows 2000

-

SUMMARY
Applications that supply their own buffer for file input and output must align the buffer with device sector boundaries in memory. All Windows 2000 devices require sector alignment; some previous versions of Windows allow the underlying device to determine the requirements for buffer alignment, which may or may not be along sector boundaries.

Most sectors are 512 bytes in size, but your application can determine a volume's sector size by calling the GetDiskFreeSpace API function. One way to align buffers on integer multiples of the volume sector size is to use VirtualAlloc to allocate the buffer.

File access must begin at byte offsets within the file that are integer multiples of the volume's sector size, and must be for numbers of bytes that are integer multiples of the volume's sector size.