我已联系 SLE4442 智能卡(2W)和 Omnikey 5421 智能卡读卡器。
我的问题是与卡的连接。 WinSCard的方法SCardConnect
返回错误SCARD_W_UNRESPONSIVE_CARD 0x80100066
。有趣的是, Omnikey 5 3 21 (前身5421)不存在这个问题。我发布了用于测试数据读取的代码(Delphi):
function GetResponseFromCard(const FCardHandle: Integer; const APdu:
string): string;
var
RetVar : cardinal;
SBuf : string;
SLen : cardinal;
RBuf : string;
RLen : cardinal;
Ppci : Pointer;
begin
SBuf := APdu;
RBuf := StringOfChar(#0,260);
Ppci := @SCARD_PCI_T0;
SLen := Length(APdu);
RLen := Length(RBuf);
RetVar := SCardTransmit(FCardHandle, Ppci, Pointer(SBuf), SLen, nil, Pointer(RBuf), @RLen);
if RetVar = SCARD_S_SUCCESS then begin
Result := Copy(RBuf,1,RLen);
end else begin
Result := IntToHex(RetVar, 8);
end;
end;
procedure TestSLE4442;
var
FContext: Cardinal;
PContext: Pointer;
Res: LongInt;
ReaderListStr: string;
ReaderListSize: integer;
v: array[0..10] of string;
SelectedReader: PChar;
phCard: Integer;
pdwActiveProtocol: Integer;
ReadedData: string;
begin
FContext := 0;
PContext := @FContext;
Res := SCardEstablishContext(SCARD_SCOPE_USER, nil, nil, PContext);
if Res = SCARD_S_SUCCESS then begin
Res := SCardListReaders(FContext, nil, nil, ReaderListSize);
if Res = SCARD_S_SUCCESS then begin
SetLength(ReaderListStr, ReaderListSize);
Res := SCardListReaders(FContext, nil, Pointer(ReaderListStr), ReaderListSize);
SortOutSubstrings(ReaderListStr,v,[#0]);
SelectedReader := PChar(v[0]);
ShowMessage('SelectedReader: '+ SelectedReader);
if Res = SCARD_S_SUCCESS then begin
Res := SCardConnect(FContext, SelectedReader, SCARD_SHARE_EXCLUSIVE, SCARD_PROTOCOL_T0, phCard, @pdwActiveProtocol);
if Res = SCARD_S_SUCCESS then begin
ReadedData := GetResponseFromCard(phCard, TStringHelper.Hex2Bin('FFB0000000'));
ShowMessage('Data: '+ ReadedData);
end;
end;
end;
SCardReleaseContext(FContext);
end;
end;
有人遇到过这个问题吗?我也问过HID,但现在没有答案。
答案 0 :(得分:0)
感谢您的帮助。我听说我累了同步Omnikey API。供应商回答我,新5421不支持2WBP。也许有机会使用SCARD_SHARE_DIRECT因为使用这个我能够使用5421连接到SLE4442。但是如果没有供应商的支持,这很难说我能做些什么。