November 2007
Intermediate to advanced
848 pages
27h 15m
English
This section discusses the Windows functions that allow you to perform synchronous device I/O. Keep in mind that a device can be a file, mailslot, pipe, socket, and so on. No matter which device is used, the I/O is performed using the same functions.
Without a doubt, the easiest and most commonly used functions for reading from and writing to devices are ReadFile and WriteFile:
BOOL ReadFile( HANDLE hFile, PVOID pvBuffer, DWORD nNumBytesToRead, PDWORD pdwNumBytes, OVERLAPPED* pOverlapped); BOOL WriteFile( HANDLE hFile, CONST VOID *pvBuffer, DWORD nNumBytesToWrite, PDWORD pdwNumBytes, OVERLAPPED* pOverlapped);
The hFile parameter identifies the handle of the device you want to access. When the device is opened, you ...
Read now
Unlock full access