xxx_Open

The xxx_Open function opens a device for reading and/or writing. An application indirectly invokes this function when it calls CreateFile to open special Device Filenames.

Syntax

DWORD xxx_Open( DWORD hDeviceContext DWORD AccessCode DWORD ShareMode );

Parameters

hDeviceContext
Specifies a handle identifying the device context. The xxx_Init function creates and returns this handle.
AccessCode
Specifies the requested access code of the device. The access is a combination of read and write.
ShareMode
Specifies the requested file share mode of the PC Card device. The share mode is a combination of file read and write sharing.

Return Value

This function returns a handle that identifies the open context of the device to the calling application. If your device can be opened multiple times, use this handle to identify each open context. This identifier is passed into the xxx_Read, xxx_Write, xxx_Seek, and xxx_IOControl functions. If the device cannot be opened, the function returns NULL.

Remarks

When this function is called, your device should allocate resources it needs for each open context and prepare for operation. This might involve preparing the device for reading or writing, and initializing data structures it uses for operation.