Funzione SCardIntroduceReaderW (winscard.h)
La funzione SCardIntroduceReader introduce un nuovo nome per un lettoresmart card esistente.
Sintassi
LONG SCardIntroduceReaderW(
[in] SCARDCONTEXT hContext,
[in] LPCWSTR szReaderName,
[in] LPCWSTR szDeviceName
);
Parametri
[in] hContext
Handle che identifica il contesto di Resource Manager. Il contesto di Resource Manager viene impostato da una chiamata precedente a SCardEstablishContext. Questo parametro non può essere NULL.
[in] szReaderName
Nome visualizzato da assegnare al lettore.
[in] szDeviceName
Nome di sistema del lettore smart card, ad esempio "MyReader 01".
Valore restituito
Questa funzione restituisce valori diversi a seconda che abbia esito positivo o negativo.
Codice restituito | Descrizione |
---|---|
|
SCARD_S_SUCCESS. |
|
Codice di errore. Per altre informazioni, vedere Valori restituiti smart card. |
Commenti
Tutti i lettori installati nel sistema vengono introdotti automaticamente dal nome del sistema. In genere, SCardIntroduceReader viene chiamato solo per modificare il nome di un lettore esistente.
La funzione SCardIntroduceReader è una funzione di gestione del database. Per altre informazioni sulle altre funzioni di gestione del database, vedere Funzioni di gestione del database smart card.
Per rimuovere un lettore, usare SCardForgetReader.
Esempio
Nell'esempio seguente viene illustrato l'introduzione di un lettore smart card.
// This example renames the reader name.
// This is a two-step process (first add the new
// name, then forget the old name).
LPBYTE pbAttr = NULL;
DWORD cByte = SCARD_AUTOALLOCATE;
LONG lReturn;
// Step 1: Add the new reader name.
// The device name attribute is a necessary value.
// hCardHandle was set by a previous call to SCardConnect.
lReturn = SCardGetAttrib(hCardHandle,
SCARD_ATTR_DEVICE_SYSTEM_NAME,
(LPBYTE)&pbAttr,
&cByte);
if ( SCARD_S_SUCCESS != lReturn )
{
printf("Failed SCardGetAttrib\n");
exit(1); // Or other error action
}
// Add the reader name.
// hContext was set earlier by SCardEstablishContext.
lReturn = SCardIntroduceReader(hContext,
TEXT("My New Reader Name"),
(LPCTSTR)pbAttr );
if ( SCARD_S_SUCCESS != lReturn )
{
printf("Failed SCardIntroduceReader\n");
exit(1); // Or other error action
}
// Step 2: Forget the old reader name.
lReturn = SCardForgetReader(hContext,
(LPCTSTR)pbAttr );
if ( SCARD_S_SUCCESS != lReturn )
{
printf("Failed SCardForgetReader\n");
exit(1); // Or other error action
}
// Free the memory when done.
lReturn = SCardFreeMemory( hContext, pbAttr );
Nota
L'intestazione winscard.h definisce SCardIntroduceReader come alias che seleziona automaticamente la versione ANSI o Unicode di questa funzione in base alla definizione della costante preprocessore UNICODE. La combinazione dell'utilizzo dell'alias di codifica neutrale con il codice che non è neutrale dalla codifica può causare errori di corrispondenza che causano errori di compilazione o runtime. Per altre informazioni, vedere Convenzioni per i prototipi di funzione.
Requisiti
Requisito | Valore |
---|---|
Client minimo supportato | Windows XP [solo app desktop] |
Server minimo supportato | Windows Server 2003 [solo app desktop] |
Piattaforma di destinazione | Windows |
Intestazione | winscard.h |
Libreria | Winscard.lib |
DLL | Winscard.dll |