Lucent Technologies USS-720 Computer Drive User Manual


 
Preliminary User Guide, Rev. 2 USS-720
February 1999 USB Device Driver
Lucent Technologies Inc. 7-5
13
3 I/O File Functions (continued)
3.2 ReadFile
The ReadFile I/O file function reads data from the Bulk In pipe and returns TRUE if the function is successful and
FALSE if it fails. Details regarding the syntax, parameters, return values, and error codes are listed below.
3.2.1 Syntax
BOOL
ReadFile(
HANDLE hDev,
LPVOID lpBuffer,
DWORD nNumberOfBytesToRead,
LPDWORD lpNumberOfBytesRead,
LPOVERLAPPED lpOverlapped
);
3.2.2 Parameters
Input:
hDev—Handle returned from a successful CreateFile.
nNumberOfBytesToRead—Specifies the number of bytes to read from the device.
lpOverlapped—Pointer to an OVERLAPPED structure. This is an optional parameter that can be “NULL” if overlap-
ping I/O is not required.
Output:
lpBuffer—Pointer to the buffer to receive data from the Bulk In pipe of the device. This buffer is assumed to be in
locked system memory allocated from the nonpaged pool.
lpNumberOfBytesRead—Pointer to the number of bytes that were read.
3.2.3 Return Values
If the function succeeds, the return value is TRUE (1).
If the function fails, the return value is FALSE (0). To get extended error information, call GetLastError.
3.2.4 Notes
See the
Win32 SDK
documentation for complete definitions.
3.2.5 Error Codes
ERROR_DEVICE_REMOVE—The device instance has been removed.
ERROR_DEVICE_STOP—The device instance has been stopped.
ERROR_INVALID_ALTERNATESETTING—The current alternate interface setting for this device instance does not
support the Bulk In pipe.
ERROR_PIPE_ALREADY_OPEN—The Bulk In pipe for this device instance is already open.
STATUS_INVALID_HANDLE—The Bulk In pipe handle is invalid for this device instance.
STATUS_INVALID_PARAMETER—The pipe type is invalid for this device instance.
STATUS_INSUFFICIENT_RESOURCES—Not enough memory to allocate a request to read Bulk In on this device
instance.