コード例 #1
0
        public virtual ControlResponse Control(IntPtr cardHandle, ControlCommand controlCmd)
        {
            int recvBufferLength = 255;
            int recvdLength      = recvBufferLength;

            byte[] recvData = new byte[recvBufferLength];

            uint dwControlCode = BitConverter.ToUInt32(controlCmd.ControlCode, 0);

            PCSC.SCardControl(cardHandle, dwControlCode, controlCmd.ControlData, controlCmd.ControlData.Length, recvData, recvBufferLength, ref recvdLength);

            byte[] responseData = new byte[recvdLength];
            Buffer.BlockCopy(recvData, 0, responseData, 0, recvdLength);
            ControlResponse controlResponse = new ControlResponse(responseData);

            return(controlResponse);
        }
コード例 #2
0
        public virtual ControlResponse Control(IntPtr cardHandle, ControlCommand controlCmd)
        {
            int recvBufferLength = 255;
            int recvdLength      = recvBufferLength;

            byte[] recvData = new byte[recvBufferLength];

            uint dwControlCode = BitConverter.ToUInt32(ByteArray.ReverseBuffer(controlCmd.ControlCode), 0);
            int  error         = PCSC.SCardControl(cardHandle, dwControlCode, controlCmd.ControlData, controlCmd.ControlData.Length, recvData, recvBufferLength, ref recvdLength);

            ThrowSmartcardException("SCardControl", error);

            byte[] responseData = new byte[recvdLength];
            Buffer.BlockCopy(recvData, 0, responseData, 0, recvdLength);
            ControlResponse controlResponse = new ControlResponse(responseData);

            return(controlResponse);
        }