beautypg.com

3 writefile, 1 syntax, 2 parameters – Lucent Technologies USS-720 User Manual

Page 64: 3 return values, 4 notes, 5 error codes, 3 i/o file functions

background image

7-6

Lucent Technologies Inc.

USS-720

Preliminary User Guide, Rev. 2

USB Device Driver

February 1999

13

3 I/O File Functions

(continued)

3.3 WriteFile

The WriteFile I/O file function writes data to the Bulk Out 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.3.1 Syntax

BOOL
WriteFile(

HANDLE

hDev,

LPVOID

lpBuffer,

DWORD

nNumberOfBytesToWrite,

LPDWORD

lpNumberOfBytesWritten,

LPOVERLAPPED

lpOverlapped

);

3.3.2 Parameters

Input:
hDev—Handle returned from a successful CreateFile.

nNumberOfBytesToWrite—Specifies the number of bytes to be written.

lpOverlapped—Pointer to OVERLAPPED structure. This is an optional parameter that can be “NULL” if overlapping
I/O is not required.

Output:
lpBuffer—Pointer to the buffer containing the data to be written to the Bulk Out pipe of the device. This buffer is
assumed to be in locked system memory allocated from the nonpaged pool.

lpNumberOfBytesWritten—Pointer to the number of bytes written.

3.3.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.3.4 Notes

See the

Win32 SDK documentation for complete definitions.

3.3.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 Out pipe.

ERROR_PIPE_ALREADY_OPEN—The Bulk Out pipe for this device instance is already open.

STATUS_INVALID_HANDLE—The Bulk Out pipe handle is invalid for this device instance.

STATUS_INVALID_PARAMETER—The pipe type is invalid for this device instance.

STATUS_INSUFFICIENT_RESOURCES—This is an internal error resulting from insufficient memory available to
perform a required USB request.