PURPOSE
Registers your application to receive Plug-and-Play and power
management event notifications, according to a predefined set of criteria.
The function receives an event handler callback, which will be invoked upon
the occurrence of a registered event.
PROTOTYPE
DWORD EventRegister(
HANDLE *phEvent,
HANDLE hWD,
WD_EVENT *pEvent,
EVENT_HANDLER pFunc,
void *pData);
PARAMETERS
| Name | Type | Input/Output |
|---|---|---|
| HANDLE* | Output | |
| HANDLE | Input | |
| WD_EVENT* | Input | |
| DWORD | Output | |
| DWORD | Input | |
| DWORD | N/A | |
| DWORD | N/A | |
| WD_BUS_TYPE | Input | |
| DWORD | Input | |
| DWORD | Input | |
| union | ||
| struct | ||
|
|
WD_PCI_ID | |
| DWORD | Input | |
| DWORD | Input | |
|
|
WD_PCI_SLOT | |
| DWORD | Input | |
| DWORD | Input | |
| DWORD | Input | |
| struct | Input | |
| struct | ||
|
|
WD_PCMCIA_ID | |
| WORD | Input | |
| WORD | Input | |
|
|
WD_PCMCIA_SLOT | |
| BYTE | Input | |
| BYTE | Input | |
| BYTE | Input | |
| BYTE | N/A | |
| DWORD | N/A | |
| DWORD | Input | |
| WDU_MATCH_TABLE[1] | Input | |
| typedef void (*EVENT_HANDLER)( WD_EVENT *pEvent, void *pData); |
Input | |
| void | Input |
DESCRIPTION
| Name | Description |
|---|---|
| phEvent | Pointer to the handle to be used in calls to EventUnregister() [4.5], or NULL if the event registration fails. |
| hWD | Handle to WinDriver's kernel-mode driver as received from WD_Open() [5.2] |
| pEvent | The criteria set for registering to receive event notifications. |
| Optional handle to be used by the low-level WD_EventUnregister() function; Zero when event registration fails. | |
| A bit-mask indicating which events to register to:
Plug-and-Play events: Device power state: Systems power state: |
|
| Card type. Can be either WD_BUS_PCI - for a PCI card, WD_BUS_PCMCIA - for a PCMCIA card, or WD_BUS_USB - for a USB device (see the WD_BUS_TYPE enumeration values) | |
| Handle to Kernel PlugIn returned from WD_KernelPlugInOpen() [6.1] (when using the Kernel PlugIn to handle the events) | |
| Can be either zero or: |
|
| Device information union: | |
| PCI card information: | |
| Card information structure: | |
|
|
PCI vendor ID to register to. If zero, register to all PCI vendor IDs. |
|
|
PCI card ID to register to. If zero, register to all PCI device IDs. |
| PCI slot information: | |
|
|
PCI bus number to register to. If zero, register to all PCI buses. |
|
|
PCI slot to register to. If zero, register to all slots. |
|
|
PCI function to register to. If zero, register to all functions. |
| USB device information - relevant only for USB devices | |
| PCMCIA card information: | |
| PCMCIA card ID information structure: | |
|
|
PCMCIA Manufacturer ID to register to. If zero, register to all PCMCIA manufacturer IDs. |
|
|
PCMCIA card ID to register to. If zero, register to all PCMCIA card IDs. |
| PCMCIA slot information structure: | |
|
|
PCMCIA bus number to register to. If zero, register to all PCMCIA buses. |
|
|
PCMCIA socket to register to. If zero, register to all sockets. |
|
|
PCMCIA function to register to. If zero, register to all functions. |
| Relevant only for USB devices | |
| Relevant only for USB devices | |
| pFunc | The callback function to call upon receipt of event notification. |
| pData | Pointer to the data to pass to the pFunc callback (NULL if there is no data to pass). |
RETURN VALUE
Returns WD_STATUS_SUCCESS (0) on success, or an appropriate error code otherwise [A].
REMARKS
EXAMPLE
HANDLE *event_handle;
WD_EVENT event;
DWORD dwStatus;
BZERO(event);
event.dwAction = WD_INSERT | WD_REMOVE;
event.dwCardType = WD_BUS_PCI;
dwStatus = EventRegister(&event_handle, hWD, &event,
event_handler_func, NULL);
if (dwStatus!=WD_STATUS_SUCCESS)
{
printf("Failed register\n");
return;
}