xxx_Read

The xxx_Read function reads data from the device identified by the open context.

Syntax

DWORD xxx_Read( DWORD hOpenContext, LPVOID pBuffer,
DWORD Count );

Parameters

hOpenContext
Specifies a handle that identifies the open context of the device. The xxx_Open function creates and returns this identifier.
pBuffer
Points to the buffer which stores the data read from the device. This buffer should be at least Count bytes long.
Count
Specifies the number of bytes to read from the device into pBuffer.

Return Value

Returns 0 for the end-of-file, –1 for an error, or the number of bytes read for success.

Remarks

An application calls ReadFile to read from the device. The operating system, in turn, invokes xxx_Read. The hFile argument is a handle for your device. The pData argument points to the buffer that contains the data read from the device. The Size argument indicates the number of bytes the application wants to read from the device. The pSizeRead argument is the address of a value where xxx_Read can store the number of bytes actually read from the device. The value returned from xxx_Read is equal to the value contained in pSizeRead, unless xxx_Read returns -1 for an error. If xxx_Read returns an error, then pSizeRead will contain 0.