Windows Dev Center

Expand Minimize

SCardGetDeviceTypeId function

The SCardGetDeviceTypeId function gets the device type identifier of the card reader for the given reader name. This function does not affect the state of the reader.

Syntax


LONG WINAPI SCardGetDeviceTypeId(
  _In_    SCARDCONTEXT hContext,
  _In_    LPCTSTR      szReaderName,
  _Inout_ LPDWORD      pdwDeviceTypeId
);

Parameters

hContext [in]

Handle that identifies the resource manager context for the query. You can set the resource manager context by calling the SCardEstablishContext function. This parameter cannot be NULL.

szReaderName [in]

Reader name. You can get this value by calling the SCardListReaders function.

pdwDeviceTypeId [in, out]

The actual device type identifier. The list of reader types returned by this function are listed under ReaderType member in the SCARD_READER_CAPABILITIES structure.

Return value

This function returns different values depending on whether it succeeds or fails.

Return codeDescription
Success

SCARD_S_SUCCESS.

Failure

An error code. For more information, see Smart Card Return Values.

 

Examples


DWORD    dwDeviceTypeId = 0;
DWORD    i;
LONG     lReturn;
LPTSTR   szReaderName = "USB Smart Card Reader 0";

// Retrieve the reader's Device Type ID
// hContext was set by a previous call to SCardEstablishContext.
lReturn = SCardGetDeviceTypeId (hContext,
                         szReaderName,
                         &dwDeviceTypeId);

if ( SCARD_S_SUCCESS != lReturn )
{
    printf("Failed SCardGetReaderDeviceInstanceId - %x\n", lReturn);
    // Take appropriate action
}


Requirements

Minimum supported client

Windows 8 [desktop apps only]

Minimum supported server

Windows Server 2012 [desktop apps only]

Header

Winscard.h

 

 

Community Additions

ADD
Show:
© 2015 Microsoft