SmartcardInitialize (WDM) routine
The SmartcardInitialize routine allocates internal buffers for the library.
Syntax
NTSTATUS SmartcardInitialize(
_In_ PSMARTCARD_EXTENSION SmartcardExtension
);
Parameters
SmartcardExtension [in]
A pointer to a SMARTCARD_EXTENSION structure that contains the device extension of the smart card device.SmartcardExtension->SmartcardRequest.BufferSize
The value of this member must be set to the number of bytes to allocate for the request buffer. If the value is less than MIN_BUFFER_SIZE, the library allocates MIN_BUFFER_SIZE bytes automatically.SmartcardExtension->SmartcardReceive.BufferSize
The value of this member must be set to the number of bytes to allocate for the receive buffer. If the value is less than MIN_BUFFER_SIZE, the library allocates MIN_BUFFER_SIZE bytes automatically.
Return value
SmartcardInitialize returns one of the following NTSTATUS values:
Return code | Description |
---|---|
STATUS_SUCCESS | The operation succeeded. |
STATUS_INSUFFICIENT_RESOURCES | The amount of memory that is required to allocate the buffers is not available. |
Remarks
The library allocates and uses two internal buffers: SmartcardExtension->SmartcardRequest.Buffer for receiving data, and SmartcardExtension->SmartcardReply.Buffer for sending data. Your driver should call SmartcardInitialize to allocate these buffers, and it should use these buffers to transfer data to and from the smart card. To free these buffers, call SmartcardExit (WDM) from your DriverUnload routine.
The smart card driver library checks the version of the SMARTCARD_EXTENSION structure. Before your driver calls SmartcardInitialize, it must set the Version member of SMARTCARD_EXTENSION to the value SMCLIB_VERSION. This is usually done in the DriverEntry routine.
Requirements
Target platform |
Desktop |
Version |
Available in Windows XP and later versions of Windows. |
Header |
Smclib.h (include Smclib.h) |
Library |
Smclib.lib |
IRQL |
PASSIVE_LEVEL |
See also