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 driver with the file system so that applications can access the driver's special device file names.

HANDLE RegisterDevice(
LPCWSTR
lpszType

DWORD
dwIndex
LPCWSTR
lpszLib,
DWORD
dwInfo
);

Parameters

lpszType
Pointer to the driver's device file name prefix, such as COM, DEV, or PGR. The prefix must be 3 characters long.
dwIndex
Specifies a device identifier index. The index must be a number from 0 through 9. For example, the index value for "COM2:" is 2.
lpszLib
Pointer to the device driver DLL's file name.
dwInfo
Specifies instance information. This is passed to the XXX_Initfunction.

Return Values

A handle to a device indicates success. Zero indicates failure. This is passed to the following functions exported by the client driver: XXX_Deinit, XXX_Open, XXX_PowerUp, and XXX_PowerDown.

Stream interface drivers are initialized by a call to this function. For most stream interface drivers, the Device Manager calls this function on behalf of the driver. However, applications can load their own special-purpose stream interface drivers, in which case they also call this function to register the driver. The IpszLibparameter is used to open the device. The IpszTypeparameter is a three-character string that identifies 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 to the initialization routine. So, for example, if there are two serial ports on a device and Comm.dll is the DLL implementing the serial driver, it presents the following initialization calls:

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

Remarks

The DeregisterDevicefunction is used if a device is removed from the system or is being shut down:

In the following code example, h1 is returned from a call to this function.

DeregisterDevice(h1);

Requirements

Runs on Versions Defined in Include Link to
Windows CE OS 2.0 and later Ntcompat.h    
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.


 Last updated on Tuesday, July 13, 2004

© 2004 Microsoft Corporation. All rights reserved.