msi.* & prereq.* — Direct 64-Bit MSI SQL Engine, .MST Transforms & Runtime Presets
RaggieScript gives you both worlds: you can write pure zero-MSI native installers (where Error 1618 mutex contention is impossible), or you can drive and author Windows Installer .msi, .msm, .mst, and .msp relational SQL databases directly in native 64-bit (x64 / ARM64) via msi.*!
msi.* — Product Discovery & External-UI Execution (13 Methods)
| Method | Signature | Return | Mutating? | Description |
|---|---|---|---|---|
msi.isUpgradeInstalled | msi.isUpgradeInstalled(upgradeCodeGuid: string) | map | Read-Only | Calls MsiEnumRelatedProductsW and returns { installed: bool, productCode: string, version: version, installLocation: path }. |
msi.isProductInstalled | msi.isProductInstalled(productCodeGuid: string) | bool | Read-Only | Calls MsiQueryProductStateW (INSTALLSTATE_DEFAULT). |
msi.isNativeInstalled | msi.isNativeInstalled(packageId: string, scope?: string) | bool | Read-Only | Checks CurrentVersion\Uninstall\<packageId> for a native RaggieScript package. |
msi.findRelatedProducts | msi.findRelatedProducts(upgradeCodeGuid: string) | array | Read-Only | Returns string[] of all installed ProductCode GUIDs sharing upgradeCodeGuid. |
msi.setSessionProperty | msi.setSessionProperty(name: string, value: string) | bool | Wizard-Safe | Queues a public Windows Installer session property (SERVICE_PORT, INSTALLDIR, etc.) from an un-elevated wizard { ... } block so RaggieScript MSI (Engine = raggiescript-msi) passes it straight into Product.msi! |
msi.getSessionProperty | msi.getSessionProperty(name: string, fallback?: string) | string | Read-Only | Reads a queued or active Windows Installer session property (fallback when unset). |
msi.installEmbedded | msi.installEmbedded(extraProperties?: map) | int | Mutating (RSW701) | Commits the embedded #201 Product.msi in a RaggieScript MSI dual-resource Setup.exe with bridged params, feature selections (ADDLOCAL/REMOVE), and MsiSetExternalUIRecord + ITaskbarList3 progress. |
msi.install | msi.install(msiPath: path, properties?: map, silent?: bool, logFile?: path) | int | Mutating (RSW701) | Installs msiPath via MsiInstallProductW with live MsiSetExternalUIRecord progress forwarded into your RaggieScript wizard bar; returns Win32 MSI code (0, 3010, 1602, 1603, etc.). |
msi.repair | msi.repair(productCodeOrMsi: string, reinstallFlags?: string, logFile?: path) | int | Mutating (RSW701) | Repairs an installed MSI (REINSTALLMODE_PECMS default). |
msi.uninstall | msi.uninstall(productCodeGuid: string, extraProps?: string, logFile?: path) | int | Mutating (RSW701) | Uninstalls productCodeGuid (REMOVE=ALL). |
msi.applyPatch | msi.applyPatch(mspPath: path, targetProductCode?: string, commandLine?: string) | int | Mutating (RSW701) | Applies a binary-delta .msp Windows Installer patch (MsiApplyPatchW). |
msi.configureFeature | msi.configureFeature(productCodeGuid: string, featureId: string, installState?: string) | int | Mutating (RSW701) | Sets an individual MSI feature to "local", "absent", or "source". |
msi.runLegacyUninstaller | msi.runLegacyUninstaller(productIdOrUpgradeCode: string, preferQuiet?: bool, extraArgs?: string) | int | Mutating (RSW701) | Discovers and runs an existing QuietUninstallString / UninstallString before upgrading a legacy installer! |
msi.session.* — Inside-the-MSI Native Custom Action Engine (RsscMsiCa.dll, 11 Methods)
In RaggieSoft Installer Studio v0.9.1+, setting [Package] Engine = raggiescript-msi (or adding [CustomAction.<Id>] Type = raggiescript to Engine = msi) embeds our static /MT C++20 Type 1 Custom Action runner (RsscMsiCa.dll, x64 & ARM64, zero external COM/CRT/PowerShell dependencies) plus your RSWBC2 bytecode stream directly inside Product.msi's Binary table (RsscCaDll + RsscBytecode). Even when enterprise IT extracts Product.msi for headless msiexec /i Product.msi /qn GPO or Intune deployment, your Immediate, Deferred, Rollback (.jnl LIFO undo + RollbackFunction), and Commit actions execute 100% natively inside Windows Installer:
| Method / Property | Signature | Return | Phase Safety | Description |
|---|---|---|---|---|
msi.session.getProperty | msi.session.getProperty(name: string, fallback?: string) | string | Immediate & Deferred | Reads live MsiGetPropertyW(hInstall, ...) in Immediate CAs, or automatically deserializes resolved properties from CustomActionData JSON in Deferred/Rollback/Commit CAs! |
msi.session.setProperty | msi.session.setProperty(name: string, value: string) | bool | Immediate | Sets a live MSIHANDLE session property (MsiSetPropertyW) and refreshes CustomActionData for downstream Deferred CAs. |
msi.session.getFeatureState | msi.session.getFeatureState(featureId: string) | map | Immediate | Calls MsiGetFeatureStateW and returns { installed: string, action: string }. |
msi.session.setFeatureState | msi.session.setFeatureState(featureId: string, state: string) | bool | Immediate | Calls MsiSetFeatureStateW ("local", "absent", "source"). |
msi.session.evaluateCondition | msi.session.evaluateCondition(conditionExpr: string) | bool | Immediate | Evaluates an MSI condition string (MsiEvaluateConditionW, e.g. "VersionNT64 >= 603"). |
msi.session.formatString | msi.session.formatString(templateText: string) | string | Immediate & Deferred | Expands [INSTALLDIR] / [ProductName] tokens via MsiFormatRecordW. |
msi.session.log | msi.session.log(message: string) | void | All CAs | Writes a structured line into the Windows Installer verbose log (MsiProcessMessage(INSTALLMESSAGE_INFO, ...)). |
msi.session.doAction | msi.session.doAction(actionName: string) | int | Immediate | Invokes a named MSI action via MsiDoActionW. |
msi.session.isDeferred | msi.session.isDeferred() | bool | Read-Only | Returns true when executing inside MsiGetMode(hInstall, MSIRUNMODE_SCHEDULED). |
msi.session.isRollback | msi.session.isRollback() | bool | Read-Only | Returns true when executing inside MSIRUNMODE_ROLLBACK. |
msi.session.isCommit | msi.session.isCommit() | bool | Read-Only | Returns true when executing inside MSIRUNMODE_COMMIT. |
msi.* — Direct 64-Bit Relational MSI SQL Table & .MST Transform Engine (11 Methods)
Every SQL operation opens msi.dll handles cleanly with RAII scope guards (MsiOpenDatabaseW -> MsiDatabaseOpenViewW -> MsiViewExecute -> MsiDatabaseCommit), supporting Schema 500 (x64;1033 and Arm64;1033) with zero legacy 32-bit table-editor limits:
| Method | Signature | Return | Mutating? | Description |
|---|---|---|---|---|
msi.createDatabase | msi.createDatabase(msiPath: path) | bool | Mutating (RSW701) | Creates a brand-new empty .msi OLE structured-storage database (MSIDBOPEN_CREATEDIRECT). |
msi.listTables | msi.listTables(msiPath: path) | array | Read-Only | Queries _Tables and returns string[] of all persistent tables in msiPath. |
msi.query | msi.query(msiPath: path, selectSql: string) | array | Read-Only | Executes an MSI SQL SELECT query and returns map[] rows keyed by column name! |
msi.execSql | msi.execSql(msiPath: path, sqlOrBatchArray: any) | bool | Mutating (RSW701) | Executes a single MSI SQL DDL/DML string (CREATE TABLE, INSERT, UPDATE, DELETE, ALTER TABLE) or an atomic string[] batch committed together! |
msi.getProperty | msi.getProperty(msiPath: path, propName: string, fallback?: string) | string | Read-Only | Reads Value for propName from the MSI Property table. |
msi.setProperty | msi.setProperty(msiPath: path, propName: string, value: string) | bool | Mutating (RSW701) | Creates the Property table if needed and upserts (propName, value) safely via parameterized MsiRecordSetStringW. |
msi.getSummary | msi.getSummary(msiPath: path) | map | Read-Only | Reads OLE \005SummaryInformation stream (title, subject, author, comments, template, packageCode, schema, wordCount). |
msi.setSummary | msi.setSummary(msiPath: path, summaryMapOrPid: any, singleVal?: any) | bool | Mutating (RSW701) | Stamps OLE SummaryInformation properties (template: "Arm64;1033", schema: 500, wordCount: 2, etc.). |
msi.importStream | msi.importStream(msiPath: path, tableName: string, rowName: string, sourceFile: path) | bool | Mutating (RSW701) | Streams a binary file (MsiRecordSetStreamW) into Binary or Icon table. |
msi.exportStream | msi.exportStream(msiPath: path, tableName: string, rowName: string, destFile: path) | bool | Read-Only | Extracts a binary stream column from Binary / Icon / _Streams to destFile. |
msi.generateTransform | msi.generateTransform(baselineMsi: path, customizedMsi: path, outMstPath: path) | bool | Mutating (RSW701) | Computes a differential .mst GPO transform (MsiDatabaseGenerateTransformW + MsiCreateTransformSummaryInfoW)! |
use installer;
let db = fs.tempDir("msi-demo") / "Sample.msi";
msi.createDatabase(db);
msi.setSummary(db, {
title: "Installation Database",
template: sys.isArm64() ? "Arm64;1033" : "x64;1033",
schema: 500
});
msi.setProperty(db, "Manufacturer", "RaggieSoft");
msi.execSql(db, [
"CREATE TABLE `CustomPolicy` (`Key` CHAR(64) NOT NULL, `Value` CHAR(128) NOT NULL PRIMARY KEY `Key`)",
"INSERT INTO `CustomPolicy` (`Key`, `Value`) VALUES ('Telemetry', 'Disabled')"
]);
const rows = msi.query(db, "SELECT `Key`, `Value` FROM `CustomPolicy`");
assert(rows[0].Value == "Disabled");
prereq.* — Curated .NET 8–11, WebView2 & VC++ Runtime Detection (7 Methods)
All prereq.* detectors automatically check true host silicon (ARM64 vs. x64) so an ARM64 Windows 11 laptop never gets mis-detected against an x64-only runtime:
| Method | Signature | Return | Mutating? | Description |
|---|---|---|---|---|
prereq.isDotNetDesktopInstalled | prereq.isDotNetDesktopInstalled(majorVer?: int, minVersion?: version) | bool | Read-Only | Detects Microsoft.WindowsDesktop.App (8, 9, 10, or 11, default 10) under dotnet\shared. |
prereq.isAspNetInstalled | prereq.isAspNetInstalled(majorVer?: int, minVersion?: version) | bool | Read-Only | Detects Microsoft.AspNetCore.App (8..11). |
prereq.isDotNetRuntimeInstalled | prereq.isDotNetRuntimeInstalled(majorVer?: int, minVersion?: version) | bool | Read-Only | Detects base Microsoft.NETCore.App (8..11). |
prereq.isWebView2Installed | prereq.isWebView2Installed() | bool | Read-Only | Detects Microsoft Edge WebView2 Evergreen Runtime across machine & per-user Clients keys. |
prereq.isVcRedist2022Installed | prereq.isVcRedist2022Installed(archOverride?: string) | bool | Read-Only | Detects Microsoft Visual C++ 2015–2022 Redistributable (14.30+) for arm64 or x64. |
prereq.isSatisfied | prereq.isSatisfied(presetId: string, arch?: string) | bool | Read-Only | Checks all 15 curated preset IDs: "DotNet8Desktop".."DotNet11Desktop", "DotNet8AspNet".."DotNet11AspNet", "DotNet8Runtime".."DotNet11Runtime", "EdgeWebView2", "VcRedist2026" (v14.50+), and "VcRedist2022". |
prereq.installPreset | prereq.installPreset(presetId: string, extraSilentArgs?: string) | bool | Mutating (RSW701) | Extracts bundled or downloads official Microsoft HTTPS bootstrapper, verifies Authenticode, runs silently, and latches 3010 if reboot is requested! |
sql.* — Zero-DLL SQLite (winsqlite3.dll) & ODBC (odbc32.dll) SQL Engine (6 Methods)
Introduced in RaggieScript v1.3, sql.* executes transactional database migrations during install { ... }, uninstall { ... }, or RsscMsiCa.dll Deferred Custom Actions using only OS-resident Windows 11 system libraries (C:\Windows\System32\winsqlite3.dll loaded via LOAD_LIBRARY_SEARCH_SYSTEM32 and C:\Windows\System32\odbc32.dll for PostgreSQL, MariaDB, MySQL, SQL Server, Firebird, and DB2)—shipping zero bundled third-party database DLLs:
| Method | Signature | Return | Phase Safety | Description |
|---|---|---|---|---|
sql.drivers | sql.drivers() | string | Wizard-Safe | Probes System32\winsqlite3.dll and enumerates installed 64-bit ODBC drivers (SQLDriversW), returning a JSON summary string. |
sql.querySqlite | sql.querySqlite(dbPath: path, selectSql: string) | string | Wizard-Safe | Runs a read-only SQLite SELECT query via winsqlite3.dll and returns a JSON array of row objects. |
sql.execSqlite | sql.execSqlite(dbPath: path, sqlBatch: string) | bool | Mutating (RSW701) | Executes DDL/DML statements inside an explicit BEGIN IMMEDIATE ... COMMIT transaction (automatically rolling back on error). |
sql.execSqliteFile | sql.execSqliteFile(dbPath: path, scriptPath: path) | bool | Mutating (RSW701) | Reads a UTF-8 .sql migration file and executes it transactionally against dbPath. |
sql.execOdbc | sql.execOdbc(connectionString: string, sqlBatch: string) | bool | Mutating (RSW701) | Connects via SQLDriverConnectW (SQL_DRIVER_NOPROMPT), splits ;/GO batches with SQL_AUTOCOMMIT_OFF, and issues SQL_ROLLBACK on failure! |
sql.execOdbcFile | sql.execOdbcFile(connectionString: string, scriptPath: path) | bool | Mutating (RSW701) | Executes an external .sql schema script over any installed 64-bit ODBC driver (PostgreSQL, MariaDB, SQL Server, Firebird, DB2). |
msi.isUpgradeInstalled(upgradeCodeGuid)Read-Only
msi.install(msiPath, properties?, silent?, logFile?)Mutating
msi.applyPatch(mspPath, productCode?, cmdLine?)Mutating
msi.createDatabase(msiPath)Mutating
msi.listTables(msiPath)Read-Only
msi.query(msiPath, selectSql)Read-Only
msi.execSql(msiPath, sqlOrBatchArray)Mutating
msi.getProperty(msiPath, propName, fallback?)Read-Only
msi.setProperty(msiPath, propName, value)Mutating
msi.setSummary(msiPath, summaryMap)Mutating
msi.generateTransform(baselineMsi, customizedMsi, outMst)Mutating
prereq.isDotNetDesktopInstalled(majorVer?, minVer?)Read-Only
prereq.isWebView2Installed()Read-Only
prereq.installPreset(presetId, extraSilentArgs?)Mutating
msi.setSessionProperty / getSessionProperty / installEmbeddedRaggieScript MSI
msi.session.getProperty / setProperty / getFeatureState / setFeatureState / evaluateCondition / formatString / log / doActionRsscMsiCa.dll
sql.drivers / querySqlite / execSqlite / execSqliteFile / execOdbc / execOdbcFileZero-DLL SQL