Changeset 107948 in vbox for trunk/src/VBox/Installer/win/InstallHelper
- Timestamp:
- Jan 27, 2025 4:57:39 PM (2 months ago)
- svn:sync-xref-src-repo-rev:
- 167195
- Location:
- trunk/src/VBox/Installer/win/InstallHelper
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Installer/win/InstallHelper/VBoxCommon.cpp
r106321 r107948 146 146 } 147 147 148 /** 149 * Sets a MSI property. 150 * 151 * @returns UINT 152 * @param hMsi MSI handle to use. 153 * @param pwszName Name of property to set. 154 * @param pwszValue Value to set. 155 */ 148 156 UINT VBoxMsiSetProp(MSIHANDLE hMsi, const WCHAR *pwszName, const WCHAR *pwszValue) 149 157 { 150 158 return MsiSetPropertyW(hMsi, pwszName, pwszValue); 151 159 } 152 #endif 153 160 #endif /* TESTCASE */ 161 162 /** 163 * Sets a MSI property (in UTF-8). 164 * 165 * Convenience function for VBoxMsiSetProp(). 166 * 167 * @returns VBox status code. 168 * @param hMsi MSI handle to use. 169 * @param pszName Name of property to set. 170 * @param pszValue Value to set. 171 */ 172 int VBoxMsiSetPropUtf8(MSIHANDLE hMsi, const char *pszName, const char *pszValue) 173 { 174 AssertPtrReturn(pszName, VERR_INVALID_POINTER); 175 AssertPtrReturn(pszValue, VERR_INVALID_POINTER); 176 177 PRTUTF16 pwszName; 178 int rc = RTStrToUtf16(pszName, &pwszName); 179 if (RT_SUCCESS(rc)) 180 { 181 PRTUTF16 pwszValue; 182 rc = RTStrToUtf16(pszValue, &pwszValue); 183 if (RT_SUCCESS(rc)) 184 { 185 UINT const uRc = VBoxMsiSetProp(hMsi, pwszName, pwszValue); 186 if (uRc != ERROR_SUCCESS) 187 rc = RTErrConvertFromWin32(uRc); 188 RTUtf16Free(pwszValue); 189 } 190 191 RTUtf16Free(pwszName); 192 } 193 194 return rc; 195 } 196 197 /** 198 * Sets a MSI property (DWORD). 199 * 200 * Convenience function for VBoxMsiSetProp(). 201 * 202 * @returns UINT 203 * @param hMsi MSI handle to use. 204 * @param pwszName Name of property to set. 205 * @param dwVal Value to set. 206 */ 154 207 UINT VBoxMsiSetPropDWORD(MSIHANDLE hMsi, const WCHAR *pwszName, DWORD dwVal) 155 208 { … … 158 211 return VBoxMsiSetProp(hMsi, pwszName, wszTemp); 159 212 } 160 -
trunk/src/VBox/Installer/win/InstallHelper/VBoxCommon.h
r106321 r107948 41 41 int VBoxMsiQueryPropInt32(MSIHANDLE hMsi, const char *pszName, DWORD *pdwValue); 42 42 UINT VBoxMsiSetProp(MSIHANDLE hMsi, const WCHAR *pwszName, const WCHAR *pwszValue); 43 int VBoxMsiSetPropUtf8(MSIHANDLE hMsi, const char *pszName, const char *pszValue); 43 44 UINT VBoxMsiSetPropDWORD(MSIHANDLE hMsi, const WCHAR *pwszName, DWORD dwVal); 44 45 -
trunk/src/VBox/Installer/win/InstallHelper/VBoxInstallHelper.cpp
r106839 r107948 65 65 #include <iprt/string.h> /* RT_ZERO */ 66 66 #include <iprt/stream.h> 67 #include <iprt/system.h> 67 68 #include <iprt/thread.h> 68 69 #include <iprt/utf16.h> … … 1579 1580 } 1580 1581 1582 /** 1583 * Returns the platform architecture as a string. 1584 * 1585 * Sets public property VBOX_PLATFORM_ARCH to "x86", "amd64" or "arm64" on success. 1586 * Called from the MSI installer as custom action. 1587 * 1588 * @returns UINT as Windows error code. 1589 * @retval ERROR_INSTALL_PLATFORM_UNSUPPORTED if the platform is invalid or unsupported. 1590 * @param hModule Windows installer module handle. 1591 * 1592 * @note We don't use WIX' util.QueryNativeMachine, as it's apparently on available on Windows 10 >= 1709. 1593 */ 1594 UINT __stdcall GetPlatformArchitecture(MSIHANDLE hModule) 1595 { 1596 const char *pszArch; 1597 1598 RT_BREAKPOINT(); 1599 1600 /* Only add supported platforms here. */ 1601 uint32_t const uNativeArch = RTSystemGetNativeArch(); 1602 switch (uNativeArch) 1603 { 1604 case RT_ARCH_VAL_X86: pszArch = "x86"; break; 1605 case RT_ARCH_VAL_AMD64: pszArch = "amd64"; break; 1606 case RT_ARCH_VAL_ARM64: pszArch = "arm64"; break; 1607 default: pszArch = NULL; break; 1608 } 1609 1610 int rc; 1611 if (pszArch) 1612 rc = VBoxMsiSetPropUtf8(hModule, "VBOX_PLATFORM_ARCH", pszArch); 1613 else 1614 rc = VERR_NOT_SUPPORTED; 1615 1616 logStringF(hModule, "GetPlatformArchitecture: Detected '%s' (%Rrc)", pszArch ? pszArch : "<Unknown>", rc); 1617 1618 return RT_SUCCESS(rc) ? ERROR_SUCCESS : ERROR_INSTALL_PLATFORM_UNSUPPORTED; 1619 } 1620 1581 1621 #if defined(VBOX_WITH_NETFLT) || defined(VBOX_WITH_NETADP) 1582 1622 -
trunk/src/VBox/Installer/win/InstallHelper/VBoxInstallHelper.def
r106321 r107948 34 34 IsPythonInstalled 35 35 IsWindows10 36 GetPlatformArchitecture 36 37 ArePythonAPIDepsInstalled 37 38 InstallPythonAPI
Note:
See TracChangeset
for help on using the changeset viewer.