Skip to content

Commit f04b562

Browse files
authored
Merge pull request #1 from notcarlton/master
stuff
2 parents 44c5408 + 61e9f3a commit f04b562

File tree

3 files changed

+20
-18
lines changed

3 files changed

+20
-18
lines changed

Injector/Debug.cs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,15 @@ static bool CheckDirectories()
3939

4040
// Create tree of all subdirectories and files
4141

42-
var tree = new List<string>();
42+
// needed?
43+
//var tree = new List<string>();
4344

4445
Logger.Log("Debug", "Checking files...");
45-
foreach (var dir in Directory.GetDirectories(praxDir))
46+
47+
foreach (var file in Directory.GetFiles(praxDir, "*", SearchOption.AllDirectories))
4648
{
47-
Logger.Log("Debug", "Directory found: " + dir);
48-
foreach (var file in Directory.GetFiles(dir))
49-
{
50-
Logger.Log("Debug", "File found: " + file);
51-
}
49+
Logger.Log("Debug", "Directory found: " + Path.GetDirectoryName(file));
50+
Logger.Log("Debug", "File found: " + file);
5251
}
5352

5453

@@ -88,7 +87,7 @@ public static void PerformChecks()
8887
Logger.Log("Debug", isGameUpToDate ? "Game is up to date" : "It's possible the game version is not supported", isGameUpToDate ? Logger.LType.Info : Logger.LType.Error);
8988

9089

91-
Logger.Log("Debug", "Checks complete, Send a picture of this in your support ticket and make sure all text is readable.");
90+
Logger.Log("Debug", "Checks complete. Send a screenshot of this in your support ticket and make sure all text is readable.");
9291

9392

9493
}

Injector/Inject.cs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -153,35 +153,34 @@ private static void ApplyAppPackages(string dllPath)
153153
public static bool InjectDLL()
154154
{
155155

156-
Logger.Log("InjectDLL", "Injecting " + Path);
156+
Logger.Log("Inject", "Injecting " + Path);
157157

158158
ApplyAppPackages(Path);
159159
var target = Process.GetProcessesByName("Minecraft.Windows").FirstOrDefault();
160160
if (target == null)
161161
{
162-
Logger.Log("InjectDLL", "Failed to find Minecraft.Windows process", Logger.LType.Error);
162+
Logger.Log("Inject", "Failed to find Minecraft.Windows process", Logger.LType.Error);
163163
return false;
164164
}
165165

166166
// Check if the dll is already injected
167167
var modules = target.Modules.Cast<ProcessModule>().ToList();
168168
if (modules.Any(module => module.FileName == Path))
169169
{
170-
Logger.Log("InjectDLL", "Prax.dll is already injected", Logger.LType.Error);
170+
Logger.Log("Inject", "Prax.dll is already injected", Logger.LType.Error);
171171
return false;
172172
}
173173

174-
Logger.Log("InjectDLL", "Injecting Prax.dll");
174+
Logger.Log("Inject", "Injecting Prax.dll");
175175

176176
var hProc = OpenProcess(0xFFFF, false, target.Id);
177177
var loadLibraryProc = GetProcAddress(GetModuleHandleW("kernel32.dll"), "LoadLibraryA");
178178
var allocated = VirtualAllocEx(hProc, IntPtr.Zero, (uint)Path.Length + 1, 0x00001000 | 0x00002000,
179179
0x40);
180180
WriteProcessMemory(hProc, allocated, Encoding.UTF8.GetBytes(Path), (uint)Path.Length + 1, out _);
181-
Logger.Log("InjectDLL", "Allocated memory");
181+
Logger.Log("Inject", "Allocated memory");
182182
CreateRemoteThread(hProc, IntPtr.Zero, 0, loadLibraryProc, allocated, 0, IntPtr.Zero);
183-
Logger.Log("InjectDLL", "Remote thread created");
184-
Logger.Log("InjectDLL", "Prax.dll injected");
183+
Logger.Log("Inject", "Remote thread created");
185184
return true;
186185
}
187186

Injector/Program.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class Program
99

1010
public static async Task Main(string[] args)
1111
{
12-
Program.Client.DefaultRequestHeaders.Add("User-Agent", "Prax Injector");
12+
Client.DefaultRequestHeaders.Add("User-Agent", "Prax Injector");
1313
Console.Title = "Prax Injector";
1414

1515
Console.ForegroundColor = ConsoleColor.Magenta;
@@ -47,7 +47,7 @@ public static async Task Main(string[] args)
4747

4848
Logger.Log("Main", "Continuing...");
4949
} else if (latestSupportedVersion == string.Empty) Logger.Log("Main", "Failed to get latest supported version!", Logger.LType.Error);
50-
else Logger.Log("Main", $"Minecraft version {mcVersion} is supported.", Logger.LType.Info);
50+
else Logger.Log("Main", $"Minecraft version {mcVersion} is supported.");
5151

5252

5353
Inject.LaunchMinecraft();
@@ -63,7 +63,11 @@ public static async Task Main(string[] args)
6363
}
6464

6565
bool result = Inject.InjectDLL();
66-
if (result) Thread.Sleep(2000);
66+
if (result)
67+
{
68+
Logger.Log("Main", "Prax injected successfully! Press insert in game to open the menu.");
69+
Thread.Sleep(5000);
70+
}
6771
else
6872
{
6973
Logger.Log("Main", "Failed to inject Prax.dll", Logger.LType.Error);

0 commit comments

Comments
 (0)