Compartir a través de


XXX_Open (Device Manager) (Compact 2013)

3/26/2014

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.

Syntax

DWORD XXX_Open(
  DWORD hDeviceContext,
  DWORD AccessCode,
  DWORD ShareMode 
);

Parameters

  • 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 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 (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.

Requirements

Header

Developer Implemented

Library

Developer Implemented

See Also

Reference

Stream Interface Driver Functions
ActivateDeviceEx
XXX_Init (Device Manager)
XXX_IOControl (Device Manager)
XXX_Read (Device Manager)
XXX_Seek (Device Manager)
XXX_Write (Device Manager)

Other Resources

CreateFile