Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ClusterM/hakchi2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--FelLib/Fel.cs2
-rw-r--r--FelLib/WinUSBNet/API/DeviceManagement.cs7
-rw-r--r--WorkerForm.cs16
-rw-r--r--hakchi_gui.csproj2
-rw-r--r--tools/mkbootfs.bat1
5 files changed, 23 insertions, 5 deletions
diff --git a/FelLib/Fel.cs b/FelLib/Fel.cs
index 63fbee54..549e71b8 100644
--- a/FelLib/Fel.cs
+++ b/FelLib/Fel.cs
@@ -370,7 +370,7 @@ namespace com.clusterrr.FelLib
}
#if DEBUG
- private static void DebugLog(string text)
+ public static void DebugLog(string text)
{
Console.WriteLine(text);
try
diff --git a/FelLib/WinUSBNet/API/DeviceManagement.cs b/FelLib/WinUSBNet/API/DeviceManagement.cs
index 2d593cce..e58a22b1 100644
--- a/FelLib/WinUSBNet/API/DeviceManagement.cs
+++ b/FelLib/WinUSBNet/API/DeviceManagement.cs
@@ -14,6 +14,7 @@ using System.Runtime.InteropServices;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Text.RegularExpressions;
+using com.clusterrr.FelLib;
namespace MadWizard.WinUSBNet.API
{
@@ -241,12 +242,18 @@ namespace MadWizard.WinUSBNet.API
// Get the String containing the devicePathName.
try
{
+#if DEBUG
+ Fel.DebugLog("Trying to parse device: "+ pathName);
+#endif
DeviceDetails details = GetDeviceDetails(pathName, deviceInfoSet, da);
if (details.VID == vid && details.PID == pid)
deviceList.Add(details);
}
catch (APIException)
{
+#if DEBUG
+ Fel.DebugLog("Can't parse this device");
+#endif
continue;
}
}
diff --git a/WorkerForm.cs b/WorkerForm.cs
index c4c770d8..bf09927e 100644
--- a/WorkerForm.cs
+++ b/WorkerForm.cs
@@ -444,8 +444,11 @@ namespace com.clusterrr.hakchi_gui
File.WriteAllText(hiddenPath, h.ToString());
}
ExecuteTool("upx.exe", "--best sbin\\cryptsetup", ramfsDirectory);
- if (!ExecuteTool("mkbootfs.bat", string.Format("\"{0}\" \"{1}\"", ramfsDirectory, initramfs_cpioPatched), toolsDirectory))
+
+ byte[] ramdisk;
+ if (!ExecuteTool("mkbootfs.exe", string.Format("\"{0}\"", ramfsDirectory), out ramdisk))
throw new Exception("Can't repack ramdisk");
+ File.WriteAllBytes(initramfs_cpioPatched, ramdisk);
var argCmdline = File.ReadAllText(Path.Combine(kernelDirectory, "kernel.img-cmdline")).Trim();
var argBoard = File.ReadAllText(Path.Combine(kernelDirectory, "kernel.img-board")).Trim();
var argBase = File.ReadAllText(Path.Combine(kernelDirectory, "kernel.img-base")).Trim();
@@ -468,6 +471,12 @@ namespace com.clusterrr.hakchi_gui
private bool ExecuteTool(string tool, string args, string directory = null, bool external = false)
{
+ byte[] output;
+ return ExecuteTool(tool, args, out output, directory, external);
+ }
+
+ private bool ExecuteTool(string tool, string args, out byte[] output, string directory = null, bool external = false)
+ {
var process = new Process();
var appDirectory = Path.GetDirectoryName(Application.ExecutablePath);
var fileName = !external ? Path.Combine(toolsDirectory, tool) : tool;
@@ -479,9 +488,12 @@ namespace com.clusterrr.hakchi_gui
process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
process.StartInfo.UseShellExecute = false;
process.StartInfo.CreateNoWindow = true;
- //process.StartInfo.RedirectStandardOutput = true;
+ process.StartInfo.StandardOutputEncoding = Encoding.GetEncoding(1251);
+ process.StartInfo.RedirectStandardOutput = true;
process.Start();
+ string outputStr = process.StandardOutput.ReadToEnd();
process.WaitForExit();
+ output = Encoding.GetEncoding(1251).GetBytes(outputStr);
return process.ExitCode == 0;
}
diff --git a/hakchi_gui.csproj b/hakchi_gui.csproj
index 78d61e76..d1a37242 100644
--- a/hakchi_gui.csproj
+++ b/hakchi_gui.csproj
@@ -5,7 +5,7 @@
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{F1F983FD-A54F-4881-8394-5A4BA65EFD6B}</ProjectGuid>
- <OutputType>WinExe</OutputType>
+ <OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>com.clusterrr.hakchi_gui</RootNamespace>
<AssemblyName>hakchi</AssemblyName>
diff --git a/tools/mkbootfs.bat b/tools/mkbootfs.bat
deleted file mode 100644
index 0d39c17e..00000000
--- a/tools/mkbootfs.bat
+++ /dev/null
@@ -1 +0,0 @@
-mkbootfs.exe %1 > %2