--- source_files: - DataPRO/Modules/InstallerCustomActions/WarnWindows11/WarnWindows11.cs generated_at: "2026-04-16T04:43:22.817107+00:00" model: "Qwen/Qwen3-Coder-Next-FP8" schema_version: 1 sha256: "4bf07a16db262f9c" --- # WarnWindows11 ## 1. Purpose This module provides a Windows Installer custom action that warns users during installation if the target system is running Windows 11. It executes as part of the installation sequence, checks the OS version by parsing the output of `systeminfo.exe`, and displays a modal warning message box if Windows 11 is detected—aimed at alerting users to potential compatibility concerns (as implied by the resource key `WARNING_WINDOWS11`). It exists to proactively inform users before proceeding with installation on an unsupported or untested platform. ## 2. Public Interface - **`OSWarning.Main(string[] args)`** *Signature:* `public static void Main(string[] args)` *Behavior:* Entry point for the custom action. Launches `systeminfo.exe`, captures its standard output, and scans line-by-line for the substring `"MICROSOFT WINDOWS 11"` (case-insensitive). If found, displays a message box using `Properties.Resources.WARNING_WINDOWS11`. All exceptions are silently caught and ignored; no error reporting or logging occurs. ## 3. Invariants - The process must successfully spawn `systeminfo.exe` and read its full output synchronously before proceeding. - The OS detection relies *solely* on exact substring matching in `systeminfo.exe` output; no other version-checking mechanisms (e.g., `Environment.OSVersion`, registry queries) are used. - The message box is shown *only* if the substring `"MICROSOFT WINDOWS 11"` appears anywhere in the output (case-insensitive). - No return value or exit code is set; the method always exits normally (even on failure). - The custom action assumes it runs in an interactive context (since `MessageBox.Show` requires user interaction); non-interactive execution (e.g., silent install) may hang or fail silently. ## 4. Dependencies - **Runtime:** .NET Framework (uses `System.Windows.Forms.MessageBox`, `System.Diagnostics.Process`, `System` namespaces). - **External executable:** `systeminfo.exe` (standard Windows utility; must be present on the target system). - **Resources:** `Properties.Resources.WARNING_WINDOWS11` must be defined (string resource) in the same assembly; failure to define it would cause a compile-time error. - **Caller:** Intended to be invoked as a Windows Installer custom action (likely deferred or immediate, though not specified here). - **No external libraries** beyond the base .NET Framework. ## 5. Gotchas - **Fragile OS detection:** Relies on `systeminfo.exe` output format, which may vary across Windows versions, locales, or system configurations (e.g., localized output like `"Microsoft Windows 11 Pro"` vs. `"Microsoft Windows 11"`). - **Silent failure handling:** All exceptions (including `Win32Exception` if `systeminfo.exe` is missing, `InvalidOperationException` if process fails, or `SecurityException` if permissions are insufficient) are swallowed—no diagnostics or fallback behavior. - **Blocking UI call:** `MessageBox.Show` blocks the installer thread; if invoked non-interactively (e.g., via `msiexec /quiet`), the installer may hang indefinitely waiting for user input. - **No cancellation path:** The warning is informational only; the installation proceeds regardless of whether the user dismisses the message. - **Performance:** Synchronous process execution and full output parsing may add latency to installation (though `systeminfo.exe` is typically fast). - **No version validation:** Detects *any* Windows 11 variant (Home, Pro, etc.) but does not distinguish editions or build numbers. - **Missing resource handling:** If `Properties.Resources.WARNING_WINDOWS11` is null or empty, the message box will show an empty dialog—no null check is performed. - **Case-insensitivity is applied only to the search string, not the output:** The `line.ToUpper()` call ensures case-insensitive matching of `"MICROSOFT WINDOWS 11"`, but if `systeminfo.exe` output uses non-ASCII characters (e.g., accented letters), matching may still fail. - **No cleanup of process resources beyond `WaitForExit()`:** While `using` ensures disposal of the `Process` object, there is no explicit handling of `StandardOutput` stream disposal (though `reader.ReadToEnd()` closes it implicitly). *None identified from source alone.* → **Correction:** Several gotchas *are* apparent from the source (see above).