S
Hallo!!!
Ich versuche seit Tagen mit der SCard Dokumentation von Towitoko daten, aus einer I2C Memory Card auszulessen. Leider komme ich nicht weiter. Kann mir jemand helfen es ist sehr wichtig.
Danke!
TForm1 *Form1;
typedef DWORD (__stdcall *SCardCmd)(LPDWORD Handle,
LPCSTR Cmd, LPINT CmdLen,
LPCSTR DataIn, LPINT DataInLen,
LPCSTR DataOut, LPINT DataOutLen)
;
SCardCmd pSCardComand = NULL;
HANDLE hSCardDLL=NULL;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
hSCardDLL = LoadLibraryA("SCard32.dll");
if (hSCardDLL)
pSCardComand = (SCardCmd)GetProcAddress(hSCardDLL, "SCardComand");
}
//---------------------------------------------------------------------------
String CardRead(int address, int length)
{
String text, command, getAddress, getLength;
char outbuffer [120];
getAddress.sprintf("%d",address);
getLength.sprintf("%d",length);
String adr= String(getAddress) + "," + String(getLength);
char inbuffer [100];
strcpy(inbuffer,adr.c_str());
command = "Card,MemRead";//," + getAddress + "," + getLength;
int inLaenge =sizeof(inbuffer);
int outLaenge=sizeof(outbuffer);
SCardCmd(0, //Handle
command.c_str(), //Command
0, //Unverschlüsselt =NULL
inbuffer, //Zeiger Eingabedaten
&inLaenge, //0, //Länge der eingabe daten
outbuffer, //Zeiger auf den Buffer
&outLaenge); //Zeiger auf die Länge
text = outbuffer;
return text;
}
void __fastcall TForm1::Button1Click(TObject *Sender)
{
Caption=CardRead(0,10);
//CardCmd(hScardDLL, "Card,MemRead,0,10");
//SCardCmd(hScardDLL, "Card,MemRead,16,10");
//SCardCmd(hScardDLL, "Card,MemRead,32,12");
}