void VField::CleanField(vuint8* Data, const VFieldType& Type) { guard(CleanField); VFieldType IntType; int InnerSize; switch (Type.Type) { case TYPE_Reference: if (*(VObject**)Data && (*(VObject**)Data)->GetFlags() & _OF_CleanupRef) { *(VObject**)Data = NULL; } break; case TYPE_Delegate: if (((VObjectDelegate*)Data)->Obj && (((VObjectDelegate*)Data)->Obj->GetFlags() & _OF_CleanupRef)) { ((VObjectDelegate*)Data)->Obj = NULL; ((VObjectDelegate*)Data)->Func = NULL; } break; case TYPE_Struct: Type.Struct->CleanObject(Data); break; case TYPE_Array: IntType = Type; IntType.Type = Type.ArrayInnerType; InnerSize = IntType.GetSize(); for (int i = 0; i < Type.ArrayDim; i++) { CleanField(Data + i * InnerSize, IntType); } break; case TYPE_DynamicArray: { VScriptArray& A = *(VScriptArray*)Data; IntType = Type; IntType.Type = Type.ArrayInnerType; InnerSize = IntType.GetSize(); for (int i = 0; i < A.Num(); i++) { CleanField(A.Ptr() + i * InnerSize, IntType); } } break; } unguard; }
void Field::RefreshField() { for (int i=0; i<FIELD_SIZE; i++) { for (int j=FIELD_SIZE-1; j>=0; j--) { jewels[i][j]->setState(jsScored); } GenerateNewJewels(i); } CleanField(); }
void Field::FillField(bool first_time) { for (int i=0; i<FIELD_SIZE; i++) for (int j=FIELD_SIZE-1; j>=0; j--) { if (first_time) { jewels[i][j] = new Jewel(rand()%6); jewels[i][j]->setPosition( getCellPosition(i,j) ); jewels[i][j]->index = Point(i,j); addChild(jewels[i][j]); } else jewels[i][j]->Set(rand()%6); } CleanField(); }
int scdir( ) { SC_READER_INFO *ri; SC_CARD_INFO *ci; FieldPtr fld; FormPtr frm; int scerr=0; BYTE sprintb[80]; BYTE buffer[255]; int resplen; int ret; int i; LONG l; BOOLEAN bool1; WORD w1, w2; if( scInit() ) return(SCDIR_LIB_ERROR); ri = scGeneralNewReader( readerType, 1 ); if( ri==NULL ) { scEnd(); return(SCDIR_LIB_ERROR); } ci = scGeneralNewCard( ); if( ci==NULL ) { scGeneralFreeReader( &ri ); scEnd(); return(SCDIR_LIB_ERROR); }; /* Init Reader */ ret = scReaderInit( ri, "1" ); if( ret!=SC_EXIT_OK ) { scerr=SCDIR_READER_ERROR; goto exit; } /* Get Card Status */ ret = scReaderCardStatus( ri ); if( ret!=SC_EXIT_OK ) { scerr=SCDIR_READER_ERROR; goto exit; } if( !(ri->status&SC_CARD_STATUS_PRESENT) ) { scerr=SCDIR_NO_CARD; goto exit; } /* Activate Card */ ret = scReaderActivate( ri ); if(ret!=SC_EXIT_OK) { scerr=SCDIR_READER_ERROR; goto exit; } /* Reset Card */ ret= scReaderResetCard( ri, ci ); if(ret!=SC_EXIT_OK) { scerr=SCDIR_CARD_ERROR; goto exit; } /* Get Card Type */ ci->type=0; ret = scSmartcardGetCardType( ci ); if( (ret!=SC_EXIT_OK) && (ret!=SC_EXIT_NOT_SUPPORTED) ) { scerr=SCDIR_CARD_ERROR; goto exit; } frm = FrmGetActiveForm(); fld = FrmGetObjectPtr(frm, FrmGetObjectIndex(frm, dataFieldID)); CleanField( fld ); switch( ci->type ) { case SC_CARD_MULTIFLEX_3K: myprintf0( "Card: Schlumberger Multiflex 3K\n" ); break; case SC_CARD_MULTIFLEX_8K: myprintf0( "Card: Schlumberger Multiflex 8K\n" ); break; case SC_CARD_MULTIFLEX_8K_DES: myprintf0( "Card: Schlumberger Multiflex 8K (with Full DES option)\n" ); break; case SC_CARD_CRYPTOFLEX: myprintf0( "Card: Schlumberger Cryptoflex\n" ); break; case SC_CARD_CRYPTOFLEX_DES: myprintf0( "Card: Schlumberger Cryptoflex (with Full DES option)\n" ); break; case SC_CARD_CRYPTOFLEX_KEYGEN: myprintf0( "Card: Schlumberger Cryptoflex (with RSA key generation)\n" ); break; case SC_CARD_CYBERFLEX: myprintf0( "Card: Schlumberger Cyberflex\n" ); break; case SC_CARD_PAYFLEX_1K_USER: myprintf0( "Card: Schlumberger Payflex 1K User card\n" ); break; case SC_CARD_PAYFLEX_1K_SAM: myprintf0( "Card: Schlumberger Payflex 1K SAM\n" ); break; case SC_CARD_PAYFLEX_4K_USER: myprintf0( "Card: Schlumberger Payflex 4K User card\n" ); break; case SC_CARD_PAYFLEX_4K_SAM: myprintf0( "Card: Schlumberger Payflex 4K SAM\n" ); break; case SC_CARD_GPK4000_S: myprintf0( "Card: Gemplus GPK4000-s\n" ); break; case SC_CARD_GPK4000_SP: myprintf0( "Card: Gemplus GPK4000-sp\n" ); break; case SC_CARD_GPK4000_SDO: myprintf0( "Card: Gemplus GPK4000-sdo\n" ); break; case SC_CARD_GPK2000_S: myprintf0( "Card: Gemplus GPK2000-s\n" ); break; case SC_CARD_GPK2000_SP: myprintf0( "Card: Gemplus GPK2000-sp\n" ); break; case SC_CARD_MPCOS_EMV_1B: myprintf0( "Card: Gemplus EMV (1-Byte data units)\n" ); break; case SC_CARD_MPCOS_EMV_4B: myprintf0( "Card: Gemplus EMV (4-Byte data units)\n" ); break; case SC_CARD_GELDKARTE: myprintf0( "Card: Geldkarte\n" ); break; case SC_CARD_TCOS: myprintf0("Telesec TCOS 2 card\n"); break; case SC_CARD_TCOS_44: myprintf0("Telesec TCOS 2 card (SLE44)\n"); break; case SC_CARD_TCOS_66: myprintf0("Telesec TCOS 2 card (SLE66)\n"); break; case SC_CARD_BASICCARD: myprintf0( "Card: BasicCard\n" ); break; case SC_CARD_BASICCARD_COMP: myprintf0( "Card: Compact BasicCard\n" ); break; case SC_CARD_BASICCARD_ENH: myprintf0( "Card: Enhanced BasicCard\n" ); break; case SC_CARD_BRADESCO: myprintf0( "Card: Moeda Eletronica Bradesco\n" ); break; case SC_CARD_GSMSIM: myprintf0( "Card: GSM SIM card.\n" ); break; case SC_CARD_UNKNOWN: default: myprintf0( "Card: Unknown\n" ); } FldDrawField(fld); printarray( fld, "ATR:", ci->atrlen, ci->atr ); switch( ci->type ) { #ifdef WITH_MULTIFLEX case SC_CARD_MULTIFLEX_3K: case SC_CARD_MULTIFLEX_8K: case SC_CARD_MULTIFLEX_8K_DES: /* Select EF */ ret = scMultiflexCmdSelectFile( ri, ci, 0x0002, buffer, &resplen ); testretsw(SCDIR_CARD_ERROR,0x90,0x00); /* Read */ resplen=8; ret = scMultiflexCmdReadBinary( ri, ci, 0, buffer, &resplen ); testretsw(SCDIR_CARD_ERROR,0x90,0x00); printarray( fld, "Serial number:", resplen, buffer ); /* Select MF */ ret = scMultiflexCmdSelectFile( ri, ci, 0x3F00, buffer, &resplen ); testretsw(SCDIR_CARD_ERROR,0x90,0x00); myprintf0("Master File (3F00):\n"); i=(buffer[2]<<8)+buffer[3]; myprintf1(" Free: %d Bytes\n",i); i=buffer[14]; myprintf1(" Number of DFs: %d\n",i); i=buffer[15]; myprintf1(" Number of EFs: %d\n",i); i=buffer[16]; myprintf1(" Number of secret codes: %d\n",i); i=buffer[18]; myprintf1(" CHV status: %d\n",i); i=buffer[19]; myprintf1(" CHV unblocking key status: %d\n",i); FldDrawField(fld); break; #endif /* WITH_MULTIFLEX */ #ifdef WITH_CRYPTOFLEX case SC_CARD_CRYPTOFLEX: case SC_CARD_CRYPTOFLEX_DES: case SC_CARD_CRYPTOFLEX_KEYGEN: /* Select EF */ ret = scCryptoflexCmdSelectFile( ri, ci, 0x0002, buffer, &resplen ); testretsw(SCDIR_CARD_ERROR,0x90,0x00); /* Read */ resplen=8; ret = scCryptoflexCmdReadBinary( ri, ci, 0, buffer, &resplen ); testretsw(SCDIR_CARD_ERROR,0x90,0x00); printarray( fld, "Serial number:", resplen, buffer ); /* Select MF */ ret = scCryptoflexCmdSelectFile( ri, ci, 0x3F00, buffer, &resplen ); testretsw(SCDIR_CARD_ERROR,0x90,0x00); myprintf0("Master File (3F00):\n"); i=(buffer[2]<<8)+buffer[3]; myprintf1(" Free: %d Bytes\n",i); i=buffer[14]; myprintf1(" Number of DFs: %d\n",i); i=buffer[15]; myprintf1(" Number of EFs: %d\n",i); i=buffer[16]; myprintf1(" Number of secret codes: %d\n",i); i=buffer[18]; myprintf1(" CHV status: %d\n",i); i=buffer[19]; myprintf1(" CHV unblocking key status: %d\n",i); FldDrawField(fld); break; #endif /* WITH_CRYPTOFLEX */ #ifdef WITH_GPK4000 case SC_CARD_GPK4000_S: case SC_CARD_GPK4000_SP: case SC_CARD_GPK4000_SDO: /* Chip Serial Number */ ret = scGpk4000CmdGetInfo( ri, ci, SC_GPK4000_INFO_CHIP_SN, buffer, &resplen ); testretsw(SCDIR_CARD_ERROR,0x90,0x00); printarray( fld, "Chip serial number:", resplen, buffer ); /* Card Serial Number */ ret = scGpk4000CmdGetInfo( ri, ci, SC_GPK4000_INFO_CARD_SN, buffer, &resplen ); testretsw(SCDIR_CARD_ERROR,0x90,0x00); printarray( fld, "Card serial number:", resplen, buffer ); /* Issuer Serial Number */ ret = scGpk4000CmdGetInfo( ri, ci, SC_GPK4000_INFO_ISSUER_SN, buffer, &resplen ); testretsw(SCDIR_CARD_ERROR,0x90,0x00); printarray( fld, "Issuer serial number:", resplen, buffer ); /* Issuer Reference Number */ ret = scGpk4000CmdGetInfo( ri, ci, SC_GPK4000_INFO_ISSUER_REF, buffer, &resplen ); testretsw(SCDIR_CARD_ERROR,0x90,0x00); printarray( fld, "Issuer reference number:", resplen, buffer ); /* Pre-issuing data */ ret = scGpk4000CmdGetInfo( ri, ci, SC_GPK4000_INFO_PRE_ISSUING, buffer, &resplen ); testretsw(SCDIR_CARD_ERROR,0x90,0x00); printarray( fld, "Pre-issuing data:", resplen, buffer ); break; #endif /* WITH_GPK4000 */ #ifdef WITH_BASICCARD case SC_CARD_BASICCARD: case SC_CARD_BASICCARD_COMP: case SC_CARD_BASICCARD_ENH: /* State */ ret = scBasiccardCmdGetState( ri, ci, buffer, &bool1 ); testretsws(SCDIR_CARD_ERROR); switch( buffer[0] ) { case 0: myprintf0( "State: NEW\n" ); break; case 1: myprintf0( "State: LOAD\n" ); break; case 2: myprintf0( "State: TEST\n" ); break; case 3: myprintf0( "State: RUN\n" ); break; default: myprintf0(" State: Unknown\n" ); } FldDrawField(fld); if( (buffer[0]==SC_BASICCARD_STATE_NEW) || (buffer[0]==SC_BASICCARD_STATE_LOAD) ) { /* EEPROM Size */ ret = scBasiccardCmdEepromSize( ri, ci, &w1, &w2 ); testretsws(SCDIR_CARD_ERROR); myprintf0( "EEPROM:\n" ); myprintf1( " Start address: %lxh\n", (long)w1 ); myprintf1( " Size: %d\n", w2 ); } FldDrawField(fld); if( (buffer[0]==SC_BASICCARD_STATE_TEST) || (buffer[0]==SC_BASICCARD_STATE_RUN) ) { /* Application ID */ ret = scBasiccardCmdGetApplId( ri, ci, buffer, &resplen ); testretsws(SCDIR_CARD_ERROR); printarray( fld, "Application ID:", resplen, buffer ); } break; #endif /* WITH_BASICCARD */ #ifdef WITH_TCOS case SC_CARD_TCOS: case SC_CARD_TCOS_44: case SC_CARD_TCOS_66: /* Select EF(GDO) */ ret = scTcosCmdSelect( ri, ci, SC_TCOS_SELECT_ABS_PATH, 0, "\x2F\x02", 2, SC_TCOS_RDATA_FCI, buffer, &resplen ); testreturn(SCDIR_CARD_ERROR); if( ci->sw[0]==0x90 ) { /* Read */ resplen=0; ret = scTcosCmdReadBinary( ri, ci, 0, buffer, &resplen ); testretsw(SCDIR_CARD_ERROR,0x90,0x00); /* Should interpret the BER structure. */ printarray( fld, "Serial number:", buffer[1], (buffer+2) ); } /* Select EF(DIR) */ ret = scTcosCmdSelect( ri, ci, SC_TCOS_SELECT_ABS_PATH, 0, "\x2F\x00", 2, SC_TCOS_RDATA_FCI, buffer, &resplen ); testreturn(SCDIR_CARD_ERROR); if( ci->sw[0]==0x90 ) { /* Read */ resplen=0; ret = scTcosCmdReadBinary( ri, ci, 0, buffer, &resplen ); testretsw(SCDIR_CARD_ERROR,0x90,0x00); /* Should interpret the BER structure. */ printarray( fld, "AID:", buffer[1], (buffer+2) ); } break; #endif /* WITH_TCOS */ #ifdef WITH_GPK4000 case SC_CARD_BRADESCO: /* Card Serial Number */ ret = scGpk4000CmdGetInfo( ri, ci, SC_GPK4000_INFO_CARD_SN, buffer, &resplen ); testretsw(SCDIR_CARD_ERROR,0x90,0x00); printarray( fld, "Card serial number:", resplen, buffer ); /* Issuer Serial Number */ ret = scGpk4000CmdGetInfo( ri, ci, SC_GPK4000_INFO_ISSUER_SN, buffer, &resplen ); testretsw(SCDIR_CARD_ERROR,0x90,0x00); printarray( fld, "Issuer serial number:", resplen, buffer ); /* Issuer Reference Number */ ret = scGpk4000CmdGetInfo( ri, ci, SC_GPK4000_INFO_ISSUER_REF, buffer, &resplen ); testretsw(SCDIR_CARD_ERROR,0x90,0x00); printarray( fld, "Issuer reference number:", resplen, buffer ); /* Select DF */ ret = scGpk4000CmdSelFil( ri, ci, SC_GPK4000_SELECT_DF, 0x0200, NULL, 0, buffer, &resplen ); testretsw(SCDIR_CARD_ERROR,0x90,0x00); /* Read Binary */ resplen = 6; ret = scGpk4000CmdRdBin( ri, ci, 0x8100, buffer, &resplen ); testretsw(SCDIR_CARD_ERROR,0x90,0x00); myprintf1("Account: %hd/", (buffer[0]<<8)+buffer[1] ); myprintf1("%ld\n", ((long)buffer[2]<<24)+((long)buffer[3]<<16)+((long)buffer[4]<<8)+buffer[5]); FldDrawField(fld); /* Read Binary */ resplen = 3; ret = scGpk4000CmdRdBin( ri, ci, 0x8202, buffer, &resplen ); testretsw(SCDIR_CARD_ERROR,0x90,0x00); l=((long)buffer[0]<<16)+((long)buffer[1]<<8)+buffer[2]; myprintf1("Balance: R$ %ld.", (long) l/100 ); myprintf1("%hd", (short) (l/10)%10 ); myprintf1("%hd\n", (short) l%10 ); FldDrawField(fld); break; #endif /* WITH_GPK4000 */ default: break; } #ifdef WITH_GELDKARTE if( ci->type==SC_CARD_GELDKARTE ) { /* EF_ID */ /* Select MF */ ret = scGeldkarteCmdSelectFile( ri, ci, SC_GELDKARTE_SELECT_MF, 0, NULL, 0, SC_GELDKARTE_SELRESP_NONE, buffer, &resplen ); testretsw(SCDIR_CARD_ERROR,0x90,0x00); /* Select EF */ ret = scGeldkarteCmdSelectFile( ri, ci, SC_GELDKARTE_SELECT_EF, 0x0003, NULL, 0, SC_GELDKARTE_SELRESP_NONE, buffer, &resplen ); testretsw(SCDIR_CARD_ERROR,0x90,0x00); /* Read Record */ resplen = 22; ret = scGeldkarteCmdReadRecord( ri, ci, 1, SC_GELDKARTE_READREC_SELECTED, 0, buffer, &resplen ); testretsw(SCDIR_CARD_ERROR,0x90,0x00); printarray2(fld,"Karteninstitut: ", 3, (buffer+1) ); printarray2(fld,"Kartennummer: ", 5, (buffer+4) ); myprintf0("Aktivierungsdatum: "); printbyte(buffer[14]); myprintf0("/"); printbyte(buffer[13]); myprintf0("/"); printbyte(buffer[12]); myprintf0("\nVerfallsdatum: "); printbyte(buffer[11]); myprintf0("/"); printbyte(buffer[10]); myprintf0("\nLand: "); printbyte(buffer[15]); printbyte(buffer[16]); myprintf3("\nWaehrung: %c%c%c\n", buffer[17], buffer[18], buffer[19] ); /* EF_VERSION */ /* Select MF */ ret = scGeldkarteCmdSelectFile( ri, ci, SC_GELDKARTE_SELECT_MF, 0, NULL, 0, SC_GELDKARTE_SELRESP_NONE, buffer, &resplen ); testretsw(SCDIR_CARD_ERROR,0x90,0x00); /* Select EF */ ret = scGeldkarteCmdSelectFile( ri, ci, SC_GELDKARTE_SELECT_EF, 0x0017, NULL, 0, SC_GELDKARTE_SELRESP_NONE, buffer, &resplen ); testreturn(SCDIR_CARD_ERROR); if( ci->sw[0]==0x90 ) { /* Read Record */ resplen = 8; ret = scGeldkarteCmdReadRecord( ri, ci, 1, SC_GELDKARTE_READREC_SELECTED, 0, buffer, &resplen ); testretsw(SCDIR_CARD_ERROR,0x90,0x00); printarray(fld,"Version:", 8, buffer ); } /* Select Application */ ret = scGeldkarteCmdSelectFile( ri, ci, SC_GELDKARTE_SELECT_AID, 0, "\xD2\x76\x00\x00\x25\x45\x50\x01\x00", 9, SC_GELDKARTE_SELRESP_NONE, buffer, &resplen ); testretsw(SCDIR_CARD_ERROR,0x90,0x00); /* EF_BETRAG */ /* Read Record */ resplen = 9; ret = scGeldkarteCmdReadRecord( ri, ci, 1, SC_GELDKARTE_READREC_SFID, 0x18, buffer, &resplen ); testretsw(SCDIR_CARD_ERROR,0x90,0x00); myprintf0("Betrag: "); printbyte(buffer[0]); printbyte(buffer[1]); myprintf0("."); printbyte(buffer[2]); myprintf0("\nMax. Betrag: "); printbyte(buffer[3]); printbyte(buffer[4]); myprintf0("."); printbyte(buffer[5]); myprintf0("\nMax. Transaktion: "); printbyte(buffer[6]); printbyte(buffer[7]); myprintf0("."); printbyte(buffer[8]); myprintf0("\n"); /* EF_BOeRSE */ /* Read Record */ resplen = 27; ret = scGeldkarteCmdReadRecord( ri, ci, 1, SC_GELDKARTE_READREC_SFID, 0x19, buffer, &resplen ); testretsw(SCDIR_CARD_ERROR,0x90,0x00); switch( buffer[0] ) { case 0x00: myprintf0("Kartentyp: Geldkarte\n"); break; case 0xFF: myprintf0("Kartentyp: Wertkarte\n"); break; default: myprintf0("Kartentyp: unknown\n"); break; } myprintf0("Boersenverrechnungskonto:\n"); printarray2(fld," BLZ: ", 4, (buffer+1) ); printarray2(fld," Kontonummer: ", 5, (buffer+5) ); /* EF_LSEQ */ /* Read Record */ resplen = 2; ret = scGeldkarteCmdReadRecord( ri, ci, 1, SC_GELDKARTE_READREC_SFID, 0x1A, buffer, &resplen ); testretsw(SCDIR_CARD_ERROR,0x90,0x00); w1=((WORD)buffer[0]<<8)+buffer[1]-1; myprintf1("Ladevorgaenge: %hd\n", w1 ); /* EF_LBEQ */ /* Read Record */ resplen = 2; ret = scGeldkarteCmdReadRecord( ri, ci, 1, SC_GELDKARTE_READREC_SFID, 0x1B, buffer, &resplen ); testretsw(SCDIR_CARD_ERROR,0x90,0x00); w1=((WORD)buffer[0]<<8)+buffer[1]-1; myprintf1("Abbuchungen: %hd\n", w1 ); /* EF_LLOG */ myprintf0("Lade-/Entladevorgaenge:\n"); for( i=1; i<4; i++ ) { /* Read Record */ resplen = 33; ret = scGeldkarteCmdReadRecord( ri, ci, (BYTE)i, SC_GELDKARTE_READREC_SFID, 0x1C, buffer, &resplen ); if( (ret!=SC_EXIT_OK) || (ci->sw[0]!=0x90) ) break; if( buffer[0]==0x00 ) { break; } myprintf1("%d)\n", i ); myprintf0(" Vorgang: "); switch( buffer[0] ) { case 0x01: case 0x03: myprintf0("Laden einleiten\n"); break; case 0x05: case 0x07: myprintf0("Laden einleiten wiederholen\n"); break; case 0x10: case 0x11: case 0x12: case 0x13: case 0x14: case 0x15: case 0x16: case 0x17: myprintf0("Laden\n"); break; case 0x21: myprintf0("Entladen einleiten\n"); break; case 0x25: myprintf0("Endladen einleiten wiederholen\n"); break; case 0x30: case 0x31: case 0x34: case 0x35: myprintf0("Entladen\n"); break; default: myprintf0("Unbekannt\n"); break; } w1=((WORD)buffer[1]<<8)+buffer[2]; myprintf1(" Ladevorgang: %hd\n", w1 ); w1=((WORD)buffer[31]<<8)+buffer[32]; myprintf1(" Abbuchungen: %hd\n", w1 ); myprintf0(" Betrag: "); printbyte(buffer[4]); printbyte(buffer[5]); myprintf0("."); printbyte(buffer[6]); printarray2(fld,"\n Terminal-ID:", 8, (buffer+13) ); printarray2(fld," Terminal-Sequenznummer:", 3, (buffer+21) ); if( buffer[26]!=0x00 ) { myprintf0(" Datum: "); printbyte(buffer[27]); myprintf0("/"); printbyte(buffer[26]); myprintf0("/"); printbyte(buffer[24]); printbyte(buffer[25]); myprintf0("\n"); } if( !( (buffer[28]==0x00) && (buffer[29]==0x00) && (buffer[30]==0x00) ) ) { myprintf0(" Uhrzeit: "); printbyte(buffer[28]); myprintf0(":"); printbyte(buffer[29]); myprintf0(":"); printbyte(buffer[30]); myprintf0("\n"); } } /* EF_BLOG */ myprintf0("Ab-/Rueckbuchungen:\n"); for( i=1; i<16; i++ ) { /* Read Record */ resplen = 37; ret = scGeldkarteCmdReadRecord( ri, ci, (BYTE)i, SC_GELDKARTE_READREC_SFID, 0x1D, buffer, &resplen ); if( (ret!=SC_EXIT_OK) || (ci->sw[0]!=0x90) ) break; if( buffer[0]==0x00 ) { break; } myprintf1("%d)\n", i ); myprintf0(" Vorgang: "); switch( buffer[0] ) { case 0x50: case 0x51: myprintf0("Abbuchen\n"); break; case 0x70: case 0x71: myprintf0("Rueckbuchen\n"); break; default: myprintf0("Unbekannt\n"); break; } w1=((WORD)buffer[1]<<8)+buffer[2]; myprintf1(" Abbuchung: %hd\n", w1 ); w1=((WORD)buffer[3]<<8)+buffer[4]; myprintf1(" Ladevorgaenge: %hd\n", w1 ); myprintf0(" Betrag: "); printbyte(buffer[5]); printbyte(buffer[6]); myprintf0("."); printbyte(buffer[7]); printarray2(fld,"\n Haendlerkartennummer:", 10, (buffer+8) ); myprintf1(" Haendlersequenznummer: %ld\n", ((LONG)buffer[18]<<24)+((LONG)buffer[19]<<16)+ ((LONG)buffer[20]<<8)+buffer[21] ); myprintf1(" Haendlersummensequenznummer: %ld\n", ((LONG)buffer[22]<<24)+((LONG)buffer[23]<<16)+ ((LONG)buffer[24]<<8)+buffer[25] ); if( buffer[31]!=0x00 ) { myprintf0(" Datum: "); printbyte(buffer[32]); myprintf0("/"); printbyte(buffer[31]); myprintf0("/"); printbyte(buffer[29]); printbyte(buffer[30]); myprintf0("\n"); } if( !( (buffer[33]==0x00) && (buffer[34]==0x00) && (buffer[35]==0x00) ) ) { myprintf0(" Uhrzeit: "); printbyte(buffer[33]); myprintf0(":"); printbyte(buffer[34]); myprintf0(":"); printbyte(buffer[35]); myprintf0("\n"); } } } #endif /* WITH_GELDKARTE */ #ifdef WITH_GSMSIM if( ci->type==SC_CARD_GSMSIM ) { /* ICCID */ /* Select */ ret = scGsmsimCmdSelect( ri, ci, 0x2FE2, buffer, &resplen ); if( (ret==0) && (ci->sw[0]==0x90) && (ci->sw[1]==0x00) ) { /* Read Binary */ resplen=10; ret = scGsmsimCmdReadBin( ri, ci, 0, buffer, &resplen ); if( (ret==0) && (ci->sw[0]==0x90) && (ci->sw[1]==0x00) ) printarray2( fld, "ICCID:", resplen, buffer ); } } #endif /* WITH_GSMSIM */ exit: scReaderDeactivate( ri ); scReaderShutdown( ri ); scGeneralFreeCard( &ci ); scGeneralFreeReader( &ri ); scEnd(); return(scerr); }