CardReadFile Function

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

Syntax

DWORD WINAPI CardReadFile(
  __in     PCARD_DATA pCardData,
  __in     LPSTR pszDirectoryName,
  __in     LPSTR pszFileName,
  __in     DWORD dwFlags,
  __out    PBYTE *ppbData,
  __inout  PDWORD pcbData
);

Parameters

  • 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/value Description
SCARD_E_FILE_NOT_FOUND 21485322600x80100024

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

Requirements

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

CARD_DATA

CardAcquireContext

Send comments about this topic to Microsoft

Build date: 3/5/2009