Changeset 108071 in vbox
- Timestamp:
- Feb 5, 2025 2:14:02 PM (2 weeks ago)
- svn:sync-xref-src-repo-rev:
- 167361
- Location:
- trunk/src/VBox
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/GuestHost/installation/VBoxWinDrvCommon.cpp
r107901 r108071 697 697 } 698 698 699 /** 700 * Queries a DWORD value from a Windows registry key, Unicode (wide char) version. 701 * 702 * @returns IPRT status code. 703 * @retval VERR_FILE_NOT_FOUND if the value has not been found. 704 * @retval VERR_WRONG_TYPE if the type (DWORD) of the value does not match. 705 * @retval VERR_MISMATCH if the type sizes do not match. 706 * @param hKey Registry handle of key to query. 707 * @param pwszName Name of the value to query. 708 * @param pdwValue Where to return the actual value on success. 709 * 710 * @note Taken from IPRT's rtSystemWinRegistryQueryDWORDW. 711 */ 712 int VBoxWinDrvRegQueryDWORDW(HKEY hKey, LPCWSTR pwszName, DWORD *pdwValue) 713 { 714 int rc = VINF_SUCCESS; 715 716 DWORD cbType = sizeof(DWORD); 717 DWORD dwType = 0; 718 DWORD dwValue; 719 LONG lErr = RegQueryValueExW(hKey, pwszName, NULL, &dwType, (BYTE *)&dwValue, &cbType); 720 if (lErr == ERROR_SUCCESS) 721 { 722 if (cbType == sizeof(DWORD)) 723 { 724 if (dwType == REG_DWORD) 725 { 726 *pdwValue = dwValue; 727 } 728 else 729 rc = VERR_WRONG_TYPE; 730 } 731 else 732 rc = VERR_MISMATCH; 733 } 734 else 735 rc = RTErrConvertFromWin32(lErr); 736 737 return rc; 738 } 739 740 /** 741 * Queries a DWORD value from a Windows registry key. 742 * 743 * @returns IPRT status code. 744 * @retval VERR_FILE_NOT_FOUND if the value has not been found. 745 * @retval VERR_WRONG_TYPE if the type (DWORD) of the value does not match. 746 * @retval VERR_MISMATCH if the type sizes do not match. 747 * @param hKey Registry handle of key to query. 748 * @param pszName Name of the value to query. 749 * @param pdwValue Where to return the actual value on success. 750 */ 751 int VBoxWinDrvRegQueryDWORD(HKEY hKey, const char *pszName, DWORD *pdwValue) 752 { 753 PRTUTF16 pwszName; 754 int rc = RTStrToUtf16Ex(pszName, RTSTR_MAX, &pwszName, 0, NULL); 755 if (RT_SUCCESS(rc)) 756 { 757 rc = VBoxWinDrvRegQueryDWORDW(hKey, pwszName, pdwValue); 758 RTUtf16Free(pwszName); 759 } 760 761 return rc; 762 } 763 -
trunk/src/VBox/GuestHost/installation/VBoxWinDrvCommon.h
r107901 r108071 75 75 int VBoxWinDrvInstErrorFromWin32(unsigned uNativeCode); 76 76 77 int VBoxWinDrvRegQueryDWORDW(HKEY hKey, LPCWSTR pwszName, DWORD *pdwValue); 78 int VBoxWinDrvRegQueryDWORD(HKEY hKey, const char *pszName, DWORD *pdwValue); 79 77 80 #endif /* !VBOX_INCLUDED_SRC_installation_VBoxWinDrvCommon_h */ 78 81 -
trunk/src/VBox/Installer/win/InstallHelper/Makefile.kmk
r106321 r108071 51 51 VBoxInstallHelper.rc \ 52 52 VBoxCommon.cpp \ 53 $(PATH_ROOT)/src/VBox/GuestHost/Installation/VBoxWinDrvCommon.cpp \ 54 $(PATH_ROOT)/src/VBox/GuestHost/Installation/VBoxWinDrvInst.cpp \ 55 $(PATH_ROOT)/src/VBox/GuestHost/Installation/VBoxWinDrvStore.cpp 53 $(PATH_ROOT)/src/VBox/GuestHost/installation/VBoxWinDrvCommon.cpp \ 54 $(PATH_ROOT)/src/VBox/GuestHost/installation/VBoxWinDrvInst.cpp \ 55 $(PATH_ROOT)/src/VBox/GuestHost/installation/VBoxWinDrvStore.cpp 56 VBoxInstallHelper_INCS += \ 57 $(PATH_ROOT)/src/VBox/GuestHost/installation 56 58 ifndef VBOX_OSE 57 59 VBoxInstallHelper_SOURCES += \ -
trunk/src/VBox/Installer/win/InstallHelper/VBoxCommon.cpp
r107950 r108071 39 39 #include <iprt/utf16.h> 40 40 41 #include <VBox/GuestHost/VBoxWinDrvInst.h> 42 #include <VBoxWinDrvCommon.h> 41 43 #include "VBoxCommon.h" 42 44 … … 206 208 return VBoxMsiSetProp(hMsi, pwszName, wszTemp); 207 209 } 210 211 /** 212 * Queries a DWORD value from a Windows registry key, Unicode (wide char) version. 213 * 214 * @returns VBox status code. 215 * @retval VERR_FILE_NOT_FOUND if the value has not been found. 216 * @retval VERR_WRONG_TYPE if the type (DWORD) of the value does not match. 217 * @retval VERR_MISMATCH if the type sizes do not match. 218 * @param hMsi MSI handle to use. 219 * @param hKey Registry handle of key to query. 220 * @param pwszName Name of the value to query. 221 * @param pdwValue Where to return the actual value on success. 222 */ 223 int VBoxMsiRegQueryDWORDW(MSIHANDLE hMsi, HKEY hKey, LPCWSTR pwszName, DWORD *pdwValue) 224 { 225 RT_NOREF(hMsi); 226 227 return VBoxWinDrvRegQueryDWORDW(hKey, pwszName, pdwValue); 228 } 229 230 /** 231 * Queries a DWORD value from a Windows registry key. 232 * 233 * @returns VBox status code. 234 * @retval VERR_FILE_NOT_FOUND if the value has not been found. 235 * @retval VERR_WRONG_TYPE if the type (DWORD) of the value does not match. 236 * @retval VERR_MISMATCH if the type sizes do not match. 237 * @param hKey Registry handle of key to query. 238 * @param pszName Name of the value to query. 239 * @param pdwValue Where to return the actual value on success. 240 */ 241 int VBoxMsiRegQueryDWORD(MSIHANDLE hMsi, HKEY hKey, const char *pszName, DWORD *pdwValue) 242 { 243 PRTUTF16 pwszName; 244 int rc = RTStrToUtf16Ex(pszName, RTSTR_MAX, &pwszName, 0, NULL); 245 if (RT_SUCCESS(rc)) 246 { 247 rc = VBoxMsiRegQueryDWORDW(hMsi, hKey, pwszName, pdwValue); 248 RTUtf16Free(pwszName); 249 } 250 251 return rc; 252 } 253 -
trunk/src/VBox/Installer/win/InstallHelper/VBoxCommon.h
r107948 r108071 43 43 int VBoxMsiSetPropUtf8(MSIHANDLE hMsi, const char *pszName, const char *pszValue); 44 44 UINT VBoxMsiSetPropDWORD(MSIHANDLE hMsi, const WCHAR *pwszName, DWORD dwVal); 45 int VBoxMsiRegQueryDWORDW(MSIHANDLE hMsi, HKEY hKey, LPCWSTR pwszName, DWORD *pdwValue); 46 int VBoxMsiRegQueryDWORD(MSIHANDLE hMsi, HKEY hKey, const char *pszName, DWORD *pdwValue); 45 47 46 48 #endif /* !VBOX_INCLUDED_SRC_InstallHelper_VBoxCommon_h */
Note:
See TracChangeset
for help on using the changeset viewer.