Snapshot for release 2026.10.31.4 (internal 34cea02)

This commit is contained in:
Tom Bohar 2026-11-01 18:47:28 -05:00
commit b1c182b05d
114 changed files with 8691 additions and 452 deletions

View file

@ -0,0 +1,47 @@
/*
* DumpArgsTests.c - offline checks for DumpArgs.h (RC_DumpProcess's command line, the hang
* dump written from rundll32). Build and run with Run-DumpArgsTests.ps1 (x86 MSVC). Exit 0 = pass.
*/
#include <stdio.h>
#include <string.h>
#include <wchar.h>
#include "../DumpArgs.h"
static int g_checks, g_failed;
static void check(int ok, const char* what)
{
g_checks++;
if (ok) return;
g_failed++;
printf("[FAIL] %s\n", what);
}
int main(void)
{
unsigned long pid;
wchar_t path[260];
/* What HangDumpCommand.Arguments leaves for the entry (rundll32 passes the text after the entry name). */
check(ParseDumpArgs(L"17132 C:\\Games\\RynthCore\\Logs\\dumps\\hang_17132_20261031_211714.dmp", &pid, path, 260)
&& pid == 17132 && wcscmp(path, L"C:\\Games\\RynthCore\\Logs\\dumps\\hang_17132_20261031_211714.dmp") == 0,
"pid and path");
check(ParseDumpArgs(L" 42 C:\\Users\\Some One's PC\\a b.dmp ", &pid, path, 260)
&& pid == 42 && wcscmp(path, L"C:\\Users\\Some One's PC\\a b.dmp") == 0,
"spaces and an apostrophe in the path are kept, the ends trimmed");
check(ParseDumpArgs(L"7 \"C:\\x y\\z.dmp\"", &pid, path, 260) && pid == 7 && wcscmp(path, L"C:\\x y\\z.dmp") == 0,
"a quoted path loses its quotes");
check(!ParseDumpArgs(L"", &pid, path, 260), "empty refused");
check(!ParseDumpArgs(NULL, &pid, path, 260), "null refused");
check(!ParseDumpArgs(L"123", &pid, path, 260), "no path refused");
check(!ParseDumpArgs(L"0 C:\\a.dmp", &pid, path, 260), "pid 0 refused");
check(!ParseDumpArgs(L"x C:\\a.dmp", &pid, path, 260), "no pid refused");
check(!ParseDumpArgs(L"12x C:\\a.dmp", &pid, path, 260), "a pid run into text refused");
check(!ParseDumpArgs(L"99999999999 C:\\a.dmp", &pid, path, 260), "an overflowing pid refused");
check(ParseDumpArgs(L"4294967295 C:\\a.dmp", &pid, path, 260) && pid == 4294967295UL, "the largest pid");
check(!ParseDumpArgs(L"5 C:\\abcdefgh.dmp", &pid, path, 8), "a path longer than the buffer refused, not cut");
check(ParseDumpArgs(L"5 C:\\a.dmp", &pid, path, 9) && wcscmp(path, L"C:\\a.dmp") == 0, "a path that just fits");
printf("%d check(s), %d failed.\n", g_checks, g_failed);
return g_failed == 0 ? 0 : 1;
}

View file

@ -0,0 +1,28 @@
# Run-DumpArgsTests.ps1
# Builds and runs DumpArgsTests.c (x86 MSVC, the same toolchain as the DLL).
# -OutDir: where the test exe goes (default: native\SehTrampoline\tests\bin). Exit 0 = pass.
param([string]$OutDir = (Join-Path $PSScriptRoot "bin"))
$ErrorActionPreference = "Stop"
$vsPath = & "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" `
-latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 `
-property installationPath 2>$null
if (-not $vsPath) { Write-Error "Visual Studio with C++ tools not found."; exit 1 }
$vcVer = (Get-ChildItem "$vsPath\VC\Tools\MSVC" | Sort-Object Name -Descending | Select-Object -First 1).Name
$vcBase = "$vsPath\VC\Tools\MSVC\$vcVer"
$cl = "$vcBase\bin\Hostx86\x86\cl.exe"
$sdkVer = (Get-ChildItem "C:\Program Files (x86)\Windows Kits\10\Include" | Sort-Object Name -Descending | Select-Object -First 1).Name
$sdkInc = "C:\Program Files (x86)\Windows Kits\10\Include\$sdkVer"
$sdkLib = "C:\Program Files (x86)\Windows Kits\10\Lib\$sdkVer"
$env:INCLUDE = "$vcBase\include;$sdkInc\ucrt;$sdkInc\um;$sdkInc\shared"
$env:LIB = "$vcBase\lib\x86;$sdkLib\ucrt\x86;$sdkLib\um\x86"
New-Item -ItemType Directory -Path $OutDir -Force | Out-Null
$exe = Join-Path $OutDir "DumpArgsTests.exe"
& $cl /nologo /W4 /WX "$PSScriptRoot\DumpArgsTests.c" /Fo"$OutDir\\" /Fe"$exe" /link /MACHINE:X86
if ($LASTEXITCODE -ne 0) { Write-Error "Compilation failed."; exit $LASTEXITCODE }
& $exe
exit $LASTEXITCODE