3.8 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | |
|---|---|---|---|---|---|
|
2026-04-17T16:46:50.881996+00:00 | zai-org/GLM-5-FP8 | 1 | 5cf0f99b67b34e4b |
Documentation: RegAddProductCode Module
1. Purpose
This module is a Windows Installer custom action that validates architecture compatibility between the installer and the operating system, then configures Windows Registry settings to add the DataPRO product code to the Secure Repair Whitelist. It exists to prevent mismatched architecture installations (e.g., 32-bit installer on 64-bit OS) and to ensure the Windows Installer service permits DataPRO installation by configuring the SecureRepairPolicy and whitelist entries under HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Installer.
2. Public Interface
static int Main(string[] args)
Signature: static int Main(string[] args)
Behavior: Entry point for the custom action. Accepts a single command-line argument specifying the architecture version ("x86" or "x64"). Validates that the installer architecture matches the operating system architecture—returns 1 (failure) if mismatched, otherwise proceeds to call AddCodeToRegistry() and returns 0 on success. Logs diagnostic information to the Windows Event Log under the source "DataPROInstaller".
Return Values:
0— Success (architecture validated, registry updated)1— Failure (architecture mismatch detected)
private static string AddCodeToRegistry()
Signature: private static string AddCodeToRegistry()
Behavior: Configures registry settings required for DataPRO installation. Opens HKEY_LOCAL_MACHINE with a 64-bit registry view, sets SecureRepairPolicy to 2 (DWORD) under the Installer policies key, and adds the product code GUID to the SecureRepairWhitelist. Creates the whitelist key if it does not exist. Returns an empty string on success, or an error message string on exception.
Note: This method is private and not part of the public interface.
3. Invariants
-
Architecture Argument Requirement: The first command-line argument (
args[0]) must be either"x86"or"x64". Any other value bypasses architecture validation entirely (no error is thrown for unrecognized values). -
Architecture Matching:
- If
architectureVersion == "x86"andEnvironment.Is64BitOperatingSystem == true, the process must terminate with return code1. - If
architectureVersion == "x64"andEnvironment.Is64BitOperatingSystem == false, the process must terminate with return code1.
- If
-
Registry View: The registry is always accessed using
RegistryView.Registry64, regardless of process bitness. -
Event Log Source: All log entries are written to the event log source
"DataPROInstaller", which must exist or be creatable. -
Registry Key Existence: The key at
Settings.Default.InstallerKeymust exist; if it does not, the method returns early with an error message and does not attempt to create it. TheSecureRepairWhitelistKeywill be created if missing.
4. Dependencies
External Dependencies (Imports)
System— Core framework typesSystem.Diagnostics—EventLogfor Windows Event Log integrationMicrosoft.Win32—RegistryKey,RegistryHive,RegistryView,RegistryValueKindfor registry manipulationSystem.Windows.Forms—MessageBoxfor user-facing error dialogsRegAddProductCode.Properties—Settingsclass providing configuration values
Configuration Dependencies (from Settings.Default)
Settings.Default.InstallerKey— Registry path to the Installer policies keySettings.Default.SecureRepairWhitelistKey— Registry path to the SecureRepairWhitelist keySettings.Default.SecureRepairPolicy— Name of the secure repair policy value- `Settings