v1.1.5 - checksum in definition, extract bin fpm

This commit is contained in:
Bouletmarc 2022-05-16 01:05:31 -04:00 committed by GitHub
parent a0bce9eaff
commit 9f617270e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 713 additions and 303 deletions

View File

@ -1173,7 +1173,7 @@ internal class ClassEditor
for (int i = 0; i < AllLines.Length; i++) for (int i = 0; i < AllLines.Length; i++)
{ {
string Thisline = AllLines[i]; string Thisline = AllLines[i];
if (Thisline.Contains("ROM Parameters")) GettingEcuList = false; //make sure we are not reading false contents if (Thisline.Contains("ROM Parameters") || Thisline.Contains("Checksum ")) GettingEcuList = false; //make sure we are not reading false contents
if (Thisline[0] != '#' && Thisline != "") if (Thisline[0] != '#' && Thisline != "")
{ {
@ -1281,7 +1281,7 @@ internal class ClassEditor
for (int i = 0; i < AllLines.Length; i++) for (int i = 0; i < AllLines.Length; i++)
{ {
string Thisline = AllLines[i]; string Thisline = AllLines[i];
if (Thisline.Contains("ROM Parameters")) GettingEcuList = false; //make sure we are not reading false contents if (Thisline.Contains("ROM Parameters") || Thisline.Contains("Checksum ")) GettingEcuList = false; //make sure we are not reading false contents
if (Thisline.Contains("THIS FILE AS BEEN GENERATED")) IsFileGenerated = true; if (Thisline.Contains("THIS FILE AS BEEN GENERATED")) IsFileGenerated = true;

View File

@ -215,7 +215,7 @@ public class Class_DefinitionMaker
{ {
if (BufECUName != "") CreateFile(AllStringFile, BufECUName); if (BufECUName != "") CreateFile(AllStringFile, BufECUName);
BufECUName = AllECUS[i]; BufECUName = AllECUS[i];
AllStringFile = GenerateNewHeader(BufECUName, new List<string>()); AllStringFile = GenerateNewHeader(BufECUName, new List<string>(), "0x8400");
//Console.WriteLine(AllECUS[i] + " | 0x" + AllFoundAddress[i].ToString("X") + " | " + AllFoundFunctions[i]); //Console.WriteLine(AllECUS[i] + " | 0x" + AllFoundAddress[i].ToString("X") + " | " + AllFoundFunctions[i]);
} }
@ -349,7 +349,7 @@ public class Class_DefinitionMaker
GForm_Main_0.method_1("File saved:" + DirectoryPath + @"\" + ThisFile + ".txt"); GForm_Main_0.method_1("File saved:" + DirectoryPath + @"\" + ThisFile + ".txt");
} }
private string GenerateNewHeader(string ThisEECU, List<string> AllEcuCompatible) private string GenerateNewHeader(string ThisEECU, List<string> AllEcuCompatible, string ChecksumLocation)
{ {
string ReturnStr = ""; string ReturnStr = "";
ReturnStr = ReturnStr + "#######################################################################" + Environment.NewLine; ReturnStr = ReturnStr + "#######################################################################" + Environment.NewLine;
@ -364,6 +364,15 @@ public class Class_DefinitionMaker
{ {
for (int i = 0; i < AllEcuCompatible.Count; i++) ReturnStr = ReturnStr + AllEcuCompatible[i] + Environment.NewLine; for (int i = 0; i < AllEcuCompatible.Count; i++) ReturnStr = ReturnStr + AllEcuCompatible[i] + Environment.NewLine;
} }
//###############################
if (ChecksumLocation != "")
{
ReturnStr = ReturnStr + "#######################################################################" + Environment.NewLine;
ReturnStr = ReturnStr + "# Checksum Address Location:" + Environment.NewLine;
ReturnStr = ReturnStr + "#######################################################################" + Environment.NewLine;
ReturnStr = ReturnStr + "ChecksumAddress:" + ChecksumLocation + Environment.NewLine;
}
//###############################
ReturnStr = ReturnStr + "#######################################################################" + Environment.NewLine; ReturnStr = ReturnStr + "#######################################################################" + Environment.NewLine;
ReturnStr = ReturnStr + "#######################################################################" + Environment.NewLine; ReturnStr = ReturnStr + "#######################################################################" + Environment.NewLine;
ReturnStr = ReturnStr + "#######################################################################" + Environment.NewLine; ReturnStr = ReturnStr + "#######################################################################" + Environment.NewLine;
@ -530,15 +539,19 @@ public class Class_DefinitionMaker
List<bool> AllTableReadOnly = new List<bool>(); List<bool> AllTableReadOnly = new List<bool>();
List<bool> AllTableUntested = new List<bool>(); List<bool> AllTableUntested = new List<bool>();
List<string> AllIndexName = new List<string>();
List<string> AllIndexShortName = new List<string>();
List<string> AllIndexLocations = new List<string>();
string CurrentParam = ""; string CurrentParam = "";
//string ThisECUName = ""; //string ThisECUName = "";
int ParamCount = 0; int ParamCount = 0;
int TableCount = 0; int TableCount = 0;
List<string> AllEcuCompatible = new List<string>(); List<string> AllEcuCompatible = new List<string>();
int NumberOfEcus = 0; int NumberOfEcus = 0;
string ChecksumLocation = "";
//######################################### //#########################################
//FileName=RDX-RWC-A620 NumBinaries
if (AllLines[2].Contains("NumBinaries=")) if (AllLines[2].Contains("NumBinaries="))
{ {
NumberOfEcus = int.Parse(AllLines[2].Split('=')[1]); NumberOfEcus = int.Parse(AllLines[2].Split('=')[1]);
@ -571,7 +584,9 @@ public class Class_DefinitionMaker
IndexCount=53 IndexCount=53
TableCount=49 TableCount=49
ChecksumAddress=0x001FFFFA ChecksumAddress=0x001FFFFA
ChecksumAddress=0x00008400*/ ChecksumAddress=0x00008400
ChecksumAddress=0x001FFFFA*/
if (ChecksumLocation == "") if(AllLines[i].Contains("ChecksumAddress=")) ChecksumLocation = AllLines[i].Split('=')[1];
if (AllLines[i].Contains("ParameterCount=")) ParamCount = int.Parse(AllLines[i].Split('=')[1]); if (AllLines[i].Contains("ParameterCount=")) ParamCount = int.Parse(AllLines[i].Split('=')[1]);
if (AllLines[i].Contains("TableCount=") && !AllLines[i].Contains("DevTableCount")) TableCount = int.Parse(AllLines[i].Split('=')[1]); if (AllLines[i].Contains("TableCount=") && !AllLines[i].Contains("DevTableCount")) TableCount = int.Parse(AllLines[i].Split('=')[1]);
@ -625,6 +640,10 @@ public class Class_DefinitionMaker
AllParamReadOnly.RemoveAt(AllParamReadOnly.Count - 1); AllParamReadOnly.RemoveAt(AllParamReadOnly.Count - 1);
AllParamUntested.RemoveAt(AllParamUntested.Count - 1); AllParamUntested.RemoveAt(AllParamUntested.Count - 1);
} }
else
{
GForm_Main_0.method_1("Added parameter: " + AllParamName[AllParamName.Count - 1]);
}
} }
catch catch
{ {
@ -697,10 +716,18 @@ public class Class_DefinitionMaker
if (IssueEncountered) if (IssueEncountered)
{ {
AllParamName.RemoveAt(AllParamName.Count - 1); AllTableName.RemoveAt(AllTableName.Count - 1);
AllParamLocations.RemoveAt(AllParamLocations.Count - 1); AllTableLocations.RemoveAt(AllTableLocations.Count - 1);
AllParamReadOnly.RemoveAt(AllParamReadOnly.Count - 1); AllColCount.RemoveAt(AllColCount.Count - 1);
AllParamUntested.RemoveAt(AllParamUntested.Count - 1); AllRowCount.RemoveAt(AllRowCount.Count - 1);
AllTableLocationsX.RemoveAt(AllTableLocationsX.Count - 1);
AllTableLocationsY.RemoveAt(AllTableLocationsY.Count - 1);
AllTableReadOnly.RemoveAt(AllTableReadOnly.Count - 1);
AllTableUntested.RemoveAt(AllTableUntested.Count - 1);
}
else
{
GForm_Main_0.method_1("Added table: " + AllTableName[AllTableName.Count - 1]);
} }
} }
catch catch
@ -718,6 +745,70 @@ public class Class_DefinitionMaker
} }
} }
} }
//########################
if (AllLines[i].Contains("[Index"))
{
//AllIndexName
//AllIndexLocations
if (AllLines[i] != CurrentParam)
{
CurrentParam = AllLines[i];
bool DoneThisParameter = false;
try
{
string ParamNamee = AllLines[i + 2].Split('=')[1];
for (int i2 = 0; i2 < AllIndexName.Count; i2++) if (AllIndexName[i2] == ParamNamee) DoneThisParameter = true;
}
catch
{
DoneThisParameter = true;
}
if (!DoneThisParameter)
{
AllIndexName.Add("");
AllIndexShortName.Add("");
AllIndexLocations.Add("");
try
{
AllIndexName[AllIndexName.Count - 1] = AllLines[i + 2].Split('=')[1];
AllIndexShortName[AllIndexShortName.Count - 1] = AllLines[i + 5].Split('=')[1];
AllIndexLocations[AllIndexLocations.Count - 1] = AllLines[i + 6].Split('=')[1];
// XXX index
AllIndexName[AllIndexName.Count - 1] = AllIndexName[AllIndexName.Count - 1].Replace(" " + AllIndexShortName[AllIndexShortName.Count - 1], "");
AllIndexName[AllIndexName.Count - 1] = AllIndexName[AllIndexName.Count - 1].Replace(" index", "");
//Check for issues
bool IssueEncountered = false;
if (!AllIndexLocations[AllIndexLocations.Count - 1].Contains("0x")) IssueEncountered = true;
if (AllIndexLocations[AllIndexLocations.Count - 1] == "0") IssueEncountered = true;
if (AllIndexName[AllIndexName.Count - 1].Contains("0x")) IssueEncountered = true;
if (IssueEncountered)
{
AllIndexName.RemoveAt(AllIndexName.Count - 1);
AllIndexShortName.RemoveAt(AllIndexShortName.Count - 1);
AllIndexLocations.RemoveAt(AllIndexLocations.Count - 1);
}
else
{
GForm_Main_0.method_1("Added index: " + AllIndexName[AllIndexName.Count - 1]);
}
}
catch
{
//issue extracing parameters, remove from list to avoid issue creating definition
AllIndexName.RemoveAt(AllIndexName.Count - 1);
AllIndexShortName.RemoveAt(AllIndexShortName.Count - 1);
AllIndexLocations.RemoveAt(AllIndexLocations.Count - 1);
}
}
}
}
//########################
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -725,6 +816,17 @@ public class Class_DefinitionMaker
} }
} }
//ChecksumAddress = 0x001FFFFA
//ChecksumAddress = 0x00008400
//ChecksumAddress = 0x001FFFFA
if (ChecksumLocation != "")
{
ChecksumLocation = ChecksumLocation.Replace("0x00", "0x");
ChecksumLocation = ChecksumLocation.Replace("0x00", "0x");
GForm_Main_0.method_1("Checksum address: " + ChecksumLocation);
}
//Check Counts //Check Counts
GForm_Main_0.method_1("Parameters existing in FPM: " + ParamCount); GForm_Main_0.method_1("Parameters existing in FPM: " + ParamCount);
GForm_Main_0.method_1("Parameters extracted: " + AllParamName.Count); GForm_Main_0.method_1("Parameters extracted: " + AllParamName.Count);
@ -733,13 +835,22 @@ public class Class_DefinitionMaker
//string SavingStr = GenerateNewHeader(ThisECUName); //string SavingStr = GenerateNewHeader(ThisECUName);
string SavingStr = GenerateNewHeader("", AllEcuCompatible); string SavingStr = GenerateNewHeader("", AllEcuCompatible, ChecksumLocation);
for (int i = 0; i < AllParamName.Count; i++) for (int i = 0; i < AllParamName.Count; i++)
{ {
SavingStr = SavingStr + "ROMLocationTable:" + AllParamLocations[i] + Environment.NewLine; SavingStr = SavingStr + "ROMLocationTable:" + AllParamLocations[i] + Environment.NewLine;
SavingStr = SavingStr + "Name:" + AllParamName[i] + Environment.NewLine; SavingStr = SavingStr + "Name:" + AllParamName[i] + Environment.NewLine;
SavingStr = SavingStr + "TableSize:1x1" + Environment.NewLine; SavingStr = SavingStr + "TableSize:1x1" + Environment.NewLine;
SavingStr = SavingStr + "IsSingleByteTable:true" + Environment.NewLine; SavingStr = SavingStr + "IsSingleByteTable:true" + Environment.NewLine;
for (int m = 0; m < AllIndexName.Count; m++)
{
if (AllIndexName[m].ToLower() == AllParamName[i].ToLower())
{
SavingStr = SavingStr + "ROMLocationY:" + AllIndexLocations[m] + Environment.NewLine;
SavingStr = SavingStr + "Unit1:" + AllIndexShortName[m] + Environment.NewLine;
m = AllIndexName.Count;
}
}
SavingStr = SavingStr + "IsNotDefined:true" + Environment.NewLine; SavingStr = SavingStr + "IsNotDefined:true" + Environment.NewLine;
if (AllParamReadOnly[i]) SavingStr = SavingStr + "IsReadOnly:true" + Environment.NewLine; if (AllParamReadOnly[i]) SavingStr = SavingStr + "IsReadOnly:true" + Environment.NewLine;
if (AllParamUntested[i]) SavingStr = SavingStr + "IsUntested:true" + Environment.NewLine; if (AllParamUntested[i]) SavingStr = SavingStr + "IsUntested:true" + Environment.NewLine;
@ -760,6 +871,15 @@ public class Class_DefinitionMaker
SavingStr = SavingStr + "ValueMin:-32768" + Environment.NewLine; SavingStr = SavingStr + "ValueMin:-32768" + Environment.NewLine;
SavingStr = SavingStr + "ValueMax:32768" + Environment.NewLine; SavingStr = SavingStr + "ValueMax:32768" + Environment.NewLine;
//SavingStr = SavingStr + "IsSingleByteTable:true" + Environment.NewLine; //SavingStr = SavingStr + "IsSingleByteTable:true" + Environment.NewLine;
for (int m = 0; m < AllIndexName.Count; m++)
{
if (AllIndexName[m].ToLower() == AllTableName[i].ToLower())
{
SavingStr = SavingStr + "ROMLocationY:" + AllIndexLocations[m] + Environment.NewLine;
SavingStr = SavingStr + "Unit1:" + AllIndexShortName[m] + Environment.NewLine;
m = AllIndexName.Count;
}
}
SavingStr = SavingStr + "IsNotDefined:true" + Environment.NewLine; SavingStr = SavingStr + "IsNotDefined:true" + Environment.NewLine;
if (AllTableReadOnly[i]) SavingStr = SavingStr + "IsReadOnly:true" + Environment.NewLine; if (AllTableReadOnly[i]) SavingStr = SavingStr + "IsReadOnly:true" + Environment.NewLine;
if (AllTableUntested[i]) SavingStr = SavingStr + "IsUntested:true" + Environment.NewLine; if (AllTableUntested[i]) SavingStr = SavingStr + "IsUntested:true" + Environment.NewLine;
@ -797,7 +917,7 @@ public class Class_DefinitionMaker
public static extern IntPtr OpenProcess(int dwDesiredAccess, bool bInheritHandle, int dwProcessId); public static extern IntPtr OpenProcess(int dwDesiredAccess, bool bInheritHandle, int dwProcessId);
[DllImport("kernel32.dll")] [DllImport("kernel32.dll")]
public static extern bool ReadProcessMemory(int hProcess, int lpBaseAddress, byte[] lpBuffer, int dwSize, ref int lpNumberOfBytesRead); public static extern bool ReadProcessMemory(int hProcess, uint lpBaseAddress, byte[] lpBuffer, int dwSize, ref int lpNumberOfBytesRead);
[DllImport("kernel32.dll")] [DllImport("kernel32.dll")]
static extern void GetSystemInfo(out SYSTEM_INFO lpSystemInfo); static extern void GetSystemInfo(out SYSTEM_INFO lpSystemInfo);
@ -817,6 +937,7 @@ public class Class_DefinitionMaker
public string ThisEndPath = Application.StartupPath + @"\Extracted\"; public string ThisEndPath = Application.StartupPath + @"\Extracted\";
public int CurrentExtractedDumps = 1; public int CurrentExtractedDumps = 1;
public int ExtractedBlockDone = 1; public int ExtractedBlockDone = 1;
public int ExtractMemorySize = 0;
// REQUIRED STRUCTS // REQUIRED STRUCTS
public struct MEMORY_BASIC_INFORMATION public struct MEMORY_BASIC_INFORMATION
@ -845,35 +966,12 @@ public class Class_DefinitionMaker
public ushort processorRevision; public ushort processorRevision;
} }
private int AllBytesContains(byte[] AllBytesCheck, byte[] CheckArray)
{
for (int i = 0; i < AllBytesCheck.Length; i++)
{
int Index2 = 0;
try
{
while (AllBytesCheck[i + Index2] == CheckArray[Index2])
{
Index2++;
}
}
catch
{
return -1;
}
if (Index2 >= CheckArray.Length) return i;
}
return -1;
}
public bool Extract(string ExtractMode) public bool Extract(string ExtractMode)
{ {
try try
{ {
SYSTEM_INFO sys_info = new SYSTEM_INFO(); SYSTEM_INFO sys_info = new SYSTEM_INFO();
GetSystemInfo(out sys_info); GetSystemInfo(out sys_info);
//CurrentIndex = 4000000;
CurrentIndex = 0; CurrentIndex = 0;
Done = false; Done = false;
ExtractedBlockDone = 1; ExtractedBlockDone = 1;
@ -903,39 +1001,42 @@ public class Class_DefinitionMaker
process = Process.GetProcessesByName("FlashProManager")[0]; process = Process.GetProcessesByName("FlashProManager")[0];
GForm_Main_0.method_1("FlashProManager is running..."); GForm_Main_0.method_1("FlashProManager is running...");
//RemovePastDump();
string ReloadDump = ""; string ReloadDump = "";
if (ExtractMode == "Bin")
Console.WriteLine("memsize: " + sys_info.maximumApplicationAddress.ToString("X"));
while (!Done)
{ {
//int Percent = (int)(((CurrentIndex - 4000000) * 100) / (Int64.Parse(sys_info.maximumApplicationAddress.ToString()) - 1)); //This function will extract datas present in 'system space memory' (kernel/protected area)
int Percent = (int)(((CurrentIndex) * 100) / (Int64.Parse(sys_info.maximumApplicationAddress.ToString()) - 1)); //32Bit applications have 4Gb of memory split into 2sections of 2Gb,
//Console.Write("\nSEARCH #" + SearchID + " " + Percent + "%"); // ->the first section 0x00000000 to 0x7FFFFFFF are 'user space memory'
GForm_Main_0.method_4(Percent); // ->the second section 0x80000000 to 0xFFFFFFFF are 'system space memory'
ExtractBINFromMemory();
}
if ((CurrentIndex + BlockSizeExtracted) > Int64.Parse(sys_info.maximumApplicationAddress.ToString())) if (ExtractMode == "Definition")
//if ((CurrentIndex + BlockSizeExtracted) > 0xFEFFFFFF) {
//This function will extract datas present in 'user space memory' (unprotected area)
//32Bit applications have 4Gb of memory split into 2sections of 2Gb,
// ->the first section 0x00000000 to 0x7FFFFFFF are 'user space memory'
// ->the second section 0x80000000 to 0xFFFFFFFF are 'system space memory'
while (!Done)
{ {
Done = true; int Percent = (int)(((CurrentIndex) * 100) / (Int64.Parse(sys_info.maximumApplicationAddress.ToString()) - 1));
} GForm_Main_0.method_4(Percent);
else
{
MaxIndex = (CurrentIndex + BlockSizeExtracted);
proc_min_address = (IntPtr)CurrentIndex; if ((CurrentIndex + BlockSizeExtracted) > Int64.Parse(sys_info.maximumApplicationAddress.ToString()))
proc_max_address = (IntPtr)MaxIndex;
proc_min_address_l = (long)proc_min_address;
proc_max_address_l = (long)proc_max_address;
ExtractMemoryBlock(ExtractMode);
//ReloadDump = ReloadDumpFile();
//ReloadDump = File.ReadAllText(ThisEndPath + "DumpHex" + ExtractedBlockDone);
//5B446566696E6974696F6E5D ->[Definition]
if (ExtractMode == "Definition")
{ {
Done = true;
}
else
{
MaxIndex = (CurrentIndex + BlockSizeExtracted);
proc_min_address = (IntPtr)CurrentIndex;
proc_max_address = (IntPtr)MaxIndex;
proc_min_address_l = (long)proc_min_address;
proc_max_address_l = (long)proc_max_address;
ExtractMemoryBlock();
ReloadDump = File.ReadAllText(ThisEndPath + "DumpHex" + ExtractedBlockDone); ReloadDump = File.ReadAllText(ThisEndPath + "DumpHex" + ExtractedBlockDone);
if (ReloadDump.Contains("[Definition]")) if (ReloadDump.Contains("[Definition]"))
{ {
@ -950,10 +1051,11 @@ public class Class_DefinitionMaker
string SaveDefPath = ThisEndPath + "ExtractedDefinition" + (CurrentExtractedDumps - 1).ToString() + ".txt"; string SaveDefPath = ThisEndPath + "ExtractedDefinition" + (CurrentExtractedDumps - 1).ToString() + ".txt";
GForm_Main_0.method_1("Extracted Definitions file created: " + SaveDefPath); GForm_Main_0.method_1("Extracted Definitions file created: " + Environment.NewLine + SaveDefPath);
File.Create(SaveDefPath).Dispose(); File.Create(SaveDefPath).Dispose();
File.WriteAllText(SaveDefPath, DumpedDefinition); File.WriteAllText(SaveDefPath, DumpedDefinition);
//NOT NEEDED ANYMORE
//< 0x20 > 0x7E //< 0x20 > 0x7E
/*byte[] AllFileBytes = File.ReadAllBytes(SaveDefPath); /*byte[] AllFileBytes = File.ReadAllBytes(SaveDefPath);
string SavingString = ""; string SavingString = "";
@ -965,24 +1067,13 @@ public class Class_DefinitionMaker
File.WriteAllText(SaveDefPath, SavingString);*/ File.WriteAllText(SaveDefPath, SavingString);*/
} }
} }
if (ExtractMode == "Bin")
{
byte[] AllBytesArray = File.ReadAllBytes(ThisEndPath + "DumpHex" + ExtractedBlockDone);
byte[] CheckBytes = new byte[] { 0xD0, 0x02, 0x40, 0x0B, 0x00, 0x09, 0xAF, 0xFE, 0x00, 0x09, 0x00, 0x00, 0x00 };
//D0 02 40 0B 00 09 AF FE 00 09 00 00 00
if (AllBytesContains(AllBytesArray, CheckBytes) != -1) CurrentIndex += BlockSizeExtracted;
{ ExtractedBlockDone++;
Console.WriteLine("Found Bin in DumpHex" + ExtractedBlockDone);
}
}
} }
CurrentIndex += BlockSizeExtracted;
ExtractedBlockDone++;
} }
//RemovePastDump(); RemovePastDump();
GForm_Main_0.ResetProgressBar(); GForm_Main_0.ResetProgressBar();
if (CurrentExtractedDumps == 1) if (CurrentExtractedDumps == 1)
@ -1018,24 +1109,136 @@ public class Class_DefinitionMaker
} }
} }
/*string ReloadDumpFile() void ExtractBINFromMemory()
{ {
string ReloadDump = File.ReadAllText(ThisEndPath + "Dump" + ExtractedBlockDone + ".txt"); int bytesRead = 0;
ReloadDump = ReloadDump.Replace("\n", ""); uint ThisLocation = 0xFC000000; //0xFCD180BB FD0100C3 FD2A00C3 //C60000
ReloadDump = ReloadDump.Replace("\r", ""); uint MaxLocation = 0xFE000000;
ReloadDump = ReloadDump.Replace(" ", ""); uint ExtractingSize = 0xFFFFF;
File.WriteAllText(ThisEndPath + "Dump" + ExtractedBlockDone + ".txt", ReloadDump); int BINSize = ExtractMemorySize + 1;
IntPtr processHandle = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_WM_READ, false, process.Id);
byte[] buffer = new byte[ExtractingSize];
//ExtractedBytes = File.ReadAllBytes(ThisEndPath + "DumpHex"); uint StartAddr = 0;
return ReloadDump; uint StartLocation = ThisLocation;
}*/ while (ThisLocation < MaxLocation && StartAddr == 0)
{
int Percent = (int)(((ThisLocation - StartLocation) * 100) / ((MaxLocation - StartLocation) - 1));
GForm_Main_0.method_4(Percent);
void ExtractMemoryBlock(string ExtractMode) ReadProcessMemory((int)processHandle, ThisLocation, buffer, buffer.Length, ref bytesRead);
//D0 02 40 0B 00 09 AF FE ->works for 1Mb &7 2Mb ROM
//0D 00 40 02 00 80 00 90 ->works for 4Mb ROM
//20 00 00 03 B4 C0 FF FF ->works for some 1Mb ROM
//FF FF FF FF FF FF FF XX -> NOT SUGGESTED
for (int i = 0; i < buffer.Length - 8; i++)
{
if (buffer[i] == 0xd0
&& buffer[i + 1] == 0x02
&& buffer[i + 2] == 0x40
&& buffer[i + 3] == 0x0b
&& buffer[i + 4] == 0x00
&& buffer[i + 5] == 0x09
&& buffer[i + 6] == 0xaf
&& buffer[i + 7] == 0xfe)
{
StartAddr = (uint)i - 8;
i = buffer.Length;
}
if (StartAddr == 0)
{
if (buffer[i] == 0x0d
&& buffer[i + 1] == 0x00
&& buffer[i + 2] == 0x40
&& buffer[i + 3] == 0x02
&& buffer[i + 4] == 0x00
&& buffer[i + 5] == 0x80
&& buffer[i + 6] == 0x00
&& buffer[i + 7] == 0x90)
{
StartAddr = (uint)i - 8;
i = buffer.Length;
}
}
if (StartAddr == 0)
{
if (buffer[i] == 0x20
&& buffer[i + 1] == 0x00
&& buffer[i + 2] == 0x00
&& buffer[i + 3] == 0x03
&& buffer[i + 4] == 0xb4
&& buffer[i + 5] == 0xc0
&& buffer[i + 6] == 0xff
&& buffer[i + 7] == 0xff)
{
StartAddr = (uint)i - 8;
i = buffer.Length;
}
}
//NOT SUGGESTED
/*if (buffer[i] == 0xff
&& buffer[i + 1] == 0xff
&& buffer[i + 2] == 0xff
&& buffer[i + 3] == 0xff
&& buffer[i + 4] == 0xff
&& buffer[i + 5] == 0xff
&& buffer[i + 6] == 0xff
&& buffer[i + 7] != 0xff)
{
StartAddr = (uint)i + 15;
i = buffer.Length;
}*/
}
if (StartAddr == 0)
{
ThisLocation += ExtractingSize;
//ThisLocation += 1;
}
}
GForm_Main_0.ResetProgressBar();
if (StartAddr != 0)
{
Console.WriteLine("address: 0x" + (StartAddr + ThisLocation).ToString("X"));
buffer = new byte[BINSize];
ReadProcessMemory((int)processHandle, (StartAddr + ThisLocation), buffer, buffer.Length, ref bytesRead);
string ECUFilename = GForm_Main_0.Editortable_0.ExtractECUNameFromThisFile(buffer);
if (ECUFilename != "")
{
string SavePathh = ThisEndPath + GForm_Main_0.Editortable_0.ExtractECUNameFromThisFile(buffer) + ".bin";
File.Create(SavePathh).Dispose();
File.WriteAllBytes(SavePathh, buffer);
GForm_Main_0.method_1("Extracted Binary file created: " + Environment.NewLine + SavePathh);
CurrentExtractedDumps++;
}
else
{
GForm_Main_0.method_1("Something went wrong while extracting .bin:" + Environment.NewLine + "Could not find 'ECU name' inside the extracted data");
//string SavePathh = ThisEndPath + "DumpHex1";
//File.Create(SavePathh).Dispose();
//File.WriteAllBytes(SavePathh, buffer);
}
}
/*else
{
string SavePathh = ThisEndPath + "DumpHex1";
File.Create(SavePathh).Dispose();
File.WriteAllBytes(SavePathh, buffer);
}*/
}
void ExtractMemoryBlock()
{ {
int bytesRead = 0; int bytesRead = 0;
IntPtr processHandle = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_WM_READ, false, process.Id); IntPtr processHandle = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_WM_READ, false, process.Id);
MEMORY_BASIC_INFORMATION mem_basic_info = new MEMORY_BASIC_INFORMATION(); MEMORY_BASIC_INFORMATION mem_basic_info = new MEMORY_BASIC_INFORMATION();
//StreamWriter sw = new StreamWriter(ThisEndPath + "Dump" + ExtractedBlockDone + ".txt");
StreamWriter sw2 = new StreamWriter(ThisEndPath + "DumpHex" + ExtractedBlockDone); StreamWriter sw2 = new StreamWriter(ThisEndPath + "DumpHex" + ExtractedBlockDone);
while (proc_min_address_l < proc_max_address_l) while (proc_min_address_l < proc_max_address_l)
@ -1046,15 +1249,11 @@ public class Class_DefinitionMaker
{ {
byte[] buffer = new byte[mem_basic_info.RegionSize]; byte[] buffer = new byte[mem_basic_info.RegionSize];
ReadProcessMemory((int)processHandle, mem_basic_info.BaseAddress, buffer, mem_basic_info.RegionSize, ref bytesRead); ReadProcessMemory((int)processHandle, (uint) mem_basic_info.BaseAddress, buffer, mem_basic_info.RegionSize, ref bytesRead);
//Console.WriteLine("adrr: " + mem_basic_info.BaseAddress.ToString("X"));
//Console.WriteLine("size: " + mem_basic_info.RegionSize.ToString("X"));
for (int i = 0; i < mem_basic_info.RegionSize; i++) for (int i = 0; i < mem_basic_info.RegionSize; i++)
{ {
if (ExtractMode == "Bin") sw2.Write(buffer[i].ToString("X2") + " "); sw2.Write((char)buffer[i]);
else sw2.Write((char)buffer[i]);
} }
} }
@ -1062,25 +1261,21 @@ public class Class_DefinitionMaker
proc_min_address = new IntPtr(proc_min_address_l); proc_min_address = new IntPtr(proc_min_address_l);
} }
//sw.Close();
sw2.Close(); sw2.Close();
if (ExtractMode == "Definition") byte[] AllBytes = File.ReadAllBytes(ThisEndPath + "DumpHex" + ExtractedBlockDone);
List<byte> AllBytesList = new List<byte>();
for (int i = 0; i < AllBytes.Length; i++)
{ {
byte[] AllBytes = File.ReadAllBytes(ThisEndPath + "DumpHex" + ExtractedBlockDone); if (AllBytes[i] >= 0x20 && AllBytes[i] <= 0x7E) AllBytesList.Add(AllBytes[i]);
List<byte> AllBytesList = new List<byte>(); if (AllBytes[i] == 0x0D || AllBytes[i] == 0x0A) AllBytesList.Add(AllBytes[i]);
for (int i = 0; i < AllBytes.Length; i++)
{
if (AllBytes[i] >= 0x20 && AllBytes[i] <= 0x7E) AllBytesList.Add(AllBytes[i]);
if (AllBytes[i] == 0x0D || AllBytes[i] == 0x0A) AllBytesList.Add(AllBytes[i]);
}
AllBytes = new byte[AllBytesList.Count];
for (int i = 0; i < AllBytesList.Count; i++) AllBytes[i] = AllBytesList[i];
File.WriteAllBytes(ThisEndPath + "DumpHex" + ExtractedBlockDone, AllBytes);
} }
AllBytes = new byte[AllBytesList.Count];
for (int i = 0; i < AllBytesList.Count; i++) AllBytes[i] = AllBytesList[i];
if (ExtractMode == "Bin") File.WriteAllBytes(ThisEndPath + "DumpHex" + ExtractedBlockDone, AllBytes);
/*if (ExtractMode == "Bin")
{ {
byte[] AllBytesChar = File.ReadAllBytes(ThisEndPath + "DumpHex" + ExtractedBlockDone); byte[] AllBytesChar = File.ReadAllBytes(ThisEndPath + "DumpHex" + ExtractedBlockDone);
byte[] AllReturnBytes = new byte[AllBytesChar.Length / 3]; byte[] AllReturnBytes = new byte[AllBytesChar.Length / 3];
@ -1094,7 +1289,7 @@ public class Class_DefinitionMaker
} }
File.WriteAllBytes(ThisEndPath + "DumpHex" + ExtractedBlockDone, AllReturnBytes); File.WriteAllBytes(ThisEndPath + "DumpHex" + ExtractedBlockDone, AllReturnBytes);
} }*/
} }
//########################################################################################################################## //##########################################################################################################################

