SmartcardInitialize (WDM)

The SmartcardInitialize function allocates internal buffers for the library.

NTSTATUS 
SmartcardInitialize(
  IN PSMARTCARD_EXTENSION SmartcardExtension
);
 

Parameters

SmartcardExtension
Points to the smart card extension of the device.
SmartcardExtension->SmartcardRequest.BufferSize
This value must be set to the number of bytes to be allocated for the request buffer. The minimum size for this buffer is MIN_BUFFER_SIZE. If this value is smaller, MIN_BUFFER_SIZE will be allocated automatically.
SmartcardExtension->SmartcardReply.BufferSize
This value must be set to the number of bytes to be allocated for the receive buffer. The minimum size for this buffer is MIN_BUFFER_SIZE. If this value is smaller, MIN_BUFFER_SIZE will be allocated automatically.

Return Values

SmartcardInitialize returns an NTSTATUS value.

Value Meaning
STATUS_INSUFFICIENT_RESOURCES Out of memory

Remarks

The library uses internal buffers for sending SmartcardExtension->SmartcardRequest.Buffer and receiving SmartcardExtension->SmartcardReply.Buffer data. SmartcardInitialize allocates these buffers. Call SmartcardExit_(WDM) in your DriverUnload routine to free these internal buffers. Your driver should use those buffers for transferring data to and from the card.

The smart card driver library checks the version of the SMARTCARD_EXTENSION structure. Before calling SmartcardInitialize, the driver must assign to the Version member of SMARTCARD_EXTENSION the value SMCLIB_VERSION. This is usually done in the DriverEntry routine.

SmartcardInitialize functions the same for WDM and VxD drivers.