- Timestamp:
- Jan 18, 2022 11:40:20 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Installer/win/InstallHelper/VBoxInstallHelper.cpp
r93334 r93335 223 223 * @param ppszPath Where to store the allocated Python path on success. 224 224 * Must be free'd by the caller using RTStrFree(). 225 * @remarks r=bird: This may return VINF_SUCCESS and *ppszPath = NULL if there 226 * are no keys under "SOFTWARE\\Python\\PythonCore" or none of them 227 * has an "InstallPath" key. It seems to work out fine, though, as 228 * we'll just use python.exe w/o a full path. 229 * 230 * @todo r=bird: On a more serious note, caller ASSUMES the returned path 231 * ends with a slash as it just appends the "python.exe" string to it. 225 232 */ 226 233 static int getPythonPathEx(MSIHANDLE hModule, HKEY hKeyRoot, char **ppszPath) … … 233 240 char *pszPythonPath = NULL; 234 241 235 RTUTF16 wszKey [RTPATH_MAX] = { 0 };236 RTUTF16 wszKey2[RTPATH_MAX] = { 0 };237 RTUTF16 wszVal [RTPATH_MAX] = { 0 };238 239 242 int rc = VINF_SUCCESS; 240 243 … … 243 246 for (int i = 0;; ++i) 244 247 { 245 DWORD dwKey = sizeof(wszKey); 246 DWORD dwKeyType = REG_SZ; 247 248 RTUTF16 wszKey[RTPATH_MAX]; 249 DWORD dwKey = sizeof(wszKey); 250 DWORD dwKeyType = REG_SZ; 251 252 /** @todo r=bird: Break on ERROR_NO_MORE_ITEMS, skip to the next one on 253 * errors. */ 248 254 dwErr = RegEnumKeyExW(hkPythonCore, i, wszKey, &dwKey, NULL, NULL, NULL, NULL); 249 255 if (dwErr != ERROR_SUCCESS || dwKey <= 0) … … 251 257 AssertBreakStmt(dwKey <= sizeof(wszKey), VERR_BUFFER_OVERFLOW); 252 258 259 /** @todo r=bird: Waste of space + effort, just append "\\InstallPath" to 260 * wszKey, reserving sufficent room for it above. */ 261 RTUTF16 wszKey2[RTPATH_MAX]; 253 262 if (RTUtf16Printf(wszKey2, sizeof(wszKey2), "%ls\\InstallPath", wszKey) <= 0) 254 263 { … … 256 265 break; 257 266 } 258 259 dwKey = sizeof(wszKey2); /* Re-initialize length. */260 267 261 268 HKEY hkPythonInstPath = NULL; … … 264 271 continue; 265 272 266 dwErr = RegQueryValueExW(hkPythonInstPath, L"", NULL, &dwKeyType, (LPBYTE)wszVal, &dwKey); 273 RTUTF16 wszVal[RTPATH_MAX] = { 0 }; 274 DWORD cbValue = sizeof(wszVal) - sizeof(RTUTF16); 275 dwErr = RegQueryValueExW(hkPythonInstPath, L"", NULL, &dwKeyType, (LPBYTE)wszVal, &cbValue); 267 276 if (dwErr == ERROR_SUCCESS) 268 277 logStringF(hModule, "getPythonPath: Path \"%ls\" found.", wszVal);
Note:
See TracChangeset
for help on using the changeset viewer.