View File

@ -5,14 +5,14 @@ internal class Class_ECUS
{ {
internal Class_ECUS(string string_4, string string_5, byte byte_1, string string_6, int int_4, int int_6, string TrannyType) internal Class_ECUS(string string_4, string string_5, byte byte_1, string string_6, int int_4, int int_6, string TrannyType)
{ {
this.RomSize_String = string_4; this.RomSize_String = string_4;//only for display
this.ECU_Byte = byte_1; this.ECU_Byte = byte_1;
this.ECU_Byte_String = string_6; this.ECU_Byte_String = string_6;//only for display
this.Processor = string_5; this.Processor = string_5; //only for display
this.ReadingSize = int_4 - 1; this.ReadingSize = int_4 - 1;
this.FirmwareSize = int_6; this.FirmwareSize = int_6; //not used
this.RomSize = int_4; this.RomSize = int_4;
this.TransmissionType = TrannyType; this.TransmissionType = TrannyType;//only for display
} }
public string RomSize_String { get; set; } public string RomSize_String { get; set; }

View File

@ -325,10 +325,21 @@ static class Class_RWD
//Get CanAddress Infos //Get CanAddress Infos
CanAddress = "18DA" + headers2[0].ToString("X2") + "F1"; CanAddress = "18DA" + headers2[0].ToString("X2") + "F1";
string AdditionnalCanInfos = ""; string AdditionnalCanInfos = "";
if (headers2[0] == 0x0e) AdditionnalCanInfos = " (CVT Transmission (maybe?))"; if (headers2[0] == 0x0b) AdditionnalCanInfos = " (Shift by wire)"; //->54008-XXX-XXXX files
if (headers2[0] == 0x10) AdditionnalCanInfos = " (Manual Transmission)"; if (headers2[0] == 0x0e) AdditionnalCanInfos = " (CVT Transmission (maybe?))"; //->
if (headers2[0] == 0x11) AdditionnalCanInfos = " (Automatics Transmission)"; if (headers2[0] == 0x10) AdditionnalCanInfos = " (ECM with Manual Transmission)"; //->37805-XXX-XXXX files
if (headers2[0] == 0x30) AdditionnalCanInfos = " (Electric Power Sterring)"; if (headers2[0] == 0x11) AdditionnalCanInfos = " (ECM with Automatics Transmission)"; //->37805-XXX-XXXX files
if (headers2[0] == 0x1e) AdditionnalCanInfos = " (TCM - Transmission Control Module)"; //->28101-XXX-XXXX files
if (headers2[0] == 0x28) AdditionnalCanInfos = " (VSA Module)"; //->57114-XXX-XXXX files
if (headers2[0] == 0x2b) AdditionnalCanInfos = " (Electric Brake Booster Module)"; //->39494-XXX-XXXX files
if (headers2[0] == 0x30) AdditionnalCanInfos = " (Electric Power Sterring Module)"; //->39990-XXX-XXXX files
if (headers2[0] == 0x3a) AdditionnalCanInfos = " (Unknown Module)"; //->39390-XXX-XXXX files
if (headers2[0] == 0x53) AdditionnalCanInfos = " (SRS Module)"; //->77959-XXX-XXXX files
if (headers2[0] == 0x60) AdditionnalCanInfos = " (Odometer Module)"; //->78109-XXX-XXXX files
if (headers2[0] == 0x61) AdditionnalCanInfos = " (HUD Module)"; //->78209-XXX-XXXX files
if (headers2[0] == 0xb0) AdditionnalCanInfos = " (FWD Radar Module)"; //->36802-XXX-XXXX files
if (headers2[0] == 0xb5) AdditionnalCanInfos = " (FWD Camera Module)"; //->36161-XXX-XXXX files
if (headers2[0] == 0xef) AdditionnalCanInfos = " (Gateway Module)"; //->38897-XXX-XXXX files
//Print/Log Informations //Print/Log Informations
GForm_Main_0.method_1("Firmware Start: 0x" + start.ToString("X")); GForm_Main_0.method_1("Firmware Start: 0x" + start.ToString("X"));
@ -394,19 +405,29 @@ static class Class_RWD
{ {
int CheckLocation = 0; int CheckLocation = 0;
if (fc.Length - 1 == 0xF7FFF) CheckLocation = 0x400; if (fc.Length - 1 == 0xF7FFF) CheckLocation = 0x400;
if (fc.Length - 1 == 0x1EFFFF) CheckLocation = 0x12; //0x10012 if (fc.Length - 1 == 0x1EFFFF) CheckLocation = 0x12; //CONFIRMED GOOD LOCATION FOR FIRMWARE, FULL BIN LOCATION: 0x10012
if (fc.Length - 1 == 0x26FFFF) CheckLocation = 0x1F03E6; //0x2003E6 if (fc.Length - 1 == 0x26FFFF) CheckLocation = 0x1F03E6; //0x2003E6 0x1EFFFA in firmware or 0x001FFFFA in full bin
byte num = GetBootloaderSum(fc, CheckLocation); byte num = GetBootloaderSum(fc, CheckLocation);
byte num2 = GetNegativeChecksumFWBin(fc, CheckLocation); byte num2 = GetNegativeChecksumFWBin(fc, CheckLocation);
byte ThisSum = num; int ThisSumInt = num;
ThisSum -= num2; ThisSumInt -= num2;
if (ThisSumInt < 0) ThisSumInt += 255;
byte ThisSum = (byte)ThisSumInt;
byte chk = fc[CheckLocation]; byte chk = fc[CheckLocation];
/*Console.WriteLine("chk: " + chk.ToString("X2"));
Console.WriteLine("num2: " + num2.ToString("X2"));
Console.WriteLine("num: " + num.ToString("X2"));
Console.WriteLine("ThisSum: " + ThisSum.ToString("X2"));*/
if (chk == ThisSum) if (chk == ThisSum)
{ {
GForm_Main_0.method_1("checksums good!"); GForm_Main_0.method_1("checksums good!");
BootloaderSum = num; BootloaderSum = num;
GForm_Main_0.method_1("Bootloader Sum are 0x" + BootloaderSum.ToString("X")); GForm_Main_0.method_1("Bootloader Sum are 0x" + BootloaderSum.ToString("X"));
} }
else
{
GForm_Main_0.method_1("checksums bad, could not get bootloader sum!");
}
} }
} }
@ -491,19 +512,24 @@ static class Class_RWD
byte[] BufferBytes = FWFileBytes; byte[] BufferBytes = FWFileBytes;
byte num = BufferBytes[CheckLocation]; byte num = BufferBytes[CheckLocation];
byte num2 = GetNegativeChecksumFWBin(BufferBytes, CheckLocation); byte num2 = GetNegativeChecksumFWBin(BufferBytes, CheckLocation);
byte BTSum = num; int BTSum = num;
BTSum += num2; BTSum += num2;
return BTSum; if (BTSum > 255) BTSum -= 255;
return (byte) BTSum;
} }
public static byte GetNegativeChecksumFWBin(byte[] byte_1, int CheckLocation) public static byte GetNegativeChecksumFWBin(byte[] byte_1, int CheckLocation)
{ {
byte b = 0; int b = 0;
for (int i = 0; i < byte_1.Length; i++) for (int i = 0; i < byte_1.Length; i++)
{ {
if (i != CheckLocation) b -= byte_1[i]; if (i != CheckLocation)
{
b -= byte_1[i];
if (b < 0) b += 255;
}
} }
return b; return (byte) b;
} }
public static byte[] Push(byte[] bArray, byte[] newBytes) public static byte[] Push(byte[] bArray, byte[] newBytes)

