CardCreateDirectory function

This function creates a subdirectory from the root in the file system of the card, and applies the provided access condition.

Directories are generally created for segregating the files that belong to a single application on the card. As an example, the files that belong to the Microsoft cryptographic application are in the “mscp” directory.

Syntax

DWORD WINAPI CardCreateDirectory(
  _In_ PCARD_DATA                      pCardData,
  _In_ LPSTR                           pszDirectory,
  _In_ CARD_DIRECTORY_ACCESS_CONDITION AccessCondition
);

Parameters

  • pCardData [in]
    Context information for the call. For more information, see CardAcquireContext.

  • pszDirectory [in]
    Name of the directory.

  • AccessCondition [in]
    Access control permissions to be applied to the directory.

Return value

Zero on success; otherwise, nonzero.

Remarks

Directory names must be 8 or fewer ANSI characters.

Currently-defined directory access control permissions are taken from the CARD_DIRECTORY_ACCESS_CONDITION from Cardmod.h. These access control permissions are:

  • InvalidAc
  • UserCreateDeleteDirAc
  • AdminCreateDeleteDirAc

Note  The AdminCreateDeleteDirAc access control list (ACL) is optional. It may be removed in future revisions of the minidriver specification.

 

For more information about these access control permission values, see File System Requirements.

The function fails if the subdirectory already exists (ERROR_FILE_EXISTS) or insufficient space exists to create the new directory on the card (SCARD_E_NO_MEMORY).

Note  The amount of free space can be retrieved by using CardQueryFreeSpace.

 

If calling CardCreateDirectory with a NULL pszDirectoryName, SCARD_E_INVALID_PARAMETER should be returned.

If the pszDirectoryName directory already exists or if there is no such directory but there is a file that is named the same, ERROR_FILE_EXISTS should be returned.

If calling CardCreateDirectory without a previous card authentication, the function is expected to fail with an SCARD_W_SECURITY_VIOLATION error.

If calling CardCreateDirectory with invalid access conditions, the function is expected to fail with an SCARD_E_INVALID_PARAMETER error.

If the name that was specified by pszDirectoryName is longer than the maximum length that is defined for file/directory names, SCARD_E_INVALID_PARAMETER must be returned.

Requirements

Target platform

Desktop

Header

Cardmod.h (include Cardmod.h)

 

 

Send comments about this topic to Microsoft