This commit is contained in:
Alessandro Autiero
2024-06-03 16:26:04 +02:00
parent 3069f3aa05
commit 46034aa1fa
24 changed files with 242 additions and 189 deletions

View File

@@ -21,3 +21,4 @@ const List<String> kCannotConnectErrors = [
"UOnlineAccountCommon::ForceLogout"
];
const String kGameFinishedLine = "PlayersLeft: 1";
const String kDisplayInitializedLine = "Display";

View File

@@ -0,0 +1,6 @@
enum InjectableDll {
console,
cobalt,
reboot,
memoryFix
}

View File

@@ -6,7 +6,7 @@ import 'package:path/path.dart' as path;
import 'package:reboot_common/common.dart';
bool _watcher = false;
final File rebootDllFile = File("${assetsDirectory.path}\\dlls\\reboot.dll");
final File rebootDllFile = File("${dllsDirectory.path}\\reboot.dll");
const String kRebootDownloadUrl =
"http://nightly.link/Milxnor/Project-Reboot-3.0/workflows/msbuild/master/Release.zip";
@@ -18,7 +18,7 @@ Future<bool> hasRebootDllUpdate(int? lastUpdateMs, {int hours = 24, bool force =
}
Future<void> downloadCriticalDll(String name, String outputPath) async {
final response = await http.get(Uri.parse("https://github.com/Auties00/reboot_launcher/raw/master/gui/assets/dlls/$name"));
final response = await http.get(Uri.parse("https://github.com/Auties00/reboot_launcher/raw/master/gui/dependencies/dlls/$name"));
if(response.statusCode != 200) {
throw Exception("Cannot download $name: status code ${response.statusCode}");
}

View File

@@ -34,10 +34,11 @@ final class _MIB_TCPTABLE_OWNER_PID extends Struct {
@Uint32()
external int dwNumEntries;
@Array(1)
@Array(512)
external Array<_MIB_TCPROW_OWNER_PID> table;
}
bool isLocalHost(String host) => host.trim() == "127.0.0.1"
|| host.trim().toLowerCase() == "localhost"
|| host.trim() == "0.0.0.0";
@@ -46,7 +47,6 @@ bool killProcessByPort(int port) {
var pTcpTable = calloc<_MIB_TCPTABLE_OWNER_PID>();
final dwSize = calloc<DWORD>();
dwSize.value = 0;
int result = _getExtendedTcpTable(
nullptr,
dwSize,
@@ -56,6 +56,7 @@ bool killProcessByPort(int port) {
0
);
if (result == ERROR_INSUFFICIENT_BUFFER) {
free(pTcpTable);
pTcpTable = calloc<_MIB_TCPTABLE_OWNER_PID>(dwSize.value);
result = _getExtendedTcpTable(
pTcpTable,

View File

@@ -3,6 +3,8 @@ import 'dart:io';
Directory get installationDirectory =>
File(Platform.resolvedExecutable).parent;
Directory get dllsDirectory => Directory("${installationDirectory.path}\\dlls");
Directory get assetsDirectory {
var directory = Directory("${installationDirectory.path}\\data\\flutter_assets\\assets");
if(directory.existsSync()) {

View File

@@ -33,7 +33,10 @@ final _CreateRemoteThread = _kernel32.lookupFunction<
Pointer<Uint32> lpThreadId)>('CreateRemoteThread');
const chunkSize = 1024;
Future<void> injectDll(int pid, String dll) async {
Future<void> injectDll(int pid, File dll) async {
// Get the path to the file
final dllPath = dll.path;
final process = OpenProcess(
0x43A,
0,
@@ -52,7 +55,7 @@ Future<void> injectDll(int pid, String dll) async {
final dllAddress = VirtualAllocEx(
process,
nullptr,
dll.length + 1,
dllPath.length + 1,
0x3000,
0x4
);
@@ -60,8 +63,8 @@ Future<void> injectDll(int pid, String dll) async {
final writeMemoryResult = WriteProcessMemory(
process,
dllAddress,
dll.toNativeUtf8(),
dll.length,
dllPath.toNativeUtf8(),
dllPath.length,
nullptr
);
@@ -89,6 +92,18 @@ Future<void> injectDll(int pid, String dll) async {
}
}
Future<bool> startElevatedProcess({required String executable, required String args, bool window = false}) async {
var shellInput = calloc<SHELLEXECUTEINFO>();
shellInput.ref.lpFile = executable.toNativeUtf16();
shellInput.ref.lpParameters = args.toNativeUtf16();
shellInput.ref.nShow = window ? SW_SHOWNORMAL : SW_HIDE;
shellInput.ref.fMask = ES_AWAYMODE_REQUIRED;
shellInput.ref.lpVerb = "runas".toNativeUtf16();
shellInput.ref.cbSize = sizeOf<SHELLEXECUTEINFO>();
var shellResult = ShellExecuteEx(shellInput);
return shellResult == 1;
}
Future<Process> startProcess({required File executable, List<String>? args, bool wrapProcess = true, bool window = false, String? name}) async {
final argsOrEmpty = args ?? [];
if(wrapProcess) {