CardReadFile Function

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

The CardReadFile function, defined by a smart card module, reads the contents of a file into a buffer.


  __in     PCARD_DATA pCardData,
  __in     LPSTR pszDirectoryName,
  __in     LPSTR pszFileName,
  __in     DWORD dwFlags,
  __out    PBYTE *ppbData,
  __inout  PDWORD pcbData


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 read.

pszFileName [in]

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

dwFlags [in]

Reserved. This parameter must be set to zero.

ppbData [out]

On output, this parameter contains the address of a pointer to a buffer that contains the contents of the file specified by the pszFileName parameter. Memory for this buffer is allocated by the smart card module and freed by the Microsoft Base Smart Card Cryptographic Service Provider.

pcbData [in, out]

If the caller of this function specifies a value for this parameter, that value specifies the number of bytes to be read from the file. If the caller does not specify a value for this parameter on input, the entire file is read.

On output, this parameter contains a pointer to a value that specifies the size, in bytes, of the ppbData buffer.

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
2148532260 (0x80100024)

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



Minimum supported client

Windows XP

Minimum supported server

Windows Server 2003



See Also




Send comments about this topic to Microsoft

Build date: 4/19/2011