Skip to content

PdfCraft: An open-source PDF reader and editor written by scratch in pure Rust

feat(installer): default to a per-user ArtCraft folder

Jeremy32df17722c40
diff --git a/.github/workflows/packaging-lint.yml b/.github/workflows/packaging-lint.yml
index f54b0538b..7e847137f 100644
--- a/.github/workflows/packaging-lint.yml
+++ b/.github/workflows/packaging-lint.yml
@@ -21,3 +21,22 @@ jobs:
lint:
# Intentionally tracked at @main (not SHA-pinned) so org-wide CI improvements, security fixes, and build optimizations propagate without PR churn across all craftapp repos.
uses: storytold/craft-common-actions/.github/workflows/packaging-lint.yml@main
+
+ windows-install-policy:
+ timeout-minutes: 10
+ name: Windows installation policy (no app build)
+ runs-on: windows-latest
+ steps:
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
+ - name: Install the pinned packaging toolchain
+ shell: pwsh
+ run: |
+ $tools = Join-Path $env:RUNNER_TEMP 'craft-install-policy-wix'
+ dotnet tool install --tool-path $tools wix --version 5.0.2
+ if ($LASTEXITCODE -ne 0) { throw 'WiX installation failed.' }
+ $tools >> $env:GITHUB_PATH
+ & (Join-Path $tools 'wix.exe') extension add -g WixToolset.UI.wixext/5.0.2 WixToolset.Util.wixext/5.0.2
+ if ($LASTEXITCODE -ne 0) { throw 'WiX extension installation failed.' }
+ - name: Build and check non-executable installer fixtures
+ shell: pwsh
+ run: ./packaging/windows/test-install-policy.ps1 -OutputDirectory (Join-Path $env:RUNNER_TEMP 'craft-install-policy-tests')
diff --git a/packaging/windows/INSTALLATION.md b/packaging/windows/INSTALLATION.md
new file mode 100644
index 000000000..982a5b420
--- /dev/null
+++ b/packaging/windows/INSTALLATION.md
@@ -0,0 +1,35 @@
+# Windows installation policy checks
+
+New installations default to the current account under `Programs\ArtCraft\<App>`.
+The first setup page offers installation for everyone. Scope is selected before duplicate
+checks and directory costing. An update uses the existing context's remembered exact folder;
+`INSTALLFOLDER` supplied explicitly is never replaced. It is a secure MSI property so the
+chosen folder reaches the elevated installer. Silent machine updates pass `ALLUSERS=1`.
+A cross-context copy is refused; changing context means uninstalling the old copy first.
+
+App registration follows the selected context. Existing optional shortcuts and file-handler
+choices stay app-owned. No new cleanup operation or model/settings migration is introduced.
+Packaged resources remain package-owned; separately downloaded shared models are not caches
+and are outside this installer's ownership.
+
+## Repeatable metadata tests
+
+On Windows with WiX 5.0.2 and its matching UI/Util extensions:
+
+```powershell
+./packaging/windows/test-install-policy.ps1 -OutputDirectory ./target/install-policy-tests
+```
+
+The script builds x64, x86 and arm64 packages with deliberately non-executable payloads. It
+uses the actual package source and compiled database. A safe Windows Installer session checks
+24 scope/registration/maintenance cases, remembered and explicit custom folders, sequencing,
+upgrade identity and the original registration inventory recorded in `install-policy.json`.
+The release packaging script runs the compiled checker before signing. Packaging CI runs the
+small fixture builds without compiling the Rust application.
+
+Never install or distribute the `NOT-INSTALLABLE.msi` fixtures as an app. Passing these checks
+does not prove real installation, elevation, legacy-version upgrades, registry writes, optional
+shortcut/menu behaviour, cancellation, rollback or uninstall. Those still require the real
+payload in an authorised clean Windows test environment. Cross-architecture metadata is not
+execution evidence on those architectures. Existing open installer/association PRs must be
+reconciled before publication. Nothing here changes macOS/Linux native packaging conventions.
diff --git a/packaging/windows/check-install-policy.ps1 b/packaging/windows/check-install-policy.ps1
new file mode 100644
index 000000000..dd2895643
--- /dev/null
+++ b/packaging/windows/check-install-policy.ps1
@@ -0,0 +1,195 @@
+<#
+.SYNOPSIS
+ Check the compiled installation policy without installing any product.
+.DESCRIPTION
+ Uses Windows Installer's safe session (OpenPackage option 1). Only property-setting custom
+ actions are exercised. No AppSearch, install, repair, removal or file-writing action runs.
+#>
+param([Parameter(Mandatory = $true)] [string] $MsiPath)
+$ErrorActionPreference = 'Stop'
+Set-StrictMode -Version Latest
+$policy = Get-Content -Raw -LiteralPath (Join-Path $PSScriptRoot 'install-policy.json') | ConvertFrom-Json
+function Read-Rows($Database, [string] $Sql, [int] $Columns) {
+ $view = $Database.OpenView($Sql)
+ try {
+ [void]$view.Execute()
+ while ($null -ne ($record = $view.Fetch())) {
+ try {
+ $values = @(for ($i = 1; $i -le $Columns; $i++) {
+ $record.GetType().InvokeMember('StringData', 'GetProperty', $null, $record, @($i))
+ })
+ ,$values
+ } finally { [void][Runtime.InteropServices.Marshal]::FinalReleaseComObject($record) }
+ }
+ } finally {
+ [void]$view.Close()
+ [void][Runtime.InteropServices.Marshal]::FinalReleaseComObject($view)
+ }
+}
+function Set-SessionProperty($Session, [string] $Name, [string] $Value) {
+ [void]$Session.GetType().InvokeMember('Property', 'SetProperty', $null, $Session, @($Name, $Value))
+}
+function Get-SessionProperty($Session, [string] $Name) {
+ $Session.GetType().InvokeMember('Property', 'GetProperty', $null, $Session, @($Name))
+}
+$installer = $null; $database = $null; $session = $null
+try {
+ $installer = New-Object -ComObject WindowsInstaller.Installer
+ $file = (Resolve-Path -LiteralPath $MsiPath).Path
+ $database = $installer.OpenDatabase($file, 0)
+ $session = $installer.OpenPackage($file, 1)
+ $properties = @{}
+ foreach ($row in (Read-Rows $database 'SELECT `Property`, `Value` FROM `Property`' 2)) { $properties[$row[0]] = $row[1] }
+ $secureProperties = @($properties['SecureCustomProperties'] -split ';')
+ if ('INSTALLFOLDER' -notin $secureProperties) {
+ throw 'The selected installation folder must survive elevation (secure INSTALLFOLDER).'
+ }
+ if ($policy.mode -eq 'perUser') {
+ if ($properties.ContainsKey('ALLUSERS')) { throw 'Launcher must remain per-user; machine self-update is not part of this change.' }
+ if ($properties['UpgradeCode'].Trim('{}') -ne $policy.upgradeCode) { throw 'Launcher upgrade identity changed.' }
+ $dirs = @{}
+ foreach ($row in (Read-Rows $database 'SELECT `Directory`, `Directory_Parent`, `DefaultDir` FROM `Directory`' 3)) { $dirs[$row[0]] = @($row[1],$row[2]) }
+ if ($dirs['INSTALLFOLDER'][0] -ne 'CraftSuiteFolder' -or $dirs['CraftSuiteFolder'][1] -ne 'ArtCraft' -or
+ $dirs['CraftSuiteFolder'][0] -ne 'LocalProgramsFolder' -or $dirs['LocalProgramsFolder'][0] -ne 'LocalAppDataFolder') {
+ throw 'Launcher new-install folder must be under the per-user ArtCraft suite root.'
+ }
+ foreach ($explicit in @('', 'F:\Chosen exact launcher')) {
+ Set-SessionProperty $session 'PREVIOUSINSTALLFOLDER' 'E:\Existing exact launcher'
+ Set-SessionProperty $session 'INSTALLFOLDER' $explicit
+ $row = @(Read-Rows $database 'SELECT `Condition` FROM `InstallUISequence` WHERE `Action` = ''CraftRestoreLauncherFolder''' 1)[0]
+ if ($session.EvaluateCondition($row[0]) -eq 1) {
+ if ($session.DoAction('CraftRestoreLauncherFolder') -ne 1) { throw 'Launcher restore action failed.' }
+ }
+ $expected = if ($explicit) { $explicit } else { 'E:\Existing exact launcher' }
+ if ((Get-SessionProperty $session 'INSTALLFOLDER') -ne $expected) { throw 'Launcher custom or existing path was lost.' }
+ }
+ $rows = @(Read-Rows $database 'SELECT `Root`, `Key`, `Name`, `Value` FROM `Registry`' 4)
+ if (@($rows | Where-Object { $_[0] -ne '1' }).Count) { throw 'Launcher registration must stay under the current account.' }
+ foreach ($entry in $policy.registry) {
+ if (@($rows | Where-Object { $_[0] -eq $entry[0] -and $_[1] -eq $entry[1] -and $_[2] -eq $entry[2] -and $_[3] -eq $entry[3] }).Count -ne 1) {
+ throw 'Launcher registration or shortcut preference changed unexpectedly.'
+ }
+ }
+ Write-Output 'PASS ArtCraft Launcher: per-user scope, suite folder, remembered/custom paths and existing registration. No installation performed.'
+ return
+ }
+ if ($properties['ALLUSERS'] -ne '2' -or $properties['MSIINSTALLPERUSER'] -ne '1') {
+ throw 'Policy regression: new packages must default to the per-user dual-scope context.'
+ }
+ if ($properties['UpgradeCode'].Trim('{}') -ne $policy.upgradeCode) { throw 'The existing upgrade identity must not change.' }
+ $directories = @{}
+ foreach ($row in (Read-Rows $database 'SELECT `Directory`, `Directory_Parent`, `DefaultDir` FROM `Directory`' 3)) {
+ $directories[$row[0]] = @($row[1], $row[2])
+ }
+ if ($directories['INSTALLFOLDER'][0] -ne 'CraftSuiteFolder' -or
+ $directories['CraftSuiteFolder'][1] -ne 'ArtCraft') { throw 'Expected the app under the ArtCraft suite folder.' }
+ $programs = $directories['CraftSuiteFolder'][0]
+ if ($programs -eq 'ProgramFiles6432Folder') { $programs = $directories[$programs][0] }
+ if ($programs -notin 'ProgramFilesFolder', 'ProgramFiles64Folder') {
+ throw 'Use Windows Installer native folder redirection, not a hard-coded profile path.'
+ }
+ $guards = @(Read-Rows $database 'SELECT `Condition`, `Description` FROM `LaunchCondition`' 2 |
+ Where-Object { $_[0] -match 'CRAFT_(USER|MACHINE)_DIR' })
+ if ($guards.Count -ne 2) { throw 'Expected both duplicate-installation guards.' }
+ $cases = 0
+ foreach ($scope in @('', '2', '1')) {
+ foreach ($user in @('', 'D:\Existing user app')) {
+ foreach ($machine in @('', 'E:\Existing machine app')) {
+ foreach ($installed in @('', '1')) {
+ Set-SessionProperty $session 'ALLUSERS' $scope
+ Set-SessionProperty $session 'Installed' $installed
+ Set-SessionProperty $session 'CRAFT_USER_DIR' $user
+ Set-SessionProperty $session 'CRAFT_MACHINE_DIR' $machine
+ $allowed = $true
+ foreach ($guard in $guards) {
+ $value = $session.EvaluateCondition($guard[0])
+ if ($value -notin 0, 1) { throw 'Invalid duplicate guard.' }
+ if ($value -eq 0) { $allowed = $false }
+ }
+ $opposite = if ($scope -eq '1') { $user } else { $machine }
+ $expected = [bool]$installed -or -not [bool]$opposite
+ if ($allowed -ne $expected) { throw "Scope regression: ALLUSERS='$scope', user=$([bool]$user), machine=$([bool]$machine), maintenance=$([bool]$installed)." }
+ $cases++
+ }
+ }
+ }
+ }
+ # Execute the actual authored type-51 actions in a safe session, not copied resolver logic.
+ foreach ($scope in @('', '2', '1')) {
+ foreach ($explicit in @('', 'F:\Chosen exact app')) {
+ Set-SessionProperty $session 'ALLUSERS' $scope
+ Set-SessionProperty $session 'INSTALLFOLDER' $explicit
+ Set-SessionProperty $session 'CRAFT_USER_DIR' 'D:\Existing user app'
+ Set-SessionProperty $session 'CRAFT_MACHINE_DIR' 'E:\Existing machine app'
+ $action = if ($scope -eq '1') { 'CraftRestoreMachineFolder' } else { 'CraftRestoreUserFolder' }
+ if (-not $explicit) {
+ if ($session.DoAction($action) -ne 1) { throw 'Remembered-folder property action failed.' }
+ }
+ $expected = if ($explicit) { $explicit } elseif ($scope -eq '1') { 'E:\Existing machine app' } else { 'D:\Existing user app' }
+ if ((Get-SessionProperty $session 'INSTALLFOLDER') -ne $expected) { throw 'Custom or remembered folder was not preserved.' }
+ }
+ }
+ $ui = @{}
+ foreach ($row in (Read-Rows $database 'SELECT `Action`, `Sequence` FROM `InstallUISequence`' 2)) { $ui[$row[0]] = [int]$row[1] }
+ if (-not ($ui['AppSearch'] -lt $ui['CraftScopeDlg'] -and $ui['CraftScopeDlg'] -lt $ui['LaunchConditions'] -and
+ $ui['CraftScopeDlg'] -lt $ui['CraftRestoreUserFolder'] -and $ui['CraftRestoreUserFolder'] -lt $ui['CostInitialize'])) {
+ throw 'Scope must be chosen after discovery and before duplicate checks, folder restoration and costing.'
+ }
+ $execute = @{}
+ foreach ($row in (Read-Rows $database 'SELECT `Action`, `Sequence` FROM `InstallExecuteSequence`' 2)) { $execute[$row[0]] = [int]$row[1] }
+ foreach ($action in @('CraftRestoreUserFolder','CraftRestoreMachineFolder')) {
+ if (-not ($execute['AppSearch'] -lt $execute[$action] -and $execute[$action] -lt $execute['CostInitialize'])) {
+ throw 'Silent updates must restore the folder before directory costing.'
+ }
+ }
+ # Switching the first-page choice must reset BOTH properties, including a back-and-forth change.
+ $events = @(Read-Rows $database 'SELECT `Event`, `Argument`, `Condition`, `Ordering` FROM `ControlEvent` WHERE `Dialog_` = ''CraftScopeDlg'' AND `Control_` = ''Next'' ORDER BY `Ordering`' 4)
+ foreach ($choice in @('user','machine','user')) {
+ Set-SessionProperty $session 'CRAFT_SCOPE' $choice
+ foreach ($event in $events) {
+ if ($event[0] -notmatch '^\[([^\]]+)\]$') { continue }
+ $property = $Matches[1]
+ if ($session.EvaluateCondition($event[2]) -eq 1) {
+ Set-SessionProperty $session $property $(if ($event[1] -eq '{}') { '' } else { $event[1] })
+ }
+ }
+ $allUsers = Get-SessionProperty $session 'ALLUSERS'
+ $perUser = Get-SessionProperty $session 'MSIINSTALLPERUSER'
+ if (($choice -eq 'machine' -and ($allUsers -ne '1' -or $perUser)) -or
+ ($choice -eq 'user' -and ($allUsers -ne '2' -or $perUser -ne '1'))) {
+ throw 'Scope selector does not reset the requested installation context.'
+ }
+ }
+ $actions = @(Read-Rows $database 'SELECT `Action`, `Source`, `Target`, `Type` FROM `CustomAction`' 4)
+ $savedOptions = @($actions | Where-Object { $_[0] -match '^CraftLoadOption[0-9]+M$' })
+ foreach ($option in $savedOptions) {
+ if ([int]$option[3] -ne 51) { throw 'Saved-option test may run only property-setting actions.' }
+ $number = [regex]::Match($option[0], '[0-9]+').Value
+ foreach ($scope in @('2','1')) {
+ Set-SessionProperty $session 'ALLUSERS' $scope
+ Set-SessionProperty $session "CRAFT_OPTION_${number}_M" 'saved-machine-choice'
+ Set-SessionProperty $session "CRAFT_OPTION_${number}_U" 'saved-user-choice'
+ Set-SessionProperty $session $option[1] ''
+ $action = "CraftLoadOption$number" + $(if ($scope -eq '1') { 'M' } else { 'U' })
+ if ($session.DoAction($action) -ne 1) { throw 'Saved-option property action failed.' }
+ $expected = if ($scope -eq '1') { 'saved-machine-choice' } else { 'saved-user-choice' }
+ if ((Get-SessionProperty $session $option[1]) -ne $expected) { throw 'Saved installer choices leaked across contexts.' }
+ }
+ }
+ $registry = @(Read-Rows $database 'SELECT `Root`, `Key`, `Name`, `Value` FROM `Registry`' 4)
+ if (@($registry | Where-Object { $_[0] -in '1', '2' }).Count) { throw 'Registration must follow the selected context, not force HKCU or HKLM.' }
+ if (@($registry | Where-Object { $_[0] -eq '0' -and $_[1] -match '^Software\\Classes(\\|$)' }).Count) {
+ throw 'HKCR keys must be relative to Classes.'
+ }
+ foreach ($entry in $policy.registry) {
+ $found = @($registry | Where-Object { $_[0] -eq $entry[0] -and $_[1] -eq $entry[1] -and $_[2] -eq $entry[2] -and $_[3] -eq $entry[3] })
+ if ($found.Count -ne 1) { throw "Lost or changed registration: $($entry[1]) / $($entry[2])" }
+ }
+ $installDir = @($registry | Where-Object { $_[0] -eq '-1' -and $_[1] -eq "Software\$($policy.name)" -and $_[2] -eq 'InstallDir' -and $_[3] -eq '[INSTALLFOLDER]' })
+ if ($installDir.Count -ne 1) { throw 'A context-sensitive installation-folder record is required.' }
+ Write-Output "PASS $($policy.name): $cases scope cases, folder preservation, action sequencing and registry contract. No installation performed."
+} finally {
+ foreach ($com in @($session, $database, $installer)) {
+ if ($null -ne $com) { [void][Runtime.InteropServices.Marshal]::FinalReleaseComObject($com) }
+ }
+}
diff --git a/packaging/windows/install-policy.json b/packaging/windows/install-policy.json
new file mode 100644
index 000000000..374bd4e5f
--- /dev/null
+++ b/packaging/windows/install-policy.json
@@ -0,0 +1,329 @@
+{
+ "id": "pdfcraft",
+ "name": "PdfCraft",
+ "upgradeCode": "EA00C367-7270-4C50-9D8B-A7A5C88AD27F",
+ "sources": [
+ "pdfcraft.wxs",
+ "installer-ui.wxs"
+ ],
+ "icon": "assets/app-icon/pdfcraft.ico",
+ "localization": [],
+ "extensions": [],
+ "payloads": [
+ "LICENSE-APACHE",
+ "LICENSE-MIT",
+ "LICENSE-document.txt",
+ "NOTICE",
+ "pdfcraft-cli.exe",
+ "pdfcraft.exe"
+ ],
+ "registry": [
+ [
+ "-1",
+ "Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\pdfcraft.exe",
+ "",
+ "[#PdfcraftExe]"
+ ],
+ [
+ "-1",
+ "Software\\Classes\\PdfCraft.Document",
+ "",
+ "PDF Document"
+ ],
+ [
+ "-1",
+ "Software\\Classes\\PdfCraft.Document\\DefaultIcon",
+ "",
+ "\"[#PdfcraftExe]\",-2"
+ ],
+ [
+ "-1",
+ "Software\\Classes\\PdfCraft.Document\\shell\\open\\command",
+ "",
+ "\"[#PdfcraftExe]\" \"%1\""
+ ],
+ [
+ "-1",
+ "Software\\Classes\\PdfCraft.Document",
+ "TypeOverlay",
+ ""
+ ],
+ [
+ "-1",
+ "Software\\Classes\\.pdf\\OpenWithProgids",
+ "PdfCraft.Document",
+ ""
+ ],
+ [
+ "-1",
+ "Software\\Classes\\Applications\\pdfcraft.exe",
+ "FriendlyAppName",
+ "PdfCraft"
+ ],
+ [
+ "-1",
+ "Software\\Classes\\Applications\\pdfcraft.exe\\DefaultIcon",
+ "",
+ "\"[#PdfcraftExe]\",-2"
+ ],
+ [
+ "-1",
+ "Software\\Classes\\Applications\\pdfcraft.exe\\SupportedTypes",
+ ".pdf",
+ ""
+ ],
+ [
+ "-1",
+ "Software\\Classes\\Applications\\pdfcraft.exe\\shell\\open\\command",
+ "",
+ "\"[#PdfcraftExe]\" \"%1\""
+ ],
+ [
+ "-1",
+ "Software\\PdfCraft\\Capabilities",
+ "ApplicationName",
+ "PdfCraft"
+ ],
+ [
+ "-1",
+ "Software\\PdfCraft\\Capabilities",
+ "ApplicationDescription",
+ "Open-source PDF workbench"
+ ],
+ [
+ "-1",
+ "Software\\PdfCraft\\Capabilities",
+ "ApplicationIcon",
+ "[#PdfcraftExe],0"
+ ],
+ [
+ "-1",
+ "Software\\PdfCraft\\Capabilities\\FileAssociations",
+ ".pdf",
+ "PdfCraft.Document"
+ ],
+ [
+ "-1",
+ "Software\\RegisteredApplications",
+ "PdfCraft",
+ "Software\\PdfCraft\\Capabilities"
+ ],
+ [
+ "-1",
+ "Software\\PdfCraft\\Shortcuts",
+ "StartMenu",
+ "#1"
+ ],
+ [
+ "-1",
+ "Software\\PdfCraft\\Shortcuts",
+ "Desktop",
+ "#1"
+ ],
+ [
+ "-1",
+ "Software\\Classes\\SystemFileAssociations\\.pdf\\shell\\PdfCraft.Edit",
+ "",
+ "Edit with PdfCraft"
+ ],
+ [
+ "-1",
+ "Software\\Classes\\SystemFileAssociations\\.pdf\\shell\\PdfCraft.Edit",
+ "Icon",
+ "\"[#PdfcraftExe]\",0"
+ ],
+ [
+ "-1",
+ "Software\\Classes\\SystemFileAssociations\\.pdf\\shell\\PdfCraft.Edit",
+ "MultiSelectModel",
+ "Document"
+ ],
+ [
+ "-1",
+ "Software\\Classes\\SystemFileAssociations\\.pdf\\shell\\PdfCraft.Edit\\command",
+ "",
+ "\"[#PdfcraftExe]\" \"%1\""
+ ],
+ [
+ "-1",
+ "Software\\Classes\\SystemFileAssociations\\.png\\shell\\PdfCraft.CreatePdf",
+ "",
+ "Create PDF with PdfCraft\u2026"
+ ],
+ [
+ "-1",
+ "Software\\Classes\\SystemFileAssociations\\.png\\shell\\PdfCraft.CreatePdf",
+ "MultiSelectModel",
+ "Single"
+ ],
+ [
+ "-1",
+ "Software\\Classes\\SystemFileAssociations\\.png\\shell\\PdfCraft.CreatePdf\\command",
+ "",
+ "\"[#PdfcraftExe]\" --create-images \"%1\""
+ ],
+ [
+ "-1",
+ "Software\\Classes\\SystemFileAssociations\\.jpg\\shell\\PdfCraft.CreatePdf",
+ "",
+ "Create PDF with PdfCraft\u2026"
+ ],
+ [
+ "-1",
+ "Software\\Classes\\SystemFileAssociations\\.jpg\\shell\\PdfCraft.CreatePdf",
+ "MultiSelectModel",
+ "Single"
+ ],
+ [
+ "-1",
+ "Software\\Classes\\SystemFileAssociations\\.jpg\\shell\\PdfCraft.CreatePdf\\command",
+ "",
+ "\"[#PdfcraftExe]\" --create-images \"%1\""
+ ],
+ [
+ "-1",
+ "Software\\Classes\\SystemFileAssociations\\.jpeg\\shell\\PdfCraft.CreatePdf",
+ "",
+ "Create PDF with PdfCraft\u2026"
+ ],
+ [
+ "-1",
+ "Software\\Classes\\SystemFileAssociations\\.jpeg\\shell\\PdfCraft.CreatePdf",
+ "MultiSelectModel",
+ "Single"
+ ],
+ [
+ "-1",
+ "Software\\Classes\\SystemFileAssociations\\.jpeg\\shell\\PdfCraft.CreatePdf\\command",
+ "",
+ "\"[#PdfcraftExe]\" --create-images \"%1\""
+ ],
+ [
+ "-1",
+ "Software\\Classes\\SystemFileAssociations\\.tif\\shell\\PdfCraft.CreatePdf",
+ "",
+ "Create PDF with PdfCraft\u2026"
+ ],
+ [
+ "-1",
+ "Software\\Classes\\SystemFileAssociations\\.tif\\shell\\PdfCraft.CreatePdf",
+ "MultiSelectModel",
+ "Single"
+ ],
+ [
+ "-1",
+ "Software\\Classes\\SystemFileAssociations\\.tif\\shell\\PdfCraft.CreatePdf\\command",
+ "",
+ "\"[#PdfcraftExe]\" --create-images \"%1\""
+ ],
+ [
+ "-1",
+ "Software\\Classes\\SystemFileAssociations\\.tiff\\shell\\PdfCraft.CreatePdf",
+ "",
+ "Create PDF with PdfCraft\u2026"
+ ],
+ [
+ "-1",
+ "Software\\Classes\\SystemFileAssociations\\.tiff\\shell\\PdfCraft.CreatePdf",
+ "MultiSelectModel",
+ "Single"
+ ],
+ [
+ "-1",
+ "Software\\Classes\\SystemFileAssociations\\.tiff\\shell\\PdfCraft.CreatePdf\\command",
+ "",
+ "\"[#PdfcraftExe]\" --create-images \"%1\""
+ ],
+ [
+ "-1",
+ "Software\\Classes\\SystemFileAssociations\\.gif\\shell\\PdfCraft.CreatePdf",
+ "",
+ "Create PDF with PdfCraft\u2026"
+ ],
+ [
+ "-1",
+ "Software\\Classes\\SystemFileAssociations\\.gif\\shell\\PdfCraft.CreatePdf",
+ "MultiSelectModel",
+ "Single"
+ ],
+ [
+ "-1",
+ "Software\\Classes\\SystemFileAssociations\\.gif\\shell\\PdfCraft.CreatePdf\\command",
+ "",
+ "\"[#PdfcraftExe]\" --create-images \"%1\""
+ ],
+ [
+ "-1",
+ "Software\\Classes\\SystemFileAssociations\\.bmp\\shell\\PdfCraft.CreatePdf",
+ "",
+ "Create PDF with PdfCraft\u2026"
+ ],
+ [
+ "-1",
+ "Software\\Classes\\SystemFileAssociations\\.bmp\\shell\\PdfCraft.CreatePdf",
+ "MultiSelectModel",
+ "Single"
+ ],
+ [
+ "-1",
+ "Software\\Classes\\SystemFileAssociations\\.bmp\\shell\\PdfCraft.CreatePdf\\command",
+ "",
+ "\"[#PdfcraftExe]\" --create-images \"%1\""
+ ],
+ [
+ "-1",
+ "Software\\Classes\\SystemFileAssociations\\.jp2\\shell\\PdfCraft.CreatePdf",
+ "",
+ "Create PDF with PdfCraft\u2026"
+ ],
+ [
+ "-1",
+ "Software\\Classes\\SystemFileAssociations\\.jp2\\shell\\PdfCraft.CreatePdf",
+ "MultiSelectModel",
+ "Single"
+ ],
+ [
+ "-1",
+ "Software\\Classes\\SystemFileAssociations\\.jp2\\shell\\PdfCraft.CreatePdf\\command",
+ "",
+ "\"[#PdfcraftExe]\" --create-images \"%1\""
+ ],
+ [
+ "-1",
+ "Software\\Classes\\SystemFileAssociations\\.j2k\\shell\\PdfCraft.CreatePdf",
+ "",
+ "Create PDF with PdfCraft\u2026"
+ ],
+ [
+ "-1",
+ "Software\\Classes\\SystemFileAssociations\\.j2k\\shell\\PdfCraft.CreatePdf",
+ "MultiSelectModel",
+ "Single"
+ ],
+ [
+ "-1",
+ "Software\\Classes\\SystemFileAssociations\\.j2k\\shell\\PdfCraft.CreatePdf\\command",
+ "",
+ "\"[#PdfcraftExe]\" --create-images \"%1\""
+ ],
+ [
+ "-1",
+ "Software\\Classes\\SystemFileAssociations\\.jpx\\shell\\PdfCraft.CreatePdf",
+ "",
+ "Create PDF with PdfCraft\u2026"
+ ],
+ [
+ "-1",
+ "Software\\Classes\\SystemFileAssociations\\.jpx\\shell\\PdfCraft.CreatePdf",
+ "MultiSelectModel",
+ "Single"
+ ],
+ [
+ "-1",
+ "Software\\Classes\\SystemFileAssociations\\.jpx\\shell\\PdfCraft.CreatePdf\\command",
+ "",
+ "\"[#PdfcraftExe]\" --create-images \"%1\""
+ ]
+ ],
+ "mode": "dualScope"
+}
diff --git a/packaging/windows/install-policy.wxi b/packaging/windows/install-policy.wxi
new file mode 100644
index 000000000..e1a51f80f
--- /dev/null
+++ b/packaging/windows/install-policy.wxi
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Include xmlns="http://wixtoolset.org/schemas/v4/wxs">
+ <!-- Choose scope before launch checks and directory costing. Never move an existing copy. -->
+ <Property Id="INSTALLFOLDER" Secure="yes" />
+ <Property Id="CRAFT_SCOPE" Value="user" Secure="yes" />
+ <Property Id="CRAFT_U_DIR" Secure="yes"><RegistrySearch Id="CRAFT_U_DIRSearch" Root="HKCU" Key="Software\PdfCraft" Name="InstallDir" Type="raw" /></Property>
+ <SetProperty Id="CRAFT_USER_DIR" Action="CraftUFromDIR" Value="[CRAFT_U_DIR]" After="AppSearch" Sequence="both" Condition="NOT CRAFT_USER_DIR AND CRAFT_U_DIR" />
+ <Property Id="CRAFT_U_FOLDER" Secure="yes"><RegistrySearch Id="CRAFT_U_FOLDERSearch" Root="HKCU" Key="Software\PdfCraft" Name="InstallFolder" Type="raw" /></Property>
+ <SetProperty Id="CRAFT_USER_DIR" Action="CraftUFromFOLDER" Value="[CRAFT_U_FOLDER]" After="CraftUFromDIR" Sequence="both" Condition="NOT CRAFT_USER_DIR AND CRAFT_U_FOLDER" />
+ <Property Id="CRAFT_U_PATH" Secure="yes"><RegistrySearch Id="CRAFT_U_PATHSearch" Root="HKCU" Key="Software\Microsoft\Windows\CurrentVersion\App Paths\pdfcraft.exe" Name="Path" Type="raw" /></Property>
+ <SetProperty Id="CRAFT_USER_DIR" Action="CraftUFromPATH" Value="[CRAFT_U_PATH]" After="CraftUFromFOLDER" Sequence="both" Condition="NOT CRAFT_USER_DIR AND CRAFT_U_PATH" />
+ <Property Id="CRAFT_U_EXEFOLDER" Secure="yes"><RegistrySearch Id="CRAFT_ULegacyFolder" Root="HKCU" Key="Software\Microsoft\Windows\CurrentVersion\App Paths\pdfcraft.exe" Type="file" /></Property>
+ <Property Id="CRAFT_U_EXE" Secure="yes"><RegistrySearch Id="CRAFT_ULegacyExe" Root="HKCU" Key="Software\Microsoft\Windows\CurrentVersion\App Paths\pdfcraft.exe" Type="file"><FileSearch Id="CRAFT_ULegacyFile" Name="pdfcraft.exe" /></RegistrySearch></Property>
+ <SetProperty Id="CRAFT_USER_DIR" Action="CraftUFromLegacyExe" Value="[CRAFT_U_EXEFOLDER]" After="CraftUFromPATH" Sequence="both" Condition="NOT CRAFT_USER_DIR AND CRAFT_U_EXEFOLDER AND CRAFT_U_EXE" />
+ <Property Id="CRAFT_USER_DIR" Secure="yes" />
+ <Property Id="CRAFT_M_DIR" Secure="yes"><RegistrySearch Id="CRAFT_M_DIRSearch" Root="HKLM" Key="Software\PdfCraft" Name="InstallDir" Type="raw" /></Property>
+ <SetProperty Id="CRAFT_MACHINE_DIR" Action="CraftMFromDIR" Value="[CRAFT_M_DIR]" After="CraftUFromLegacyExe" Sequence="both" Condition="NOT CRAFT_MACHINE_DIR AND CRAFT_M_DIR" />
+ <Property Id="CRAFT_M_FOLDER" Secure="yes"><RegistrySearch Id="CRAFT_M_FOLDERSearch" Root="HKLM" Key="Software\PdfCraft" Name="InstallFolder" Type="raw" /></Property>
+ <SetProperty Id="CRAFT_MACHINE_DIR" Action="CraftMFromFOLDER" Value="[CRAFT_M_FOLDER]" After="CraftMFromDIR" Sequence="both" Condition="NOT CRAFT_MACHINE_DIR AND CRAFT_M_FOLDER" />
+ <Property Id="CRAFT_M_PATH" Secure="yes"><RegistrySearch Id="CRAFT_M_PATHSearch" Root="HKLM" Key="Software\Microsoft\Windows\CurrentVersion\App Paths\pdfcraft.exe" Name="Path" Type="raw" /></Property>
+ <SetProperty Id="CRAFT_MACHINE_DIR" Action="CraftMFromPATH" Value="[CRAFT_M_PATH]" After="CraftMFromFOLDER" Sequence="both" Condition="NOT CRAFT_MACHINE_DIR AND CRAFT_M_PATH" />
+ <Property Id="CRAFT_M_EXEFOLDER" Secure="yes"><RegistrySearch Id="CRAFT_MLegacyFolder" Root="HKLM" Key="Software\Microsoft\Windows\CurrentVersion\App Paths\pdfcraft.exe" Type="file" /></Property>
+ <Property Id="CRAFT_M_EXE" Secure="yes"><RegistrySearch Id="CRAFT_MLegacyExe" Root="HKLM" Key="Software\Microsoft\Windows\CurrentVersion\App Paths\pdfcraft.exe" Type="file"><FileSearch Id="CRAFT_MLegacyFile" Name="pdfcraft.exe" /></RegistrySearch></Property>
+ <SetProperty Id="CRAFT_MACHINE_DIR" Action="CraftMFromLegacyExe" Value="[CRAFT_M_EXEFOLDER]" After="CraftMFromPATH" Sequence="both" Condition="NOT CRAFT_MACHINE_DIR AND CRAFT_M_EXEFOLDER AND CRAFT_M_EXE" />
+ <Property Id="CRAFT_MACHINE_DIR" Secure="yes" />
+ <SetProperty Id="CRAFT_SCOPE" Action="CraftPreferMachineScope" Value="machine" After="CraftMFromLegacyExe" Sequence="ui" Condition="ALLUSERS = 1 OR (CRAFT_MACHINE_DIR AND NOT CRAFT_USER_DIR)" />
+ <SetProperty Id="INSTALLFOLDER" Action="CraftRestoreUserFolder" Value="[CRAFT_USER_DIR]" Before="CostInitialize" Sequence="both" Condition="NOT INSTALLFOLDER AND ALLUSERS &lt;&gt; 1 AND CRAFT_USER_DIR" />
+ <SetProperty Id="INSTALLFOLDER" Action="CraftRestoreMachineFolder" Value="[CRAFT_MACHINE_DIR]" Before="CraftRestoreUserFolder" Sequence="both" Condition="NOT INSTALLFOLDER AND ALLUSERS = 1 AND CRAFT_MACHINE_DIR" />
+ <Launch Condition="Installed OR ALLUSERS &lt;&gt; 1 OR NOT CRAFT_USER_DIR" Message="This app is already installed for your account. Choose Only for me to update it, or uninstall that copy before changing who it is installed for." />
+ <Launch Condition="Installed OR ALLUSERS = 1 OR NOT CRAFT_MACHINE_DIR" Message="This app is already installed for everyone. Choose Everyone to update it, or pass ALLUSERS=1 to msiexec. Uninstall that copy before changing who it is installed for." />
+ <UI>
+ <TextStyle Id="CraftScopeText" FaceName="Segoe UI" Size="9" />
+ <TextStyle Id="CraftScopeTitle" FaceName="Segoe UI" Size="12" Bold="yes" />
+ <Dialog Id="CraftScopeDlg" Width="370" Height="220" Title="[ProductName] Setup" NoMinimize="yes">
+ <Control Id="Title" Type="Text" X="20" Y="15" Width="330" Height="30" Text="{\CraftScopeTitle}Who should use [ProductName]?" />
+ <Control Id="Info" Type="Text" X="20" Y="50" Width="330" Height="30" Text="{\CraftScopeText}An update keeps the existing folder. New copies use the ArtCraft folder under Programs." />
+ <Control Id="Scope" Type="RadioButtonGroup" X="20" Y="88" Width="330" Height="60" Property="CRAFT_SCOPE">
+ <RadioButtonGroup Property="CRAFT_SCOPE">
+ <RadioButton Value="user" X="0" Y="0" Width="330" Height="20" Text="Only for me (no administrator permission needed)" />
+ <RadioButton Value="machine" X="0" Y="30" Width="330" Height="20" Text="Everyone on this computer (asks an administrator)" />
+ </RadioButtonGroup>
+ </Control>
+ <Control Id="Next" Type="PushButton" X="214" Y="182" Width="66" Height="20" Default="yes" Text="Next">
+ <Publish Property="ALLUSERS" Value="1" Order="1" Condition="CRAFT_SCOPE = &quot;machine&quot;" />
+ <Publish Property="ALLUSERS" Value="2" Order="2" Condition="CRAFT_SCOPE = &quot;user&quot;" />
+ <Publish Property="MSIINSTALLPERUSER" Value="{}" Order="3" Condition="CRAFT_SCOPE = &quot;machine&quot;" />
+ <Publish Property="MSIINSTALLPERUSER" Value="1" Order="4" Condition="CRAFT_SCOPE = &quot;user&quot;" />
+ <Publish Event="EndDialog" Value="Return" Order="5" />
+ </Control>
+ <Control Id="Cancel" Type="PushButton" X="290" Y="182" Width="60" Height="20" Cancel="yes" Text="Cancel"><Publish Event="EndDialog" Value="Exit" /></Control>
+ </Dialog>
+ </UI>
+ <InstallUISequence><Show Dialog="CraftScopeDlg" Before="LaunchConditions" Condition="NOT Installed AND NOT REMOVE AND UILevel = 5" /></InstallUISequence>
+</Include>
diff --git a/packaging/windows/installer-ui.wxs b/packaging/windows/installer-ui.wxs
index a437c2a8c..cb7b486d9 100644
--- a/packaging/windows/installer-ui.wxs
+++ b/packaging/windows/installer-ui.wxs
@@ -1,6 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
-<!-- Original, text-only native MSI dialogs. No third-party UI artwork or custom-action DLLs.
- Full UI gets welcome (with the desktop-shortcut and PDF context-menu checkboxes)/progress/outcome screens; /qn and /qb stay unattended. -->
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
<Fragment>
<UI Id="PdfcraftInstallerUI">
@@ -10,12 +8,9 @@
<Dialog Id="InstallWelcome" Width="370" Height="180" Title="[ProductName] Setup">
<Control Id="Title" Type="Text" X="20" Y="20" Width="330" Height="25" Text="{\InstallerTitle}Install [ProductName]" />
- <Control Id="Description" Type="Text" X="20" Y="55" Width="330" Height="40"
- Text="Setup will install [ProductName] for all users and add it to the Start menu. Click Install to continue." />
- <Control Id="DesktopShortcut" Type="CheckBox" X="20" Y="105" Width="330" Height="17"
- Property="INSTALLDESKTOPSHORTCUT" CheckBoxValue="1" Text="Create a &amp;desktop shortcut" />
- <Control Id="PdfContextMenu" Type="CheckBox" X="20" Y="123" Width="330" Height="17"
- Property="INSTALLPDFCONTEXTMENU" CheckBoxValue="1" Text="Add &quot;&amp;Edit with PdfCraft&quot; to the right-click menu of PDF files" />
+ <Control Id="Description" Type="Text" X="20" Y="55" Width="330" Height="40" Text="Setup will install [ProductName] for all users and add it to the Start menu. Click Install to continue." />
+ <Control Id="DesktopShortcut" Type="CheckBox" X="20" Y="105" Width="330" Height="17" Property="INSTALLDESKTOPSHORTCUT" CheckBoxValue="1" Text="Create a &amp;desktop shortcut" />
+ <Control Id="PdfContextMenu" Type="CheckBox" X="20" Y="123" Width="330" Height="17" Property="INSTALLPDFCONTEXTMENU" CheckBoxValue="1" Text="Add &quot;&amp;Edit with PdfCraft&quot; to the right-click menu of PDF files" />
<Control Id="Install" Type="PushButton" X="195" Y="145" Width="75" Height="23" Default="yes" ElevationShield="yes" Text="&amp;Install">
<Publish Event="EndDialog" Value="Return" />
</Control>
@@ -26,8 +21,7 @@
<Dialog Id="InstallMaintenance" Width="370" Height="180" Title="[ProductName] Setup">
<Control Id="Title" Type="Text" X="20" Y="20" Width="330" Height="25" Text="{\InstallerTitle}Maintain [ProductName]" />
- <Control Id="Description" Type="Text" X="20" Y="55" Width="330" Height="70"
- Text="[ProductName] is already installed. Choose Repair to restore missing files and shortcuts, or Remove to uninstall it." />
+ <Control Id="Description" Type="Text" X="20" Y="55" Width="330" Height="70" Text="[ProductName] is already installed. Choose Repair to restore missing files and shortcuts, or Remove to uninstall it." />
<Control Id="Repair" Type="PushButton" X="110" Y="145" Width="75" Height="23" Default="yes" ElevationShield="yes" Text="&amp;Repair">
<Publish Property="REINSTALL" Value="ALL" Order="1" />
<Publish Property="REINSTALLMODE" Value="amus" Order="2" />
@@ -66,8 +60,7 @@
<Dialog Id="InstallComplete" Width="370" Height="180" Title="[ProductName] Setup">
<Control Id="Title" Type="Text" X="20" Y="20" Width="330" Height="25" Text="{\InstallerTitle}Setup completed successfully" />
- <Control Id="Description" Type="Text" X="20" Y="55" Width="330" Height="70"
- Text="[ProductName] setup has completed successfully. Click Finish to close this window." />
+ <Control Id="Description" Type="Text" X="20" Y="55" Width="330" Height="70" Text="[ProductName] setup has completed successfully. Click Finish to close this window." />
<Control Id="Finish" Type="PushButton" X="280" Y="145" Width="70" Height="23" Default="yes" Cancel="yes" Text="&amp;Finish">
<Publish Event="EndDialog" Value="Return" />
</Control>
@@ -75,8 +68,7 @@
<Dialog Id="InstallFailed" Width="370" Height="180" Title="[ProductName] Setup">
<Control Id="Title" Type="Text" X="20" Y="20" Width="330" Height="25" Text="{\InstallerTitle}Setup failed" />
- <Control Id="Description" Type="Text" X="20" Y="55" Width="330" Height="70"
- Text="[ProductName] setup could not be completed. Resolve the reported error and run setup again." />
+ <Control Id="Description" Type="Text" X="20" Y="55" Width="330" Height="70" Text="[ProductName] setup could not be completed. Resolve the reported error and run setup again." />
<Control Id="Finish" Type="PushButton" X="280" Y="145" Width="70" Height="23" Default="yes" Cancel="yes" Text="&amp;Finish">
<Publish Event="EndDialog" Value="Return" />
</Control>
@@ -84,8 +76,7 @@
<Dialog Id="InstallCancelled" Width="370" Height="180" Title="[ProductName] Setup">
<Control Id="Title" Type="Text" X="20" Y="20" Width="330" Height="25" Text="{\InstallerTitle}Setup cancelled" />
- <Control Id="Description" Type="Text" X="20" Y="55" Width="330" Height="70"
- Text="[ProductName] setup was cancelled. Run setup again when you are ready." />
+ <Control Id="Description" Type="Text" X="20" Y="55" Width="330" Height="70" Text="[ProductName] setup was cancelled. Run setup again when you are ready." />
<Control Id="Finish" Type="PushButton" X="280" Y="145" Width="70" Height="23" Default="yes" Cancel="yes" Text="&amp;Finish">
<Publish Event="EndDialog" Value="Return" />
</Control>
@@ -96,8 +87,7 @@
continues; Cancel ends setup. -->
<Dialog Id="MsiRMFilesInUse" Width="370" Height="200" Title="[ProductName] Setup" KeepModeless="yes">
<Control Id="Title" Type="Text" X="20" Y="15" Width="330" Height="25" Text="{\InstallerTitle}Files in use" />
- <Control Id="Description" Type="Text" X="20" Y="45" Width="330" Height="30"
- Text="These programs are using files that setup needs to update. Click OK to close them and continue, or Cancel to stop setup." />
+ <Control Id="Description" Type="Text" X="20" Y="45" Width="330" Height="30" Text="These programs are using files that setup needs to update. Click OK to close them and continue, or Cancel to stop setup." />
<Control Id="List" Type="ListBox" X="20" Y="80" Width="330" Height="55" Property="FileInUseProcess" Sunken="yes" TabSkip="yes" />
<Control Id="OK" Type="PushButton" X="195" Y="165" Width="75" Height="23" Default="yes" Text="OK">
<Publish Property="MSIRMSHUTDOWN" Value="2" Order="1" />
diff --git a/packaging/windows/package.ps1 b/packaging/windows/package.ps1
index dccc21f55..e9b9e4432 100644
--- a/packaging/windows/package.ps1
+++ b/packaging/windows/package.ps1
@@ -154,6 +154,8 @@ Invoke-Native 'test-msi' {
& (Get-Process -Id $PID).Path -NoProfile -File (Join-Path $PSScriptRoot 'test-msi.ps1') $Msi `
-CraftFontLicences $HasCraftFontLicences -ExpectedFontNoticesDirectory $Docs
}
+# Check the compiled scope, path and registration contract before signing.
+& (Join-Path $PSScriptRoot 'check-install-policy.ps1') -MsiPath $Msi
# wix writes its debug symbols (.wixpdb) next to the MSI; keep them out of the release assets.
Remove-Item -Force -ErrorAction SilentlyContinue ([IO.Path]::ChangeExtension($Msi, '.wixpdb'))
& (Join-Path $PSScriptRoot 'sign.ps1') $Msi
diff --git a/packaging/windows/pdfcraft.wxs b/packaging/windows/pdfcraft.wxs
index 65e76f254..c5881401d 100644
--- a/packaging/windows/pdfcraft.wxs
+++ b/packaging/windows/pdfcraft.wxs
@@ -1,37 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
-<!--
- PdfCraft MSI (WiX Toolset v5: `dotnet tool install -g wix`). Built by package.ps1:
-
- wix build pdfcraft.wxs installer-ui.wxs -arch x64 -d Version=1.2.3 -d BinDir=... -d ModelsDir=... -d IconPath=... -o out.msi
-
- Per-machine install into Program Files, a Start Menu shortcut, a desktop shortcut (on by default,
- optional, and an update keeps it only if it is still there), an App Paths entry, PdfCraft registered as a PDF handler (offered under "Open with"
- and in Default apps, never forced as the default), "Edit with PdfCraft" on PDF files'
- right-click menu and "Create PDF with PdfCraft…" on image files' right-click menu (both on by
- default, optional, and an update keeps the installed version's choice). Files opened with
- PdfCraft arrive on its command line.
--->
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
<?ifndef HasCraftFontLicences ?>
<?define HasCraftFontLicences=0 ?>
- <?endif ?>
- <Package
- Name="PdfCraft"
- Manufacturer="Learning Machines LLC"
- Version="$(var.Version)"
- UpgradeCode="EA00C367-7270-4C50-9D8B-A7A5C88AD27F"
- Scope="perMachine"
- Compressed="yes"
- Language="1033">
+ <?endif?>
+ <Package Name="PdfCraft" Manufacturer="Learning Machines LLC" Version="$(var.Version)" UpgradeCode="EA00C367-7270-4C50-9D8B-A7A5C88AD27F" Scope="perUserOrMachine" Compressed="yes" Language="1033">
<SummaryInformation Description="PdfCraft PDF workbench" Manufacturer="Learning Machines LLC" />
+ <?include $(sys.SOURCEFILEDIR)install-policy.wxi?>
<!-- HKLM registrations must never point into a per-user installation (#305). Allow removal
of an existing installation even if an older MSI let it install per-user. -->
- <Launch Condition="ALLUSERS = 1 OR (Installed AND REMOVE = &quot;ALL&quot;)"
- Message="PdfCraft must be installed for all users. Run setup with administrator privileges and ALLUSERS=1; per-user installation is not supported." />
<!-- Same-version upgrades let successive pre-releases of one X.Y.Z replace each other
(MSI versions are numeric, so 1.2.3-rc.1 and 1.2.3-rc.2 are both 1.2.3). -->
- <MajorUpgrade AllowSameVersionUpgrades="yes"
- DowngradeErrorMessage="A newer version of PdfCraft is already installed." />
+ <MajorUpgrade AllowSameVersionUpgrades="yes" DowngradeErrorMessage="A newer version of PdfCraft is already installed." />
<MediaTemplate EmbedCab="yes" CompressionLevel="high" />
<!-- Windows Installer requires an Icon id ending in .ico or .exe, or advertised shortcuts and
@@ -53,8 +32,7 @@
<FileSearch Name="PdfCraft.lnk" />
</DirectorySearch>
</Property>
- <SetProperty Id="INSTALLDESKTOPSHORTCUT" Value="1" After="AppSearch" Sequence="first"
- Condition="NOT INSTALLDESKTOPSHORTCUT AND (NOT WIX_UPGRADE_DETECTED OR EXISTINGDESKTOPSHORTCUT)" />
+ <SetProperty Id="INSTALLDESKTOPSHORTCUT" Value="1" After="CraftLoadOption2U" Sequence="first" Condition="NOT INSTALLDESKTOPSHORTCUT AND (NOT WIX_UPGRADE_DETECTED OR EXISTINGDESKTOPSHORTCUT)" />
<!-- The File Explorer menus: "Edit with PdfCraft" for PDF files (#682) and "Create PDF with
PdfCraft…" for images (#190). Each is on by default for a first install and has a property
to leave it out of unattended installs: INSTALLPDFCONTEXTMENU=0 (also a welcome-dialog
@@ -69,23 +47,21 @@
<UpgradeVersion Minimum="0.4.0" IncludeMinimum="yes" OnlyDetect="yes" Property="IMAGECONTEXTMENURELEASE" />
</Upgrade>
<Property Id="INSTALLPDFCONTEXTMENU" Secure="yes" />
- <Property Id="EXISTINGPDFCONTEXTMENU">
- <RegistrySearch Id="PdfContextMenuSearch" Root="HKLM" Key="Software\Classes\SystemFileAssociations\.pdf\shell\PdfCraft.Edit" Type="raw" />
- </Property>
- <SetProperty Id="INSTALLPDFCONTEXTMENU" Value="1" After="AppSearch" Sequence="first"
- Condition="NOT INSTALLPDFCONTEXTMENU AND (NOT PDFCONTEXTMENURELEASE OR EXISTINGPDFCONTEXTMENU)" />
+ <Property Id="EXISTINGPDFCONTEXTMENU" Secure="yes">
+ </Property>
+ <SetProperty Id="INSTALLPDFCONTEXTMENU" Value="1" After="CraftLoadOption2U" Sequence="first" Condition="NOT INSTALLPDFCONTEXTMENU AND (NOT PDFCONTEXTMENURELEASE OR EXISTINGPDFCONTEXTMENU)" />
<Property Id="INSTALLIMAGECONTEXTMENU" Secure="yes" />
- <Property Id="EXISTINGIMAGECONTEXTMENU">
- <RegistrySearch Id="ImageContextMenuSearch" Root="HKLM" Key="Software\Classes\SystemFileAssociations\.png\shell\PdfCraft.CreatePdf" Type="raw" />
- </Property>
- <SetProperty Id="INSTALLIMAGECONTEXTMENU" Value="1" After="AppSearch" Sequence="first"
- Condition="NOT INSTALLIMAGECONTEXTMENU AND (NOT IMAGECONTEXTMENURELEASE OR EXISTINGIMAGECONTEXTMENU)" />
+ <Property Id="EXISTINGIMAGECONTEXTMENU" Secure="yes">
+ </Property>
+ <SetProperty Id="INSTALLIMAGECONTEXTMENU" Value="1" After="CraftLoadOption2U" Sequence="first" Condition="NOT INSTALLIMAGECONTEXTMENU AND (NOT IMAGECONTEXTMENURELEASE OR EXISTINGIMAGECONTEXTMENU)" />
<UIRef Id="PdfcraftInstallerUI" />
<StandardDirectory Id="ProgramFiles6432Folder">
- <Directory Id="INSTALLFOLDER" Name="PdfCraft">
+ <Directory Id="CraftSuiteFolder" Name="ArtCraft">
+ <Directory Id="INSTALLFOLDER" Name="PdfCraft">
<Directory Id="ModelsFolder" Name="models" />
</Directory>
+ </Directory>
</StandardDirectory>
<StandardDirectory Id="ProgramMenuFolder" />
<StandardDirectory Id="DesktopFolder" />
@@ -93,23 +69,27 @@
<Feature Id="Main" Title="PdfCraft" Level="1">
<?if $(var.HasCraftFontLicences) = 1 ?>
<ComponentGroupRef Id="CraftFontLicences" />
- <?endif ?>
+ <?endif?>
<ComponentGroupRef Id="PdfcraftFiles" />
<ComponentGroupRef Id="PdfcraftModels" />
</Feature>
- </Package>
+ <Property Id="CRAFT_OPTION_1_M" Secure="yes"><RegistrySearch Id="CRAFT_OPTION_1_MSearch" Root="HKLM" Key="Software\Classes\SystemFileAssociations\.pdf\shell\PdfCraft.Edit" Type="raw" />
+ </Property><SetProperty Id="EXISTINGPDFCONTEXTMENU" Action="CraftLoadOption1M" Value="[CRAFT_OPTION_1_M]" After="LaunchConditions" Sequence="both" Condition="ALLUSERS = 1" /><Property Id="CRAFT_OPTION_1_U" Secure="yes"><RegistrySearch Id="CRAFT_OPTION_1_USearch" Root="HKCU" Key="Software\Classes\SystemFileAssociations\.pdf\shell\PdfCraft.Edit" Type="raw" />
+ </Property><SetProperty Id="EXISTINGPDFCONTEXTMENU" Action="CraftLoadOption1U" Value="[CRAFT_OPTION_1_U]" After="CraftLoadOption1M" Sequence="both" Condition="ALLUSERS &lt;&gt; 1" /><Property Id="CRAFT_OPTION_2_M" Secure="yes"><RegistrySearch Id="CRAFT_OPTION_2_MSearch" Root="HKLM" Key="Software\Classes\SystemFileAssociations\.png\shell\PdfCraft.CreatePdf" Type="raw" />
+ </Property><SetProperty Id="EXISTINGIMAGECONTEXTMENU" Action="CraftLoadOption2M" Value="[CRAFT_OPTION_2_M]" After="CraftLoadOption1U" Sequence="both" Condition="ALLUSERS = 1" /><Property Id="CRAFT_OPTION_2_U" Secure="yes"><RegistrySearch Id="CRAFT_OPTION_2_USearch" Root="HKCU" Key="Software\Classes\SystemFileAssociations\.png\shell\PdfCraft.CreatePdf" Type="raw" />
+ </Property><SetProperty Id="EXISTINGIMAGECONTEXTMENU" Action="CraftLoadOption2U" Value="[CRAFT_OPTION_2_U]" After="CraftLoadOption2M" Sequence="both" Condition="ALLUSERS &lt;&gt; 1" /></Package>
<Fragment>
<?if $(var.HasCraftFontLicences) = 1 ?>
<ComponentGroup Id="CraftFontLicences" Directory="INSTALLFOLDER">
<Files Include="$(var.DocsDir)\**" />
</ComponentGroup>
- <?endif ?>
+ <?endif?>
<ComponentGroup Id="PdfcraftFiles" Directory="INSTALLFOLDER">
<Component Id="PdfcraftApp" Guid="E724C1C6-091F-4E21-A685-80D089FDBE21">
<File Id="PdfcraftExe" Source="$(var.BinDir)\pdfcraft.exe" KeyPath="yes" />
- <RegistryValue Root="HKLM" Key="Software\Microsoft\Windows\CurrentVersion\App Paths\pdfcraft.exe" Value="[#PdfcraftExe]" Type="string" />
+ <RegistryValue Root="HKMU" Key="Software\Microsoft\Windows\CurrentVersion\App Paths\pdfcraft.exe" Value="[#PdfcraftExe]" Type="string" />
<!-- PDF files (#107): PdfCraft is offered under "Open with" and in Settings ▸ Default
apps, through Windows' Default Programs registration (a ProgID, OpenWithProgids,
@@ -117,26 +97,27 @@
.pdf's own default value is left alone, and the user chooses. Without this, the only
PdfCraft entry to pick was the advertised Start Menu shortcut, which Windows can't
run as a file handler ("This app can't run on your PC"). -->
- <RegistryValue Root="HKLM" Key="Software\Classes\PdfCraft.Document" Value="PDF Document" Type="string" />
+ <RegistryValue Root="HKMU" Key="Software\Classes\PdfCraft.Document" Value="PDF Document" Type="string" />
<!-- A negative index selects the stable icon resource ID, rather than its position.
Resource 1 is the app's lion; resource 2 is the PDF document (build.rs). -->
- <RegistryValue Root="HKLM" Key="Software\Classes\PdfCraft.Document\DefaultIcon" Value="&quot;[#PdfcraftExe]&quot;,-2" Type="string" />
- <RegistryValue Root="HKLM" Key="Software\Classes\PdfCraft.Document\shell\open\command" Value="&quot;[#PdfcraftExe]&quot; &quot;%1&quot;" Type="string" />
+ <RegistryValue Root="HKMU" Key="Software\Classes\PdfCraft.Document\DefaultIcon" Value="&quot;[#PdfcraftExe]&quot;,-2" Type="string" />
+ <RegistryValue Root="HKMU" Key="Software\Classes\PdfCraft.Document\shell\open\command" Value="&quot;[#PdfcraftExe]&quot; &quot;%1&quot;" Type="string" />
<!-- No overlay on thumbnails and in the preview pane: without TypeOverlay, Windows paints
the default program's icon (the lion) over the lower-right corner of every PDF
thumbnail, covering part of the page. An empty string means none ("Thumbnail
Handlers", Microsoft Learn). -->
- <RegistryValue Root="HKLM" Key="Software\Classes\PdfCraft.Document" Name="TypeOverlay" Value="" Type="string" />
- <RegistryValue Root="HKLM" Key="Software\Classes\.pdf\OpenWithProgids" Name="PdfCraft.Document" Value="" Type="string" />
- <RegistryValue Root="HKLM" Key="Software\Classes\Applications\pdfcraft.exe" Name="FriendlyAppName" Value="PdfCraft" Type="string" />
- <RegistryValue Root="HKLM" Key="Software\Classes\Applications\pdfcraft.exe\DefaultIcon" Value="&quot;[#PdfcraftExe]&quot;,-2" Type="string" />
- <RegistryValue Root="HKLM" Key="Software\Classes\Applications\pdfcraft.exe\SupportedTypes" Name=".pdf" Value="" Type="string" />
- <RegistryValue Root="HKLM" Key="Software\Classes\Applications\pdfcraft.exe\shell\open\command" Value="&quot;[#PdfcraftExe]&quot; &quot;%1&quot;" Type="string" />
- <RegistryValue Root="HKLM" Key="Software\PdfCraft\Capabilities" Name="ApplicationName" Value="PdfCraft" Type="string" />
- <RegistryValue Root="HKLM" Key="Software\PdfCraft\Capabilities" Name="ApplicationDescription" Value="Open-source PDF workbench" Type="string" />
- <RegistryValue Root="HKLM" Key="Software\PdfCraft\Capabilities" Name="ApplicationIcon" Value="[#PdfcraftExe],0" Type="string" />
- <RegistryValue Root="HKLM" Key="Software\PdfCraft\Capabilities\FileAssociations" Name=".pdf" Value="PdfCraft.Document" Type="string" />
- <RegistryValue Root="HKLM" Key="Software\RegisteredApplications" Name="PdfCraft" Value="Software\PdfCraft\Capabilities" Type="string" />
+ <RegistryValue Root="HKMU" Key="Software\Classes\PdfCraft.Document" Name="TypeOverlay" Value="" Type="string" />
+ <RegistryValue Root="HKMU" Key="Software\Classes\.pdf\OpenWithProgids" Name="PdfCraft.Document" Value="" Type="string" />
+ <RegistryValue Root="HKMU" Key="Software\Classes\Applications\pdfcraft.exe" Name="FriendlyAppName" Value="PdfCraft" Type="string" />
+ <RegistryValue Root="HKMU" Key="Software\Classes\Applications\pdfcraft.exe\DefaultIcon" Value="&quot;[#PdfcraftExe]&quot;,-2" Type="string" />
+ <RegistryValue Root="HKMU" Key="Software\Classes\Applications\pdfcraft.exe\SupportedTypes" Name=".pdf" Value="" Type="string" />
+ <RegistryValue Root="HKMU" Key="Software\Classes\Applications\pdfcraft.exe\shell\open\command" Value="&quot;[#PdfcraftExe]&quot; &quot;%1&quot;" Type="string" />
+ <RegistryValue Root="HKMU" Key="Software\PdfCraft\Capabilities" Name="ApplicationName" Value="PdfCraft" Type="string" />
+ <RegistryValue Root="HKMU" Key="Software\PdfCraft\Capabilities" Name="ApplicationDescription" Value="Open-source PDF workbench" Type="string" />
+ <RegistryValue Root="HKMU" Key="Software\PdfCraft\Capabilities" Name="ApplicationIcon" Value="[#PdfcraftExe],0" Type="string" />
+ <RegistryValue Root="HKMU" Key="Software\PdfCraft\Capabilities\FileAssociations" Name=".pdf" Value="PdfCraft.Document" Type="string" />
+ <RegistryValue Root="HKMU" Key="Software\RegisteredApplications" Name="PdfCraft" Value="Software\PdfCraft\Capabilities" Type="string" />
+ <RegistryValue Root="HKMU" Key="Software\PdfCraft" Name="InstallDir" Value="[INSTALLFOLDER]" Type="string" />
</Component>
<!-- Shortcuts (#143) are plain links to pdfcraft.exe, not advertised MSI shortcuts: advertised
@@ -145,16 +126,13 @@
(#143). Each has its own component with an HKLM key path, so Windows Installer removes it
on uninstall; in this per-machine package both folders are the all-users ones. -->
<Component Id="PdfcraftStartMenuShortcut" Directory="ProgramMenuFolder" Guid="DC028192-C233-4F99-9A77-ED458C60DF26">
- <Shortcut Id="StartMenuShortcut" Name="PdfCraft" Description="PdfCraft PDF workbench"
- Target="[#PdfcraftExe]" WorkingDirectory="INSTALLFOLDER" Icon="PdfcraftIcon.ico" IconIndex="0" />
- <RegistryValue Root="HKLM" Key="Software\PdfCraft\Shortcuts" Name="StartMenu" Type="integer" Value="1" KeyPath="yes" />
+ <Shortcut Id="StartMenuShortcut" Name="PdfCraft" Description="PdfCraft PDF workbench" Target="[#PdfcraftExe]" WorkingDirectory="INSTALLFOLDER" Icon="PdfcraftIcon.ico" IconIndex="0" />
+ <RegistryValue Root="HKMU" Key="Software\PdfCraft\Shortcuts" Name="StartMenu" Type="integer" Value="1" KeyPath="yes" />
</Component>
- <Component Id="PdfcraftDesktopShortcut" Directory="DesktopFolder" Guid="F6948627-32AB-4D78-8865-0FDF417CE442"
- Condition="INSTALLDESKTOPSHORTCUT = 1">
- <Shortcut Id="DesktopShortcut" Name="PdfCraft" Description="PdfCraft PDF workbench"
- Target="[#PdfcraftExe]" WorkingDirectory="INSTALLFOLDER" Icon="PdfcraftIcon.ico" IconIndex="0" />
- <RegistryValue Root="HKLM" Key="Software\PdfCraft\Shortcuts" Name="Desktop" Type="integer" Value="1" KeyPath="yes" />
+ <Component Id="PdfcraftDesktopShortcut" Directory="DesktopFolder" Guid="F6948627-32AB-4D78-8865-0FDF417CE442" Condition="INSTALLDESKTOPSHORTCUT = 1">
+ <Shortcut Id="DesktopShortcut" Name="PdfCraft" Description="PdfCraft PDF workbench" Target="[#PdfcraftExe]" WorkingDirectory="INSTALLFOLDER" Icon="PdfcraftIcon.ico" IconIndex="0" />
+ <RegistryValue Root="HKMU" Key="Software\PdfCraft\Shortcuts" Name="Desktop" Type="integer" Value="1" KeyPath="yes" />
</Component>
<!-- PDF context menu (#682): "Edit with PdfCraft" opens the file in PdfCraft whichever app is
@@ -164,12 +142,11 @@
Windows 11 the entry is under "Show more options": the first-level menu only takes
packaged apps' (IExplorerCommand) entries. Its own component with an HKLM key path, so
INSTALLPDFCONTEXTMENU=0 leaves it out and uninstall removes it. -->
- <Component Id="PdfcraftPdfContextMenu" Guid="439F084F-657D-4AC2-A4CC-F099C518D71F"
- Condition="INSTALLPDFCONTEXTMENU = 1">
- <RegistryValue Root="HKLM" Key="Software\Classes\SystemFileAssociations\.pdf\shell\PdfCraft.Edit" Value="Edit with PdfCraft" Type="string" KeyPath="yes" />
- <RegistryValue Root="HKLM" Key="Software\Classes\SystemFileAssociations\.pdf\shell\PdfCraft.Edit" Name="Icon" Value="&quot;[#PdfcraftExe]&quot;,0" Type="string" />
- <RegistryValue Root="HKLM" Key="Software\Classes\SystemFileAssociations\.pdf\shell\PdfCraft.Edit" Name="MultiSelectModel" Value="Document" Type="string" />
- <RegistryValue Root="HKLM" Key="Software\Classes\SystemFileAssociations\.pdf\shell\PdfCraft.Edit\command" Value="&quot;[#PdfcraftExe]&quot; &quot;%1&quot;" Type="string" />
+ <Component Id="PdfcraftPdfContextMenu" Guid="439F084F-657D-4AC2-A4CC-F099C518D71F" Condition="INSTALLPDFCONTEXTMENU = 1">
+ <RegistryValue Root="HKMU" Key="Software\Classes\SystemFileAssociations\.pdf\shell\PdfCraft.Edit" Value="Edit with PdfCraft" Type="string" KeyPath="yes" />
+ <RegistryValue Root="HKMU" Key="Software\Classes\SystemFileAssociations\.pdf\shell\PdfCraft.Edit" Name="Icon" Value="&quot;[#PdfcraftExe]&quot;,0" Type="string" />
+ <RegistryValue Root="HKMU" Key="Software\Classes\SystemFileAssociations\.pdf\shell\PdfCraft.Edit" Name="MultiSelectModel" Value="Document" Type="string" />
+ <RegistryValue Root="HKMU" Key="Software\Classes\SystemFileAssociations\.pdf\shell\PdfCraft.Edit\command" Value="&quot;[#PdfcraftExe]&quot; &quot;%1&quot;" Type="string" />
</Component>
<!-- Image context menu (#190): "Create PDF with PdfCraft…" opens the DPI chooser, without
@@ -177,38 +154,37 @@
INSTALLIMAGECONTEXTMENU=0 leaves it out and uninstall removes it. These rows were in
PdfcraftApp up to 0.7.1; moving them is safe because MajorUpgrade removes the old version
before installing (afterInstallValidate), so no old row is left behind. -->
- <Component Id="PdfcraftImageContextMenu" Guid="1B783BF3-12DF-4588-AF80-E2CEA8BC1E5A"
- Condition="INSTALLIMAGECONTEXTMENU = 1">
- <RegistryValue Root="HKLM" Key="Software\Classes\SystemFileAssociations\.png\shell\PdfCraft.CreatePdf" Value="Create PDF with PdfCraft…" Type="string" KeyPath="yes" />
- <RegistryValue Root="HKLM" Key="Software\Classes\SystemFileAssociations\.png\shell\PdfCraft.CreatePdf" Name="MultiSelectModel" Value="Single" Type="string" />
- <RegistryValue Root="HKLM" Key="Software\Classes\SystemFileAssociations\.png\shell\PdfCraft.CreatePdf\command" Value="&quot;[#PdfcraftExe]&quot; --create-images &quot;%1&quot;" Type="string" />
- <RegistryValue Root="HKLM" Key="Software\Classes\SystemFileAssociations\.jpg\shell\PdfCraft.CreatePdf" Value="Create PDF with PdfCraft…" Type="string" />
- <RegistryValue Root="HKLM" Key="Software\Classes\SystemFileAssociations\.jpg\shell\PdfCraft.CreatePdf" Name="MultiSelectModel" Value="Single" Type="string" />
- <RegistryValue Root="HKLM" Key="Software\Classes\SystemFileAssociations\.jpg\shell\PdfCraft.CreatePdf\command" Value="&quot;[#PdfcraftExe]&quot; --create-images &quot;%1&quot;" Type="string" />
- <RegistryValue Root="HKLM" Key="Software\Classes\SystemFileAssociations\.jpeg\shell\PdfCraft.CreatePdf" Value="Create PDF with PdfCraft…" Type="string" />
- <RegistryValue Root="HKLM" Key="Software\Classes\SystemFileAssociations\.jpeg\shell\PdfCraft.CreatePdf" Name="MultiSelectModel" Value="Single" Type="string" />
- <RegistryValue Root="HKLM" Key="Software\Classes\SystemFileAssociations\.jpeg\shell\PdfCraft.CreatePdf\command" Value="&quot;[#PdfcraftExe]&quot; --create-images &quot;%1&quot;" Type="string" />
- <RegistryValue Root="HKLM" Key="Software\Classes\SystemFileAssociations\.tif\shell\PdfCraft.CreatePdf" Value="Create PDF with PdfCraft…" Type="string" />
- <RegistryValue Root="HKLM" Key="Software\Classes\SystemFileAssociations\.tif\shell\PdfCraft.CreatePdf" Name="MultiSelectModel" Value="Single" Type="string" />
- <RegistryValue Root="HKLM" Key="Software\Classes\SystemFileAssociations\.tif\shell\PdfCraft.CreatePdf\command" Value="&quot;[#PdfcraftExe]&quot; --create-images &quot;%1&quot;" Type="string" />
- <RegistryValue Root="HKLM" Key="Software\Classes\SystemFileAssociations\.tiff\shell\PdfCraft.CreatePdf" Value="Create PDF with PdfCraft…" Type="string" />
- <RegistryValue Root="HKLM" Key="Software\Classes\SystemFileAssociations\.tiff\shell\PdfCraft.CreatePdf" Name="MultiSelectModel" Value="Single" Type="string" />
- <RegistryValue Root="HKLM" Key="Software\Classes\SystemFileAssociations\.tiff\shell\PdfCraft.CreatePdf\command" Value="&quot;[#PdfcraftExe]&quot; --create-images &quot;%1&quot;" Type="string" />
- <RegistryValue Root="HKLM" Key="Software\Classes\SystemFileAssociations\.gif\shell\PdfCraft.CreatePdf" Value="Create PDF with PdfCraft…" Type="string" />
- <RegistryValue Root="HKLM" Key="Software\Classes\SystemFileAssociations\.gif\shell\PdfCraft.CreatePdf" Name="MultiSelectModel" Value="Single" Type="string" />
- <RegistryValue Root="HKLM" Key="Software\Classes\SystemFileAssociations\.gif\shell\PdfCraft.CreatePdf\command" Value="&quot;[#PdfcraftExe]&quot; --create-images &quot;%1&quot;" Type="string" />
- <RegistryValue Root="HKLM" Key="Software\Classes\SystemFileAssociations\.bmp\shell\PdfCraft.CreatePdf" Value="Create PDF with PdfCraft…" Type="string" />
- <RegistryValue Root="HKLM" Key="Software\Classes\SystemFileAssociations\.bmp\shell\PdfCraft.CreatePdf" Name="MultiSelectModel" Value="Single" Type="string" />
- <RegistryValue Root="HKLM" Key="Software\Classes\SystemFileAssociations\.bmp\shell\PdfCraft.CreatePdf\command" Value="&quot;[#PdfcraftExe]&quot; --create-images &quot;%1&quot;" Type="string" />
- <RegistryValue Root="HKLM" Key="Software\Classes\SystemFileAssociations\.jp2\shell\PdfCraft.CreatePdf" Value="Create PDF with PdfCraft…" Type="string" />
- <RegistryValue Root="HKLM" Key="Software\Classes\SystemFileAssociations\.jp2\shell\PdfCraft.CreatePdf" Name="MultiSelectModel" Value="Single" Type="string" />
- <RegistryValue Root="HKLM" Key="Software\Classes\SystemFileAssociations\.jp2\shell\PdfCraft.CreatePdf\command" Value="&quot;[#PdfcraftExe]&quot; --create-images &quot;%1&quot;" Type="string" />
- <RegistryValue Root="HKLM" Key="Software\Classes\SystemFileAssociations\.j2k\shell\PdfCraft.CreatePdf" Value="Create PDF with PdfCraft…" Type="string" />
- <RegistryValue Root="HKLM" Key="Software\Classes\SystemFileAssociations\.j2k\shell\PdfCraft.CreatePdf" Name="MultiSelectModel" Value="Single" Type="string" />
- <RegistryValue Root="HKLM" Key="Software\Classes\SystemFileAssociations\.j2k\shell\PdfCraft.CreatePdf\command" Value="&quot;[#PdfcraftExe]&quot; --create-images &quot;%1&quot;" Type="string" />
- <RegistryValue Root="HKLM" Key="Software\Classes\SystemFileAssociations\.jpx\shell\PdfCraft.CreatePdf" Value="Create PDF with PdfCraft…" Type="string" />
- <RegistryValue Root="HKLM" Key="Software\Classes\SystemFileAssociations\.jpx\shell\PdfCraft.CreatePdf" Name="MultiSelectModel" Value="Single" Type="string" />
- <RegistryValue Root="HKLM" Key="Software\Classes\SystemFileAssociations\.jpx\shell\PdfCraft.CreatePdf\command" Value="&quot;[#PdfcraftExe]&quot; --create-images &quot;%1&quot;" Type="string" />
+ <Component Id="PdfcraftImageContextMenu" Guid="1B783BF3-12DF-4588-AF80-E2CEA8BC1E5A" Condition="INSTALLIMAGECONTEXTMENU = 1">
+ <RegistryValue Root="HKMU" Key="Software\Classes\SystemFileAssociations\.png\shell\PdfCraft.CreatePdf" Value="Create PDF with PdfCraft…" Type="string" KeyPath="yes" />
+ <RegistryValue Root="HKMU" Key="Software\Classes\SystemFileAssociations\.png\shell\PdfCraft.CreatePdf" Name="MultiSelectModel" Value="Single" Type="string" />
+ <RegistryValue Root="HKMU" Key="Software\Classes\SystemFileAssociations\.png\shell\PdfCraft.CreatePdf\command" Value="&quot;[#PdfcraftExe]&quot; --create-images &quot;%1&quot;" Type="string" />
+ <RegistryValue Root="HKMU" Key="Software\Classes\SystemFileAssociations\.jpg\shell\PdfCraft.CreatePdf" Value="Create PDF with PdfCraft…" Type="string" />
+ <RegistryValue Root="HKMU" Key="Software\Classes\SystemFileAssociations\.jpg\shell\PdfCraft.CreatePdf" Name="MultiSelectModel" Value="Single" Type="string" />
+ <RegistryValue Root="HKMU" Key="Software\Classes\SystemFileAssociations\.jpg\shell\PdfCraft.CreatePdf\command" Value="&quot;[#PdfcraftExe]&quot; --create-images &quot;%1&quot;" Type="string" />
+ <RegistryValue Root="HKMU" Key="Software\Classes\SystemFileAssociations\.jpeg\shell\PdfCraft.CreatePdf" Value="Create PDF with PdfCraft…" Type="string" />
+ <RegistryValue Root="HKMU" Key="Software\Classes\SystemFileAssociations\.jpeg\shell\PdfCraft.CreatePdf" Name="MultiSelectModel" Value="Single" Type="string" />
+ <RegistryValue Root="HKMU" Key="Software\Classes\SystemFileAssociations\.jpeg\shell\PdfCraft.CreatePdf\command" Value="&quot;[#PdfcraftExe]&quot; --create-images &quot;%1&quot;" Type="string" />
+ <RegistryValue Root="HKMU" Key="Software\Classes\SystemFileAssociations\.tif\shell\PdfCraft.CreatePdf" Value="Create PDF with PdfCraft…" Type="string" />
+ <RegistryValue Root="HKMU" Key="Software\Classes\SystemFileAssociations\.tif\shell\PdfCraft.CreatePdf" Name="MultiSelectModel" Value="Single" Type="string" />
+ <RegistryValue Root="HKMU" Key="Software\Classes\SystemFileAssociations\.tif\shell\PdfCraft.CreatePdf\command" Value="&quot;[#PdfcraftExe]&quot; --create-images &quot;%1&quot;" Type="string" />
+ <RegistryValue Root="HKMU" Key="Software\Classes\SystemFileAssociations\.tiff\shell\PdfCraft.CreatePdf" Value="Create PDF with PdfCraft…" Type="string" />
+ <RegistryValue Root="HKMU" Key="Software\Classes\SystemFileAssociations\.tiff\shell\PdfCraft.CreatePdf" Name="MultiSelectModel" Value="Single" Type="string" />
+ <RegistryValue Root="HKMU" Key="Software\Classes\SystemFileAssociations\.tiff\shell\PdfCraft.CreatePdf\command" Value="&quot;[#PdfcraftExe]&quot; --create-images &quot;%1&quot;" Type="string" />
+ <RegistryValue Root="HKMU" Key="Software\Classes\SystemFileAssociations\.gif\shell\PdfCraft.CreatePdf" Value="Create PDF with PdfCraft…" Type="string" />
+ <RegistryValue Root="HKMU" Key="Software\Classes\SystemFileAssociations\.gif\shell\PdfCraft.CreatePdf" Name="MultiSelectModel" Value="Single" Type="string" />
+ <RegistryValue Root="HKMU" Key="Software\Classes\SystemFileAssociations\.gif\shell\PdfCraft.CreatePdf\command" Value="&quot;[#PdfcraftExe]&quot; --create-images &quot;%1&quot;" Type="string" />
+ <RegistryValue Root="HKMU" Key="Software\Classes\SystemFileAssociations\.bmp\shell\PdfCraft.CreatePdf" Value="Create PDF with PdfCraft…" Type="string" />
+ <RegistryValue Root="HKMU" Key="Software\Classes\SystemFileAssociations\.bmp\shell\PdfCraft.CreatePdf" Name="MultiSelectModel" Value="Single" Type="string" />
+ <RegistryValue Root="HKMU" Key="Software\Classes\SystemFileAssociations\.bmp\shell\PdfCraft.CreatePdf\command" Value="&quot;[#PdfcraftExe]&quot; --create-images &quot;%1&quot;" Type="string" />
+ <RegistryValue Root="HKMU" Key="Software\Classes\SystemFileAssociations\.jp2\shell\PdfCraft.CreatePdf" Value="Create PDF with PdfCraft…" Type="string" />
+ <RegistryValue Root="HKMU" Key="Software\Classes\SystemFileAssociations\.jp2\shell\PdfCraft.CreatePdf" Name="MultiSelectModel" Value="Single" Type="string" />
+ <RegistryValue Root="HKMU" Key="Software\Classes\SystemFileAssociations\.jp2\shell\PdfCraft.CreatePdf\command" Value="&quot;[#PdfcraftExe]&quot; --create-images &quot;%1&quot;" Type="string" />
+ <RegistryValue Root="HKMU" Key="Software\Classes\SystemFileAssociations\.j2k\shell\PdfCraft.CreatePdf" Value="Create PDF with PdfCraft…" Type="string" />
+ <RegistryValue Root="HKMU" Key="Software\Classes\SystemFileAssociations\.j2k\shell\PdfCraft.CreatePdf" Name="MultiSelectModel" Value="Single" Type="string" />
+ <RegistryValue Root="HKMU" Key="Software\Classes\SystemFileAssociations\.j2k\shell\PdfCraft.CreatePdf\command" Value="&quot;[#PdfcraftExe]&quot; --create-images &quot;%1&quot;" Type="string" />
+ <RegistryValue Root="HKMU" Key="Software\Classes\SystemFileAssociations\.jpx\shell\PdfCraft.CreatePdf" Value="Create PDF with PdfCraft…" Type="string" />
+ <RegistryValue Root="HKMU" Key="Software\Classes\SystemFileAssociations\.jpx\shell\PdfCraft.CreatePdf" Name="MultiSelectModel" Value="Single" Type="string" />
+ <RegistryValue Root="HKMU" Key="Software\Classes\SystemFileAssociations\.jpx\shell\PdfCraft.CreatePdf\command" Value="&quot;[#PdfcraftExe]&quot; --create-images &quot;%1&quot;" Type="string" />
</Component>
<Component Id="PdfcraftCli">
diff --git a/packaging/windows/test-install-policy.ps1 b/packaging/windows/test-install-policy.ps1
new file mode 100644
index 000000000..21199ca7f
--- /dev/null
+++ b/packaging/windows/test-install-policy.ps1
@@ -0,0 +1,54 @@
+<#
+.SYNOPSIS
+ Build non-executable installer metadata fixtures; never install them.
+#>
+param(
+ [Parameter(Mandatory = $true)] [string] $OutputDirectory,
+ [ValidateSet('x64','x86','arm64')] [string[]] $Architectures = @('x64','x86','arm64')
+)
+$ErrorActionPreference = 'Stop'
+Set-StrictMode -Version Latest
+$root = (Resolve-Path (Join-Path $PSScriptRoot '..\..')).Path
+$policy = Get-Content -Raw -LiteralPath (Join-Path $PSScriptRoot 'install-policy.json') | ConvertFrom-Json
+[void](New-Item -ItemType Directory -Force -Path $OutputDirectory)
+$output = (Resolve-Path -LiteralPath $OutputDirectory).Path
+Add-Type -AssemblyName System.Drawing
+foreach ($arch in $Architectures) {
+ $stage = Join-Path $output $arch
+ [void](New-Item -ItemType Directory -Force -Path $stage)
+ foreach ($name in $policy.payloads) {
+ $destination = Join-Path $stage $name
+ [void](New-Item -ItemType Directory -Force -Path ([IO.Path]::GetDirectoryName($destination)))
+ Set-Content -LiteralPath $destination -Encoding Ascii -Value 'NON-EXECUTABLE MSI METADATA TEST FIXTURE'
+ }
+ foreach ($folder in @('docs','models','notices')) {
+ $path = Join-Path $stage $folder
+ [void](New-Item -ItemType Directory -Force -Path $path)
+ Set-Content -LiteralPath (Join-Path $path "$folder-fixture.txt") -Value 'Metadata test fixture, not a user file or model.'
+ }
+ foreach ($model in @('metadata-one.rten','metadata-two.rten')) {
+ Set-Content -LiteralPath (Join-Path (Join-Path $stage 'models') $model) -Encoding Ascii -Value 'NON-EXECUTABLE MODEL METADATA FIXTURE'
+ }
+ foreach ($spec in @(@('banner.bmp',493,58),@('dialog.bmp',493,312))) {
+ $bitmap = [Drawing.Bitmap]::new($spec[1],$spec[2],[Drawing.Imaging.PixelFormat]::Format24bppRgb)
+ try { $bitmap.Save((Join-Path $stage $spec[0]),[Drawing.Imaging.ImageFormat]::Bmp) }
+ finally { $bitmap.Dispose() }
+ }
+ Set-Content -LiteralPath (Join-Path $stage 'licence.rtf') -Encoding Ascii -Value '{\rtf1 Metadata test fixture.}'
+ $sources = @($policy.sources | ForEach-Object { Join-Path $PSScriptRoot $_ })
+ $msi = Join-Path $stage "$($policy.id)-NOT-INSTALLABLE.msi"
+ $extensions = @($policy.extensions | ForEach-Object { '-ext'; "WixToolset.$_.wixext" })
+ & wix build @sources -arch $arch -wx @extensions `
+ -culture en-US -d 'Version=0.0.1' -d 'DisplayVersion=0.0.1-metadata-test' `
+ -d "BinDir=$stage" -d "IconPath=$(Join-Path $root $policy.icon)" `
+ -d "DocsDir=$(Join-Path $stage 'docs')" -d "ModelsDir=$(Join-Path $stage 'models')" `
+ -d "AppNoticesDir=$(Join-Path $stage 'notices')" -d 'HasCraftFontLicences=1' -d 'HasCli=1' `
+ -d "BannerBmp=$(Join-Path $stage 'banner.bmp')" -d "DialogBmp=$(Join-Path $stage 'dialog.bmp')" `
+ -d "UiBannerBmp=$(Join-Path $stage 'banner.bmp')" -d "UiDialogBmp=$(Join-Path $stage 'dialog.bmp')" `
+ -d "LicenseRtf=$(Join-Path $stage 'licence.rtf')" -o $msi @($policy.localization | ForEach-Object { '-loc'; Join-Path $PSScriptRoot $_ })
+ if ($LASTEXITCODE -ne 0) { throw "WiX validation failed for $arch (exit $LASTEXITCODE)." }
+ $shell = (Get-Process -Id $PID).Path
+ & $shell -NoProfile -ExecutionPolicy Bypass -File (Join-Path $PSScriptRoot 'check-install-policy.ps1') -MsiPath $msi
+ if ($LASTEXITCODE -ne 0) { throw "Compiled installer policy failed for $arch (exit $LASTEXITCODE)." }
+ Write-Output "PASS $arch metadata-only package. This is not an executable installer."
+}
diff --git a/packaging/windows/test-msi.ps1 b/packaging/windows/test-msi.ps1
index 24a4c6d75..59b1c1369 100644
--- a/packaging/windows/test-msi.ps1
+++ b/packaging/windows/test-msi.ps1
@@ -38,41 +38,11 @@ function Assert-NoRow([string] $Sql, [string] $What) {
} finally { [void] $view.Close() }
}
-# Test the compiled condition with Windows Installer's evaluator, in a restricted session that
-# cannot change machine state. Normal installs/repairs work, per-user overrides fail, and removal
-# of an older incorrectly scoped installation remains possible (#305).
-$scopeMessage = 'PdfCraft must be installed for all users. Run setup with administrator privileges and ALLUSERS=1; per-user installation is not supported.'
-$scopeCondition = Read-Row ('SELECT `Condition` FROM `LaunchCondition` WHERE `Description` = ''' + $scopeMessage + '''') 1
+# The shared compiled contract covers both scopes, duplicate guards and safe maintenance.
+# Keep it in a separate process because Windows Installer permits one session per process.
+& (Get-Process -Id $PID).Path -NoProfile -ExecutionPolicy Bypass -File (Join-Path $PSScriptRoot 'check-install-policy.ps1') -MsiPath $Path
+if ($LASTEXITCODE -ne 0) { throw 'Dual-scope installer contract failed.' }
$Installer.UILevel = 2
-$session = $null
-try {
- $session = $Installer.OpenPackage((Resolve-Path -LiteralPath $Path).Path, 1)
- foreach ($case in @(
- @('machine install', '1', '', '', '', 1),
- @('machine repair', '1', '', '1', '', 1),
- @('forced per-user install', '2', '1', '', '', 0),
- @('empty ALLUSERS', '', '', '', '', 0),
- @('resolved per-user install', '', '1', '', '', 0),
- @('forced per-user repair', '2', '1', '1', '', 0),
- @('machine uninstall', '1', '', '1', 'ALL', 1),
- @('legacy per-user uninstall', '', '1', '1', 'ALL', 1))) {
- $session.Property('ALLUSERS') = $case[1]
- $session.Property('MSIINSTALLPERUSER') = $case[2]
- $session.Property('Installed') = $case[3]
- $session.Property('REMOVE') = $case[4]
- Assert-Equal ($session.EvaluateCondition($scopeCondition[0])) $case[5] $case[0]
- }
-} finally {
- if ($session) { [void] [Runtime.InteropServices.Marshal]::FinalReleaseComObject($session) }
-}
-foreach ($sequence in @('InstallUISequence', 'InstallExecuteSequence')) {
- $launch = Read-Row ('SELECT `Condition`, `Sequence` FROM `' + $sequence + '` WHERE `Action` = ''LaunchConditions''') 2
- Assert-Equal $launch[0] '' "$sequence launch conditions are unconditional"
- $cost = Read-Row ('SELECT `Sequence` FROM `' + $sequence + '` WHERE `Action` = ''CostInitialize''') 1
- if ([int] $launch[1] -le 0 -or [int] $launch[1] -ge [int] $cost[0]) {
- throw "$sequence must reject per-user overrides before costing"
- }
-}
$manufacturer = Read-Row 'SELECT `Value` FROM `Property` WHERE `Property` = ''Manufacturer''' 1
Assert-Equal $manufacturer[0] 'Learning Machines LLC' 'MSI manufacturer'
@@ -173,7 +143,7 @@ Assert-Equal $checked[0] '1' 'Welcome checkbox value'
$app = Read-Row 'SELECT `KeyPath` FROM `Component` WHERE `Component` = ''PdfcraftApp''' 1
Assert-Equal $app[0] 'PdfcraftExe' 'Shortcut executable key path'
$scope = Read-Row 'SELECT `Value` FROM `Property` WHERE `Property` = ''ALLUSERS''' 1
-Assert-Equal $scope[0] '1' 'Per-machine shortcut scope'
+Assert-Equal $scope[0] '2' 'Dual-scope shortcut package'
# Each File Explorer menu remembers whether it was installed by finding its key path in HKLM, in the
# package's own registry view (64-bit for x64 and arm64). Only a release that offered the menu can
@@ -181,12 +151,22 @@ Assert-Equal $scope[0] '1' 'Per-machine shortcut scope'
$upgradeCode = Read-Row 'SELECT `Value` FROM `Property` WHERE `Property` = ''UpgradeCode''' 1
$view64 = $Database.SummaryInformation(0).Property(7) -notmatch '^Intel;'
function Assert-MenuSearch([string] $Found, [string] $Key, [string] $Release, [string] $Since, [string] $What) {
- $search = Read-Row ('SELECT `Root`, `Key`, `Name`, `Type` FROM `RegLocator`, `AppSearch` WHERE `AppSearch`.`Signature_` = `RegLocator`.`Signature_` AND `AppSearch`.`Property` = ''' + $Found + '''') 4
- Assert-Equal $search[0] '2' "$What search HKLM root"
- Assert-Equal $search[1] $Key "$What search key"
- Assert-Equal $search[2] '' "$What search reads the default value"
- # msidbLocatorTypeRawValue (2), plus msidbLocatorType64bit (16) in a 64-bit package.
- Assert-Equal ([int] $search[3]) $(if ($view64) { 18 } else { 2 }) "$What search type"
+ foreach ($context in @(@('M', '2'), @('U', '1'))) {
+ $cache = ''
+ $loaders = $Database.OpenView('SELECT `Action`, `Target` FROM `CustomAction` WHERE `Source` = ''' + $Found + '''')
+ try {
+ [void]$loaders.Execute()
+ while ($row = $loaders.Fetch()) {
+ if ($row.StringData(1) -match ('^CraftLoadOption[0-9]+' + $context[0] + '$')) { $cache = $row.StringData(2).Trim('[]') }
+ }
+ } finally { [void]$loaders.Close() }
+ if (-not $cache) { throw "$What has no context-specific loader." }
+ $search = Read-Row ('SELECT `Root`, `Key`, `Name`, `Type` FROM `RegLocator`, `AppSearch` WHERE `AppSearch`.`Signature_` = `RegLocator`.`Signature_` AND `AppSearch`.`Property` = ''' + $cache + '''') 4
+ Assert-Equal $search[0] $context[1] "$What context $($context[0]) search root"
+ Assert-Equal $search[1] $Key "$What search key"
+ Assert-Equal $search[2] '' "$What search reads the default value"
+ Assert-Equal ([int] $search[3]) $(if ($view64) { 18 } else { 2 }) "$What search type"
+ }
$upgrade = Read-Row ('SELECT `UpgradeCode`, `VersionMin`, `VersionMax`, `Attributes` FROM `Upgrade` WHERE `ActionProperty` = ''' + $Release + '''') 4
Assert-Equal $upgrade[0] $upgradeCode[0] "$What release detection upgrade code"
Assert-Equal $upgrade[1] $Since "$What release detection minimum"
@@ -213,7 +193,7 @@ foreach ($ext in @('png', 'jpg', 'jpeg', 'tif', 'tiff', 'gif', 'bmp', 'jp2', 'j2
$menu = Read-Row ('SELECT `Value`, `Component_`, `Root` FROM `Registry` WHERE `Key` = ''' + $key + ''' AND `Name` IS NULL') 3
Assert-Equal $menu[0] 'Create PDF with PdfCraft…' "$ext context menu label"
Assert-Equal $menu[1] 'PdfcraftImageContextMenu' "$ext context menu component"
- Assert-Equal $menu[2] '2' "$ext context menu HKLM root"
+ Assert-Equal $menu[2] '-1' "$ext context menu context-sensitive root"
$command = Read-Row ('SELECT `Value`, `Component_` FROM `Registry` WHERE `Key` = ''' + $key + '\command''') 2
Assert-Equal $command[0] '"[#PdfcraftExe]" --create-images "%1"' "$ext context menu command"
Assert-Equal $command[1] 'PdfcraftImageContextMenu' "$ext context menu command component"
@@ -246,7 +226,7 @@ $pdfKey = 'Software\Classes\SystemFileAssociations\.pdf\shell\PdfCraft.Edit'
$pdfMenu = Read-Row ('SELECT `Registry`, `Value`, `Component_`, `Root` FROM `Registry` WHERE `Key` = ''' + $pdfKey + ''' AND `Name` IS NULL') 4
Assert-Equal $pdfMenu[1] 'Edit with PdfCraft' 'PDF context menu label'
Assert-Equal $pdfMenu[2] 'PdfcraftPdfContextMenu' 'PDF context menu component'
-Assert-Equal $pdfMenu[3] '2' 'PDF context menu HKLM root'
+Assert-Equal $pdfMenu[3] '-1' 'PDF context menu context-sensitive root'
foreach ($value in @(@('Icon', '"[#PdfcraftExe]",0'), @('MultiSelectModel', 'Document'))) {
$row = Read-Row ('SELECT `Value`, `Component_` FROM `Registry` WHERE `Key` = ''' + $pdfKey + ''' AND `Name` = ''' + $value[0] + '''') 2
Assert-Equal $row[0] $value[1] "PDF context menu $($value[0])"
@@ -299,4 +279,4 @@ $rm = Read-Row 'SELECT `Dialog` FROM `Dialog` WHERE `Dialog` = ''MsiRMFilesInUse
Assert-Equal $rm[0] 'MsiRMFilesInUse' 'Files-in-use dialog'
[void] [Runtime.InteropServices.Marshal]::FinalReleaseComObject($Database)
[void] [Runtime.InteropServices.Marshal]::FinalReleaseComObject($Installer)
-Write-Output 'ok MSI: per-machine scope guard, publisher, persistent progress text, Start Menu shortcut, optional desktop shortcut and PDF and image context menus (on for a first install, kept on update only while present; checkboxes for the first two), icon/key path, full-UI success/cancel/error and Finish controls, files-in-use dialog, OCR models'
+Write-Output 'ok MSI: dual-scope guards, publisher, persistent progress text, Start Menu shortcut, optional desktop shortcut and PDF and image context menus (on for a first install, kept on update only while present; checkboxes for the first two), icon/key path, full-UI success/cancel/error and Finish controls, files-in-use dialog, OCR models'