CardDeleteContainer function

The CardDeleteContainer function deletes the key container specified by its index value. This is done by deleting all key material (public and private) that is associated with that index value.


DWORD WINAPI CardDeleteContainer(
  _In_ PCARD_DATA pCardData,
  _In_ BYTE       bContainerIndex,
  _In_ DWORD      dwReserved


pCardData [in]

Context information for the call. For more information, see CardAcquireContext.

bContainerIndex [in]

KSP-assigned index for the CAPI container that is to be deleted.

dwReserved [in]

Reserved. Set to 0.

Return value

Zero on success; otherwise, nonzero.


This function deletes the key material that is associated with the indexed container. Certificates are deleted separately by the Base CSP/KSP through calls to CardDeleteFile for the files that contain the affected certificates. CardDeleteContainer removes key material that is not reachable through the file system. Note also that update of the ContainerMapFile is completely the responsibility of the Base CSP/KSP, which it does through the file system calls.

Status should indicate success if the container existed and was successfully deleted. If CardDeleteContainer is called with an invalid or nonexistent bContainerIndex parameter, it should succeed.


Target platform


Cardmod.h (include Cardmod.h)



Send comments about this topic to Microsoft

© 2016 Microsoft