SmcDeviceInitConfig function
Registers client driver-implemented callback functions with the smart card class extension before the framework creates a device object for the smart card device.
Syntax
NTSTATUS SmcDeviceInitConfig(
_In_ PWDFDEVICE_INIT DeviceInit,
_In_ PSMC_CONFIG CcidConfig
);
Parameters
DeviceInit [in]
Pointer to a WDFDEVICE_INIT structure that contains initialization information for the framework device object. The pointer is passed by the framework to the client driver in the DeviceInit parameter of the EvtDriverDeviceAdd.CcidConfig [in]
Pointer to a driver-allocated SMC_CONFIG structure.
Return value
If the function encounters no errors, it must return STATUS_SUCCESS. Otherwise, one of the appropriate NTSTATUS values.
Remarks
The client driver must register its callback functions with the framework in the driver's EvtDriverDeviceAdd function before the WdfDeviceCreate call. Pointers to the callback functions are provided in a driver-allocated SMC_CONFIG structure pointer to by the CcidConfig.
The driver must call SMC_CONFIG_INIT to initialize that structure, set the members to the driver implemented callback functions, and then call SmcDeviceInitConfig.
After the WdfDeviceCreate, call SmcCxInitializeCx by passing the framework device object.
Examples
NTSTATUS
OnDeviceAdd(
_In_ WDFDRIVER Driver,
_Inout_ PWDFDEVICE_INIT DeviceInit
)
{
NTSTATUS status;
SMC_CONFIG scConfig;
...
// Initialize the CX device
SMC_CONFIG_INIT(&scConfig);
scConfig.EvtCcidAssignCardPower = OnAssignCardPower;
scConfig.EvtCcidSetProtocol = OnSetProtocol;
scConfig.EvtCcidTransmit = OnTransmit;
scConfig.EvtCcidEject = OnEject;
scConfig.EvtCcidSwallow = OnSwallow;
scConfig.EvtCcidVendorIoctl = OnVendorIoctl;
status = SmcDeviceInitConfig(DeviceInit, &scConfig);
// Create the framework device object.
WDFDEVICE fxDevice;
WDF_OBJECT_ATTRIBUTES DeviceAttributes;
WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&DeviceAttributes, DEVICE_CONTEXT);
status = WdfDeviceCreate(&DeviceInit,
&DeviceAttributes,
&fxDevice);
status = SmcCxInitializeCx(fxDevice);
...
}
Requirements
Target platform |
Desktop |
Header |
SmcCx.h on Windows 10 |
See also