Share via


RegisterDevice

This function registers a new device.

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

Parameters

  • lpszType
    Long pointer to the null-terminated string that contains the device identifier prefix (for example COM, DEV, PGR); must be 3 characters long.
  • dwIndex
    Specifies the device identifier index; must be a number from 0 through 9. For example, the index value for COM2 would be 2.
  • lpszLib
    Long pointer to the null-terminated string that contain that device driver DLL module name.
  • dwInfo
    Specifies instance information.

Return Values

A handle to a device indicates success. Zero indicates failure. This is passed to the following functions that are exported by the client driver: PRE_Open, PRE_Deinit, PRE_PowerUp, and PRE_PowerDown.

For stream-based devices, the drivers are DLL files. Each driver is initialized by a call to the RegisterDevice function (performed by the server process). The IpszLib parameter is used to open the device. The IpszType parameter is a three character string which is used to identify the function 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. Finally dwInfo is passed in to the initialization routine. So, for example, if there were two serial ports on a device, and Comm.dll was the DLL implementing the serial driver, it would likely present the following initialization calls:

h1 = RegisterDevice(L"COM", 1, L"comm.dll",0x3f8);
hs

Remarks

The DeregisterDevice function can be used if a device is removed from the system or is being shut down. An example would be:

DeregisterDevice(h1);

where h1 was returned from a call to RegisterDevice.

Requirements

Runs on Versions Defined in Include Link to
Windows CE OS 1.0 and later Winbase.h   Coredll.lib

Note   This API is part of the complete Windows CE OS package as provided by Microsoft. The functionality of a particular platform is determined by the original equipment manufacturer (OEM) and some devices may not support this API.

See Also

DeregisterDevice

 Last updated on Tuesday, July 13, 2004

© 1992-2000 Microsoft Corporation. All rights reserved.