Microsoft Windows CE 3.0  

RegisterDevice

Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

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 RegisterDevicefunction (performed by the server process). The IpszLibparameter is used to open the device. The IpszTypeparameter 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 lpszLibparameter is the name of the DLL that contains the entry points. Finally dwInfois 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 DeregisterDevicefunction can be used if a device is removed from the system or is being shut down. An example would be:

DeregisterDevice(h1);

where h1was 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