# Windows Dependency Audit — NexusShell

**Date:** 2026-06-05  
**Scope:** `source/nexus-shell/NexusShell` (NexusShell codebase)  
**Mission:** Replace Windows functions gradually — not lockdown/registry/GPO.

---

## Still uses Windows

### File dialogs (Microsoft.Win32)

| Location | Usage | Notes |
|----------|-------|-------|
| `ViewModels/NexusSettingsViewModel.cs` | `NexusOpenFileDialog` (migrated v1) | Wallpaper picker — now Nexus-branded wrapper |
| `Controls/Dialogs/NexusOpenFileDialogWindow.xaml.cs` | Underlying `OpenFileDialog` | v1 delegates browse to Win32 inside Nexus chrome |
| `Controls/Dialogs/NexusSaveFileDialogWindow.xaml.cs` | Underlying `SaveFileDialog` | v1 delegates browse to Win32 inside Nexus chrome |

**Not in NexusShell:** `OpenFolderDialog` exists in `nexus-installer` only.

### Process.Start / UseShellExecute

| Location | Target | Purpose |
|----------|--------|---------|
| `MainWindow.xaml.cs` | `shutdown /r`, `shutdown /s` | System restart/shutdown |
| `MainWindow.xaml.cs` | Shell exe (`UseShellExecute=true`) | Restart shell from console |
| `Services/AppLaunchService.cs` | Catalog app executables | Launch whitelisted external apps |
| `Services/NexusFileSystemService.cs` | `UseShellExecute=true` on file path | **Legacy** Windows default-app open (Files no longer calls this in v1) |
| `Services/IdentityHostService.cs` | Identity API process | Backend host |
| `Services/UpdateService.cs` | Updater/installer | Auto-update apply |

### Registry reads (Microsoft.Win32.Registry)

| Service | Key / purpose |
|---------|----------------|
| `NexusDeviceInfoService` | CPU name from `HARDWARE\DESCRIPTION\System\CentralProcessor\0` |
| `NexusGpuService` | GPU adapter name |
| `NexusBluetoothInfoService` | Bluetooth status and paired devices |
| `DisplaySettingsService` | Display mode changes via `ChangeDisplaySettingsEx` (not registry read, but Win32 API) |

### Windows settings / Explorer references

| Location | Type |
|----------|------|
| `Services/AppLaunchService.cs` | Blocks `ms-settings:`, `SystemSettings`, `control.exe` launches |
| `Services/NexusBrowserNavigationService.cs` | Blocks `ms-settings:` URLs |
| `Services/NexusCommandRegistry.cs` | Blocks `explorer`, `ms-settings` console tokens |
| `Services/Policy/NexusPolicyAppKeys.cs` | Detects `explorer.exe` in policy keys |
| `Services/LockdownService.cs` | Blocks `calc.exe`, Windows Photos, WMP by path pattern |
| `Views/DeveloperConsoleWindow.xaml` | Disabled "Open Registry Editor" button (placeholder) |

### ShellExecute file associations (Windows default)

| Location | Behavior |
|----------|----------|
| `NexusFileSystemService.TryOpenWithDefaultApp` | `Process.Start` + `UseShellExecute=true` — **still present** but Files app routes via `NexusFileOpenService` in v1 |

### MessageBox (System.Windows — acceptable)

Used throughout `MainWindow`, `App.xaml.cs` for errors and access denied — standard WPF, not Windows common dialogs.

---

## Now Nexus (replacement in place)

| Windows function | Nexus replacement | Status |
|------------------|-------------------|--------|
| Explorer (file browsing) | **Nexus Files** (`NexusFilesWindow`, `NexusFileSystemService`) | Production POC |
| Windows Photos | **Nexus Photos** | Production POC |
| Windows Media Player | **Nexus Media** | Production POC |
| Windows Settings | **Nexus Settings** (`NexusSettingsWindow`) | Production POC; blocks Windows Settings launches |
| Calculator | **Nexus Calculator** | Production POC |
| Notepad / text | **Nexus Files** preview (v1 default for `.txt`) | Partial |
| Open File dialog | **NexusOpenFileDialog** | v1 foundation |
| Save File dialog | **NexusSaveFileDialog** | v1 foundation |
| Open With dialog | **NexusOpenWithDialog** | v1 foundation (Nexus apps only) |
| Default app preferences | **NexusDefaultAppsService** → `%LocalAppData%/NinjaNexus/default-apps.json` | v1 design-only (no registry) |
| File open routing | **NexusFileOpenService** + **NexusFileAssociations** | v1; Files app migrated |

---

## Replaceable next sprint

| Priority | Target | Proposed Nexus action |
|----------|--------|------------------------|
| P1 | `NexusFileSystemService.TryOpenWithDefaultApp` | Remove or gate behind explicit "Windows fallback" dev flag |
| P1 | Pure WPF file picker | Replace Win32 delegate inside `NexusOpenFileDialogWindow` with custom tree/list UI |
| P1 | Wire Open With to Files context menu | Shift+Open or right-click → `NexusOpenWithDialog` |
| P2 | `AppLaunchService` external Process.Start | Route more catalog entries to Nexus windows |
| P2 | Registry-based device info | WMI / Nexus Agent inventory only |
| P2 | PDF in Browser | Dedicated Nexus PDF preview or Browser file:// handler |
| P3 | MessageBox → NexusModal | Consistent Nexus chrome for all prompts |
| P3 | Windows file association registration | Only after JSON prefs stable; still optional per mission |
| P3 | Notepad replacement | Dedicated Nexus Notes app or Files editor pane |

---

## Summary counts (NexusShell)

- **OpenFileDialog / SaveFileDialog direct call sites:** 0 in app code (wrapped in Controls/Dialogs)
- **Process.Start call sites:** 6 files
- **Registry read call sites:** 3 services (+ display Win32 API)
- **Windows Settings block points:** 3 services
- **Migrated to Nexus dialogs (v1):** 2 call sites (Settings wallpaper, Files open routing)
