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 | |
| EVENT_HANDLER | Input | |
| void | Input | |
| DWORD | N/A | |
| DWORD | Input | |
| WDU_MATCH_TABLE[1] | 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 | The handle to WinDriver's kernel-mode driver received from WD_Open() [5.2] |
| event | The criteria set for registering to receive event notifications. |
| handle | Optional handle to be used by the low-level WD_EventUnregister() function; Zero when event registration fails. |
| dwAction | A bit-mask indicating which events to register to:
Plug and Play events: Device power state: Systems power state: |
| dwCardType | 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) |
| hKernelPlugIn | Handle to Kernel PlugIn returned from WD_KernelPlugInOpen() [6.1] (when using the Kernel PlugIn to handle the events) |
| dwOptions | Can be either zero or: |
| u | Device information union: |
| Pci | PCI card information: |
| cardId | Card information structure: |
| dwVendorId | PCI vendor ID to register to. If zero, register to all PCI vendor IDs. |
| dwDeviceId | PCI card ID to register to. If zero, register to all PCI device IDs. |
| pciSlot | PCI slot information: |
| dwBus | PCI bus number to register to. If zero, register to all PCI buses. |
| dwSlot | PCI slot to register to. If zero, register to all slots. |
| dwFunction | PCI function to register to. If zero, register to all functions. |
| Usb | USB device information - relevant only for USB devices |
| Pcmcia | PCMCIA card information: |
| deviceId | PCMCIA card ID information structure: |
| wManufacturerId | PCMCIA Manufacturer ID to register to. If zero, register to all PCMCIA manufacturer IDs. |
| wCardId | PCMCIA card ID to register to. If zero, register to all PCMCIA card IDs. |
| slot | PCMCIA slot information structure: |
| uBus | PCMCIA bus number to register to. If zero, register to all PCMCIA buses. |
| uSocket | PCMCIA socket to register to. If zero, register to all sockets. |
| uFunction | PCMCIA function to register to. If zero, register to all functions. |
| func | The callback function to call upon receipt of event notification. |
| data | Pointer to the data to pass to the callback function (NULL if there is no data to pass). |
| dwNumMatchTables | Relevant only for USB devices |
| matchTables | Relevant only for USB devices |
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;
}