RegisterDevice (Windows Embedded CE 6.0)

1/6/2010

This function registers a device.

Note

This function is obsolete as of Windows Embedded CE 6.0. Use ActivateDeviceEx instead.

Syntax

HANDLE RegisterDevice(
  LPCWSTR lpszType,
  DWORD dwIndex,
  LPCWSTR lpszLib,
  DWORD dwInfo
);

Parameters

  • lpszType
    [in] Long pointer to the null-terminated string that contains the device identifier prefix, for example COM, DEV, or PGR. Must be three characters long.
  • dwIndex
    [in] Device identifier index. Must be a number from 0 (zero) through 9. For example, the index value for COM2 is 2.
  • lpszLib
    [in] Long pointer to the null-terminated string that identifies the device driver DLL name.
  • dwInfo
    [in] Instance information.

Return Value

A handle to a device indicates success. Zero indicates failure

For devices that expose the stream interface, the drivers are DLL files. The RegisterDevice function initializes each driver. The Device Manager calls this function on behalf of the driver. However, applications can load custom stream interfaces, in which case they also call this function to register the driver. The lpszLib parameter opens the device. The lpszType parameter is a three-character string that identifies the function's entry points in the DLL so that multiple devices can exist in one DLL. The lpszLib parameter is the name of the DLL that contains the entry points. Pass the dwInfo parameter to the initialization routine.

This handle is obtained from the driver's XXX_Init (Device Manager) function and is passed to the XXX_Open (Device Manager), XXX_Deinit (Device Manager), XXX_PowerUp (Device Manager), and XXX_PowerDown (Device Manager) functions.

Remarks

Use the DeregisterDevice function, if the user removes a device from the system or if the system is shutting down, and if the handle was returned from a call to RegisterDevice.

This function is only callable by privileged callers. The following list shows the ramifications of this:

  • The installer for the driver must use a relative path for the DLL. The relative path must point to the Windows directory or other places in the specified search path.
  • If the installer uses an explicit path, it is responsible for setting the correct path and not pointing to a directory that normal code can modify.

Requirements

Header winbase.h
Library coredll.lib
Windows Embedded CE Windows CE 1.0 and later

See Also

Reference

Device Manager Functions
ActivateDeviceEx
DeregisterDevice
XXX_Deinit (Device Manager)
XXX_Init (Device Manager)
XXX_Open (Device Manager)
XXX_PowerDown (Device Manager)
XXX_PowerUp (Device Manager)

Other Resources

Stream Interface Drivers