Skip to content

Commit

Permalink
V33
Browse files Browse the repository at this point in the history
  • Loading branch information
werasik2aa committed Apr 13, 2024
1 parent 5d05d58 commit a74a13d
Show file tree
Hide file tree
Showing 15 changed files with 345 additions and 365 deletions.
20 changes: 8 additions & 12 deletions HuaweiUnlock/DIAGNOS/OemInfoTool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ public static void Decompile(string path, string Header = "4F454D5F494E464F")
LOG(0, "DATA:", Encoding.ASCII.GetString(data));
}
}
FileAll = null;
}
public static List<int> GetOffsets(byte[] file, string pattr)
{
Expand All @@ -94,26 +95,21 @@ public static List<int> GetOffsets(byte[] file, string pattr)
public static void Compile(string intpath, string outpath)
{
//NOT WORK
FileStream outfile = new FileStream(outpath, FileMode.OpenOrCreate);
outfile.Seek(0, SeekOrigin.Begin);

//ТУТ нужно было все файлы из папки в .img
//а я вот такую поеботу сделал 0_)
DirectoryInfo hdDirectoryInWhichToSearch = new DirectoryInfo("UnlockFiles/OemInfoData/");
DirectoryInfo hdDirectoryInWhichToSearch = new DirectoryInfo(intpath);
FileInfo[] filesInDir = hdDirectoryInWhichToSearch.GetFiles("*.header");
FileStream outfile = new FileStream(outpath, FileMode.OpenOrCreate);
foreach (var dfile in filesInDir)
{
byte[] filebts = File.ReadAllBytes(dfile.FullName);
outfile.Seek(0, SeekOrigin.Begin);
LOG(0, "Adding: " + dfile.Name);
byte[] filebts = File.ReadAllBytes(intpath + dfile.Name);
outfile.Write(filebts, 0, filebts.Length);
foreach (var aoffset in Offsets)
{
LOG(0, "Adding: OEM_INFO_" + aoffset + ".header");
filebts = File.ReadAllBytes(intpath + "/OEM_INFO_" + aoffset + ".header");
outfile.Write(filebts, 0, filebts.Length);
}
outfile.Close();
outfile.Dispose();
}
outfile.Close();
outfile.Dispose();
}
}
}
5 changes: 3 additions & 2 deletions HuaweiUnlock/English.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Success,SUCCESS
Done,DONE
Percent,Please wait:
File,File:
FileWrong,Wrong File
Canceled,Canceled
MAIN1,Its free noo need to pay for that
MAIN2,Author: moongamer
Expand All @@ -32,8 +33,8 @@ SelPathToFGB,Select Path To Firmware:
SelPathToGPTXML,Select path for save rawprogram0.xml:
SelPathToGPT,Select path to gpt.bin:
UnlockBTN,Unlock FRP
DdBtn,Download BootLoader And Unlock [factory BL]
DdBtnE,Unlock Dev [factory BL]
DdBtn,Download BootLoader And Unlock [Factory BL]
DdBtnE,Unlock Device [Factory BL]
FlBtn,Flash Firmware
UnpBtn,Extract Firmware
FlashUnpBtn,Extract and Flash
Expand Down
4 changes: 1 addition & 3 deletions HuaweiUnlock/FlashTool/FlashToolQClegacy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,8 @@ public static async void Unlock(string loader, string path)
{
if (fileName.EndsWith(".xml")) continue;
string partname = fileName.Split('\\').Last().Split('.').First();
LOG(0, "Writer", partname + newline);
subcommand = "-p " + DeviceInfo.Port.ComName + " -f " + '"' + loader + '"' + " -b " + partname + " " + '"' + fileName + '"';
if (DeviceInfo.Partitions.ContainsKey(partname))
CurPartLenght = int.Parse(DeviceInfo.Partitions[partname].BlockNumSectors);
LOG(0, "Writer", partname + newline);
if (!SyncRUN(command, subcommand))
LOG(2, "FailUnl");
else Progress(50);
Expand Down
3 changes: 2 additions & 1 deletion HuaweiUnlock/HuaweiUnlock.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>HuaweiUnlocker</RootNamespace>
<AssemblyName>HuaweiUnlock</AssemblyName>
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
Expand Down Expand Up @@ -145,6 +145,7 @@
<DesignTime>True</DesignTime>
</Compile>
<EmbeddedResource Include="English.ini" />
<None Include="app.config" />
<None Include="ILMerge.props" />
<None Include="packages.config" />
<EmbeddedResource Include="Russian.ini" />
Expand Down
11 changes: 6 additions & 5 deletions HuaweiUnlock/LangProc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ namespace HuaweiUnlocker
{
public static class LangProc
{
public const string APP_VERSION = "32F";
public const string APP_VERSION = "33F";
public static TextBox LOGGBOX;
public static string log, loge, newline = Environment.NewLine, PrevFolder = "c:\\";
public static string log, loge, newline = Environment.NewLine, PrevFolder = "UnlockFiles";
public static StreamWriter se;
public static NProgressBar PRG;
public static TabControl Tab;
Expand Down Expand Up @@ -175,14 +175,14 @@ public static bool LOG(int o, object i, object j = null, string sepa = " ")

try
{
i = string.Join("", Regex.Split((string)i, @"(?:\r\n|\n|\r)"));
j = string.Join("", Regex.Split((string)j, @"(?:\r\n|\n|\r)"));
i = string.Join(newline, Regex.Split((string)i, @"(?:\r\n|\n|\r)"));
j = string.Join(newline, Regex.Split((string)j, @"(?:\r\n|\n|\r)"));
}
catch
{

}
string line = (newline + state + i + sepa + j).Replace("/n", newline).Replace("\n", newline);
string line = (newline + state + i + sepa + j);
action = () => LOGGBOX.AppendText(line);
if (LOGGBOX.InvokeRequired)
LOGGBOX.Invoke(action);
Expand Down Expand Up @@ -234,6 +234,7 @@ public static List<Port_D> GETPORTLIST()
reqq.ComName = DEVICEname.Split(' ').Last().Replace("(", "").Replace(")", "");
reqq.FullName = DEVICEname;
req.Add(reqq);
Thread.Sleep(10);
}
}
catch (Exception)
Expand Down
24 changes: 12 additions & 12 deletions HuaweiUnlock/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 7 additions & 5 deletions HuaweiUnlock/Russian.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ NotFoundF,Файл не найден:
NoRights,Нет прав. Попробуйте от имени админа
Info,[ЛОГ]
Error,[Ошибка]
Action,Действия:
Warning,[Предупреждение]
Success,Успешно
Done,Завершено
Percent,Подождите:
File,Файл:
FileWrong,Говно Файл.(Не правильный)
Canceled,Отменено/Очищенно
MAIN1,Это бесплатное ПО. Не нужно за него платить
MAIN2,Автор: moongamer
Expand All @@ -32,8 +34,8 @@ SelPathToFGB,Выберите путь к прошивке:
SelPathToGPTXML,Выберите путь для сохранения файла rawprogram0.xml:
SelPathToGPT,Выберите путь к gpt.bin:
UnlockBTN,Разблокировать FRP
DdBtn,Загрузить загрузчик и разблокировать [factory BL]
DdBtnE,Разблокировать устройство [factory BL]
DdBtn,Загрузить загрузчик и разблокировать [Factory BL]
DdBtnE,Разблокировать устройство [Factory BL]
FlBtn,Прошить прошивку
UnpBtn,Распаковать прошивку
FlashUnpBtn,Распаковать и прошить
Expand Down Expand Up @@ -144,14 +146,14 @@ WarnUnl,Разблокированное ядро для этого устрой
[HISI]
HISIGPTtagSimpl,[HISI] Разделы
HISISelectCpu,Выберите процессор
HISIInitFB,Записать ключ разблокировки устройства
HISIWriteKirinBL,Записать ключа разблокировки устройства
HISIInitFB,Записать информацию и ключ разблокировки устройства
HISIWriteKirinBL,Прочитать ключ разблокировки устройства
HISIWriteKirinBLD,Загрузить заводской загрузчик и прочитать информацию
HISIWriteKirinBLD2,Загрузить заводской загрузчик и войти в Fastboot
HISIInfoS,*** FBLOCK заблокирован! ***/nВ этом состоянии FBLOCK ничего не сделать
HISINewKey,[FASTBOOT] Новый ключ USERLOCK:
HISIOldKey,[FASTBOOT] Считанный код USERLOCK:
HISINewKeyErr,[Fastboot] Ошибка при записи/считывании кода разблокировки
HISIVerifyHash, Проверка изображений...[HISI]
HISI TryULTag, разблокируйте WARN. Может быть бутлуп.
HISITryULTag, разблокируйте WARN. Может быть бутлуп.
HISITryUnlock, заводской загрузчик будет прошит в качестве основного загрузчика. Если заводской загрузчик показывает черный экран - нажмите НЕТ! В противном случае вы получите устройство с черным экраном. Ваше устройство может загружаться только с черным экраном!
2 changes: 1 addition & 1 deletion HuaweiUnlock/TOOLS/Fastboot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ public bool Connect(int waittime = 100)
return false;
}

