Example correction
This commit is contained in:
+8
-10
@@ -431,7 +431,7 @@ Any WDF context-allocation failure | Returned from `WdfObjectAllocateContext`.
|
||||
|
||||
Parameter | Description
|
||||
----|----
|
||||
BusFilterConfig | Pointer to a fully populated `DMF_BusFilter_CONFIG`. Initialize with `DMF_BusFilter_CONFIG_INIT` before setting callbacks. The caller retains ownership; the library copies the config internally.
|
||||
BusFilterConfig | Pointer to a fully populated `DMF_BusFilter_CONFIG`. Initialize with `DMF_BusFilter_CONFIG_INIT` before setting callbacks. The library copies the struct internally; the pointer does not need to remain valid after `DMF_BusFilter_Initialize` returns, so a stack-local variable in `DriverEntry` is sufficient.
|
||||
|
||||
##### Remarks
|
||||
|
||||
@@ -689,11 +689,6 @@ the filter. Release rules:
|
||||
The following sketch shows the minimum wiring for a client driver.
|
||||
|
||||
````c
|
||||
//
|
||||
// Global configuration block (or stored in driver context).
|
||||
//
|
||||
static DMF_BusFilter_CONFIG g_BusFilterConfig;
|
||||
|
||||
//
|
||||
// Optional: per-child callback.
|
||||
//
|
||||
@@ -767,12 +762,15 @@ DriverEntry(
|
||||
}
|
||||
|
||||
// Initialize the bus filter library after WdfDriverCreate.
|
||||
// The config struct can live on the stack: Initialize copies it internally
|
||||
// and never reads the pointer again after it returns.
|
||||
//
|
||||
DMF_BusFilter_CONFIG_INIT(&g_BusFilterConfig, DriverObject);
|
||||
g_BusFilterConfig.EvtDeviceAdd = MyDriver_EvtDeviceAdd;
|
||||
g_BusFilterConfig.EvtDeviceRemove = MyDriver_EvtDeviceRemove;
|
||||
DMF_BusFilter_CONFIG busFilterConfig;
|
||||
DMF_BusFilter_CONFIG_INIT(&busFilterConfig, DriverObject);
|
||||
busFilterConfig.EvtDeviceAdd = MyDriver_EvtDeviceAdd;
|
||||
busFilterConfig.EvtDeviceRemove = MyDriver_EvtDeviceRemove;
|
||||
|
||||
return DMF_BusFilter_Initialize(&g_BusFilterConfig);
|
||||
return DMF_BusFilter_Initialize(&busFilterConfig);
|
||||
}
|
||||
````
|
||||
|
||||
|
||||
Reference in New Issue
Block a user