Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/qubes-rpc-services/get-appmenus.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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)"
Expand Down
8 changes: 7 additions & 1 deletion src/qubes-rpc-services/log.ps1
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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"
Expand Down
12 changes: 11 additions & 1 deletion src/qubes-rpc-services/start-app.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,22 @@
*
#>

. $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'

$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