CreateFile

Description:
Opens an ARCNET device. The function returns a handle that is used to access the device

Syntax:

HANDLE WINAPI CreateFile( __in LPCTSTR lpFileName, __in DWORD dwDesiredAccess, __in DWORD dwShareMode, __in_opt LPSECURITY_ATTRIBUTES lpSecurityAttributes, __in DWORD dwCreationDisposition, __in DWORD dwFlagsAndAttributes, __in_opt HANDLE hTemplateFile );

Parameters:

Parameter Description
lpFileName The name of ARCNET network controller to be opened. This name is build from prefix "\\.\" and device name that is specified under RAW driver properties as "AccessName".
Note: For SH ARCALYZER-PCMCIA this name is fixed to "SHARCALY"
dwDesiredAccess The requested access to the file or device, which can be summarized as read, write, both or neither zero).
dwShareMode The requested sharing mode of the file or device, which can be read, write, both or none (see MSDN Library) for more details.

Possible values:
  • 0 (0x00000000) - exclusive access, i.e. prevents other processes from opening
  • FILE_SHARE_READ(0x00000001) - allows subsequent open operations on a device to request read access.
  • FILE_SHARE_WRITE(0x00000002) - allows subsequent open operations on a device to request write access.
lpSecurityAttributes A pointer to a SECURITY_ATTRIBUTES structure that contains two separate but related data members: an optional security descriptor, and a Boolean value that determines whether the returned handle can be inherited by child processes.

This parameter can be NULL.
dwCreationDisposition An action to take on the device that exists or does not exist.
This value must be set to OPEN_EXISTING (3)
dwFlagsAndAttributes The device attributes and flags.
Possible values:
  • FILE_ATTRIBUTE_NORMAL(0x80) - synchron access to device
  • FILE_ATTRIBUTE_NORMAL|FILE_FLAG_OVERLAPPED(0x40000080) - asynchron access to device
Please read comparison "Asynchon vs. Synchron" for more details
hTemplateFile A valid handle to a template file with the GENERIC_READ access right. The template file supplies file attributes and extended attributes for the file that is being created.
This parameter must be to NULL

Return Value:
If the function succeeds, the return value is an open handle to the specified file, device, named pipe, or mail slot.
If the function fails, the return value is INVALID_HANDLE_VALUE. To get extended error information, call GetLastError.

Possible errors (see also Error codes ):
E_FARC_DRIVER_NOT_STARTED

Example:
Opening device with access name "FARC" in asynchron mode. Note, that the following example is only a fragment.

... CreateFile( "\\\\.\\FARC", // handlename of the driver GENERIC_READ | GENERIC_WRITE, // Access 0, // ShareMode NULL, // Security_Attributes OPEN_EXISTING, // dwCreationDisposition FILE_ATTRIBUTE_NORMAL|FILE_FLAG_OVERLAPPED, // dwFlagsAndAttributes NULL // hTemplateFile ); ...
Back to Programming Guide Contact Copyright and Disclaimer