Q&A

  • (연구)넘 어려운 난관에 봉착 "다같이 연구하시죠"
typedef struct {

DWORD dwProtocol

DWORD cbPciLength;

} SCARD_IO_REQUEST;



//파라메타 설명

//=====================//

dwProtocol

Identifies the protocol in use.



cbPciLength

Supplies the length, in bytes,

of the SCARD_IO_REQUEST structure plus

any following PCI-specific information.

//=====================//





//== 실제 선언된 함수 ==//

LONG SCardTransmit(

IN SCARDHANDLE hCard,

IN LPCSCARD_I0_REQUEST pioSendPci,

IN LPCBYTE pbSendBuffer,

IN DWORD cbSendLength,

IN OUT LPSCARD_IO_REQUEST pioRecvPci,

OUT LPBYTE pbRecvBuffer,

IN OUT LPDWORD pcbRecvLength );



//== 파라메타 설명 ==//

Parameters

hCard

Handle to the reference value returned from SCardConnect.



pioSendPci

Pointer to the protocol header structure for the instruction.

This buffer is in the format of an SCARD_IO_REQUEST structure,

followed by the specific protocol control information.



pbSendBuffer

Pointer to the actual data to be written to the card.



cbSendLength

Count of bytes that represent the length of the pbSendBuffer parameter.





pioRecvPci

Pointer to the protocol header structure for the instruction, followed by a buffer in

which to receive any returned protocol control information (PCI) specific to the protocol in use.

This parameter may be NULL if no returned PCI is desired.



pbRecvBuffer

Pointer to any data returned from the card.



pcbRecvLength

Pointer to the length, in bytes, of the pbRecvBuffer parameter;

receives the actual number of bytes received from the smart card.





//===============이부분부터는 내가 코딩함===========//

// 델파이에서 정의함

Type

SCARD_IO_REQUEST = Record

// Protocol identifier

dwProtocol : Integer;

// Protocol Control Information Length

dbPciLength : Integer;

end;



Function SCardTransmit(

hCard : Longint;

var pioSendPci : SCARD_IO_REQUEST;

var pbSendBuffer : Byte;

cbSendLength : Longint;

var pioRecvPci : SCARD_IO_REQUEST;

var pbRecvBuffer : Byte;

pcbRecvLength : Longint

): Longint; stdcall; external 'winscard.dll';



Var

pioSendPci : SCARD_IO_REQUEST;

abyRecvBuffer : array[0..250] of BYTE;

abySelectFile : array[0..6] of BYTE;





// 호출하는 부분임

abySelectFile[0] := $00;

abySelectFile[1] := $A4;

abySelectFile[2] := $00;

abySelectFile[3] := $00;

abySelectFile[4] := $02;

abySelectFile[5] := $3F;

abySelectFile[6] := $00;

pioSendPci.dwProtocol := 1;

pioSendPci.dbPciLength := 8;



lngResult := SCardTransmit( lngCard,

pioSendPci,

abySelectFile[0],

7, // 보낼배열의 크기

pioSendPci,

abyRecvBuffer[0],

251); // 받을배열의 크기



// 델파이 호출부분과 윗 부분 선업부분의 파라메타 전달방식에 문제가 있는듯 한데

제 실력으로는 도저히 알 수가 없어서 델파이 박사 이신 "님들" 께 감히 이렇게

질문을 보내드립니다.

부디 시간을 내셔 주시면 감사드리겠습니다

0  COMMENTS