View File

@ -110,9 +110,9 @@ public class Editortable : DarkForm
private void InitializeComponent() private void InitializeComponent()
{ {
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Editortable)); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Editortable));
this.treeView1 = new DarkUI.Controls.DarkTreeView(); this.treeView1 = new DarkUI.Controls.DarkTreeView();
this.groupBox1 = new DarkUI.Controls.DarkGroupBox(); this.groupBox1 = new DarkUI.Controls.DarkGroupBox();
@ -133,6 +133,9 @@ public class Editortable : DarkForm
this.increaseSelectionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.increaseSelectionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.decreaseSelectionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.decreaseSelectionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripDropDownButton3 = new System.Windows.Forms.ToolStripDropDownButton(); this.toolStripDropDownButton3 = new System.Windows.Forms.ToolStripDropDownButton();
this.openOBD2ScanToolToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.convertrwdTobinToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.convertbinTorwdToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.removeBootloaderInbinToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.removeBootloaderInbinToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
this.developpersToolsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.developpersToolsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@ -147,9 +150,6 @@ public class Editortable : DarkForm
this.splitContainer2 = new System.Windows.Forms.SplitContainer(); this.splitContainer2 = new System.Windows.Forms.SplitContainer();
this.darkTextBox_0 = new DarkUI.Controls.DarkTextBox(); this.darkTextBox_0 = new DarkUI.Controls.DarkTextBox();
this.folderBrowserDialog1 = new System.Windows.Forms.FolderBrowserDialog(); this.folderBrowserDialog1 = new System.Windows.Forms.FolderBrowserDialog();
this.convertrwdTobinToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.convertbinTorwdToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.openOBD2ScanToolToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.groupBox1.SuspendLayout(); this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dataGridView_0)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView_0)).BeginInit();
this.darkToolStrip1.SuspendLayout(); this.darkToolStrip1.SuspendLayout();
@ -203,37 +203,37 @@ public class Editortable : DarkForm
this.dataGridView_0.AllowUserToDeleteRows = false; this.dataGridView_0.AllowUserToDeleteRows = false;
this.dataGridView_0.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.AllCells; this.dataGridView_0.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.AllCells;
this.dataGridView_0.BackgroundColor = System.Drawing.SystemColors.ControlDarkDark; this.dataGridView_0.BackgroundColor = System.Drawing.SystemColors.ControlDarkDark;
dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle7.BackColor = System.Drawing.SystemColors.ControlDarkDark; dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.ControlDarkDark;
dataGridViewCellStyle7.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); dataGridViewCellStyle1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
dataGridViewCellStyle7.ForeColor = System.Drawing.SystemColors.Window; dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.Window;
dataGridViewCellStyle7.SelectionBackColor = System.Drawing.SystemColors.Highlight; dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle7.SelectionForeColor = System.Drawing.SystemColors.HighlightText; dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle7.WrapMode = System.Windows.Forms.DataGridViewTriState.True; dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.dataGridView_0.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle7; this.dataGridView_0.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;
this.dataGridView_0.ColumnHeadersHeight = 20; this.dataGridView_0.ColumnHeadersHeight = 20;
dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle8.BackColor = System.Drawing.SystemColors.ControlLight; dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.ControlLight;
dataGridViewCellStyle8.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); dataGridViewCellStyle2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
dataGridViewCellStyle8.ForeColor = System.Drawing.SystemColors.ControlText; dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.ControlText;
dataGridViewCellStyle8.SelectionBackColor = System.Drawing.SystemColors.Highlight; dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle8.SelectionForeColor = System.Drawing.SystemColors.HighlightText; dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle8.WrapMode = System.Windows.Forms.DataGridViewTriState.False; dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dataGridView_0.DefaultCellStyle = dataGridViewCellStyle8; this.dataGridView_0.DefaultCellStyle = dataGridViewCellStyle2;
this.dataGridView_0.Dock = System.Windows.Forms.DockStyle.Fill; this.dataGridView_0.Dock = System.Windows.Forms.DockStyle.Fill;
this.dataGridView_0.EnableHeadersVisualStyles = false; this.dataGridView_0.EnableHeadersVisualStyles = false;
this.dataGridView_0.GridColor = System.Drawing.SystemColors.ControlDarkDark; this.dataGridView_0.GridColor = System.Drawing.SystemColors.ControlDarkDark;
this.dataGridView_0.Location = new System.Drawing.Point(2, 15); this.dataGridView_0.Location = new System.Drawing.Point(2, 15);
this.dataGridView_0.Margin = new System.Windows.Forms.Padding(2); this.dataGridView_0.Margin = new System.Windows.Forms.Padding(2);
this.dataGridView_0.Name = "dataGridView_0"; this.dataGridView_0.Name = "dataGridView_0";
dataGridViewCellStyle9.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle9.BackColor = System.Drawing.SystemColors.ControlDarkDark; dataGridViewCellStyle3.BackColor = System.Drawing.SystemColors.ControlDarkDark;
dataGridViewCellStyle9.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); dataGridViewCellStyle3.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
dataGridViewCellStyle9.ForeColor = System.Drawing.SystemColors.Window; dataGridViewCellStyle3.ForeColor = System.Drawing.SystemColors.Window;
dataGridViewCellStyle9.SelectionBackColor = System.Drawing.SystemColors.Highlight; dataGridViewCellStyle3.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle9.SelectionForeColor = System.Drawing.SystemColors.HighlightText; dataGridViewCellStyle3.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle9.WrapMode = System.Windows.Forms.DataGridViewTriState.True; dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.dataGridView_0.RowHeadersDefaultCellStyle = dataGridViewCellStyle9; this.dataGridView_0.RowHeadersDefaultCellStyle = dataGridViewCellStyle3;
this.dataGridView_0.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.AutoSizeToAllHeaders; this.dataGridView_0.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.AutoSizeToAllHeaders;
this.dataGridView_0.RowTemplate.DefaultCellStyle.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; this.dataGridView_0.RowTemplate.DefaultCellStyle.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
this.dataGridView_0.RowTemplate.Height = 31; this.dataGridView_0.RowTemplate.Height = 31;
@ -412,6 +412,33 @@ public class Editortable : DarkForm
this.toolStripDropDownButton3.Size = new System.Drawing.Size(47, 25); this.toolStripDropDownButton3.Size = new System.Drawing.Size(47, 25);
this.toolStripDropDownButton3.Text = "Tools"; this.toolStripDropDownButton3.Text = "Tools";
// //
// openOBD2ScanToolToolStripMenuItem
//
this.openOBD2ScanToolToolStripMenuItem.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(63)))), ((int)(((byte)(65)))));
this.openOBD2ScanToolToolStripMenuItem.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220)))));
this.openOBD2ScanToolToolStripMenuItem.Name = "openOBD2ScanToolToolStripMenuItem";
this.openOBD2ScanToolToolStripMenuItem.Size = new System.Drawing.Size(214, 22);
this.openOBD2ScanToolToolStripMenuItem.Text = "Open OBD2 Scan Tool";
this.openOBD2ScanToolToolStripMenuItem.Click += new System.EventHandler(this.openOBD2ScanToolToolStripMenuItem_Click);
//
// convertrwdTobinToolStripMenuItem
//
this.convertrwdTobinToolStripMenuItem.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(63)))), ((int)(((byte)(65)))));
this.convertrwdTobinToolStripMenuItem.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220)))));
this.convertrwdTobinToolStripMenuItem.Name = "convertrwdTobinToolStripMenuItem";
this.convertrwdTobinToolStripMenuItem.Size = new System.Drawing.Size(214, 22);
this.convertrwdTobinToolStripMenuItem.Text = "Convert .rwd to .bin";
this.convertrwdTobinToolStripMenuItem.Click += new System.EventHandler(this.convertrwdTobinToolStripMenuItem_Click);
//
// convertbinTorwdToolStripMenuItem
//
this.convertbinTorwdToolStripMenuItem.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(63)))), ((int)(((byte)(65)))));
this.convertbinTorwdToolStripMenuItem.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220)))));
this.convertbinTorwdToolStripMenuItem.Name = "convertbinTorwdToolStripMenuItem";
this.convertbinTorwdToolStripMenuItem.Size = new System.Drawing.Size(214, 22);
this.convertbinTorwdToolStripMenuItem.Text = "Convert .bin to .rwd";
this.convertbinTorwdToolStripMenuItem.Click += new System.EventHandler(this.convertbinTorwdToolStripMenuItem_Click);
//
// removeBootloaderInbinToolStripMenuItem // removeBootloaderInbinToolStripMenuItem
// //
this.removeBootloaderInbinToolStripMenuItem.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(63)))), ((int)(((byte)(65))))); this.removeBootloaderInbinToolStripMenuItem.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(63)))), ((int)(((byte)(65)))));
@ -549,37 +576,11 @@ public class Editortable : DarkForm
this.darkTextBox_0.Location = new System.Drawing.Point(0, 0); this.darkTextBox_0.Location = new System.Drawing.Point(0, 0);
this.darkTextBox_0.Multiline = true; this.darkTextBox_0.Multiline = true;
this.darkTextBox_0.Name = "darkTextBox_0"; this.darkTextBox_0.Name = "darkTextBox_0";
this.darkTextBox_0.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.darkTextBox_0.Size = new System.Drawing.Size(799, 152); this.darkTextBox_0.Size = new System.Drawing.Size(799, 152);
this.darkTextBox_0.TabIndex = 56; this.darkTextBox_0.TabIndex = 56;
this.darkTextBox_0.Text = "Honda CANBUS Tools"; this.darkTextBox_0.Text = "Honda CANBUS Tools";
// //
// convertrwdTobinToolStripMenuItem
//
this.convertrwdTobinToolStripMenuItem.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(63)))), ((int)(((byte)(65)))));
this.convertrwdTobinToolStripMenuItem.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220)))));
this.convertrwdTobinToolStripMenuItem.Name = "convertrwdTobinToolStripMenuItem";
this.convertrwdTobinToolStripMenuItem.Size = new System.Drawing.Size(214, 22);
this.convertrwdTobinToolStripMenuItem.Text = "Convert .rwd to .bin";
this.convertrwdTobinToolStripMenuItem.Click += new System.EventHandler(this.convertrwdTobinToolStripMenuItem_Click);
//
// convertbinTorwdToolStripMenuItem
//
this.convertbinTorwdToolStripMenuItem.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(63)))), ((int)(((byte)(65)))));
this.convertbinTorwdToolStripMenuItem.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220)))));
this.convertbinTorwdToolStripMenuItem.Name = "convertbinTorwdToolStripMenuItem";
this.convertbinTorwdToolStripMenuItem.Size = new System.Drawing.Size(214, 22);
this.convertbinTorwdToolStripMenuItem.Text = "Convert .bin to .rwd";
this.convertbinTorwdToolStripMenuItem.Click += new System.EventHandler(this.convertbinTorwdToolStripMenuItem_Click);
//
// openOBD2ScanToolToolStripMenuItem
//
this.openOBD2ScanToolToolStripMenuItem.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(63)))), ((int)(((byte)(65)))));
this.openOBD2ScanToolToolStripMenuItem.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220)))));
this.openOBD2ScanToolToolStripMenuItem.Name = "openOBD2ScanToolToolStripMenuItem";
this.openOBD2ScanToolToolStripMenuItem.Size = new System.Drawing.Size(214, 22);
this.openOBD2ScanToolToolStripMenuItem.Text = "Open OBD2 Scan Tool";
this.openOBD2ScanToolToolStripMenuItem.Click += new System.EventHandler(this.openOBD2ScanToolToolStripMenuItem_Click);
//
// Editortable // Editortable
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -1037,7 +1038,7 @@ public class Editortable : DarkForm
public string ExtractECUNameFromThisFile(byte[] ThisFileBytes) public string ExtractECUNameFromThisFile(byte[] ThisFileBytes)
{ {
string ECUName = ""; string ECUName = "";
for (int i = 0; i < ThisFileBytes.Length; i++) for (int i = 0; i < ThisFileBytes.Length - 12; i++)
{ {
//37805- //37805-
if ((char) ThisFileBytes[i] == '3' if ((char) ThisFileBytes[i] == '3'
@ -1045,8 +1046,10 @@ public class Editortable : DarkForm
&& (char)ThisFileBytes[i + 2] == '8' && (char)ThisFileBytes[i + 2] == '8'
&& (char)ThisFileBytes[i + 3] == '0' && (char)ThisFileBytes[i + 3] == '0'
&& (char)ThisFileBytes[i + 4] == '5' && (char)ThisFileBytes[i + 4] == '5'
&& (char)ThisFileBytes[i + 5] == '-') && (char)ThisFileBytes[i + 5] == '-'
&& (char)ThisFileBytes[i + 10] != 'Z')
{ {
ECUName = "";
ECUName = ECUName + ((char)ThisFileBytes[i]).ToString(); //3 ECUName = ECUName + ((char)ThisFileBytes[i]).ToString(); //3
ECUName = ECUName + ((char)ThisFileBytes[i + 1]).ToString(); //7 ECUName = ECUName + ((char)ThisFileBytes[i + 1]).ToString(); //7
ECUName = ECUName + ((char)ThisFileBytes[i + 2]).ToString(); //8 ECUName = ECUName + ((char)ThisFileBytes[i + 2]).ToString(); //8
@ -1398,8 +1401,15 @@ public class Editortable : DarkForm
private void extractbinFileFromFPMToolStripMenuItem_Click(object sender, EventArgs e) private void extractbinFileFromFPMToolStripMenuItem_Click(object sender, EventArgs e)
{ {
//THIS FUNCTION DOES NOT WORK YET GForm_ExtractSize GForm_ExtractSize_0 = new GForm_ExtractSize();
GForm_Main_0.Class_DefinitionMaker_0.Extract("Bin"); DialogResult result = GForm_ExtractSize_0.ShowDialog();
if (result == DialogResult.OK)
{
if (GForm_ExtractSize_0.comboBox1.SelectedIndex == 0) GForm_Main_0.Class_DefinitionMaker_0.ExtractMemorySize = 0xF7FFF;
if (GForm_ExtractSize_0.comboBox1.SelectedIndex == 1) GForm_Main_0.Class_DefinitionMaker_0.ExtractMemorySize = 0x1EFFFF;
if (GForm_ExtractSize_0.comboBox1.SelectedIndex == 2) GForm_Main_0.Class_DefinitionMaker_0.ExtractMemorySize = 0x26FFFF;
GForm_Main_0.Class_DefinitionMaker_0.Extract("Bin");
}
} }
private void convertrwdTobinToolStripMenuItem_Click(object sender, EventArgs e) private void convertrwdTobinToolStripMenuItem_Click(object sender, EventArgs e)

View File

@ -78,6 +78,9 @@
<Compile Include="GClass4.cs" /> <Compile Include="GClass4.cs" />
<Compile Include="GEnum0.cs" /> <Compile Include="GEnum0.cs" />
<Compile Include="GEnum1.cs" /> <Compile Include="GEnum1.cs" />
<Compile Include="GForm_ExtractSize.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="GForm_Credits.cs"> <Compile Include="GForm_Credits.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
@ -108,6 +111,9 @@
</Compile> </Compile>
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="frmOBD2Scan.resx" /> <EmbeddedResource Include="frmOBD2Scan.resx" />
<EmbeddedResource Include="GForm_ExtractSize.resx">
<DependentUpon>GForm_ExtractSize.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="GForm_Credits.resx"> <EmbeddedResource Include="GForm_Credits.resx">
<DependentUpon>GForm_Credits.cs</DependentUpon> <DependentUpon>GForm_Credits.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>

View File

@ -45,7 +45,6 @@ public class GForm_Credits : DarkForm
this.darkButton_0 = new DarkUI.Controls.DarkButton(); this.darkButton_0 = new DarkUI.Controls.DarkButton();
this.label1 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label();
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
this.SuspendLayout(); this.SuspendLayout();
// //
// darkButton_0 // darkButton_0
@ -81,10 +80,6 @@ public class GForm_Credits : DarkForm
this.label3.Text = "Credits from Honda community:"; this.label3.Text = "Credits from Honda community:";
this.label3.TextAlign = System.Drawing.ContentAlignment.TopCenter; this.label3.TextAlign = System.Drawing.ContentAlignment.TopCenter;
// //
// openFileDialog1
//
this.openFileDialog1.Title = "Select File";
//
// GForm_Credits // GForm_Credits
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -111,5 +106,4 @@ public class GForm_Credits : DarkForm
private DarkButton darkButton_0; private DarkButton darkButton_0;
private Label label1; private Label label1;
private Label label3; private Label label3;
private OpenFileDialog openFileDialog1;
} }

View File

@ -117,7 +117,4 @@
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<metadata name="openFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root> </root>

114
GForm_ExtractSize.cs Normal file
View File

@ -0,0 +1,114 @@
using System;
using System.ComponentModel;
using System.Drawing;
using System.Runtime.CompilerServices;
using System.Windows.Forms;
using DarkUI.Controls;
using DarkUI.Forms;
public class GForm_ExtractSize : DarkForm
{
public GForm_ExtractSize()
{
this.InitializeComponent();
comboBox1.SelectedIndex = 0;
}
private void method_0(object sender, EventArgs e)
{
base.DialogResult = DialogResult.OK;
base.Close();
}
private void method_1(object sender, EventArgs e)
{
}
private void method_2(object sender, EventArgs e)
{
base.DialogResult = DialogResult.Abort;
base.Close();
}
protected virtual void Dispose(bool disposing)
{
if (disposing && this.icontainer_0 != null)
{
this.icontainer_0.Dispose();
}
base.Dispose(disposing);
}
private void InitializeComponent()
{
this.darkButton_0 = new DarkUI.Controls.DarkButton();
this.label3 = new System.Windows.Forms.Label();
this.comboBox1 = new System.Windows.Forms.ComboBox();
this.SuspendLayout();
//
// darkButton_0
//
this.darkButton_0.Checked = false;
this.darkButton_0.DialogResult = System.Windows.Forms.DialogResult.OK;
this.darkButton_0.Location = new System.Drawing.Point(105, 68);
this.darkButton_0.Name = "darkButton_0";
this.darkButton_0.Size = new System.Drawing.Size(75, 23);
this.darkButton_0.TabIndex = 4;
this.darkButton_0.Text = "Accept";
this.darkButton_0.Click += new System.EventHandler(this.method_0);
//
// label3
//
this.label3.AutoSize = true;
this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F);
this.label3.ForeColor = System.Drawing.SystemColors.ControlLight;
this.label3.Location = new System.Drawing.Point(31, 15);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(223, 13);
this.label3.TabIndex = 10;
this.label3.Text = "Select the size of memory you want to extract:";
this.label3.TextAlign = System.Drawing.ContentAlignment.TopCenter;
//
// comboBox1
//
this.comboBox1.FormattingEnabled = true;
this.comboBox1.Items.AddRange(new object[] {
"0xF7FFF (1Mb firmware .bin)",
"0x1EFFFF (2Mb firmware .bin)",
"0x26FFFF (4Mb firmware .bin)"});
this.comboBox1.Location = new System.Drawing.Point(9, 38);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(272, 21);
this.comboBox1.TabIndex = 11;
//
// GForm_ExtractSize
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(289, 101);
this.ControlBox = false;
this.Controls.Add(this.comboBox1);
this.Controls.Add(this.label3);
this.Controls.Add(this.darkButton_0);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "GForm_ExtractSize";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Memory Size for Extraction";
this.Load += new System.EventHandler(this.method_1);
this.ResumeLayout(false);
this.PerformLayout();
}
[CompilerGenerated]
private IContainer icontainer_0;
private DarkButton darkButton_0;
private Label label3;
public ComboBox comboBox1;
}

120
GForm_ExtractSize.resx Normal file
View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -32,7 +32,7 @@ public class GForm_Main : DarkForm
private DarkButton darkButton6; private DarkButton darkButton6;
private DarkButton darkButton3; private DarkButton darkButton3;
public Editortable Editortable_0; public Editortable Editortable_0;
public string Version = "v1.1.3"; public string Version = "v1.1.5";
private DarkTextBox darkTextBoxJ2534Command; private DarkTextBox darkTextBoxJ2534Command;
private DarkLabel darkLabel1; private DarkLabel darkLabel1;
private DarkButton darkButtonJ2534Command; private DarkButton darkButtonJ2534Command;
@ -101,6 +101,7 @@ public class GForm_Main : DarkForm
//Send to ROM Editor logs //Send to ROM Editor logs
Editortable_0.method_1(string_3); Editortable_0.method_1(string_3);
Application.DoEvents();
} }
catch { } catch { }
} }
@ -300,31 +301,25 @@ public class GForm_Main : DarkForm
{ {
if (this.byte_7 != null) if (this.byte_7 != null)
{ {
this.method_8(this.byte_7); SaveFileDialog saveFileDialog = new SaveFileDialog();
saveFileDialog.RestoreDirectory = true;
saveFileDialog.Filter = "Honda Rom Dump|*.Bin";
saveFileDialog.FileName = this.darkTextBox_2.Text;
if (saveFileDialog.ShowDialog() != DialogResult.OK)
{
return;
}
File.WriteAllBytes(saveFileDialog.FileName, this.byte_7);
this.method_1("File saved: " + saveFileDialog.FileName);
DarkMessageBox.Show(this, "Successfully Saved File!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
/*this.darkButton_DownloadROM.Enabled = false;
this.darkButton_Unlock41.Enabled = false;
this.darkButton_Unlock01.Enabled = false;
this.darkButton_FlashRom.Enabled = false;
this.darkButton_FlashFW.Enabled = false;*/
} }
} }
private void method_8(byte[] byte_12)
{
SaveFileDialog saveFileDialog = new SaveFileDialog();
saveFileDialog.RestoreDirectory = true;
saveFileDialog.Filter = "Honda Rom Dump|*.Bin";
saveFileDialog.FileName = this.darkTextBox_2.Text;
if (saveFileDialog.ShowDialog() != DialogResult.OK)
{
return;
}
File.WriteAllBytes(saveFileDialog.FileName, byte_12);
this.method_1("File saved: " + saveFileDialog.FileName);
DarkMessageBox.Show(this, "Successfully Saved File!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
/*this.darkButton_DownloadROM.Enabled = false;
this.darkButton_Unlock41.Enabled = false;
this.darkButton_Unlock01.Enabled = false;
this.darkButton_FlashRom.Enabled = false;
this.darkButton_FlashFW.Enabled = false;*/
}
private void darkButton2_Click(object sender, EventArgs e) private void darkButton2_Click(object sender, EventArgs e)
{ {
/*if (GForm_Main.string_0.Length == 0) /*if (GForm_Main.string_0.Length == 0)
@ -499,7 +494,7 @@ public class GForm_Main : DarkForm
{ {
0x18, 0x18,
0xDA, 0xDA,
GForm_Main.byte_3, //-> 0x10|0x11 GForm_Main.ECU_Byte, //-> 0x10|0x11
0xF1 0xF1
}; };
@ -587,6 +582,7 @@ public class GForm_Main : DarkForm
{ {
if (SendPendingResp) if (SendPendingResp)
{ {
//This may resolve the issue
Thread.Sleep(5); Thread.Sleep(5);
RetryCount++; RetryCount++;
continue; continue;
@ -898,7 +894,7 @@ public class GForm_Main : DarkForm
}; };
byte[] byte_13 = new byte[] byte[] byte_13 = new byte[]
{ {
GForm_Main.byte_3, GForm_Main.ECU_Byte,
99 99
}; };
@ -986,8 +982,8 @@ public class GForm_Main : DarkForm
this.byte_7 = this.method_15(channel, this.backgroundWorker_1); this.byte_7 = this.method_15(channel, this.backgroundWorker_1);
stopwatch.Stop(); stopwatch.Stop();
TimeSpan.FromMilliseconds((double)stopwatch.ElapsedMilliseconds); TimeSpan.FromMilliseconds((double)stopwatch.ElapsedMilliseconds);
DarkTextBox darkTextBox = this.darkTextBox_0; //DarkTextBox darkTextBox = this.darkTextBox_0;
darkTextBox.Text = darkTextBox.Text + GForm_Main.smethod_1(this.byte_7) + Environment.NewLine; //darkTextBox.Text = darkTextBox.Text + GForm_Main.smethod_1(this.byte_7) + Environment.NewLine;
} }
} }
} }
@ -1239,13 +1235,13 @@ public class GForm_Main : DarkForm
24, //0x18 24, //0x18
218, //0xDA 218, //0xDA
241, //0xF1 241, //0xF1
GForm_Main.byte_3 //0x00 GForm_Main.ECU_Byte //0x00
}; };
messageFilter.FlowControl = new byte[] messageFilter.FlowControl = new byte[]
{ {
24, //0x18 24, //0x18
218, //0xDA 218, //0xDA
GForm_Main.byte_3, //0x00 -> 0x10|0x11 GForm_Main.ECU_Byte, //0x00 -> 0x10|0x11
241 //0xF1 241 //0xF1
}; };
MessageFilter filter = messageFilter; MessageFilter filter = messageFilter;
@ -1562,7 +1558,7 @@ public class GForm_Main : DarkForm
public void method_13_Close(Channel channel_0) public void method_13_Close(Channel channel_0)
{ {
byte[] arraySend1 = new byte[] {0x37}; byte[] arraySend1 = new byte[] {0x37};
byte[] buffer2 = new byte[] { GForm_Main.byte_3, 0x77 }; byte[] buffer2 = new byte[] { GForm_Main.ECU_Byte, 0x77 };
byte[] Received = SendJ2534Message(channel_0, arraySend1, 3); byte[] Received = SendJ2534Message(channel_0, arraySend1, 3);
if (BadResponceReceived) return; if (BadResponceReceived) return;
@ -1589,7 +1585,7 @@ public class GForm_Main : DarkForm
{ {
0x18, 0x18,
0xDA, 0xDA,
GForm_Main.byte_3, GForm_Main.ECU_Byte,
0xF1, 0xF1,
0x36, 0x36,
byte_6X byte_6X
@ -1598,7 +1594,7 @@ public class GForm_Main : DarkForm
SAE.J2534.Message message = new SAE.J2534.Message(data, TxFlag.CAN_29BIT_ID | TxFlag.ISO15765_FRAME_PAD); SAE.J2534.Message message = new SAE.J2534.Message(data, TxFlag.CAN_29BIT_ID | TxFlag.ISO15765_FRAME_PAD);
channel_0.SendMessage(message); channel_0.SendMessage(message);
bool flag = false; bool flag = false;
byte[] buffer2 = new byte[] { GForm_Main.byte_3, 0x76, byte_6X }; byte[] buffer2 = new byte[] { GForm_Main.ECU_Byte, 0x76, byte_6X };
while (!flag) while (!flag)
{ {
GetMessageResults messages = channel_0.GetMessages(5); GetMessageResults messages = channel_0.GetMessages(5);
@ -1646,12 +1642,12 @@ public class GForm_Main : DarkForm
return; return;
} }
gform.Dispose(); gform.Dispose();
GForm_Main.byte_3 = GForm_Main.class9_0.ECU_Byte; GForm_Main.ECU_Byte = GForm_Main.class9_0.ECU_Byte;
GForm_Main.byte_0[3] = GForm_Main.class9_0.ECU_Byte; GForm_Main.byte_0[3] = GForm_Main.class9_0.ECU_Byte;
GForm_Main.byte_1[3] = GForm_Main.class9_0.ECU_Byte; GForm_Main.byte_1[3] = GForm_Main.class9_0.ECU_Byte;
GForm_Main.byte_2[3] = GForm_Main.class9_0.ECU_Byte; GForm_Main.byte_2[3] = GForm_Main.class9_0.ECU_Byte;
this.byte_5[0] = GForm_Main.class9_0.ECU_Byte; this.byte_5[0] = GForm_Main.class9_0.ECU_Byte;
Array.Resize<byte>(ref GForm_Main.byte_4, GForm_Main.class9_0.FirmwareSize); //Array.Resize<byte>(ref GForm_Main.byte_4, GForm_Main.class9_0.FirmwareSize);
Array.Resize<byte>(ref this.byte_7, GForm_Main.class9_0.RomSize); Array.Resize<byte>(ref this.byte_7, GForm_Main.class9_0.RomSize);
this.byte_7 = Enumerable.Repeat<byte>(byte.MaxValue, GForm_Main.class9_0.RomSize).ToArray<byte>(); this.byte_7 = Enumerable.Repeat<byte>(byte.MaxValue, GForm_Main.class9_0.RomSize).ToArray<byte>();
this.darkButton_2.Enabled = true; this.darkButton_2.Enabled = true;
@ -1719,6 +1715,7 @@ public class GForm_Main : DarkForm
this.darkTextBox_0.Location = new System.Drawing.Point(218, 63); this.darkTextBox_0.Location = new System.Drawing.Point(218, 63);
this.darkTextBox_0.Multiline = true; this.darkTextBox_0.Multiline = true;
this.darkTextBox_0.Name = "darkTextBox_0"; this.darkTextBox_0.Name = "darkTextBox_0";
this.darkTextBox_0.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.darkTextBox_0.Size = new System.Drawing.Size(399, 408); this.darkTextBox_0.Size = new System.Drawing.Size(399, 408);
this.darkTextBox_0.TabIndex = 55; this.darkTextBox_0.TabIndex = 55;
this.darkTextBox_0.Text = "Honda CANBUS Tools"; this.darkTextBox_0.Text = "Honda CANBUS Tools";
@ -2155,14 +2152,8 @@ public class GForm_Main : DarkForm
public static string string_0 = string.Empty; public static string string_0 = string.Empty;
public static string string_1 = ""; public static string string_1 = "";
private Dictionary<string, byte[]> dictionary_0 = new Dictionary<string, byte[]>(); private Dictionary<string, byte[]> dictionary_0 = new Dictionary<string, byte[]>();
private List<string> list_0 = new List<string>(); private List<string> list_0 = new List<string>();
@ -2200,37 +2191,28 @@ public class GForm_Main : DarkForm
}; };
public static byte byte_3 = 16; public static byte ECU_Byte = 16;
public static byte[] byte_ToWrite = new byte[] { }; public static byte[] byte_ToWrite = new byte[] { };
//public static byte[] byte_4 = new byte[2097152];
public static byte[] byte_4 = new byte[2097152];
private byte[] byte_5 = new byte[] private byte[] byte_5 = new byte[]
{ {
GForm_Main.byte_3, GForm_Main.ECU_Byte,
127 127
}; };
private byte[] byte_6 = new byte[2]; private byte[] byte_6 = new byte[2];
private byte[] byte_7; private byte[] byte_7;
private static byte[] byte_8 = new byte[] private static byte[] byte_8 = new byte[]
{ {
GForm_Main.byte_3, GForm_Main.ECU_Byte,
20 20
}; };
private string string_2 = string.Empty; private string string_2 = string.Empty;
internal static Class_ECUS class9_0; internal static Class_ECUS class9_0;
@ -2256,84 +2238,31 @@ public class GForm_Main : DarkForm
private BackgroundWorker backgroundWorker_0; private BackgroundWorker backgroundWorker_0;
private BackgroundWorker backgroundWorker_1; private BackgroundWorker backgroundWorker_1;
private DateTime dateTime_0; private DateTime dateTime_0;
private long long_0; private long long_0;
private IContainer icontainer_0; private IContainer icontainer_0;
private DarkButton darkButton_0; private DarkButton darkButton_0;
private DarkButton darkButton_DownloadROM; private DarkButton darkButton_DownloadROM;
private DarkButton darkButton_2; private DarkButton darkButton_2;
private DarkButton darkButton_3; private DarkButton darkButton_3;
private DarkTextBox darkTextBox_0; private DarkTextBox darkTextBox_0;
private DarkGroupBox darkGroupBox_0; private DarkGroupBox darkGroupBox_0;
private DarkLabel darkLabel_0; private DarkLabel darkLabel_0;
private DarkLabel darkLabel_1; private DarkLabel darkLabel_1;
private DarkLabel darkLabel_2; private DarkLabel darkLabel_2;
private DarkLabel darkLabel_3; private DarkLabel darkLabel_3;
private DarkLabel darkLabel_4; private DarkLabel darkLabel_4;
private DarkLabel darkLabel_5; private DarkLabel darkLabel_5;
private DarkTextBox darkTextBox_1; private DarkTextBox darkTextBox_1;
private DarkTextBox darkTextBox_2; private DarkTextBox darkTextBox_2;
private DarkTextBox darkTextBox_3; private DarkTextBox darkTextBox_3;
private DarkTextBox darkTextBox_4; private DarkTextBox darkTextBox_4;
private DarkButton darkButton_4; private DarkButton darkButton_4;
private DarkButton darkButton_FlashRom; private DarkButton darkButton_FlashRom;
private DarkButton darkButton_6; private DarkButton darkButton_6;
private DarkProgressBar darkProgressBar_0; private DarkProgressBar darkProgressBar_0;
private DarkLabel darkLabel_7; private DarkLabel darkLabel_7;
private DarkLabel darkLabel_8; private DarkLabel darkLabel_8;
private DarkButton darkButton1; private DarkButton darkButton1;
private DarkButton darkButton_Unlock41; private DarkButton darkButton_Unlock41;

View File

@ -44,6 +44,25 @@ public class GForm_PlatformSelect : DarkForm
private void method_1() private void method_1()
{ {
//#################################################################################################################
/*if (headers2[0] == 0x0b) AdditionnalCanInfos = " (Shift by wire)"; //->54008-XXX-XXXX files
if (headers2[0] == 0x0e) AdditionnalCanInfos = " (CVT Transmission (maybe?))"; //->
if (headers2[0] == 0x10) AdditionnalCanInfos = " (ECM with Manual Transmission)"; //->37805-XXX-XXXX files
if (headers2[0] == 0x11) AdditionnalCanInfos = " (ECM with Automatics Transmission)"; //->37805-XXX-XXXX files
if (headers2[0] == 0x1e) AdditionnalCanInfos = " (TCM - Transmission Control Module)"; //->28101-XXX-XXXX files
if (headers2[0] == 0x28) AdditionnalCanInfos = " (VSA Module)"; //->57114-XXX-XXXX files
if (headers2[0] == 0x2b) AdditionnalCanInfos = " (Electric Brake Booster Module)"; //->39494-XXX-XXXX files
if (headers2[0] == 0x30) AdditionnalCanInfos = " (Electric Power Sterring Module)"; //->39990-XXX-XXXX files
if (headers2[0] == 0x3a) AdditionnalCanInfos = " (Unknown Module)"; //->39390-XXX-XXXX files
if (headers2[0] == 0x53) AdditionnalCanInfos = " (SRS Module)"; //->77959-XXX-XXXX files
if (headers2[0] == 0x60) AdditionnalCanInfos = " (Odometer Module)"; //->78109-XXX-XXXX files
if (headers2[0] == 0x61) AdditionnalCanInfos = " (HUD Module)"; //->78209-XXX-XXXX files
if (headers2[0] == 0xb0) AdditionnalCanInfos = " (FWD Radar Module)"; //->36802-XXX-XXXX files
if (headers2[0] == 0xb5) AdditionnalCanInfos = " (FWD Camera Module)"; //->36161-XXX-XXXX files
if (headers2[0] == 0xef) AdditionnalCanInfos = " (Gateway Module)"; //->38897-XXX-XXXX files*/
//#################################################################################################################
//this.list_0.Add(new Class_ECUS("512k", "SH7055", 16, "0x10", 0x7FFFF, 1015808, "Manual")); //this.list_0.Add(new Class_ECUS("512k", "SH7055", 16, "0x10", 0x7FFFF, 1015808, "Manual"));
//this.list_0.Add(new Class_ECUS("512k", "SH7055", 17, "0x11", 0x7FFFF, 1015808, "Automatic")); //this.list_0.Add(new Class_ECUS("512k", "SH7055", 17, "0x11", 0x7FFFF, 1015808, "Automatic"));
//this.list_0.Add(new Class_ECUS("512k", "SH7055", 14, "0x0E", 0x7FFFF, 1015808, "CVT(maybe?)")); //this.list_0.Add(new Class_ECUS("512k", "SH7055", 14, "0x0E", 0x7FFFF, 1015808, "CVT(maybe?)"));