Changeset 22809 in vbox
- Timestamp:
- Sep 7, 2009 12:35:51 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceExec.cpp
r22744 r22809 140 140 *ppszValue = NULL; 141 141 142 char *pszPropNameUtf8; 143 rc = RTStrCurrentCPToUtf8(&pszPropNameUtf8, pszPropName); 144 if (RT_FAILURE(rc)) 145 { 146 VBoxServiceError("Exec: Failed to convert property name %s to UTF-8: %Rrc", 147 pszPropName, rc); 148 return rc; 149 } 150 142 151 for (unsigned cTries = 0; cTries < 10; cTries++) 143 152 { … … 156 165 char *pszFlags; 157 166 uint64_t uTimestamp; 158 rc = VbglR3GuestPropRead(g_uExecGuestPropSvcClientID, pszPropName ,167 rc = VbglR3GuestPropRead(g_uExecGuestPropSvcClientID, pszPropNameUtf8, 159 168 pvBuf, cbBuf, 160 169 &pszValue, &uTimestamp, &pszFlags, NULL); … … 202 211 203 212 RTMemFree(pvBuf); 213 RTStrFree(pszPropNameUtf8); 204 214 return rc; 205 215 } … … 284 294 285 295 /* add it */ 286 papszArgs[cUsed ++] = RTStrDupN(pszArgs, (uintptr_t)pszEnd - (uintptr_t)pszArgs);296 papszArgs[cUsed] = RTStrDupN(pszArgs, (uintptr_t)pszEnd - (uintptr_t)pszArgs); 287 297 if (!papszArgs[cUsed++]) 288 298 break; … … 327 337 for (;;) 328 338 { 329 #if 0 /** @todo r=bird: This code needs reviewing and testing before it can be enabled. */330 339 if (!fSysprepDone) 331 340 { … … 342 351 rc = VERR_NOT_FOUND; 343 352 #else 344 /* Predefined sys . */353 /* Predefined sysprep. */ 345 354 int rc = VINF_SUCCESS; 346 355 char szSysprepCmd[RTPATH_MAX] = "C:\\sysprep\\sysprep.exe"; … … 350 359 if ( GetVersionEx((LPOSVERSIONINFO) &OSInfoEx) 351 360 && OSInfoEx.dwPlatformId == VER_PLATFORM_WIN32_NT 352 && OSInfoEx.dwMajorVersion >= 6 /* Vista */)361 && OSInfoEx.dwMajorVersion >= 6 /* Vista or later */) 353 362 { 354 rc = RTEnvGetEx(RTENV_DEFAULT, "windir", szSys PrepCmd, sizeof(szSysPrepCmd), NULL);363 rc = RTEnvGetEx(RTENV_DEFAULT, "windir", szSysprepCmd, sizeof(szSysprepCmd), NULL); 355 364 if (RT_SUCCESS(rc)) 356 rc = RTPathAppend(szSys PrepCmd, sizeof(szSysPrepCmd), "system32\\sysprep\\sysprep.exe");365 rc = RTPathAppend(szSysprepCmd, sizeof(szSysprepCmd), "system32\\sysprep\\sysprep.exe"); 357 366 } 358 367 pszSysprepExec = szSysprepCmd; … … 399 408 * Store the result in Set return value so the host knows what happend. 400 409 */ 401 rc = VbglR3GuestPropWriteValueF(g_uExecGuestPropSvcClientID, 402 "/VirtualBox/HostGuest/SysprepRet", 403 "%d", Status.iStatus); 410 char* pszValueUtf8; 411 rc = RTStrCurrentCPToUtf8(&pszValueUtf8, "/VirtualBox/HostGuest/SysprepRet"); 404 412 if (RT_FAILURE(rc)) 405 VBoxServiceError("Exec: Failed to write SysprepRet: rc=%Rrc\n", rc); 413 { 414 VBoxServiceError("Exec: Failed to convert SysprepVBoxRC name to UTF-8: rc=%Rrc\n", rc); 415 } 416 else 417 { 418 rc = VbglR3GuestPropWriteValueF(g_uExecGuestPropSvcClientID, 419 pszValueUtf8, 420 "%d", Status.iStatus); 421 if (RT_FAILURE(rc)) 422 VBoxServiceError("Exec: Failed to write SysprepRet: rc=%Rrc\n", rc); 423 RTStrFree(pszValueUtf8); 424 } 406 425 } 407 426 else … … 424 443 RTStrFree(pszSysprepArgs); 425 444 } 426 #if ndef SYSPREP_WITH_CMD445 #ifdef SYSPREP_WITH_CMD 427 446 RTStrFree(pszSysprepExec); 428 447 #endif … … 437 456 { 438 457 VBoxServiceVerbose(1, "Exec: Stopping sysprep processing (rc=%Rrc)\n", rc); 439 rc = VbglR3GuestPropWriteValueF(g_uExecGuestPropSvcClientID, "/VirtualBox/HostGuest/SysprepVBoxRC", "%d", rc); 458 459 char* pszValueUtf8; 460 rc = RTStrCurrentCPToUtf8(&pszValueUtf8, "/VirtualBox/HostGuest/SysprepVBoxRC"); 440 461 if (RT_FAILURE(rc)) 441 VBoxServiceError("Exec: Failed to write SysprepVBoxRC: rc=%Rrc\n", rc); 462 { 463 VBoxServiceError("Exec: Failed to convert SysprepVBoxRC name to UTF-8: rc=%Rrc\n", rc); 464 } 465 else 466 { 467 rc = VbglR3GuestPropWriteValueF(g_uExecGuestPropSvcClientID, pszValueUtf8, "%d", rc); 468 if (RT_FAILURE(rc)) 469 VBoxServiceError("Exec: Failed to write SysprepVBoxRC: rc=%Rrc\n", rc); 470 RTStrFree(pszValueUtf8); 471 } 442 472 fSysprepDone = true; 443 473 } 444 474 } 445 #endif /* temporarily disabled. */446 447 475 #ifdef FULL_FEATURED_EXEC 448 476 1. Read the command - value, timestamp and flags.
Note:
See TracChangeset
for help on using the changeset viewer.