int FixChkSum(ECU_info* dllECUinfo) { unsigned int FindOffset, HexCount ; unsigned char HexBytes1[]= {0x00, 0x00, 0x80, 0x00, 0xFD, 0x5E, 0x80, 0x00, 0x00, 0x80, 0x80, 0x00, 0xFF, 0xFB, 0x80, 0x00}; unsigned char HexBytes2[]= {0x00, 0x00, 0x80, 0x00, 0xFF, 0x5F, 0x80, 0x00, 0x00, 0x80, 0x80, 0x00, 0xFF, 0xFB, 0x80, 0x00}; HexCount=16; DWORD Buffer= (DWORD)dllECUinfo->EcuBuffer; //Распознаем ECU if (dllECUinfo->EcuFileSize!=ECUFILESIZE) { return 0; } FindOffset=FindHexStr(0, dllECUinfo->EcuFileSize, (unsigned char*)Buffer , HexBytes1, HexCount); if (FindOffset==0xFFFFFFFF) { FindOffset=FindHexStr(0, dllECUinfo->EcuFileSize, (unsigned char*)Buffer , HexBytes2, HexCount); if (FindOffset==0xFFFFFFFF) { return 0; } } if (!FindFixCRC(dllECUinfo, 1)) { return 0; } return dllECUinfo->BadChkSumNumber; }
int RecogniseECU (ECU_info* dllECUinfo) { unsigned int i, s_crc, FindOffset, HexCount ; char* FileDescr="HYUNDAY Bosch M7.9.7"; // char cf_crc[30]; unsigned char HexBytes1[]= {0x00, 0x00, 0x80, 0x00, 0xFD, 0x5E, 0x80, 0x00, 0x00, 0x80, 0x80, 0x00, 0xFF, 0xFB, 0x80, 0x00}; unsigned char HexBytes2[]= {0x00, 0x00, 0x80, 0x00, 0xFF, 0x5F, 0x80, 0x00, 0x00, 0x80, 0x80, 0x00, 0xFF, 0xFB, 0x80, 0x00}; HexCount=16; DWORD Buffer= (DWORD)dllECUinfo->EcuBuffer; //Распознаем ECU if (dllECUinfo->EcuFileSize!=ECUFILESIZE) { return 0; } FindOffset=FindHexStr(0, dllECUinfo->EcuFileSize, (unsigned char*)Buffer , HexBytes1, HexCount); if (FindOffset==0xFFFFFFFF) { FindOffset=FindHexStr(0, dllECUinfo->EcuFileSize, (unsigned char*)Buffer , HexBytes2, HexCount); if (FindOffset==0xFFFFFFFF) { return 0; } } if (!FindFixCRC(dllECUinfo, 0)) { return 0; } /* for (i = 0; i < dllECUinfo->EcuFileSize; i++) { f_crc+= *(unsigned char*)(Buffer+i); } */ StringCbLength(FileDescr, 50, &s_crc); StringCbCopyN (dllECUinfo->ECU_Descr, 100, FileDescr, s_crc); /* IntToChar (f_crc, cf_crc); StringCbLength(cf_crc, 50, &s_crc); StringCbCatN (dllECUinfo->ECU_Descr, 100, cf_crc, s_crc+1 ); */ /* FindOffset=FindHexStr(0, dllECUinfo->EcuFileSize, (unsigned char*)Buffer , HexBytes, HexCount); f_crc=SummInt8(0, dllECUinfo->EcuFileSize-1, (unsigned char*)Buffer ); s_crc=SummInt16Intel(0, dllECUinfo->EcuFileSize-1, (unsigned char*)Buffer ); s_crc=SummInt16Mot(0, dllECUinfo->EcuFileSize-1, (unsigned char*)Buffer ); */ return 1; }
int RecogniseECU (ECU_info* dllECUinfo) { unsigned int i, s_crc, FindOffset, HexCount1, HexCount2, HexCount3 ; char* FileDescr="VAG Bosch MED9.5"; unsigned char HexBytes1[]={0xA1, 0x86, 0x00, 0x00, 0x7C, 0xA5, 0x62, 0x14, 0xA1, 0x66, 0x00, 0x02, 0x7C, 0xA5, 0x5A, 0x14, 0x38, 0xC6, 0x00, 0x04, 0x7C, 0x06, 0x20, 0x40, 0x41, 0x80, 0xFF, 0xE8, 0x7C, 0xA3, 0x2B, 0x78 }; unsigned char HexBytes2[]={0x7D, 0x84, 0x28, 0xAE, 0x7D, 0x63, 0x28, 0xAE, 0x7C, 0x0C, 0x58, 0x00, 0x41, 0x82, 0x00, 0x18 }; HexCount1=32; HexCount2=16; DWORD Buffer= (DWORD)dllECUinfo->EcuBuffer; //Recognise ECU if (dllECUinfo->EcuFileSize!=ECUFILESIZE) { return 0; } FindOffset=FindHexStr(0, dllECUinfo->EcuFileSize, (unsigned char*)Buffer , HexBytes1, HexCount1); if (FindOffset==0xFFFFFFFF) { return 0; } FindOffset=FindHexStr(0, dllECUinfo->EcuFileSize, (unsigned char*)Buffer , HexBytes2, HexCount2); if (FindOffset==0xFFFFFFFF) { return 0; } if (!FindFixCRC(dllECUinfo, 0)) { return 0; } StringCbLength(FileDescr, 50, &s_crc); StringCbCopyN (dllECUinfo->ECU_Descr, 100, FileDescr, s_crc); return 1; }
int FixChkSum(ECU_info* dllECUinfo) { unsigned int FindOffset, HexCount1, HexCount2, HexCount3; unsigned char HexBytes1[]={0xA1, 0x86, 0x00, 0x00, 0x7C, 0xA5, 0x62, 0x14, 0xA1, 0x66, 0x00, 0x02, 0x7C, 0xA5, 0x5A, 0x14, 0x38, 0xC6, 0x00, 0x04, 0x7C, 0x06, 0x20, 0x40, 0x41, 0x80, 0xFF, 0xE8, 0x7C, 0xA3, 0x2B, 0x78 }; unsigned char HexBytes2[]={0x7D, 0x84, 0x28, 0xAE, 0x7D, 0x63, 0x28, 0xAE, 0x7C, 0x0C, 0x58, 0x00, 0x41, 0x82, 0x00, 0x18 }; HexCount1=32; HexCount2=16; DWORD Buffer= (DWORD)dllECUinfo->EcuBuffer; //Recognise ECU if (dllECUinfo->EcuFileSize!=ECUFILESIZE) { return 0; } FindOffset=FindHexStr(0, dllECUinfo->EcuFileSize, (unsigned char*)Buffer , HexBytes1, HexCount1); if (FindOffset==0xFFFFFFFF) { return 0; } FindOffset=FindHexStr(0, dllECUinfo->EcuFileSize, (unsigned char*)Buffer , HexBytes2, HexCount2); if (FindOffset==0xFFFFFFFF) { return 0; } if (!FindFixCRC(dllECUinfo, 1)) { return 0; } return dllECUinfo->BadChkSumNumber; }