CardDeleteFile Function

The CardDeleteFile function, defined by a smart card module, deletes a file from a smart card.


DWORD WINAPI CardDeleteFile(
  __in  PCARD_DATA pCardData,
  __in  LPSTR pszDirectoryName,
  __in  LPSTR pszFileName,
  __in  DWORD dwFlags


  • pCardData [in]
    A pointer to a CARD_DATA structure received from a call to the CardAcquireContext function.

  • pszDirectoryName [in]
    A pointer to a null-terminated string that contains the name of the directory that contains the file to delete.

  • pszFileName [in]
    A pointer to a null-terminated string that contains the name of the file to delete. If the specified file does not exist, the return value of this function should indicate that the file does not exist.

  • dwFlags [in]
    Reserved. This parameter must be set to zero.

Return Value

If the function succeeds, the function returns zero.

If the function fails, it returns a nonzero error value or one of the following possible error values.

Return code/value Description
SCARD_E_FILE_NOT_FOUND 21485322600x80100024

The file specified by the pszDirectoryName and pszFileName parameters does not exist.

SCARD_E_INVALID_PARAMETER 21485322280x80100004

The dwFlags parameter contains a value that is not valid.


The caller did not authenticate to the smart card before calling this function.


Minimum supported client Windows XP, Windows 2000 Professional with SP4
Minimum supported server Windows Server 2003, Windows 2000 Server with SP4
Header Cardmod.h

See Also

Microsoft Base Smart Card Cryptographic Service Provider




Send comments about this topic to Microsoft

Build date: 3/5/2009