Lecteur de carte à puces

Le coin des administrateurs et des développeurs. Astuces techniques, ...
Verrouillé
ducros
Novice
Novice
Messages : 2
Enregistré le : 24 nov. 2007, 08:59

Lecteur de carte à puces

Message par ducros »

Bonjour,
Est ce que qq a réussi à faire fonctionner un lecteur de cartes à puces sous VISTA : La liste des groupes de lecteurs est vide dans SCardListReaderGroups et SCardListReaders retourne systématiquement SCARD_E_NO_READERS_AVAILABLE. Le service carte à puces est démarré, plusieurs lecteurs de marque différentes ont été testés et apparaissent correctement dans la liste des matériels. Le PnP fonctionne correctement.

Le comportement est le meme en mode administrateur.

PS : Je travaille sous Visual Studio 2005 mais d'anciens programmes écrits sous VC 6.00 ont le même comportement.

// Establish the context.
lReturn = SCardEstablishContext(SCARD_SCOPE_SYSTEM,
NULL,
NULL,
phSC);

cch = SCARD_AUTOALLOCATE;

if (cch != SCARD_AUTOALLOCATE)
_tprintf(_T("Rien ne va plus !!!!!\n"));

if ( SCARD_S_SUCCESS != lReturn ) _tprintf(_T("Failed SCardEstablishContext\n"));
else
{
cch = SCARD_AUTOALLOCATE;
lReturn = SCardListReaderGroups(hSC,
(LPTSTR)&pmszReaderGroups,
&cch );

if ( SCARD_S_SUCCESS != lReturn ) _tprintf(_T("Failed SCardListReaderGroups\n"));
else
{
// Do something with the multi string of reader groups.
// Output the values.
// A double-null terminates the list of values.
pReaderGroup = pmszReaderGroups;
while ( '\0' != *pReaderGroup )
{
// Display the value.

_tprintf(_T("%S\n"), pReaderGroup);
// Advance to the next value.
pReaderGroup = pReaderGroup + wcslen(pReaderGroup) + 1;
}
// Remember to free pmszReaderGroups by a call to SCardFreeMemory.
}

DWORD dwReaders = SCARD_AUTOALLOCATE;
dwReaders = 1024;

lReturn = SCardListReaders(hSC,NULL,NULL,&dwReaders);
if (lReturn != SCARD_S_SUCCESS) _tprintf(_T("CardListReaders failure"));

switch( lReturn )
{
case SCARD_E_NO_READERS_AVAILABLE:
_tprintf(_T("Reader is not in groups.\n"));
// Take appropriate action.
break;

case SCARD_S_SUCCESS:
// Do something with the multi string of readers.
// Output the values.
// A double-null terminates the list of values.
pReader = pmszReaders;
while ( '\0' != *pReader )
{
// Display the value.
_tprintf(_T("Reader: %S\n"), pReader);
// Advance to the next value.
pReader = pReader + wcslen(pReader) + 1;
}
// Free the memory.
lReturn2 = SCardFreeMemory( hSC, pmszReaders );
if ( SCARD_S_SUCCESS != lReturn2 ) _tprintf(_T("Failed SCardFreeMemory\n"));
break;

default:
_tprintf(_T("Failed SCardListReaders\n"));
// Take appropriate action.
break;
}

J'ai pensé aussi à un problème UNICODE, sans succès là non plus.

Si quelqu'un a une idée, merci d'avance.

cdc
Néo
Novice
Novice
Messages : 8
Enregistré le : 25 nov. 2007, 23:13
Localisation : La Matrice

Message par Néo »

J'ai eu un soucis avec une carte micro sd 2 go sous vista et la solution fut réglée en achetant le lecteur HD trust dernier modèle spécial vista(9,90 euros) et là plus de soucis toutes les carte sont reconnues(j'ai pas testé au delà de 2 go).

Mais il te faut un lecteur HD sous vista c'est impératif au delà de 1 go ou alors comptons à une mise à jour dans le sp1 bientot
Un mot,un geste et Néo fait le reste!!!
Avatar du membre
Kana-chan
Support
Support
Messages : 1069
Enregistré le : 02 oct. 2007, 20:36
Localisation : Antibes

Message par Kana-chan »

Bonjour,

LOL Néo ... vive le HS je pense là ! :P
Ducros parle des cartes à puce de type carte bancaire ... enfin je pense à la vu du code qu'il met ! :D
@+, Kana-chan.
------------------------
Image
Néo
Novice
Novice
Messages : 8
Enregistré le : 25 nov. 2007, 23:13
Localisation : La Matrice

Message par Néo »

Bonjour,
:oops: Oups,sorry zavais pas vu :roll:
Un mot,un geste et Néo fait le reste!!!
ducros
Novice
Novice
Messages : 2
Enregistré le : 24 nov. 2007, 08:59

Message par ducros »

Bonjour,

J'ai trouvé une réponse sur un site belge, comme quoi ils ne font
pas que se déclarer la guerre entre eux :

http://www.isabel.be/support/fr/forum/v ... .php?t=129

The problem is in the registry permission for LOCAL_SERVICE :

I've had the same problem before after an upgrade from Windows 2000 to
Windows xp.

To solve it, I had to correct the permissions on the registry key
HKLM\SOFTWARE\Microsoft\Cryptography\Calais.

1. Right-click on the key HKLM\SOFTWARE\Microsoft\Cryptography\Calais and
select Permissions...
2. Click Add.
3. Click Advanced.
4. Click Locations.
5. Click on the computername and click OK.
6. In the window 'Select user or groups', click on Find now.
7. Select LOCAL SERVICE.
8. Click OK.
9. In the window 'Select user or groups', click on OK.
10. In the window 'Permissions for Calais', click on LOCAL SERVICE and make
sure 'Full control' , 'Read' and 'special permissions' is allowed.
11. In the window 'Advance Security Settings for Calais", deactivate the
options 'Inherit from parent the permission entries that apply to child
objects...'
12. When the window 'Security' appears, click Copy.
13. In the window 'Advance Security Settings for Calais", activate the
option 'Replace permission entries on all child objects with entries shown
here that apply to child objects' and click OK.
14. In the window 'Security' click Yes
15. In the window 'Permissions for Calais', click OK.

I don't now why the registry permissions have been reseted. But it seams to
be a solution of the problem. I hope that Microsoft can give us a patch and
an explanation of this fact !
Avatar du membre
nardino
Modérateurs
Modérateurs
Messages : 11993
Enregistré le : 05 févr. 2007, 17:38
Localisation : Reims
Contact :

Message par nardino »

Bonjour,

Celle qui suit, je ne pouvais pas la louper.
Merci de t'être décarcassé comme çà.
:D

Si tu nous traduis tout cela en français, notre gratitude n'en sera que plus grande.

Merci encore .
@+
Image
Clic sur l'image pour ouvrir le site.
Verrouillé