Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

Refresh a rewritten shortcut's icon where the shell cannot define the type (#11116)

Daniel Hanecc691babcb8
diff --git a/.github/workflows/cross-platform-parity-ci.yml b/.github/workflows/cross-platform-parity-ci.yml
index 8166d90fc42..d0be9c3ea21 100644
--- a/.github/workflows/cross-platform-parity-ci.yml
+++ b/.github/workflows/cross-platform-parity-ci.yml
@@ -108,6 +108,7 @@ on:
- 'tests/studio/test_install_lock_excludes_aliases.ps1'
- 'tests/studio/test_early_python_path_resolver.ps1'
- 'tests/studio/test_early_python_process_image.ps1'
+ - 'tests/studio/test_early_python_icon_refresh.ps1'
- 'tests/studio/test_application_control_cli_fallback.ps1'
# test_application_control_cli_fallback.ps1 pins install.ps1's trampoline against
# process.rs's, so a change to either spelling has to run here.
@@ -222,6 +223,7 @@ on:
- 'tests/studio/test_install_lock_excludes_aliases.ps1'
- 'tests/studio/test_early_python_path_resolver.ps1'
- 'tests/studio/test_early_python_process_image.ps1'
+ - 'tests/studio/test_early_python_icon_refresh.ps1'
- 'tests/studio/test_application_control_cli_fallback.ps1'
# test_application_control_cli_fallback.ps1 pins install.ps1's trampoline against
# process.rs's, so a change to either spelling has to run here.
@@ -410,6 +412,13 @@ jobs:
if: runner.os == 'Windows'
shell: powershell
run: powershell -NoProfile -File tests\studio\test_early_python_process_image.ps1
+ - name: Early Python icon refresh tests
+ shell: pwsh
+ run: pwsh -NoProfile -File tests/studio/test_early_python_icon_refresh.ps1
+ - name: Early Python icon refresh tests (Windows PowerShell 5.1)
+ if: runner.os == 'Windows'
+ shell: powershell
+ run: powershell -NoProfile -File tests\studio\test_early_python_icon_refresh.ps1
- name: Install lock alias-exclusion tests (Windows PowerShell 5.1)
if: runner.os == 'Windows'
shell: powershell
diff --git a/install.ps1 b/install.ps1
index 80b5fc12993..8b01b97ffb1 100644
--- a/install.ps1
+++ b/install.ps1
@@ -2918,6 +2918,40 @@ exit 1
return $answer
}
+ # Shortcut icon refresh via a child interpreter when the type cannot be defined. Cosmetic: never throws.
+ function Invoke-StudioPythonShellIconRefresh {
+ param([string[]]$Paths = @(), [string]$Exe = "", [switch]$DestinationValidated)
+ if (-not ($env:OS -eq "Windows_NT")) { return $false }
+ # Elevated, a venv interpreter runs only after the destination guard; --shortcuts-only never reaches it.
+ if (-not $DestinationValidated) {
+ try { if ((Get-ElevationState) -ne "false") { return $false } } catch { return $false }
+ }
+ # Kill switch before $Exe too: it forbids any child on this host, however the path was found.
+ if ("$($env:UNSLOTH_EARLY_PYTHON_PROBE)".Trim() -eq "0") { return $false }
+ $exe = $Exe
+ if ([string]::IsNullOrWhiteSpace($exe)) {
+ try {
+ $exe = Get-StudioEarlyPython
+ } catch { return $false }
+ }
+ if (-not $exe) { return $false }
+ # Per-item SHCNE_UPDATEITEM is required: the global broadcast misses in-place .lnk rewrites.
+ # SHCNF_FLUSH (0x1000) because the child exits at once and a queued notification is lost.
+ $script = "import ctypes,sys" + [char]10 +
+ "from ctypes import wintypes" + [char]10 +
+ "s32=ctypes.WinDLL('shell32',use_last_error=True)" + [char]10 +
+ "s32.SHChangeNotify.restype=None" + [char]10 +
+ "s32.SHChangeNotify.argtypes=[wintypes.LONG,wintypes.UINT,wintypes.LPCWSTR,wintypes.LPCWSTR]" + [char]10 +
+ "for p in sys.argv[1:]:" + [char]10 +
+ " s32.SHChangeNotify(0x00002000,0x1005,p,None)" + [char]10 +
+ "s32.SHChangeNotify(0x08000000,0x1000,None,None)" + [char]10 +
+ "sys.stdout.write('ok')"
+ try {
+ $answer = Invoke-StudioEarlyPythonScript -Exe $exe -Script $script -ScriptArgs $Paths -TimeoutMs 10000
+ } catch { return $false }
+ return ("$answer".Trim() -eq "ok")
+ }
+
# Exact = $true means the native resolver answered, so the string is what it
# always was. Callers keying a lock on it use that to judge an inequality.
function Resolve-StudioFinalPathInfo {
@@ -5168,7 +5202,8 @@ exit 1
function New-StudioShortcuts {
param(
- [Parameter(Mandatory = $true)][string]$ManagedPythonPath
+ [Parameter(Mandatory = $true)][string]$ManagedPythonPath,
+ [switch]$DestinationValidated
)
if (-not (Test-Path -LiteralPath $ManagedPythonPath)) {
@@ -5718,7 +5753,13 @@ exit 0
}
# SHCNE_ASSOCCHANGED (0x08000000) global refresh (belt-and-suspenders)
[UnslothShellIconRefresh]::SHChangeNotify(0x08000000, 0, $null, [System.IntPtr]::Zero)
- } catch {}
+ } catch {
+ # WDAC Dynamic Code Security refused the type: same notifications via a child.
+ try {
+ $null = Invoke-StudioPythonShellIconRefresh `
+ -Paths $createdShortcutPaths -Exe $ManagedPythonPath -DestinationValidated:$DestinationValidated
+ } catch {}
+ }
if ($firstInstall -or $iconChanged) {
try { & "$env:SystemRoot\System32\ie4uinit.exe" -ClearIconCache 2>$null } catch {}
try { & "$env:SystemRoot\System32\ie4uinit.exe" -show 2>$null } catch {}
@@ -11491,7 +11532,7 @@ sys.exit(2 if conflict else (0 if installed else 1))
}
# New-StudioShortcuts gates the .lnk shortcuts on env-mode internally.
- New-StudioShortcuts -ManagedPythonPath $VenvPython
+ New-StudioShortcuts -ManagedPythonPath $VenvPython -DestinationValidated
# Compare content hashes so hardlinks and identical copies do not false-trigger.
try {
diff --git a/tests/studio/test_early_python_icon_refresh.ps1 b/tests/studio/test_early_python_icon_refresh.ps1
new file mode 100644
index 00000000000..3097146ad5d
--- /dev/null
+++ b/tests/studio/test_early_python_icon_refresh.ps1
@@ -0,0 +1,207 @@
+#!/usr/bin/env pwsh
+# SPDX-License-Identifier: AGPL-3.0-only
+# Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
+# Shortcut icon refresh via a child interpreter where WDAC refuses the runtime type; must never fail an install.
+# Run: pwsh -NoProfile -File tests/studio/test_early_python_icon_refresh.ps1
+
+$ErrorActionPreference = "Stop"
+$root = (Resolve-Path ([System.IO.Path]::Combine($PSScriptRoot, "..", ".."))).Path
+$installPs1 = Join-Path $root "install.ps1"
+
+$failures = 0
+function Check($name, $cond) {
+ if ($cond) { Write-Host " PASS $name" }
+ else { Write-Host " FAIL $name" -ForegroundColor Red; $script:failures++ }
+}
+
+$tokens = $null; $errors = $null
+$ast = [System.Management.Automation.Language.Parser]::ParseFile($installPs1, [ref]$tokens, [ref]$errors)
+if ($errors) { $errors | ForEach-Object { $_.ToString() }; throw "install.ps1 has parse errors" }
+foreach ($name in @(
+ "Invoke-StudioEarlyPythonScript", "Invoke-StudioEarlyPython", "Get-StudioEarlyPython",
+ "Invoke-StudioPythonShellIconRefresh"
+)) {
+ $fn = $ast.FindAll({ param($n)
+ $n -is [System.Management.Automation.Language.FunctionDefinitionAst] -and $n.Name -eq $name
+ }, $true)
+ if ($fn.Count -lt 1) { throw "expected $name in install.ps1, found none" }
+ Invoke-Expression $fn[0].Extent.Text
+}
+# A standard user: an elevated run declines this probe, and hosted Windows runners are elevated.
+function Get-ElevationState { return "false" }
+
+# The kill switch would make discovery decline; its own cases below set it explicitly.
+Remove-Item Env:UNSLOTH_EARLY_PYTHON_PROBE -ErrorAction SilentlyContinue
+$script:StudioEarlyPythonProbed = $false
+$script:StudioEarlyPython = $null
+if (-not (Get-StudioEarlyPython)) {
+ # A runnable python on PATH means a broken extraction, not a host without Python.
+ $onPath = $null
+ foreach ($n in @("python3", "python")) {
+ foreach ($cmd in @(Get-Command $n -All -CommandType Application -ErrorAction SilentlyContinue)) {
+ if ($onPath -or -not $cmd.Source) { continue }
+ $job = Start-Job -ArgumentList $cmd.Source -ScriptBlock {
+ param($exe)
+ $o = & $exe -I -S -c "import os,sys;sys.stdout.write(os.path.realpath('.') if sys.version_info >= (3, 8) else '')" 2>$null
+ [pscustomobject]@{ Out = "$o"; Code = $LASTEXITCODE }
+ }
+ $ran = $null
+ if (Wait-Job $job -Timeout 30) { $ran = Receive-Job $job -ErrorAction SilentlyContinue } else { Stop-Job $job }
+ Remove-Job $job -Force
+ if ($ran -and $ran.Code -eq 0 -and -not [string]::IsNullOrWhiteSpace($ran.Out)) { $onPath = $cmd }
+ }
+ }
+ if ($onPath) {
+ Write-Host " FAIL Get-StudioEarlyPython found nothing, yet $($onPath.Source) is on PATH." -ForegroundColor Red
+ Write-Host " That is a broken extraction in this file, not a host without Python." -ForegroundColor Red
+ exit 1
+ }
+ Write-Host " SKIP no Python on this host, which is the fallback case and not a failure" -ForegroundColor Yellow
+ exit 0
+}
+
+
+$script:RunnerCalls = 0
+$script:RunnerArgs = @()
+$script:RunnerOutput = "ok"
+$script:RunnerThrows = $false
+function Invoke-StudioEarlyPythonScript {
+ param([string]$Exe, [string]$Script, [string[]]$ScriptArgs = @(), [int]$TimeoutMs = 10000)
+ $script:RunnerCalls++
+ $script:RunnerArgs = $ScriptArgs
+ if ($script:RunnerThrows) { throw "the child went wrong" }
+ return $script:RunnerOutput
+}
+
+$savedOs = $env:OS
+try {
+ $env:OS = "Windows_NT"
+
+ $script:RunnerCalls = 0
+ $links = @("C:\a\Unsloth Studio.lnk", "C:\b\Unsloth Studio.lnk")
+ $ok = Invoke-StudioPythonShellIconRefresh -Paths $links
+ Check "a child that reports success is believed" ($ok -eq $true)
+ Check "every shortcut written is named to the child, not just the last" (
+ $script:RunnerCalls -eq 1 -and ($script:RunnerArgs -join "|") -eq ($links -join "|"))
+
+ # Only the child's answer counts as success.
+ $script:RunnerOutput = ""
+ Check "control: a silent child is not success" (
+ (Invoke-StudioPythonShellIconRefresh -Paths $links) -eq $false)
+ $script:RunnerOutput = "something else"
+ Check "control: an unexpected answer is not success" (
+ (Invoke-StudioPythonShellIconRefresh -Paths $links) -eq $false)
+ $script:RunnerOutput = "ok"
+
+ $script:RunnerThrows = $true
+ $threw = $false
+ try { $null = Invoke-StudioPythonShellIconRefresh -Paths $links } catch { $threw = $true }
+ Check "a child that throws does not escape into the install" ($threw -eq $false)
+ $script:RunnerThrows = $false
+
+ Check "an empty shortcut list is handled" (
+ $null -ne (Invoke-StudioPythonShellIconRefresh -Paths @()))
+
+ # A passed interpreter wins over a cached discovery miss from before the install.
+ $savedFinder = ${function:Get-StudioEarlyPython}
+ function Get-StudioEarlyPython {
+ if ($script:StudioEarlyPythonProbed) { return $script:StudioEarlyPython }
+ $script:StudioEarlyPythonProbed = $true
+ $script:StudioEarlyPython = $script:FakeHostPython
+ return $script:StudioEarlyPython
+ }
+ $script:StudioEarlyPythonProbed = $false
+ $script:StudioEarlyPython = $null
+ $script:FakeHostPython = $null
+ $null = Get-StudioEarlyPython
+ $script:FakeHostPython = "C:\Studio\venv\Scripts\python.exe"
+
+ Check "control: discovery is still stuck on the cached miss (bites)" (
+ $null -eq (Get-StudioEarlyPython))
+ $script:RunnerCalls = 0
+ $ok = Invoke-StudioPythonShellIconRefresh -Paths $links -Exe $script:FakeHostPython
+ Check "a fresh install refreshes through the interpreter it just installed" (
+ $ok -eq $true -and $script:RunnerCalls -eq 1)
+ ${function:Get-StudioEarlyPython} = $savedFinder
+ $script:StudioEarlyPythonProbed = $false
+ $script:StudioEarlyPython = $null
+
+ $shortcutFn = @($ast.FindAll({ param($n)
+ $n -is [System.Management.Automation.Language.FunctionDefinitionAst] -and
+ $n.Name -eq "New-StudioShortcuts"
+ }, $true))[0].Extent.Text
+ Check "New-StudioShortcuts passes its own interpreter to the refresh" (
+ $shortcutFn -match '(?s)Invoke-StudioPythonShellIconRefresh[^\r\n]*[\r\n\s`]*-Paths \$createdShortcutPaths -Exe \$ManagedPythonPath')
+
+ # UNSLOTH_EARLY_PYTHON_PROBE=0 must win even over a passed interpreter (a past regression).
+ $savedProbe = $env:UNSLOTH_EARLY_PYTHON_PROBE
+ try {
+ $env:UNSLOTH_EARLY_PYTHON_PROBE = "0"
+ $script:RunnerCalls = 0
+ Check "with the probe disabled an explicit interpreter is still refused" (
+ (Invoke-StudioPythonShellIconRefresh -Paths $links -Exe "C:\Studio\venv\Scripts\python.exe") -eq $false)
+ Check "and no child process was started" ($script:RunnerCalls -eq 0)
+ $env:UNSLOTH_EARLY_PYTHON_PROBE = " 0 "
+ Check "the switch is read with surrounding whitespace trimmed" (
+ (Invoke-StudioPythonShellIconRefresh -Paths $links -Exe "C:\Studio\venv\Scripts\python.exe") -eq $false)
+ $env:UNSLOTH_EARLY_PYTHON_PROBE = "1"
+ $script:RunnerCalls = 0
+ Check "control: with the probe enabled the same call goes through" (
+ (Invoke-StudioPythonShellIconRefresh -Paths $links -Exe "C:\Studio\venv\Scripts\python.exe") -eq $true -and
+ $script:RunnerCalls -eq 1)
+ } finally {
+ if ($null -eq $savedProbe) { Remove-Item Env:UNSLOTH_EARLY_PYTHON_PROBE -ErrorAction SilentlyContinue }
+ else { $env:UNSLOTH_EARLY_PYTHON_PROBE = $savedProbe }
+ }
+
+ # Elevated, the venv interpreter runs only once the destination guard has passed: --shortcuts-only never gets there.
+ function Get-ElevationState { return "true" }
+ $script:RunnerCalls = 0
+ Check "an elevated run before the destination guard refuses the interpreter" (
+ (Invoke-StudioPythonShellIconRefresh -Paths $links -Exe "C:\Studio\venv\Scripts\python.exe") -eq $false -and
+ $script:RunnerCalls -eq 0)
+ Check "control: an elevated full install past the guard still refreshes" (
+ (Invoke-StudioPythonShellIconRefresh -Paths $links -Exe "C:\Studio\venv\Scripts\python.exe" -DestinationValidated) -eq $true -and
+ $script:RunnerCalls -eq 1)
+ function Get-ElevationState { return "false" }
+ $installText = Get-Content -LiteralPath $installPs1 -Raw
+ Check "only the full install's call vouches for the destination" (
+ ($installText -match 'New-StudioShortcuts -ManagedPythonPath \$VenvPython -DestinationValidated') -and
+ ($installText -match 'New-StudioShortcuts -ManagedPythonPath \$ShortcutPython\r?\n') -and
+ ($shortcutFn -match '-DestinationValidated:\$DestinationValidated'))
+
+ $env:OS = "Linux"
+ $script:RunnerCalls = 0
+ Check "off Windows the rung declines: there is no shell32 there" (
+ (Invoke-StudioPythonShellIconRefresh -Paths $links) -eq $false -and $script:RunnerCalls -eq 0)
+} finally {
+ if ($null -eq $savedOs) { Remove-Item Env:OS -ErrorAction SilentlyContinue } else { $env:OS = $savedOs }
+}
+
+
+$fnAst = $ast.FindAll({ param($n)
+ $n -is [System.Management.Automation.Language.FunctionDefinitionAst] -and
+ $n.Name -eq "Invoke-StudioPythonShellIconRefresh"
+}, $true)[0]
+$probeText = $fnAst.Extent.Text
+
+# Per-item SHCNE_UPDATEITEM is required (the global broadcast misses in-place .lnk rewrites); SHCNF_FLUSH since the child exits at once.
+Check "the probe sends SHCNE_UPDATEITEM with SHCNF_PATHW per shortcut, flushed" (
+ $probeText -match "SHChangeNotify\(0x00002000,0x1005,p,None\)")
+Check "the probe still sends the global SHCNE_ASSOCCHANGED broadcast, flushed" (
+ $probeText -match "SHChangeNotify\(0x08000000,0x1000,None,None\)")
+Check "the probe declares SHChangeNotify's signature" (
+ $probeText -match "SHChangeNotify\.argtypes" -and $probeText -match "LPCWSTR")
+
+# Fallback only: when the type can be defined the installer must not reach the child.
+$source = Get-Content -LiteralPath $installPs1 -Raw
+Check "the type-defining rung is still tried first" (
+ $source -match "UnslothShellIconRefresh`" -as \[type\]")
+Check "the child is reached only from the catch of that rung" (
+ $source -match "(?s)\}\s*catch\s*\{[^}]*?Invoke-StudioPythonShellIconRefresh")
+
+if ($failures -gt 0) {
+ Write-Host "$failures check(s) failed" -ForegroundColor Red
+ exit 1
+}
+Write-Host "all checks passed" -ForegroundColor Green
diff --git a/tests/studio/test_early_python_path_resolver.ps1 b/tests/studio/test_early_python_path_resolver.ps1
index f2288c2833b..c74a4bd95de 100644
--- a/tests/studio/test_early_python_path_resolver.ps1
+++ b/tests/studio/test_early_python_path_resolver.ps1
@@ -63,10 +63,33 @@ function Get-ElevationState { return "false" }
$tmp = Join-Path ([System.IO.Path]::GetTempPath()) ("earlypy-" + [guid]::NewGuid().ToString("N"))
New-Item -ItemType Directory -Force -Path $tmp | Out-Null
try {
+ # The kill switch would make discovery decline; its own cases below set it explicitly.
+ Remove-Item Env:UNSLOTH_EARLY_PYTHON_PROBE -ErrorAction SilentlyContinue
$script:StudioEarlyPythonProbed = $false
$script:StudioEarlyPython = $null
$exe = Get-StudioEarlyPython
if (-not $exe) {
+ # A runnable python on PATH means a broken extraction, not a host without Python.
+ $onPath = $null
+ foreach ($n in @("python3", "python")) {
+ foreach ($cmd in @(Get-Command $n -All -CommandType Application -ErrorAction SilentlyContinue)) {
+ if ($onPath -or -not $cmd.Source) { continue }
+ $job = Start-Job -ArgumentList $cmd.Source -ScriptBlock {
+ param($exe)
+ $o = & $exe -I -S -c "import os,sys;sys.stdout.write(os.path.realpath('.') if sys.version_info >= (3, 8) else '')" 2>$null
+ [pscustomobject]@{ Out = "$o"; Code = $LASTEXITCODE }
+ }
+ $ran = $null
+ if (Wait-Job $job -Timeout 30) { $ran = Receive-Job $job -ErrorAction SilentlyContinue } else { Stop-Job $job }
+ Remove-Job $job -Force
+ if ($ran -and $ran.Code -eq 0 -and -not [string]::IsNullOrWhiteSpace($ran.Out)) { $onPath = $cmd }
+ }
+ }
+ if ($onPath) {
+ Write-Host " FAIL Get-StudioEarlyPython found nothing, yet $($onPath.Source) is on PATH." -ForegroundColor Red
+ Write-Host " That is a broken extraction in this file, not a host without Python." -ForegroundColor Red
+ exit 1
+ }
Write-Host " SKIP no Python on this host, which is the fallback case and not a failure" -ForegroundColor Yellow
exit 0
}
diff --git a/tests/studio/test_early_python_process_image.ps1 b/tests/studio/test_early_python_process_image.ps1
index 388563b928c..68962005826 100644
--- a/tests/studio/test_early_python_process_image.ps1
+++ b/tests/studio/test_early_python_process_image.ps1
@@ -45,10 +45,33 @@ function Reset-RungState {
# ---------------------------------------------------------------- the generic runner, for real
+# The kill switch would make discovery decline; its own cases below set it explicitly.
+Remove-Item Env:UNSLOTH_EARLY_PYTHON_PROBE -ErrorAction SilentlyContinue
$script:StudioEarlyPythonProbed = $false
$script:StudioEarlyPython = $null
$exe = Get-StudioEarlyPython
if (-not $exe) {
+ # A runnable python on PATH means a broken extraction, not a host without Python.
+ $onPath = $null
+ foreach ($n in @("python3", "python")) {
+ foreach ($cmd in @(Get-Command $n -All -CommandType Application -ErrorAction SilentlyContinue)) {
+ if ($onPath -or -not $cmd.Source) { continue }
+ $job = Start-Job -ArgumentList $cmd.Source -ScriptBlock {
+ param($exe)
+ $o = & $exe -I -S -c "import os,sys;sys.stdout.write(os.path.realpath('.') if sys.version_info >= (3, 8) else '')" 2>$null
+ [pscustomobject]@{ Out = "$o"; Code = $LASTEXITCODE }
+ }
+ $ran = $null
+ if (Wait-Job $job -Timeout 30) { $ran = Receive-Job $job -ErrorAction SilentlyContinue } else { Stop-Job $job }
+ Remove-Job $job -Force
+ if ($ran -and $ran.Code -eq 0 -and -not [string]::IsNullOrWhiteSpace($ran.Out)) { $onPath = $cmd }
+ }
+ }
+ if ($onPath) {
+ Write-Host " FAIL Get-StudioEarlyPython found nothing, yet $($onPath.Source) is on PATH." -ForegroundColor Red
+ Write-Host " That is a broken extraction in this file, not a host without Python." -ForegroundColor Red
+ exit 1
+ }
Write-Host " SKIP no Python on this host, which is the fallback case and not a failure" -ForegroundColor Yellow
exit 0
}
@@ -181,6 +204,21 @@ Check "the probe declares CloseHandle's argument type" (
$probeText -match "CloseHandle\.argtypes")
# 0x400 is refused by protected and cross-session processes; 0x1000 is not.
Check "the probe asks for the limited-information right only" ($probeText -match "OpenProcess\(0x1000,")
+# Both rungs must return the same string or Test-StudioProtectedPathMatch sees false differences.
+$nativeInit = ($ast.FindAll({ param($n)
+ $n -is [System.Management.Automation.Language.FunctionDefinitionAst] -and
+ $n.Name -eq "Get-StudioNativeProcessImagePath" }, $true)[0]).Extent.Text
+$nativeRight = if ($nativeInit -match '\$queryLimitedInformation\s*=\s*\[uint32\](0x[0-9a-fA-F]+)') { $Matches[1] } else { "" }
+Check "the native rung asks for the same access right the probe does" (
+ $nativeRight -eq "0x1000" -and
+ $nativeInit -match "OpenProcess\(\s*\r?\n?\s*\`$queryLimitedInformation," -and
+ $probeText -match "OpenProcess\(0x1000,")
+Check "both pass flags 0, so both get the Win32 path form and not the device form" (
+ $nativeInit -match "QueryFullProcessImageNameW\(\s*\`$handle,\s*\[uint32\]0," -and
+ $probeText -match "QueryFullProcessImageNameW\(h,0,")
+Check "both size the buffer the same" (
+ $nativeInit -match "32768" -and $probeText -match "create_unicode_buffer\(32768\)")
+
# EnumProcesses filling the buffer exactly may mean truncation; only a smaller count is complete.
Check "the probe grows its buffer until the enumeration is provably complete" (
$probeText -match "b\.value\s*<\s*ctypes\.sizeof\(a\)")