beautypg.com

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

Page 62: 3 return values, 4 notes, 5 error code, 3 i/o file functions

background image

7-4

Lucent Technologies Inc.

USS-720

Preliminary User Guide, Rev. 2

USB Device Driver

February 1999

13

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.