Clear log on install and update installer URLs

This commit is contained in:
√(noham)²
2026-05-10 16:36:11 +02:00
parent 3d8d519d8b
commit 9335c33671
2 changed files with 14 additions and 9 deletions

View File

@@ -51,6 +51,10 @@ static std::string GetLogPath()
return "rmhook.log"; return "rmhook.log";
} }
static void ClearLog()
{
std::ofstream file(GetLogPath(), std::ios::trunc);
}
static void Log(const std::string& msg) static void Log(const std::string& msg)
{ {
@@ -304,7 +308,7 @@ static void LoadConfig()
Log("[ERROR] Failed to check config existence: " + ec.message()); Log("[ERROR] Failed to check config existence: " + ec.message());
} }
MessageBoxA(NULL, "First launch detected.\nUsing default config (example.com:443).\nYou can edit configuration in %LOCALAPPDATA%\\RMHook\\config.json", "RMHook Configuration", MB_OK | MB_ICONINFORMATION); MessageBoxA(NULL, "First launch detected.\nUsing default config (example.com:443).\nEdit configuration in %LOCALAPPDATA%\\RMHook\\config.json\nand restart the application to apply changes.", "RMHook Configuration", MB_OK | MB_ICONINFORMATION);
std::filesystem::create_directories(configPath.parent_path(), ec); std::filesystem::create_directories(configPath.parent_path(), ec);
if (ec) if (ec)
@@ -592,6 +596,7 @@ static void* ResolveExport(HMODULE module, const char* symbol)
void InstallHooks() void InstallHooks()
{ {
LoadConfig(); LoadConfig();
ClearLog();
Log("[*] Initializing MinHook"); Log("[*] Initializing MinHook");

View File

@@ -1,19 +1,19 @@
$DllUrl = "https://github.com/NohamR/RMHook-Win/releases/download/v1.0/paho-mqtt3as.dll" $REPO = "NohamR/RMHook-Win"
$ScriptUrl = "https://raw.githubusercontent.com/NohamR/RMHook-Win/main/scripts/install-hook.ps1" $FILE = "paho-mqtt3as.dll"
$TempDir = [System.IO.Path]::GetTempPath() $TempDir = [System.IO.Path]::GetTempPath()
$DestPath = Join-Path $TempDir "paho-mqtt3as.dll" $DestPath = Join-Path $TempDir $FILE
$InstallScriptPath = Join-Path $TempDir "install-hook.ps1" $InstallScriptPath = Join-Path $TempDir "install-hook.ps1"
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Write-Host "Downloading DLL from $DllUrl to $DestPath..." Write-Host "[INFO] Downloading $FILE..."
Invoke-WebRequest -Uri $DllUrl -OutFile $DestPath -UseBasicParsing Invoke-WebRequest -Uri "https://github.com/$REPO/releases/latest/download/$FILE" -OutFile $DestPath -UseBasicParsing
Write-Host "Downloading install script..." Write-Host "[INFO] Downloading install script..."
Invoke-WebRequest -Uri $ScriptUrl -OutFile $InstallScriptPath -UseBasicParsing Invoke-WebRequest -Uri "https://raw.githubusercontent.com/$REPO/refs/heads/main/scripts/install-hook.ps1" -OutFile $InstallScriptPath -UseBasicParsing
Write-Host "Installing hook with downloaded DLL..." Write-Host "[INFO] Running install script..."
# Run the downloaded script, bypassing execution policies # Run the downloaded script, bypassing execution policies
powershell.exe -NoProfile -ExecutionPolicy Bypass -File $InstallScriptPath -Action install -SourcePath $DestPath powershell.exe -NoProfile -ExecutionPolicy Bypass -File $InstallScriptPath -Action install -SourcePath $DestPath