RaggieScript v1.3.0
Browse Table of Contents (17 chapters)
Getting Started (2)
Language Reference (4)
Core Standard Library (3)
Windows, MSI SQL & Native FFI (3)
Wizard UI & Studio Sandboxes (3)
Diagnostics & Bytecode ISA (2)
Master Symbol Index
7 min read Module: raggiesoft.raggiescript F1: IDH_RSSC_NS_MSI (0x200C)

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)

MethodSignatureReturnMutating?Description
msi.isUpgradeInstalledmsi.isUpgradeInstalled(upgradeCodeGuid: string)mapRead-OnlyCalls MsiEnumRelatedProductsW and returns { installed: bool, productCode: string, version: version, installLocation: path }.
msi.isProductInstalledmsi.isProductInstalled(productCodeGuid: string)boolRead-OnlyCalls MsiQueryProductStateW (INSTALLSTATE_DEFAULT).
msi.isNativeInstalledmsi.isNativeInstalled(packageId: string, scope?: string)boolRead-OnlyChecks CurrentVersion\Uninstall\<packageId> for a native RaggieScript package.
msi.findRelatedProductsmsi.findRelatedProducts(upgradeCodeGuid: string)arrayRead-OnlyReturns string[] of all installed ProductCode GUIDs sharing upgradeCodeGuid.
msi.setSessionPropertymsi.setSessionProperty(name: string, value: string)boolWizard-SafeQueues 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.getSessionPropertymsi.getSessionProperty(name: string, fallback?: string)stringRead-OnlyReads a queued or active Windows Installer session property (fallback when unset).
msi.installEmbeddedmsi.installEmbedded(extraProperties?: map)intMutating (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.installmsi.install(msiPath: path, properties?: map, silent?: bool, logFile?: path)intMutating (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.repairmsi.repair(productCodeOrMsi: string, reinstallFlags?: string, logFile?: path)intMutating (RSW701)Repairs an installed MSI (REINSTALLMODE_PECMS default).
msi.uninstallmsi.uninstall(productCodeGuid: string, extraProps?: string, logFile?: path)intMutating (RSW701)Uninstalls productCodeGuid (REMOVE=ALL).
msi.applyPatchmsi.applyPatch(mspPath: path, targetProductCode?: string, commandLine?: string)intMutating (RSW701)Applies a binary-delta .msp Windows Installer patch (MsiApplyPatchW).
msi.configureFeaturemsi.configureFeature(productCodeGuid: string, featureId: string, installState?: string)intMutating (RSW701)Sets an individual MSI feature to "local", "absent", or "source".
msi.runLegacyUninstallermsi.runLegacyUninstaller(productIdOrUpgradeCode: string, preferQuiet?: bool, extraArgs?: string)intMutating (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 / PropertySignatureReturnPhase SafetyDescription
msi.session.getPropertymsi.session.getProperty(name: string, fallback?: string)stringImmediate & DeferredReads live MsiGetPropertyW(hInstall, ...) in Immediate CAs, or automatically deserializes resolved properties from CustomActionData JSON in Deferred/Rollback/Commit CAs!
msi.session.setPropertymsi.session.setProperty(name: string, value: string)boolImmediateSets a live MSIHANDLE session property (MsiSetPropertyW) and refreshes CustomActionData for downstream Deferred CAs.
msi.session.getFeatureStatemsi.session.getFeatureState(featureId: string)mapImmediateCalls MsiGetFeatureStateW and returns { installed: string, action: string }.
msi.session.setFeatureStatemsi.session.setFeatureState(featureId: string, state: string)boolImmediateCalls MsiSetFeatureStateW ("local", "absent", "source").
msi.session.evaluateConditionmsi.session.evaluateCondition(conditionExpr: string)boolImmediateEvaluates an MSI condition string (MsiEvaluateConditionW, e.g. "VersionNT64 >= 603").
msi.session.formatStringmsi.session.formatString(templateText: string)stringImmediate & DeferredExpands [INSTALLDIR] / [ProductName] tokens via MsiFormatRecordW.
msi.session.logmsi.session.log(message: string)voidAll CAsWrites a structured line into the Windows Installer verbose log (MsiProcessMessage(INSTALLMESSAGE_INFO, ...)).
msi.session.doActionmsi.session.doAction(actionName: string)intImmediateInvokes a named MSI action via MsiDoActionW.
msi.session.isDeferredmsi.session.isDeferred()boolRead-OnlyReturns true when executing inside MsiGetMode(hInstall, MSIRUNMODE_SCHEDULED).
msi.session.isRollbackmsi.session.isRollback()boolRead-OnlyReturns true when executing inside MSIRUNMODE_ROLLBACK.
msi.session.isCommitmsi.session.isCommit()boolRead-OnlyReturns 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:

MethodSignatureReturnMutating?Description
msi.createDatabasemsi.createDatabase(msiPath: path)boolMutating (RSW701)Creates a brand-new empty .msi OLE structured-storage database (MSIDBOPEN_CREATEDIRECT).
msi.listTablesmsi.listTables(msiPath: path)arrayRead-OnlyQueries _Tables and returns string[] of all persistent tables in msiPath.
msi.querymsi.query(msiPath: path, selectSql: string)arrayRead-OnlyExecutes an MSI SQL SELECT query and returns map[] rows keyed by column name!
msi.execSqlmsi.execSql(msiPath: path, sqlOrBatchArray: any)boolMutating (RSW701)Executes a single MSI SQL DDL/DML string (CREATE TABLE, INSERT, UPDATE, DELETE, ALTER TABLE) or an atomic string[] batch committed together!
msi.getPropertymsi.getProperty(msiPath: path, propName: string, fallback?: string)stringRead-OnlyReads Value for propName from the MSI Property table.
msi.setPropertymsi.setProperty(msiPath: path, propName: string, value: string)boolMutating (RSW701)Creates the Property table if needed and upserts (propName, value) safely via parameterized MsiRecordSetStringW.
msi.getSummarymsi.getSummary(msiPath: path)mapRead-OnlyReads OLE \005SummaryInformation stream (title, subject, author, comments, template, packageCode, schema, wordCount).
msi.setSummarymsi.setSummary(msiPath: path, summaryMapOrPid: any, singleVal?: any)boolMutating (RSW701)Stamps OLE SummaryInformation properties (template: "Arm64;1033", schema: 500, wordCount: 2, etc.).
msi.importStreammsi.importStream(msiPath: path, tableName: string, rowName: string, sourceFile: path)boolMutating (RSW701)Streams a binary file (MsiRecordSetStreamW) into Binary or Icon table.
msi.exportStreammsi.exportStream(msiPath: path, tableName: string, rowName: string, destFile: path)boolRead-OnlyExtracts a binary stream column from Binary / Icon / _Streams to destFile.
msi.generateTransformmsi.generateTransform(baselineMsi: path, customizedMsi: path, outMstPath: path)boolMutating (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:

MethodSignatureReturnMutating?Description
prereq.isDotNetDesktopInstalledprereq.isDotNetDesktopInstalled(majorVer?: int, minVersion?: version)boolRead-OnlyDetects Microsoft.WindowsDesktop.App (8, 9, 10, or 11, default 10) under dotnet\shared.
prereq.isAspNetInstalledprereq.isAspNetInstalled(majorVer?: int, minVersion?: version)boolRead-OnlyDetects Microsoft.AspNetCore.App (8..11).
prereq.isDotNetRuntimeInstalledprereq.isDotNetRuntimeInstalled(majorVer?: int, minVersion?: version)boolRead-OnlyDetects base Microsoft.NETCore.App (8..11).
prereq.isWebView2Installedprereq.isWebView2Installed()boolRead-OnlyDetects Microsoft Edge WebView2 Evergreen Runtime across machine & per-user Clients keys.
prereq.isVcRedist2022Installedprereq.isVcRedist2022Installed(archOverride?: string)boolRead-OnlyDetects Microsoft Visual C++ 2015–2022 Redistributable (14.30+) for arm64 or x64.
prereq.isSatisfiedprereq.isSatisfied(presetId: string, arch?: string)boolRead-OnlyChecks all 15 curated preset IDs: "DotNet8Desktop".."DotNet11Desktop", "DotNet8AspNet".."DotNet11AspNet", "DotNet8Runtime".."DotNet11Runtime", "EdgeWebView2", "VcRedist2026" (v14.50+), and "VcRedist2022".
prereq.installPresetprereq.installPreset(presetId: string, extraSilentArgs?: string)boolMutating (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:

MethodSignatureReturnPhase SafetyDescription
sql.driverssql.drivers()stringWizard-SafeProbes System32\winsqlite3.dll and enumerates installed 64-bit ODBC drivers (SQLDriversW), returning a JSON summary string.
sql.querySqlitesql.querySqlite(dbPath: path, selectSql: string)stringWizard-SafeRuns a read-only SQLite SELECT query via winsqlite3.dll and returns a JSON array of row objects.
sql.execSqlitesql.execSqlite(dbPath: path, sqlBatch: string)boolMutating (RSW701)Executes DDL/DML statements inside an explicit BEGIN IMMEDIATE ... COMMIT transaction (automatically rolling back on error).
sql.execSqliteFilesql.execSqliteFile(dbPath: path, scriptPath: path)boolMutating (RSW701)Reads a UTF-8 .sql migration file and executes it transactionally against dbPath.
sql.execOdbcsql.execOdbc(connectionString: string, sqlBatch: string)boolMutating (RSW701)Connects via SQLDriverConnectW (SQL_DRIVER_NOPROMPT), splits ;/GO batches with SQL_AUTOCOMMIT_OFF, and issues SQL_ROLLBACK on failure!
sql.execOdbcFilesql.execOdbcFile(connectionString: string, scriptPath: path)boolMutating (RSW701)Executes an external .sql schema script over any installed 64-bit ODBC driver (PostgreSQL, MariaDB, SQL Server, Firebird, DB2).
Indexed API Calls & Symbols on This Page (17):