fix(shell): preserve Windows launcher paths and elevation arguments
macOS QQ runtime / runtime (arm64, macos-15) (push) Canceled after 0s
macOS QQ runtime / runtime (x64, macos-15-intel) (push) Canceled after 0s
Windows launcher / launchers (push) Canceled after 0s
Release Tag / validate-version (push) Canceled after 0s
Release Tag / trigger-release (push) Canceled after 0s
macOS native compatibility / native (arm64, macos-15) (push) Canceled after 0s
macOS native compatibility / native (x64, macos-15-intel) (push) Canceled after 0s
macOS QQ runtime / runtime (arm64, macos-15) (push) Canceled after 0s
macOS QQ runtime / runtime (x64, macos-15-intel) (push) Canceled after 0s
Windows launcher / launchers (push) Canceled after 0s
Release Tag / validate-version (push) Canceled after 0s
Release Tag / trigger-release (push) Canceled after 0s
macOS native compatibility / native (arm64, macos-15) (push) Canceled after 0s
macOS native compatibility / native (x64, macos-15-intel) (push) Canceled after 0s
This commit is contained in:
1 parent
f8786c65de
commit
ff9a829e29
8 files changed
+210
-23
No files matched your search
@@ -0,0 +1,20 @@
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$terminal = $args[0]
|
||||
$payload = @{
|
||||
script = $args[1]
|
||||
arguments = @($args | Select-Object -Skip 2)
|
||||
} | ConvertTo-Json -Compress
|
||||
$encodedPayload = [Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes($payload))
|
||||
$command = @"
|
||||
`$payload = [Text.Encoding]::UTF8.GetString([Convert]::FromBase64String('$encodedPayload')) | ConvertFrom-Json
|
||||
`$launchArguments = @(`$payload.arguments)
|
||||
& `$payload.script @launchArguments
|
||||
exit `$LASTEXITCODE
|
||||
"@
|
||||
$encodedCommand = [Convert]::ToBase64String([Text.Encoding]::Unicode.GetBytes($command))
|
||||
$commandArguments = "-NoProfile -ExecutionPolicy Bypass -EncodedCommand $encodedCommand"
|
||||
if ($terminal -eq 'wt.exe') {
|
||||
Start-Process -FilePath $terminal -ArgumentList "powershell.exe $commandArguments" -Verb RunAs
|
||||
} else {
|
||||
Start-Process -FilePath $terminal -ArgumentList $commandArguments -Verb RunAs
|
||||
}
|
||||
@@ -7,11 +7,14 @@ set "NAPCAT_LOAD_PATH=%cd%\loadNapCat.js"
|
||||
set "NAPCAT_INJECT_PATH=%cd%\NapCatWinBootHook.dll"
|
||||
set "NAPCAT_LAUNCHER_PATH=%cd%\NapCatWinBootMain.exe"
|
||||
set "NAPCAT_MAIN_PATH=%cd%\napcat.mjs"
|
||||
:loop_read
|
||||
set "RetString="
|
||||
for /f "tokens=2*" %%a in ('reg query "HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\QQ" /v "UninstallString"') do (
|
||||
set "RetString=%%~b"
|
||||
goto :napcat_boot
|
||||
)
|
||||
echo QQ installation was not found in the registry.
|
||||
pause
|
||||
exit /b 1
|
||||
|
||||
:napcat_boot
|
||||
for %%a in ("%RetString%") do (
|
||||
@@ -23,9 +26,10 @@ set "QQPath=%pathWithoutUninstall%QQ.exe"
|
||||
if not exist "%QQpath%" (
|
||||
echo provided QQ path is invalid
|
||||
pause
|
||||
exit /b
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
"%NAPCAT_LAUNCHER_PATH%" "%QQPath%" "%NAPCAT_INJECT_PATH%" %*
|
||||
|
||||
set "napcat_exit_code=%ERRORLEVEL%"
|
||||
pause
|
||||
exit /b %napcat_exit_code%
|
||||
@@ -7,11 +7,14 @@ set "NAPCAT_LOAD_PATH=%cd%\loadNapCat.js"
|
||||
set "NAPCAT_INJECT_PATH=%cd%\NapCatWinBootHook.dll"
|
||||
set "NAPCAT_LAUNCHER_PATH=%cd%\NapCatWinBootMain.exe"
|
||||
set "NAPCAT_MAIN_PATH=%cd%\napcat.mjs"
|
||||
:loop_read
|
||||
set "RetString="
|
||||
for /f "tokens=2*" %%a in ('reg query "HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\QQ" /v "UninstallString"') do (
|
||||
set "RetString=%%~b"
|
||||
goto :napcat_boot
|
||||
)
|
||||
echo QQ installation was not found in the registry.
|
||||
pause
|
||||
exit /b 1
|
||||
|
||||
:napcat_boot
|
||||
for %%a in ("%RetString%") do (
|
||||
@@ -23,11 +26,13 @@ set "QQPath=%pathWithoutUninstall%QQ.exe"
|
||||
if not exist "%QQpath%" (
|
||||
echo provided QQ path is invalid
|
||||
pause
|
||||
exit /b
|
||||
exit /b 1
|
||||
)
|
||||
"%NAPCAT_LAUNCHER_PATH%" "%QQPath%" "%NAPCAT_INJECT_PATH%" %*
|
||||
set "napcat_exit_code=%ERRORLEVEL%"
|
||||
|
||||
REM Optional: -q <QQ_NUMBER> for quick login, omit for QR code login
|
||||
REM Example: "%NAPCAT_LAUNCHER_PATH%" "%QQPath%" "%NAPCAT_INJECT_PATH%" -q 123456
|
||||
|
||||
pause
|
||||
exit /b %napcat_exit_code%
|
||||
@@ -3,24 +3,26 @@ setlocal DisableDelayedExpansion
|
||||
cd /d "%~dp0" || exit /b 1
|
||||
chcp 65001 >nul
|
||||
net session >nul 2>&1
|
||||
if %ERRORLEVEL% == 0 (
|
||||
echo Administrator mode detected.
|
||||
) else (
|
||||
echo Please run this script in administrator mode.
|
||||
powershell -Command "Start-Process 'cmd.exe' -ArgumentList '/c cd /d \"%cd%\" && \"%~f0\" %*' -Verb runAs"
|
||||
exit
|
||||
)
|
||||
if not errorlevel 1 goto :napcat_admin
|
||||
powershell -NoProfile -ExecutionPolicy Bypass -File "%~dp0launcher-elevate.ps1" powershell.exe "%~f0" %*
|
||||
exit /b %ERRORLEVEL%
|
||||
|
||||
:napcat_admin
|
||||
echo Administrator mode detected.
|
||||
|
||||
set "NAPCAT_PATCH_PACKAGE=%cd%\qqnt.json"
|
||||
set "NAPCAT_LOAD_PATH=%cd%\loadNapCat.js"
|
||||
set "NAPCAT_INJECT_PATH=%cd%\NapCatWinBootHook.dll"
|
||||
set "NAPCAT_LAUNCHER_PATH=%cd%\NapCatWinBootMain.exe"
|
||||
set "NAPCAT_MAIN_PATH=%cd%\napcat.mjs"
|
||||
:loop_read
|
||||
set "RetString="
|
||||
for /f "tokens=2*" %%a in ('reg query "HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\QQ" /v "UninstallString"') do (
|
||||
set "RetString=%%~b"
|
||||
goto :napcat_boot
|
||||
)
|
||||
echo QQ installation was not found in the registry.
|
||||
pause
|
||||
exit /b 1
|
||||
|
||||
:napcat_boot
|
||||
for %%a in ("%RetString%") do (
|
||||
@@ -32,9 +34,10 @@ set "QQPath=%pathWithoutUninstall%QQ.exe"
|
||||
if not exist "%QQPath%" (
|
||||
echo provided QQ path is invalid
|
||||
pause
|
||||
exit /b
|
||||
exit /b 1
|
||||
)
|
||||
"%NAPCAT_LAUNCHER_PATH%" "%QQPath%" "%NAPCAT_INJECT_PATH%" %*
|
||||
exit /b %ERRORLEVEL%
|
||||
|
||||
REM Optional: -q <QQ_NUMBER> for quick login, omit for QR code login
|
||||
REM Example: "%NAPCAT_LAUNCHER_PATH%" "%QQPath%" "%NAPCAT_INJECT_PATH%" -q 123456
|
||||
@@ -3,24 +3,26 @@ setlocal DisableDelayedExpansion
|
||||
cd /d "%~dp0" || exit /b 1
|
||||
chcp 65001 >nul
|
||||
net session >nul 2>&1
|
||||
if %ERRORLEVEL% == 0 (
|
||||
echo Administrator mode detected.
|
||||
) else (
|
||||
echo Please run this script in administrator mode.
|
||||
powershell -Command "Start-Process 'wt.exe' -ArgumentList 'cmd /c cd /d \"%cd%\" && \"%~f0\" %*' -Verb runAs"
|
||||
exit
|
||||
)
|
||||
if not errorlevel 1 goto :napcat_admin
|
||||
powershell -NoProfile -ExecutionPolicy Bypass -File "%~dp0launcher-elevate.ps1" wt.exe "%~f0" %*
|
||||
exit /b %ERRORLEVEL%
|
||||
|
||||
:napcat_admin
|
||||
echo Administrator mode detected.
|
||||
|
||||
set "NAPCAT_PATCH_PACKAGE=%cd%\qqnt.json"
|
||||
set "NAPCAT_LOAD_PATH=%cd%\loadNapCat.js"
|
||||
set "NAPCAT_INJECT_PATH=%cd%\NapCatWinBootHook.dll"
|
||||
set "NAPCAT_LAUNCHER_PATH=%cd%\NapCatWinBootMain.exe"
|
||||
set "NAPCAT_MAIN_PATH=%cd%\napcat.mjs"
|
||||
:loop_read
|
||||
set "RetString="
|
||||
for /f "tokens=2*" %%a in ('reg query "HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\QQ" /v "UninstallString"') do (
|
||||
set "RetString=%%~b"
|
||||
goto :napcat_boot
|
||||
)
|
||||
echo QQ installation was not found in the registry.
|
||||
pause
|
||||
exit /b 1
|
||||
|
||||
:napcat_boot
|
||||
for %%a in ("%RetString%") do (
|
||||
@@ -32,7 +34,8 @@ set "QQPath=%pathWithoutUninstall%QQ.exe"
|
||||
if not exist "%QQPath%" (
|
||||
echo provided QQ path is invalid
|
||||
pause
|
||||
exit /b
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
"%NAPCAT_LAUNCHER_PATH%" "%QQPath%" "%NAPCAT_INJECT_PATH%" %*
|
||||
exit /b %ERRORLEVEL%
|
||||
Reference in new issue
Block a user