Files
2026-04-17 14:55:32 -04:00

36 lines
2.3 KiB
Markdown

---
source_files:
- DataPRO/Modules/InstallerCustomActions/WarnWindows11/WarnWindows11.cs
generated_at: "2026-04-17T16:15:12.796756+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "2c9c3764491675e8"
---
# WarnWindows11
### Purpose
This module serves as a Windows Installer custom action that detects whether the target system is running Windows 11 and displays a warning message to the user if detected. It is designed to be executed during installation to inform users of potential compatibility concerns with the Windows 11 operating system.
### Public Interface
- **`OSWarning`** (class)
- `public static void Main(string[] args)` - Entry point for the custom action. Spawns `systeminfo.exe`, captures its output, parses it line-by-line for the string "MICROSOFT WINDOWS 11" (case-insensitive), and displays a message box with the warning resource `Properties.Resources.WARNING_WINDOWS11` if detected. All exceptions are silently caught and ignored.
### Invariants
- The process `systeminfo.exe` must be available on the target system PATH.
- The resource string `Properties.Resources.WARNING_WINDOWS11` must be defined in the project's resource file.
- The method always completes without throwing exceptions to the caller (all exceptions are caught and swallowed).
### Dependencies
- **Depends on**: `System`, `System.Diagnostics`, `System.Windows` (for `MessageBox`), and project resources (`Properties.Resources`).
- **Depends on external executable**: `systeminfo.exe` (Windows system utility).
- **Depended by**: Unclear from source alone; likely invoked by an MSI installer or setup executable as a custom action.
### Gotchas
- **Silent failure**: The `catch (Exception) { }` block swallows all exceptions without logging, meaning any failure (missing `systeminfo.exe`, permission issues, resource loading errors) will fail silently.
- **Synchronous blocking**: `reader.ReadToEnd()` and `process.WaitForExit()` block the calling thread; this could cause installer UI freezes if run on the UI thread.
- **Fragile detection logic**: Detection relies on exact string matching of `systeminfo.exe` output format ("MICROSOFT WINDOWS 11"), which could break if Microsoft changes the output format.
- **No exit code handling**: The process exit code is not checked; `systeminfo.exe` could fail and the code would not detect it.
---