Thread.Sleep(500);
counter++;
Thread.Sleep(64);
Application.DoEvents();
}

Expand Down
9 changes: 4 additions & 5 deletions HuaweiUnlock/TOOLS/HISI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,15 @@ public static void FlashBootloader(Bootloader bootloader, string port)
{
if (!image.IsValid)
{
throw new Exception($"Image `{image.Role}` is not valid!");
LOG(2, "Image " + image.Role + " is not valid!");
return;
}

asize += image.Size;
}

LOG(0, "CPort", port);
flasher.Open(port);

LOG(0, "Writer", bootloader.Name);
LOG(0, "Writer", bootloader.Name.Replace("NVME", "NVE"));

foreach (var image in bootloader.Images)
{
Expand Down Expand Up @@ -216,7 +215,7 @@ public static string ReadIndentifier()
var res = fb.Command("oem get_identifier_token");
var match = Regex.Match(res.Payload, @"[\w\d]{16}");

return match.Success ? match.Value : "NaN";
return match.Success ? match.Value : res.Payload;
}
public static void UnlockFBLOCK()
{
Expand Down
3 changes: 2 additions & 1 deletion HuaweiUnlock/TOOLS/ImageFlasher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ private void SendFrame(byte[] data)

if (_ack != 0xAA)
{
throw new Exception(string.Format("ACK is invalid! ACK={0:X2}; Excepted={1:X2}", _ack, 0xAA));
LangProc.LOG(2, string.Format("ACK is invalid! ACK={0:X2}; Excepted={1:X2}", _ack, 0xAA), " :FAIL TO FLASH:");
return;
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions HuaweiUnlock/UI/Language.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,20 @@ public static bool ReadLngFile()
StreamReader readerL = new StreamReader(File.OpenRead("Languages\\" + CURRENTlanguage + ".ini"));
string line;
while ((line = readerL.ReadLine()) != null)
if (!line.StartsWith("[") && !line.StartsWith("#")) LanguageStrs.Add(line.Split(',')[0], line.Split(',')[1]);
if (!line.StartsWith("[") && !line.StartsWith("#")) LanguageStrs.Add(line.Split(',')[0].ToLower(), line.Split(',')[1]);
readerL.Close();
readerL.Dispose();
return LanguageStrs.Count > 0;
}
public static string Get(string name)
{
if (isExist(name))
return LanguageStrs[name];
if (isExist(name.ToLower()))
return LanguageStrs[name.ToLower()];
else return "LANG_ERROR";
}
public static bool isExist(string name)
{
return LanguageStrs.ContainsKey(name);
return LanguageStrs.ContainsKey(name.ToLower());
}
}
}
Loading

0 comments on commit a74a13d

Please sign in to comment.