public int CardControl() { string tempstr = ""; int index = 0; for (index = 0; index <= SendLen - 1; index++) { tempstr = tempstr + " " + string.Format("{0:X2}", SendBuff[index]); } displayOut(2, 0, tempstr); retCode = ModWinsCard.SCardControl(hCard, (int)ModWinsCard.IOCTL_CCID_ESCAPE_SCARD_CTL_CODE, ref SendBuff[0], SendLen, ref RecvBuff[0], RecvLen, ref nBytesRet); if (retCode != ModWinsCard.SCARD_S_SUCCESS) { displayOut(2, retCode, ""); return(retCode); } tempstr = ""; for (index = 0; index <= RecvLen - 1; index++) { tempstr = tempstr + " " + string.Format("{0:X2}", RecvBuff[index]); } //DisplayOut(tempstr, 4); displayOut(3, 0, tempstr); return(retCode); }
public int CardControl() { string tempstr = string.Empty; int index = 0; for (index = 0; index <= SendLen - 1; index++) { //tempstr = tempstr + Microsoft.VisualBasic.Right("00" + Conversion.Hex(SendBuff(index)), 2) + " "; tempstr = tempstr + " " + string.Format("{0:X2}", SendBuff[index]); } displayOut(2, 0, tempstr.Trim()); //retCode = ModWinsCard.SCardControl(hCard, ModWinsCard.IOCTL_CCID_ESCAPE_SCARD_CTL_CODE, SendBuff[0], SendLen, RecvBuff[0], RecvLen, nBytesRet); retCode = ModWinsCard.SCardControl(hCard, (uint)ModWinsCard.IOCTL_CCID_ESCAPE_SCARD_CTL_CODE, ref SendBuff[0], SendLen, ref RecvBuff[0], RecvLen, ref nBytesRet); if (retCode != ModWinsCard.SCARD_S_SUCCESS) { displayOut(2, retCode, ""); return(retCode); } tempstr = string.Empty; for (index = 0; index <= RecvLen - 1; index++) { //tempstr = tempstr + Microsoft.VisualBasic.Right("00" + Conversion.Hex(RecvBuff(index)), 2) + " "; tempstr = tempstr + " " + string.Format("{0:X2}", RecvBuff[index]); } //DisplayOut(tempstr, 4); displayOut(3, 0, tempstr.Trim()); return(retCode); }
private bool CanControl() { var bytesReturned = 0; if (!IsConnected) { Connect(); } _sentBuffer = APDUCommands.GetControl(); _receivedBuffer = new byte[21]; _receivedBuffer[0] = 0; IsControlled = ModWinsCard.SCardControl( _hCard, _dwControlCode, ref _sentBuffer[0], _sentBuffer.Length, ref _receivedBuffer[0], _receivedBuffer.Length, ref bytesReturned) == ModWinsCard.SCARD_S_SUCCESS; return(IsControlled); }