CardCreateFile Function

This topic is not current. For the most current information about the Smart Card API, see Smart Card Minidriver Specification.

The CardCreateFile function, defined by a smart card module, creates a file in the specified directory of a smart card.


DWORD WINAPI CardCreateFile(
  __in  PCARD_DATA pCardData,
  __in  LPSTR pszDirectoryName,
  __in  LPSTR pszFileName,
  __in  DWORD cbInitialCreationSize,
  __in  CARD_FILE_ACCESS_CONDITION AccessCondition


pCardData [in]

A pointer to the CARD_DATA structure received from a call to the CardAcquireContext function.

pszDirectoryName [in]

A pointer to a null-terminated string that contains a directory name. The CardCreateFile function creates the new file in this directory. The function fails if the specified directory does not exist.

pszFileName [in]

A pointer to a null-terminated string that contains the name of the file to create.

cbInitialCreationSize [in]

The size, in bytes, of the new file.

AccessCondition [in]

A member of the CARD_FILE_ACCESS_CONDITION enumeration that specifies access control permissions for the new file.

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/valueDescription
128 (0x80)

A file with the same name as the value of the pszFileName parameter already exists.



Minimum supported client

Windows XP

Minimum supported server

Windows Server 2003



See Also

Microsoft Base Smart Card Cryptographic Service Provider



Send comments about this topic to Microsoft

Build date: 4/19/2011