Build legacy drivers and publish per-OS packages with web activation and DEB

This commit is contained in:
2026-11-27 20:55:31 +00:00
96 changed files with 3204 additions and 25 deletions

22
cross/build-legacy-bridge.sh Executable file
View File

@@ -0,0 +1,22 @@
#!/usr/bin/env bash
# CRT-free x86 executable. No historical Microsoft headers required for usermode.
set -euo pipefail
cd "$(dirname "$0")/.."
for t in clang lld-link llvm-ar python3 objdump; do command -v "$t" >/dev/null; done
out=$PWD/build/cross/legacy-bridge; mkdir -p "$out"; rm -f "$out"/{MARSNET.EXE,imports.lib}
python3 - "$out" <<'PY'
import pathlib,struct,sys
p=pathlib.Path(sys.argv[1]);
exports={'KERNEL32.dll':{'ExitProcess':4,'GetStdHandle':4,'WriteFile':20,'GetCommandLineA':0,'GetFullPathNameA':16,'GetPrivateProfileStringA':24,'GetSystemDirectoryA':8,'LoadLibraryA':4,'GetProcAddress':8,'FreeLibrary':4,'GetTickCount':0,'Sleep':4,'SetConsoleCtrlHandler':8,'CreateMutexA':12,'CloseHandle':4,'GetLastError':0},'WSOCK32.dll':{'WSAStartup':8,'WSACleanup':0,'WSAGetLastError':0,'socket':12,'closesocket':4,'setsockopt':20,'bind':12,'getsockname':12,'ioctlsocket':12,'sendto':24,'recvfrom':24}}
for dll, funcs in exports.items():
for name,n in funcs.items():
data=f'_{name}@{n}\0{dll}\0'.encode('ascii');(p/(name+'.imp.obj')).write_bytes(struct.pack('<HHHHIIHH',0,0xffff,0,0x14c,0,len(data),0,3<<2)+data)
PY
llvm-ar rcs "$out/imports.lib" "$out"/*.imp.obj
for f in src/ipxpkt.c clients/windows/client_core.c clients/windows/ndis3/legacy_bridge.c; do
clang --target=i686-pc-windows-msvc -march=i386 -mno-sse -mno-sse2 -ffreestanding -fno-builtin -fno-stack-protector -Os -Wall -Wextra -Iclients/windows/ndis3/freestanding -Isrc -c "$f" -o "$out/$(basename "$f" .c).obj"
done
lld-link /entry:start /subsystem:console,4.0 /osversion:4.0 /nodefaultlib /machine:x86 /safeseh:no /dynamicbase:no /nxcompat:no /timestamp:0 /out:"$out/MARSNET.EXE" "$out/legacy_bridge.obj" "$out/client_core.obj" "$out/ipxpkt.obj" "$out/imports.lib"
python3 cross/verify-pe.py "$out/MARSNET.EXE" exe
objdump -p "$out/MARSNET.EXE" > "$out/MARSNET.imports.txt"
echo 'CRT-free MARSNET.EXE built; still requires an NDIS3 miniport and WinPcap 3.1 at runtime.'