diff --git a/src/qubes-rpc-services/get-appmenus.ps1 b/src/qubes-rpc-services/get-appmenus.ps1 index 0002e0b..5242a7b 100644 --- a/src/qubes-rpc-services/get-appmenus.ps1 +++ b/src/qubes-rpc-services/get-appmenus.ps1 @@ -19,6 +19,8 @@ * #> +. $env:QUBES_TOOLS\qubes-rpc-services\log.ps1 + # Registry location for path hash -> full path mapping for GetImageRGBA $RegistryMapPath = 'HKCU:\Software\Invisible Things Lab\Qubes Tools' $RegistryMapKey = 'AppMap' @@ -57,6 +59,8 @@ Function ProcessLink($pathObj, $basepath) # Store also basename-LNK location for qubes.StartApp service New-ItemProperty -Path "$RegistryMapPath\$RegistryMapKey" -Name $desktopFileName.Replace('.lnk', '') -PropertyType String -Value $pathObj.FullName | Out-Null + LogDebug "$targetHash -> $targetPath" + Write-Host "$($linkBaseName):Name=$appmenuLocation$($pathObj.BaseName)" Write-Host "$($linkBaseName):Exec=$($targetPath.Replace('\','\\'))" Write-Host "$($linkBaseName):Comment=$($linkObj.Description)" diff --git a/src/qubes-rpc-services/log.ps1 b/src/qubes-rpc-services/log.ps1 index c78cd19..35bc748 100644 --- a/src/qubes-rpc-services/log.ps1 +++ b/src/qubes-rpc-services/log.ps1 @@ -1,6 +1,8 @@ function LogStart { $logDir = Get-ItemPropertyValue "hklm:\Software\Invisible Things Lab\Qubes Tools" LogDir - $baseName = (Get-Item $MyInvocation.PSCommandPath).BaseName + # get the originating script path + $basePath = (Get-PSCallStack | Where-Object { $_.ScriptName } | Select-Object -Last 1).ScriptName + $baseName = Split-Path -Leaf -Path $basePath $logname = "$baseName-$(Get-Date -Format "yyyyMMdd-HHmmss")-$PID.log" $global:qwtLogPath = "$logDir\$logName" $global:qwtLogLevel = Get-ItemPropertyValue "hklm:\Software\Invisible Things Lab\Qubes Tools" LogLevel @@ -12,6 +14,10 @@ function Log { [string]$msg ) + if ($qwtLogPath -eq $null) { + LogStart + } + if ($level -le $qwtLogLevel) { $ts = Get-Date -Format "yyyyMMdd.HHmmss.fff" Add-Content $qwtLogPath -value "[$ts-$("EWIDV"[$level-1])] $msg" diff --git a/src/qubes-rpc-services/start-app.ps1 b/src/qubes-rpc-services/start-app.ps1 index b3cccd1..3d67fa1 100644 --- a/src/qubes-rpc-services/start-app.ps1 +++ b/src/qubes-rpc-services/start-app.ps1 @@ -19,6 +19,8 @@ * #> +. $env:QUBES_TOOLS\qubes-rpc-services\log.ps1 + # Registry location for path hash -> full path mapping $RegistryMapPath = 'HKCU:\Software\Invisible Things Lab\Qubes Tools' $RegistryMapKey = 'AppMap' @@ -26,5 +28,13 @@ $RegistryMapKey = 'AppMap' $desktopBaseName = $args[0] $desktopFullName = Get-ItemProperty -Path "$RegistryMapPath\$RegistryMapKey" -Name $desktopBaseName +$target = $desktopFullName.$desktopBaseName + +while (! (Get-CimInstance -ClassName Win32_ComputerSystem).UserName) { + LogDebug "Waiting for user logon" + Start-Sleep -Milliseconds 100 +} + +LogDebug "Starting $target" -Start-Process -Wait $desktopFullName.$desktopBaseName +Start-Process -Wait $target