| author | |
| committer | |
| log | faf67c106107e66fc5f2bb7f3b73bb972f1411e3 |
| tree | b042ab895b31539e3cb19cb0e6daf87dd5bd6d2f |
| parent | f4d8ce9b1e0defb90de5d60d85276bff2b7ff738 |
| signature | Signed by SSH key SHA256:52mNGHRsVFBDED9IAX5pe+LRWUefqTbxEReunq21QvU |
Use the ARM desktop subsystem ABI, remove the legacy bootstrap task during preparation, and call the existing job stop method inside the cleanup PowerShell process.
Assisted-by: gpt-6.1-sol5 files changed, 4 insertions(+), 6 deletions(-)
guest/build.py+1-1| ... | ... | @@ -38,7 +38,7 @@ if args.platform == "linux": |
| 38 | 38 | ], check=True) |
| 39 | 39 | raise SystemExit(0) |
| 40 | 40 | args.arch = args.arch or "x86_64" |
| 41 | subsystem = "10.0" if args.arch == "aarch64" else "6.1" | |
| 41 | subsystem = "6.2" if args.arch == "aarch64" else "6.1" | |
| 42 | 42 | environment = subprocess.check_output(["zig", "env"], text=True) |
| 43 | 43 | match = re.search(r'\.lib_dir\s*=\s*"([^"]+)"', environment) |
| 44 | 44 | library = Path(match[1] if match else json.loads(environment)["lib_dir"]) |
guest/computer-windows.cs-1| ... | ... | @@ -122,7 +122,6 @@ public static class ComputerWorker { |
| 122 | 122 | [DllImport("user32.dll")] static extern bool SetProcessDPIAware(); |
| 123 | 123 | [STAThread] public static void Main(string[] args) { |
| 124 | 124 | if(args.Length != 2) return; |
| 125 | if(args[0]=="--stop") {try {ComputerProcess.Stop(args[1]);}catch {Environment.Exit(1);}return;} | |
| 126 | 125 | requestPath=args[0];responsePath=args[1]; object result; |
| 127 | 126 | try { SetProcessDPIAware(); result=Run(Map(json.DeserializeObject(System.IO.File.ReadAllText(requestPath)))); } |
| 128 | 127 | catch(Exception error) { result=new { error=error.Message }; } |
guest/test.py+1-1| ... | ... | @@ -13,7 +13,7 @@ for arch in ['x86', 'x86_64', 'aarch64']: |
| 13 | 13 | machine, sections, _, _, _, optional_size = struct.unpack_from('<HHIIIH', data, pe + 4) |
| 14 | 14 | optional = pe + 24 |
| 15 | 15 | assert machine == {'x86': 0x14c, 'x86_64': 0x8664, 'aarch64': 0xaa64}[arch] |
| 16 | assert struct.unpack_from('<HH', data, optional + 48) == ((10, 0) if arch == 'aarch64' else (6, 1)) | |
| 16 | assert struct.unpack_from('<HH', data, optional + 48) == ((6, 2) if arch == 'aarch64' else (6, 1)) | |
| 17 | 17 | table = optional + optional_size |
| 18 | 18 | def offset(rva): |
| 19 | 19 | for index in range(sections): |
guest/windows-provision.ps1+1-1| ... | ... | @@ -27,7 +27,7 @@ try { |
| 27 | 27 | if ($Prepare) { |
| 28 | 28 | Remove-ItemProperty 'HKLM:\Software\Microsoft\Windows\CurrentVersion\Run' -Name SnowglobeBootstrap -ErrorAction SilentlyContinue |
| 29 | 29 | foreach ($task in $folder.GetTasks(1)) { |
| 30 | if ($task.Name -eq 'SnowglobeFinalize') { $task.Stop(0); $folder.DeleteTask($task.Name, 0) } | |
| 30 | if ($task.Name -eq 'SnowglobeFinalize' -or $task.Name -eq 'SnowglobeBootstrap') { $task.Stop(0); $folder.DeleteTask($task.Name, 0) } | |
| 31 | 31 | } |
| 32 | 32 | & "$root\install-guest.ps1" -Binary "$root\snowglobe-guest.exe" -User sandbox |
| 33 | 33 | $user = Get-WmiObject Win32_UserAccount -Filter "LocalAccount=True AND Name='sandbox'" |
tools/vm-computer.py+1-2| ... | ... | @@ -359,8 +359,7 @@ def finish_operation(name, operation): |
| 359 | 359 | cleanup += "$t=$f.GetTasks(1) | Where-Object {$_.Name -eq 'SnowglobeComputer-"+run+"'};if($t){" |
| 360 | 360 | if not operation.get('keep_spawn'): |
| 361 | 361 | cleanup += "$workers=@(Get-WmiObject Win32_Process | Where-Object {$_.CommandLine -like ('*'+$d+'\\request.json*')} | ForEach-Object {$p=Get-Process -Id $_.ProcessId -ErrorAction SilentlyContinue;if($p){$null=$p.Handle;$p}});" |
| 362 | cleanup += "$info=New-Object Diagnostics.ProcessStartInfo;$info.FileName=$t.Definition.Actions.Item(1).Path;$info.Arguments='--stop \"'+$d+'\\request.json\"';$info.UseShellExecute=$false;$info.CreateNoWindow=$true;" | |
| 363 | cleanup += "$stop=[Diagnostics.Process]::Start($info);if(!$stop.WaitForExit(12000) -or $stop.ExitCode -ne 0){throw 'Process cleanup failed'};$stop.Dispose();" | |
| 362 | cleanup += "[Reflection.Assembly]::LoadFrom($t.Definition.Actions.Item(1).Path)|Out-Null;[ComputerProcess]::Stop($d+'\\request.json');" | |
| 364 | 363 | cleanup += "$t.Stop(0);while($t.State -eq 4){Start-Sleep -Milliseconds 100};" |
| 365 | 364 | cleanup += "foreach($p in $workers){if(!$p.WaitForExit(10000)){throw 'Process cleanup failed'};$p.Dispose()};" |
| 366 | 365 | cleanup += "$f.DeleteTask('SnowglobeComputer-"+run+"',0)};" |