The RegisterDevice function registers a new device.
HANDLE RegisterDevice(LPCWSTR lpszType DWORD dwIndex LPCWSTR lpszLib DWORD dwInfo);
Header file: | Winbase.h |
Platforms: | H/PC |
Versions: | 1.0 and later |
Returns a handle to a device or zero for 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 will be DLL files. Each driver is initialized by a call to the RegisterDevice function (performed by the server process). The IpszLib parameter is what will be 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
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.