No description
Find a file
wilma24 1774929afb Revert "19041"
This reverts commit 227bf027d2.
2025-09-03 17:17:10 -05:00
.gitignore Update .gitignore 2025-06-28 12:50:27 -05:00
fix_chromium.sh Update fix_chromium.sh 2025-08-05 10:14:04 -05:00
README.md Revert "19041" 2025-09-03 17:17:10 -05:00
runwithargs.sh Revert "19041" 2025-09-03 17:17:10 -05:00

to all future readers i ended up making a bash script that u can run on windows which does some tricks to make chromium always launch with --oauth2-client-id=77185425430.apps.googleusercontent.com --oauth2-client-secret=OTJgUOQcT7lO7GsGZq2G4IlT regardless of whats in the shortcut target

install visual studio 2019 buildtools from https://aka.ms/vs/16/release/vs_BuildTools.exe

and then run vs_BuildTools.exe --add Microsoft.VisualStudio.Component.Windows10SDK.20348 --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.VisualStudio.Component.VC.CMake.Project in cmd

this will install windows sdk and msvc

fun fact this also installs everything you need to run rust 1.75.0 too if u ever want or need to

anyway

now also install https://github.com/git-for-windows/git/releases/tag/v2.46.0.windows.1 as you will need it for the next steps

all of the programs i just linked are compatible with windows 7

and then save this

#!/bin/bash
export INCLUDE="C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/include;C:/Program Files (x86)/Windows Kits/NETFXSDK/4.8/include/um;C:/Program Files (x86)/Windows Kits/10/include/10.0.20348.0/ucrt;C:/Program Files (x86)/Windows Kits/10/include/10.0.20348.0/shared;C:/Program Files (x86)/Windows Kits/10/include/10.0.20348.0/um;C:/Program Files (x86)/Windows Kits/10/include/10.0.20348.0/winrt;C:/Program Files (x86)/Windows Kits/10/include/10.0.20348.0/cppwinrt"
export LIB="C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/lib/x86;C:/Program Files (x86)/Windows Kits/NETFXSDK/4.8/lib/um/x86;C:/Program Files (x86)/Windows Kits/10/lib/10.0.20348.0/ucrt/x86;C:/Program Files (x86)/Windows Kits/10/lib/10.0.20348.0/um/x86"
targetExe="$1"
prependArgs="${@:2}"
echo "$prependArgs"
if [[ -z "$targetExe" || -z "$prependArgs" ]]; then
    echo "Usage: $0 <targetExe> <prependArgs>"
    exit 1
fi
targetDir="$(dirname "$targetExe")"
baseName="$(basename "$targetExe" .exe)"
copyName="${baseName}_copy.exe"
copyPath="${targetDir}\\${copyName}"
cp -av "$targetExe" "$copyPath"
wrapperName="${baseName}_wrapper.exe"
wrapperPath="${targetDir}\\${wrapperName}"
wrapperSourceName="${baseName}_wrapper.c"
wrapperSourcePath="${targetDir}/${wrapperSourceName}"
cat > "$wrapperSourcePath" <<EOF
#pragma comment(lib, "Shlwapi.lib")
#pragma comment(lib, "shell32.lib")
#pragma comment(lib, "Advapi32.lib")
#include <windows.h>
#include <stdio.h>
#include <shlwapi.h>

