VirtualBox

Ignore:
Timestamp:
Jan 27, 2025 4:57:39 PM (3 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
167195
Message:

Host installer/win: Added GetPlatformArchitecture() to the VBoxInstallHelper.dll. bugref:10849

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Installer/win/InstallHelper/VBoxCommon.cpp

    r106321 r107948  
    146146}
    147147
     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 */
    148156UINT VBoxMsiSetProp(MSIHANDLE hMsi, const WCHAR *pwszName, const WCHAR *pwszValue)
    149157{
    150158    return MsiSetPropertyW(hMsi, pwszName, pwszValue);
    151159}
    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 */
     172int 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 */
    154207UINT VBoxMsiSetPropDWORD(MSIHANDLE hMsi, const WCHAR *pwszName, DWORD dwVal)
    155208{
     
    158211    return VBoxMsiSetProp(hMsi, pwszName, wszTemp);
    159212}
    160 
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette