Skip to content

Harden helper deploy against partial-copy UAC loop (#97)#99

Draft
corando98 wants to merge 1 commit into
release/v0.3.98.0from
issue97-deploy-hardening
Draft

Harden helper deploy against partial-copy UAC loop (#97)#99
corando98 wants to merge 1 commit into
release/v0.3.98.0from
issue97-deploy-hardening

Conversation

@corando98

Copy link
Copy Markdown
Owner

Fixes the infinite version-mismatch/UAC setup loop reported in #97 (fresh install on GPD Win 5).

Root cause

DeployHelper() returned success whenever the exe landed (successCount > 0 && File.Exists(DeployedExePath)), even with failCount > 0 — but only stamps .version when failCount == 0. A single failed file copy therefore let PerformSetup() report Setup Complete while .version was never written. Every subsequent launch re-detected a version mismatch (deployed=, current=0.3.2556.0) and re-fired UAC. Once the scheduled task had a helper running from the deployed folder, its locked exe/DLLs made every redeploy fail the same way — a permanent loop the reporter could only break by hand-writing .version and End-Tasking zombie helpers.

Changes

  • DeployHelper() success now matches the .version stamp condition (failCount == 0 && exe present), so a partial deploy fails setup loudly instead of half-succeeding silently.
  • PerformSetup() kills running/zombie XboxGamingBarHelper.exe instances before deploying (Step 0). The setup process is elevated so it has the rights; this releases the file locks that made retries fail.
  • The self-copy no-op path re-stamps a missing/stale .version when a real package-identity version is available — never the assembly-version fallback (hardcoded 1.0.0.0), which would poison the stamp and recreate the loop. Extracted GetPackageVersionFromIdentity() (returns null without identity) for this.

Verification

XboxGamingBarHelper.csproj builds clean in Release x64. Not hardware-tested; the loop needs a machine where a deploy copy fails mid-setup to reproduce end-to-end.

Fresh install on GPD Win 5 hit an infinite version-mismatch/UAC loop:
DeployHelper returned success whenever the exe landed, even with
failCount>0, but only stamps .version when failCount==0. A single
failed file copy therefore let PerformSetup report Setup Complete
while .version was never written, so every launch re-detected a
mismatch and re-fired UAC. Once the scheduled task had a helper
running from the deployed folder, its locked files made every retry
fail the same way.

- DeployHelper success now matches the .version stamp condition, so a
  partial deploy fails setup loudly instead of half-succeeding.
- PerformSetup kills running/zombie helper instances before deploying
  (elevated, so it has the rights) to release file locks.
- The self-copy no-op path re-stamps a missing/stale .version when a
  real package-identity version is available (never the 1.0.0.0
  assembly fallback, which would poison the stamp).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant