This function opens a device for reading, writing, or both. An application indirectly invokes this function when it calls the CreateFile function to open special device file names.
DWORD XXX_Open(
DWORD hDeviceContext,
DWORD AccessCode,
DWORD ShareMode
);
Parameters
hDeviceContext
[in] Handle to the device context. The XXX_Init (Device Manager) function creates and returns this handle.
AccessCode
[in] Access code for the device. The access is a combination of read and write access from CreateFile.
ShareMode
[in] File share mode of the device. The share mode is a combination of read and write access sharing from CreateFile.
Return Values
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 (Device Manager), XXX_Write (Device Manager), XXX_Seek (Device Manager), and XXX_IOControl (Device Manager) functions. This function returns zero if the device cannot be opened.
Remarks
When this function executes, your device should allocate the resources that 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.
Device Manager uses the XXX prefix. When implementing the stream interface, replace XXX with a prefix appropriate for your implementation or use undecorated entry point names in conjunction with DEVFLAGS_NAKEDENTRIES. For more information about other valid Flags values, see ActivateDeviceEx