int main(int argc, char *argv[]) {
    STARTUPINFOA si = { sizeof(si) };
    PROCESS_INFORMATION pi;
    si.dwFlags |= STARTF_USESTDHANDLES;
    si.hStdInput  = GetStdHandle(STD_INPUT_HANDLE);
    si.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE);
    si.hStdError  = GetStdHandle(STD_ERROR_HANDLE);
    LPCSTR exePath = "$(echo "$copyPath" | sed 's/\\/\\\\/g')";
    LPCSTR args    = "${prependArgs}";
    char cmdline[4096];
    snprintf(cmdline, sizeof(cmdline), "\"%s\"", exePath);
    for (int i = 2; i < argc; i++) {
        strcat(cmdline, " ");
        strcat(cmdline, argv[i]);
    }
    if (strstr(cmdline, args) == NULL) {
        char temp[4096];
        snprintf(temp, sizeof(temp), "\"%s\" %s", exePath, args);
        for (int i = 2; i < argc; i++) {
            strcat(temp, " ");
            strcat(temp, argv[i]);
        }
        strcpy(cmdline, temp);
    }
    char workingDir[MAX_PATH];
    strcpy(workingDir, exePath);
    PathRemoveFileSpecA(workingDir);
    BOOL ok = CreateProcessA(NULL, cmdline, NULL, NULL, TRUE, 0, NULL, workingDir, &si, &pi);
    if (!ok) {
        DWORD err = GetLastError();
        fprintf(stderr, "CreateProcessA failed: %lu\\n", err);
        return 1;
    }
    WaitForSingleObject(pi.hProcess, INFINITE);
    DWORD exitCode;
    GetExitCodeProcess(pi.hProcess, &exitCode);
    CloseHandle(pi.hProcess);
    CloseHandle(pi.hThread);
    return (int)exitCode;
}
EOF
clExe="/c/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx86/x86/cl.exe"
"$clExe" -nologo -O2 -Fe"$wrapperPath" "$wrapperSourcePath" -link -SUBSYSTEM:WINDOWS -ENTRY:mainCRTStartup
elevatorSourcePath="${targetDir}/elevate_reg.c"
elevatorExePath="${targetDir}/elevate_reg.exe"
regCommand="reg add \"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\$(basename "$targetExe")\" -v Debugger -t REG_SZ -d \"$wrapperPath\" -f"
escapedRegCommand=$(printf "%s" "$regCommand" | sed 's/\\/\\\\/g; s/"/\\"/g')
cat > "$elevatorSourcePath" <<EOF
#pragma comment(lib, "shell32.lib")
#include <shlwapi.h>

int main() {
    ShellExecuteA(NULL, "runas", "cmd.exe", "/c \"$escapedRegCommand\"", NULL, SW_HIDE);
    return 0;
}
EOF
escapedCommand=$(echo "$regCommand" | sed 's/"/\\"/g')
sed -i "s|CMDLINE_PLACEHOLDER|\"$escapedCommand\"|" "$elevatorSourcePath"
"$clExe" -nologo -O2 -Fe"$elevatorExePath" "$elevatorSourcePath" -link -SUBSYSTEM:WINDOWS -ENTRY:mainCRTStartup
"$elevatorExePath"
echo "Built wrapper and set IFEO debugger to: $wrapperPath"
exit 0

to runwithargs.sh into a folder that u can remember

and open git bash as administrator as u need admin perms to write to HKEY_LOCAL_MACHINE in registry

and then cd with git bash into the directory where u saved runwithargs.sh

and then run ./runwithargs.sh "C:\Users\\$(whoami)\AppData\Local\Chromium\Application\chrome.exe" "--oauth2-client-id=77185425430.apps.googleusercontent.com --oauth2-client-secret=OTJgUOQcT7lO7GsGZq2G4IlT" in git bash

but make sure all chromium windows are closed out before running that command

it should then show

--oauth2-client-id=77185425430.apps.googleusercontent.com --oauth2-client-secret=OTJgUOQcT7lO7GsGZq2G4IlT
'C:\Users\roryliebtuns\AppData\Local\Chromium\Application\chrome.exe' -> 'C:\Users\roryliebtuns\AppData\Local\Chromium\Application\chrome_copy.exe'
chrome_wrapper.c
elevate_reg.c
Built wrapper and set IFEO debugger to: C:\Users\roryliebtuns\AppData\Local\Chromium\Application\chrome_wrapper.exe

and then next time you launch chromium, itll run with --oauth2-client-id=77185425430.apps.googleusercontent.com --oauth2-client-secret=OTJgUOQcT7lO7GsGZq2G4IlT always

tested working on https://github.com/e3kskoy7wqk/Chromium-for-windows-7/releases/tag/135.0.7049.72 https://github.com/e3kskoy7wqk/Chromium-for-windows-7/releases/tag/130.0.6723.79 https://github.com/e3kskoy7wqk/Chromium-for-windows-7/releases/tag/132.0.6834.154 https://github.com/e3kskoy7wqk/Chromium-for-windows-7/releases/tag/122.0.6261.116