共用方式為


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.

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
2148532260 (0x80100024)
The file specified by the pszDirectoryName and pszFileName parameters does not exist.

Requirements

Minimum supported client
Windows XP [desktop apps only]
Minimum supported server
Windows Server 2003 [desktop apps only]
Header
Cardmod.h

See also

CARD_DATA

CardAcquireContext