儲存庫 vbox 的更動 50745
- 時間撮記:
- 2014-3-12 下午01:10:54 (11 年 以前)
- 檔案:
-
- 修改 1 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/Runtime/r3/win/process-win.cpp
r50062 r50745 5 5 6 6 /* 7 * Copyright (C) 2006-201 3Oracle Corporation7 * Copyright (C) 2006-2014 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 613 613 614 614 /** 615 * Creates an environment block out of a handed in Unicode and RTENV block. 616 * The RTENV block can overwrite entries already present in the Unicode block. 615 * Creates an environment block out of a handed-in Unicode and 616 * RTENV block. The RTENV block can overwrite entries already 617 * present in the Unicode block. 617 618 * 618 619 * @return IPRT status code. 619 620 * 620 * @param pvBlock Unicode block (array) of environment entries; name=value 621 * @param hEnv Handle of an existing RTENV block to use. 622 * @param ppwszBlock Pointer to the final output. 623 */ 624 static int rtProcWinEnvironmentCreateInternal(VOID *pvBlock, RTENV hEnv, PRTUTF16 *ppwszBlock) 621 * @param pvEnvBlock Unicode block (array) of environment entries; 622 * in form of "FOO=BAR\0BAR=BAZ". 623 * @param hEnv Handle of an existing RTENV block to use. 624 * @param fOverwriteExisting Whether to overwrite existing values of hEnv 625 * with the ones defined in pvEnvBlock. 626 * @param ppwszBlock Pointer to the final output. 627 */ 628 static int rtProcWinEnvironmentCreateInternal(VOID *pvEnvBlock, RTENV hEnv, 629 bool fOverwriteExisting, 630 PRTUTF16 *ppwszBlock) 625 631 { 626 632 RTENV hEnvTemp; … … 628 634 if (RT_SUCCESS(rc)) 629 635 { 630 PCRTUTF16 pwch = (PCRTUTF16)pv Block;636 PCRTUTF16 pwch = (PCRTUTF16)pvEnvBlock; 631 637 while ( pwch 632 638 && RT_SUCCESS(rc)) … … 638 644 if (RT_SUCCESS(rc)) 639 645 { 640 /* Don't overwrite values which we already have set to a custom value 641 * specified in hEnv ... */ 642 if (!RTEnvExistEx(hEnv, pszEntry)) 643 rc = RTEnvPutEx(hEnvTemp, pszEntry); 646 const char *pszEq = strchr(pszEntry, '='); 647 if ( !pszEq 648 && fOverwriteExisting) 649 { 650 rc = RTEnvUnset(pszEntry); 651 } 652 else if (pszEq) 653 { 654 const char *pszValue = pszEq + 1; 655 size_t cchVar = pszEq - pszEntry; 656 char *pszVar = (char *)RTMemAlloc(cchVar + 1); 657 if (pszVar) 658 { 659 memcpy(pszVar, pszEntry, cchVar); 660 pszVar[cchVar] = '\0'; 661 if ( !RTEnvExistEx(hEnv, pszVar) 662 || fOverwriteExisting) 663 { 664 rc = RTEnvSetEx(hEnvTemp, pszVar, pszValue); 665 } 666 RTMemFree(pszVar); 667 } 668 else 669 rc = VERR_NO_MEMORY; 670 } 644 671 RTStrFree(pszEntry); 645 672 } … … 694 721 if (pfnCreateEnvironmentBlock(&pvEnvBlockProfile, hToken, FALSE /* Don't inherit from parent. */)) 695 722 { 696 rc = rtProcWinEnvironmentCreateInternal(pvEnvBlockProfile, hEnv, ppwszBlock); 723 rc = rtProcWinEnvironmentCreateInternal(pvEnvBlockProfile, hEnv, 724 false /* fOverwriteExisting */, 725 ppwszBlock); 697 726 pfnDestroyEnvironmentBlock(pvEnvBlockProfile); 698 727 }
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器