Lucent Technologies USS-720 manual 3 I/O File Functions continued, CreateFile, USB Device Driver

Models: USS-720

1 96
Download 96 pages 16.83 Kb
Page 62
Image 62

USS-720

Preliminary User Guide, Rev. 2

USB Device Driver

February 1999

 

 

3 I/O File Functions (continued)

3.1 CreateFile

The CreateFile I/O file function opens an instance of a particular device and returns an open handle to the device instance. Details regarding the syntax, parameters, return values, and error codes are listed below.

3.1.1 Syntax

 

HANDLE

 

CreateFile(

 

LPCTSTR

lpDevName,

DWORD

dwDesiredAccess,

DWORD

dwShareMode,

LPSECURITY_ATTRIBUTES

lpSecurityAttributes,

DWORD

dwCreationDistribution,

DWORD

dwFlagsAndAttributes,

HANDLE

hTemplateFile

);

 

3.1.2 Parameters

Input:

lpDevName—Points to a null-terminated string that specifies the symbolic link name of a specific device instance to open (see Section 4.12 IOCTL_GET_DEVICE_INSTANCES). Note that the symbolic link must be prefixed with “\\.\”. For example, to retrieve the handle of the symbolic name LPTUSB1, “\\.\LPTUSB1” must be passed to the lpDevName parameter.

Note: For definitions of other input parameters, refer to CreateFile Function in the WIN32 SDK documentation.

Output:

None.

3.1.3 Return Values

If the function succeeds, the return value is an open handle to the device instance.

If the function fails, the return value is INVALID_HANDLE_VALUE. To get extended error information, call GetLastError.

3.1.4 Notes

See the Win32 SDK documentation for complete definitions of parameters.

3.1.5 Error Code

ERROR_ALREADY_OPENED—Device instance is already open.

7-4

Lucent Technologies Inc.

Page 62
Image 62
Lucent Technologies USS-720 3 I/O File Functions continued, CreateFile, Preliminary User Guide, Rev, USB Device Driver