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 device.
Note: |
---|
This function is obsolete. Use ActivateDeviceExinstead. |
Note: |
---|
This function is obsolete as of Windows Embedded CE 6.0. Use ActivateDeviceExinstead. |
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
For All Platforms
A handle to a device indicates success. Zero indicates failure
For devices that expose the stream interface, the drivers are DLL files. The RegisterDevicefunction 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 lpszLibparameter opens the device. The lpszTypeparameter 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 lpszLibparameter is the name of the DLL that contains the entry points. Pass the dwInfoparameter to the initialization routine.
For Windows Embedded CE
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 DeregisterDevicefunction, 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 |
Windows Mobile | Windows Mobile Version 5.0 and later |
See Also
Reference
Device Manager FunctionsActivateDeviceEx
DeregisterDevice
XXX_Deinit (Device Manager)
XXX_Init (Device Manager)
XXX_Open (Device Manager)
XXX_PowerDown (Device Manager)
XXX_PowerUp (Device Manager)