Compartilhar via


XXX_Init (Device Manager) (Windows CE 5.0)

Send Feedback

This function initializes a device.

DWORDXXX_Init(LPCTSTR pContext,DWORD dwBusContext);

Parameters

  • pContext
    [in] Pointer to a string containing the registry path to the active key for the stream interface driver.
  • lpvBusContext
    [in] Potentially process-mapped pointer passed as the fourth parameter to ActivateDeviceEx. If this driver was loaded through legacy mechanisms, then dwBusContext is zero. This pointer, if used, has only been mapped again as it passes through the protected server library (PSL). The XXX_Init function is responsible for performing all protection checking. In addition, any pointers referenced through dwBusContext must be remapped with the MapCallerPtr function before they can be dereferenced.

Return Values

Returns a handle to the device context created if successful. Returns zero if not successful. This handle is passed to the XXX_Open (Device Manager), XXX_PowerDown (Device Manager), XXX_PowerUp (Device Manager), and XXX_Deinit (Device Manager) functions.

Remarks

Device Manager calls this function as a result of a call to the ActivateDeviceEx function. When the user starts using a device, such as inserting a PC Card, Device Manager calls this function to initialize the device. Applications do not call this function.

If your steam interface supports multiple instances of the same type of device file name, you only need to expect one call to the XXX_Init function for each instance of the device file name. The XXX_Init function returns a separate handle each time it executes. An example is the sample serial port driver, located in %_WINCEROOT%\Public\Common\Oak\Drivers\Serial. It supports multiple COMx: device file names. Stream interfaces that only support one instance of a device file name can return any non-zero value.

Device Manager specifies a pointer to a string containing the registry path to the active key of the specific PC Card device in the pContext parameter. Usually, the string contains the registry path to a numbered subkey of the HKEY_LOCAL_MACHINE\Drivers\Active registry key. Your initialization function uses this information to access data stored in the registry.

The following list shows the tasks this function can perform:

  • Initialize the installed device to a default state.

  • Allocate resources used globally by the device driver.

  • Register a status callback function with PC Card Services.

    When the status of the device changes, the operating system calls this status callback function. For example, the status of a PC Card changes when you insert it or remove it.

  • Map system memory and I/O space to a PC Card device memory and I/O space.

  • Request notification on specific callback events.

  • Register an interrupt callback function for an interrupt-driven device.

    When the device generates an interrupt, the operating system calls this interrupt callback function.

Device Manager uses the XXX prefix. When implementing the stream interface, replace XXX with a prefix appropriate for your specific implementation or use undecorated entry point names in conjunction with DEVFLAGS_NAKEDENTRIES. For more information about other valid Flags values, see ActivateDeviceEx.

Requirements

OS Versions: Windows CE 1.0 and later.
Header: Developer implemented.
Link Library: Developer implemented.

See Also

Device File Names | ActivateDeviceEx | XXX_Deinit (Device Manager) | XXX_IOControl (Device Manager) | XXX_Open (Device Manager) | XXX_PowerDown (Device Manager) | XXX_PowerUp (Device Manager)

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.