Changeset 98297 in vbox for trunk/src/VBox/Main/src-all
- Timestamp:
- Jan 25, 2023 1:59:25 AM (23 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-all/win/VBoxProxyStub.c
r98103 r98297 360 360 361 361 /** The current total result. */ 362 LSTATUS rc;362 LSTATUS lrc; 363 363 364 364 /** KEY_WOW64_32KEY, KEY_WOW64_64KEY or 0 (for default). Allows doing all … … 395 395 static LSTATUS vbpsRegInit(VBPSREGSTATE *pState, HKEY hkeyRoot, const char *pszSubRoot, bool fDelete, bool fUpdate, DWORD fSamWow) 396 396 { 397 LSTATUS rc;397 LSTATUS lrc; 398 398 unsigned i = 0; 399 399 … … 411 411 } 412 412 pState->cAltDeletes = 0; 413 pState-> rc= ERROR_SUCCESS;413 pState->lrc = ERROR_SUCCESS; 414 414 pState->fDelete = fDelete; 415 415 pState->fUpdate = fUpdate; … … 428 428 * Open the root keys. 429 429 */ 430 rc = RegOpenKeyExA(hkeyRoot, pszSubRoot, 0 /*fOptions*/, pState->fSamBoth, &pState->hkeyClassesRootDst);431 if ( rc == ERROR_SUCCESS)432 { 433 rc = RegCreateKeyExW(pState->hkeyClassesRootDst, L"CLSID", 0 /*Reserved*/, NULL /*pszClass*/, 0 /*fOptions*/,434 pState->fSamBoth, NULL /*pSecAttr*/, &pState->hkeyClsidRootDst, NULL /*pdwDisposition*/);435 if ( rc == ERROR_SUCCESS)430 lrc = RegOpenKeyExA(hkeyRoot, pszSubRoot, 0 /*fOptions*/, pState->fSamBoth, &pState->hkeyClassesRootDst); 431 if (lrc == ERROR_SUCCESS) 432 { 433 lrc = RegCreateKeyExW(pState->hkeyClassesRootDst, L"CLSID", 0 /*Reserved*/, NULL /*pszClass*/, 0 /*fOptions*/, 434 pState->fSamBoth, NULL /*pSecAttr*/, &pState->hkeyClsidRootDst, NULL /*pdwDisposition*/); 435 if (lrc == ERROR_SUCCESS) 436 436 return ERROR_SUCCESS; 437 437 438 438 /* Ignore access denied errors as these may easily happen for 439 439 non-admin users. Just give up when this happens */ 440 AssertLogRelMsgReturn( rc == ERROR_ACCESS_DENIED, ("%u\n", rc), pState->rc =rc);440 AssertLogRelMsgReturn(lrc == ERROR_ACCESS_DENIED, ("%u\n", lrc), pState->lrc = lrc); 441 441 } 442 442 else 443 AssertLogRelMsgReturn( rc == ERROR_ACCESS_DENIED, ("%u\n", rc), pState->rc =rc);444 return pState-> rc =rc;443 AssertLogRelMsgReturn(lrc == ERROR_ACCESS_DENIED, ("%u\n", lrc), pState->lrc = lrc); 444 return pState->lrc = lrc; 445 445 } 446 446 … … 453 453 static void vbpsRegTerm(VBPSREGSTATE *pState) 454 454 { 455 LSTATUS rc;455 LSTATUS lrc; 456 456 if (pState->hkeyClassesRootDst) 457 457 { 458 rc = RegCloseKey(pState->hkeyClassesRootDst);459 Assert( rc == ERROR_SUCCESS);458 lrc = RegCloseKey(pState->hkeyClassesRootDst); 459 Assert(lrc == ERROR_SUCCESS); 460 460 pState->hkeyClassesRootDst = NULL; 461 461 } 462 462 if (pState->hkeyClsidRootDst) 463 463 { 464 rc = RegCloseKey(pState->hkeyClsidRootDst);465 Assert( rc == ERROR_SUCCESS);464 lrc = RegCloseKey(pState->hkeyClsidRootDst); 465 Assert(lrc == ERROR_SUCCESS); 466 466 pState->hkeyClsidRootDst = NULL; 467 467 } 468 468 if (pState->hkeyInterfaceRootDst) 469 469 { 470 rc = RegCloseKey(pState->hkeyInterfaceRootDst);471 Assert( rc == ERROR_SUCCESS);470 lrc = RegCloseKey(pState->hkeyInterfaceRootDst); 471 Assert(lrc == ERROR_SUCCESS); 472 472 pState->hkeyInterfaceRootDst = NULL; 473 473 } … … 478 478 if (pState->aAltDeletes[i].hkeyClasses) 479 479 { 480 rc = RegCloseKey(pState->aAltDeletes[i].hkeyClasses);481 Assert( rc == ERROR_SUCCESS);480 lrc = RegCloseKey(pState->aAltDeletes[i].hkeyClasses); 481 Assert(lrc == ERROR_SUCCESS); 482 482 pState->aAltDeletes[i].hkeyClasses = NULL; 483 483 } 484 484 if (pState->aAltDeletes[i].hkeyClsid) 485 485 { 486 rc = RegCloseKey(pState->aAltDeletes[i].hkeyClsid);487 Assert( rc == ERROR_SUCCESS);486 lrc = RegCloseKey(pState->aAltDeletes[i].hkeyClsid); 487 Assert(lrc == ERROR_SUCCESS); 488 488 pState->aAltDeletes[i].hkeyClsid = NULL; 489 489 } 490 490 if (pState->aAltDeletes[i].hkeyInterface) 491 491 { 492 rc = RegCloseKey(pState->aAltDeletes[i].hkeyInterface);493 Assert( rc == ERROR_SUCCESS);492 lrc = RegCloseKey(pState->aAltDeletes[i].hkeyInterface); 493 Assert(lrc == ERROR_SUCCESS); 494 494 pState->aAltDeletes[i].hkeyInterface = NULL; 495 495 } … … 512 512 { 513 513 unsigned i; 514 LSTATUS rc;514 LSTATUS lrc; 515 515 516 516 /* Ignore call if not in delete mode. */ … … 520 520 /* Check that there is space in the state. */ 521 521 i = pState->cAltDeletes; 522 AssertReturn(i < RT_ELEMENTS(pState->aAltDeletes), pState-> rc = ERROR_TOO_MANY_NAMES);522 AssertReturn(i < RT_ELEMENTS(pState->aAltDeletes), pState->lrc = ERROR_TOO_MANY_NAMES); 523 523 524 524 525 525 /* Open the root. */ 526 rc = RegOpenKeyExA(hkeyAltRoot, pszAltSubRoot, 0 /*fOptions*/, pState->fSamDelete,526 lrc = RegOpenKeyExA(hkeyAltRoot, pszAltSubRoot, 0 /*fOptions*/, pState->fSamDelete, 527 527 &pState->aAltDeletes[i].hkeyClasses); 528 if ( rc == ERROR_SUCCESS)528 if (lrc == ERROR_SUCCESS) 529 529 { 530 530 /* Try open the CLSID subkey, it's fine if it doesn't exists. */ 531 rc = RegOpenKeyExW(pState->aAltDeletes[i].hkeyClasses, L"CLSID", 0 /*fOptions*/, pState->fSamDelete,532 &pState->aAltDeletes[i].hkeyClsid);533 if ( rc == ERROR_SUCCESS ||rc == ERROR_FILE_NOT_FOUND)531 lrc = RegOpenKeyExW(pState->aAltDeletes[i].hkeyClasses, L"CLSID", 0 /*fOptions*/, pState->fSamDelete, 532 &pState->aAltDeletes[i].hkeyClsid); 533 if (lrc == ERROR_SUCCESS || lrc == ERROR_FILE_NOT_FOUND) 534 534 { 535 if ( rc == ERROR_FILE_NOT_FOUND)535 if (lrc == ERROR_FILE_NOT_FOUND) 536 536 pState->aAltDeletes[i].hkeyClsid = NULL; 537 537 pState->cAltDeletes = i + 1; 538 538 return ERROR_SUCCESS; 539 539 } 540 AssertLogRelMsgFailed(("%u\n", rc));540 AssertLogRelMsgFailed(("%u\n", lrc)); 541 541 RegCloseKey(pState->aAltDeletes[i].hkeyClasses); 542 542 } 543 543 /* No need to add non-existing alternative roots, nothing to delete in the void. */ 544 else if ( rc == ERROR_FILE_NOT_FOUND)545 rc = ERROR_SUCCESS;544 else if (lrc == ERROR_FILE_NOT_FOUND) 545 lrc = ERROR_SUCCESS; 546 546 else 547 547 { 548 AssertLogRelMsgFailed(("%u (%#x %s)\n", rc));549 pState-> rc =rc;548 AssertLogRelMsgFailed(("%u (%#x %s)\n", lrc)); 549 pState->lrc = lrc; 550 550 } 551 551 552 552 pState->aAltDeletes[i].hkeyClasses = NULL; 553 553 pState->aAltDeletes[i].hkeyClsid = NULL; 554 return rc;554 return lrc; 555 555 } 556 556 … … 568 568 { 569 569 unsigned i; 570 LSTATUS rc;570 LSTATUS lrc; 571 571 572 572 /* … … 576 576 { 577 577 if (pState->fSamUpdate) 578 rc = RegCreateKeyExW(pState->hkeyClassesRootDst, L"Interface", 0 /*Reserved*/, NULL /*pszClass*/, 0 /*fOptions*/,579 pState->fSamBoth, NULL /*pSecAttr*/, &pState->hkeyInterfaceRootDst, NULL /*pdwDisposition*/);578 lrc = RegCreateKeyExW(pState->hkeyClassesRootDst, L"Interface", 0 /*Reserved*/, NULL /*pszClass*/, 0 /*fOptions*/, 579 pState->fSamBoth, NULL /*pSecAttr*/, &pState->hkeyInterfaceRootDst, NULL /*pdwDisposition*/); 580 580 else 581 rc = RegOpenKeyExW(pState->hkeyClassesRootDst, L"Interface", 0 /*fOptions*/, pState->fSamBoth,582 &pState->hkeyClsidRootDst);583 if ( rc == ERROR_ACCESS_DENIED)581 lrc = RegOpenKeyExW(pState->hkeyClassesRootDst, L"Interface", 0 /*fOptions*/, pState->fSamBoth, 582 &pState->hkeyClsidRootDst); 583 if (lrc == ERROR_ACCESS_DENIED) 584 584 { 585 585 pState->hkeyInterfaceRootDst = NULL; 586 return pState-> rc =rc;586 return pState->lrc = lrc; 587 587 } 588 AssertLogRelMsgReturnStmt( rc == ERROR_SUCCESS, ("%u\n", rc), pState->hkeyInterfaceRootDst = NULL, pState->rc =rc);588 AssertLogRelMsgReturnStmt(lrc == ERROR_SUCCESS, ("%u\n", lrc), pState->hkeyInterfaceRootDst = NULL, pState->lrc = lrc); 589 589 } 590 590 … … 596 596 if (pState->aAltDeletes[i].hkeyInterface == NULL) 597 597 { 598 rc = RegOpenKeyExW(pState->aAltDeletes[i].hkeyClasses, L"Interface", 0 /*fOptions*/, pState->fSamDelete,599 &pState->aAltDeletes[i].hkeyInterface);600 if ( rc != ERROR_SUCCESS)598 lrc = RegOpenKeyExW(pState->aAltDeletes[i].hkeyClasses, L"Interface", 0 /*fOptions*/, pState->fSamDelete, 599 &pState->aAltDeletes[i].hkeyInterface); 600 if (lrc != ERROR_SUCCESS) 601 601 { 602 AssertMsgStmt( rc == ERROR_FILE_NOT_FOUND || rc == ERROR_ACCESS_DENIED, ("%u\n", rc), pState->rc =rc);602 AssertMsgStmt(lrc == ERROR_FILE_NOT_FOUND || lrc == ERROR_ACCESS_DENIED, ("%u\n", lrc), pState->lrc = lrc); 603 603 pState->aAltDeletes[i].hkeyInterface = NULL; 604 604 } … … 687 687 { 688 688 DWORD const cbValue = (DWORD)((RTUtf16Len(pwszValue) + 1) * sizeof(RTUTF16)); 689 LSTATUS rc;689 LSTATUS lrc; 690 690 Assert(pState->fUpdate); 691 691 … … 699 699 PRTUTF16 pwszExistingData = (PRTUTF16)alloca(cbExistingData); 700 700 DWORD dwExistingType; 701 rc = RegQueryValueExW(hkey, pwszValueNm, 0 /*Reserved*/, &dwExistingType, (BYTE *)pwszExistingData, &cbExistingData);702 if ( rc == ERROR_SUCCESS)701 lrc = RegQueryValueExW(hkey, pwszValueNm, 0 /*Reserved*/, &dwExistingType, (BYTE *)pwszExistingData, &cbExistingData); 702 if (lrc == ERROR_SUCCESS) 703 703 { 704 704 if ( dwExistingType == REG_SZ … … 718 718 } 719 719 else 720 Assert( rc == ERROR_FILE_NOT_FOUND ||rc == ERROR_MORE_DATA);720 Assert(lrc == ERROR_FILE_NOT_FOUND || lrc == ERROR_MORE_DATA); 721 721 } 722 722 … … 724 724 * Set the value. 725 725 */ 726 rc = RegSetValueExW(hkey, pwszValueNm, 0 /*Reserved*/, REG_SZ, (const BYTE *)pwszValue, cbValue);727 if ( rc == ERROR_SUCCESS)726 lrc = RegSetValueExW(hkey, pwszValueNm, 0 /*Reserved*/, REG_SZ, (const BYTE *)pwszValue, cbValue); 727 if (lrc == ERROR_SUCCESS) 728 728 { 729 729 VBSP_LOG_SET_VALUE(("vbpsSetRegValueWW: %ls/%ls=%ls (at %d)\n", … … 732 732 } 733 733 734 AssertLogRelMsg(VBPS_LOGREL_NO_ASSERT( rc == ERROR_ACCESS_DENIED),735 ("%d: '%ls'='%ls' -> %u\n", uLine, pwszValueNm, pwszValue, rc));736 pState-> rc =rc;737 return rc;734 AssertLogRelMsg(VBPS_LOGREL_NO_ASSERT(lrc == ERROR_ACCESS_DENIED), 735 ("%d: '%ls'='%ls' -> %u\n", uLine, pwszValueNm, pwszValue, lrc)); 736 pState->lrc = lrc; 737 return lrc; 738 738 } 739 739 … … 752 752 { 753 753 DWORD const cbValue = (DWORD)strlen(pszValue) + 1; 754 LSTATUS rc;754 LSTATUS lrc; 755 755 Assert(pState->fUpdate); 756 756 … … 764 764 char *pszExistingData = alloca(cbExistingData); 765 765 DWORD dwExistingType; 766 rc = RegQueryValueExA(hkey, pszValueNm, 0 /*Reserved*/, &dwExistingType, (PBYTE)pszExistingData, &cbExistingData);767 if ( rc == ERROR_SUCCESS)766 lrc = RegQueryValueExA(hkey, pszValueNm, 0 /*Reserved*/, &dwExistingType, (PBYTE)pszExistingData, &cbExistingData); 767 if (lrc == ERROR_SUCCESS) 768 768 { 769 769 if ( dwExistingType == REG_SZ … … 785 785 } 786 786 else 787 Assert( rc == ERROR_FILE_NOT_FOUND ||rc == ERROR_MORE_DATA);787 Assert(lrc == ERROR_FILE_NOT_FOUND || lrc == ERROR_MORE_DATA); 788 788 } 789 789 … … 791 791 * Set the value. 792 792 */ 793 rc = RegSetValueExA(hkey, pszValueNm, 0 /*Reserved*/, REG_SZ, (PBYTE)pszValue, cbValue);794 if ( rc == ERROR_SUCCESS)793 lrc = RegSetValueExA(hkey, pszValueNm, 0 /*Reserved*/, REG_SZ, (PBYTE)pszValue, cbValue); 794 if (lrc == ERROR_SUCCESS) 795 795 { 796 796 VBSP_LOG_SET_VALUE(("vbpsSetRegValueAA: %ls/%s=%s (at %d)\n", … … 799 799 } 800 800 801 AssertLogRelMsg(VBPS_LOGREL_NO_ASSERT( rc == ERROR_ACCESS_DENIED),802 ("%d: '%s'='%s' -> %u\n", uLine, pszValueNm, pszValue, rc));803 pState-> rc =rc;804 return rc;801 AssertLogRelMsg(VBPS_LOGREL_NO_ASSERT(lrc == ERROR_ACCESS_DENIED), 802 ("%d: '%s'='%s' -> %u\n", uLine, pszValueNm, pszValue, lrc)); 803 pState->lrc = lrc; 804 return lrc; 805 805 } 806 806 … … 816 816 static LSTATUS vbpsCloseKey(VBPSREGSTATE *pState, HKEY hkey, unsigned uLine) 817 817 { 818 LSTATUS rc = RegCloseKey(hkey);819 if ( rc == ERROR_SUCCESS)818 LSTATUS lrc = RegCloseKey(hkey); 819 if (lrc == ERROR_SUCCESS) 820 820 return ERROR_SUCCESS; 821 821 822 AssertLogRelMsgFailed(("%d: close key -> %u\n", uLine, rc));823 pState-> rc =rc;824 return rc;822 AssertLogRelMsgFailed(("%d: close key -> %u\n", uLine, lrc)); 823 pState->lrc = lrc; 824 return lrc; 825 825 } 826 826 … … 844 844 HKEY hNewKey; 845 845 DWORD dwDisposition = 0; 846 LSTATUS rc = RegCreateKeyExA(hkeyParent, pszKey, 0 /*Reserved*/, NULL /*pszClass*/, 0 /*fOptions*/,847 pState->fSamBoth, NULL /*pSecAttr*/, &hNewKey, &dwDisposition);848 if ( rc == ERROR_SUCCESS)846 LSTATUS lrc = RegCreateKeyExA(hkeyParent, pszKey, 0 /*Reserved*/, NULL /*pszClass*/, 0 /*fOptions*/, 847 pState->fSamBoth, NULL /*pSecAttr*/, &hNewKey, &dwDisposition); 848 if (lrc == ERROR_SUCCESS) 849 849 { 850 850 *phkey = hNewKey; … … 854 854 else 855 855 { 856 AssertLogRelMsg(VBPS_LOGREL_NO_ASSERT( rc == ERROR_ACCESS_DENIED),857 ("%d: create key '%s' -> %u\n", uLine, pszKey, rc));858 pState-> rc =rc;856 AssertLogRelMsg(VBPS_LOGREL_NO_ASSERT(lrc == ERROR_ACCESS_DENIED), 857 ("%d: create key '%s' -> %u\n", uLine, pszKey, lrc)); 858 pState->lrc = lrc; 859 859 *phkey = NULL; 860 860 } 861 return rc;861 return lrc; 862 862 } 863 863 … … 878 878 { 879 879 HKEY hNewKey; 880 LSTATUS rc = vbpsCreateRegKeyA(pState, hkeyParent, pszKey, &hNewKey, uLine);881 if ( rc == ERROR_SUCCESS)882 { 883 rc = vbpsSetRegValueAA(pState, hNewKey, NULL /*pszValueNm*/, pszValue, uLine);880 LSTATUS lrc = vbpsCreateRegKeyA(pState, hkeyParent, pszKey, &hNewKey, uLine); 881 if (lrc == ERROR_SUCCESS) 882 { 883 lrc = vbpsSetRegValueAA(pState, hNewKey, NULL /*pszValueNm*/, pszValue, uLine); 884 884 vbpsCloseKey(pState, hNewKey, uLine); 885 885 } 886 886 else 887 887 { 888 AssertLogRelMsg(VBPS_LOGREL_NO_ASSERT( rc == ERROR_ACCESS_DENIED),889 ("%d: create key '%s'(/Default='%s') -> %u\n", uLine, pszKey, pszValue, rc));890 pState-> rc =rc;891 } 892 return rc;888 AssertLogRelMsg(VBPS_LOGREL_NO_ASSERT(lrc == ERROR_ACCESS_DENIED), 889 ("%d: create key '%s'(/Default='%s') -> %u\n", uLine, pszKey, pszValue, lrc)); 890 pState->lrc = lrc; 891 } 892 return lrc; 893 893 } 894 894 … … 909 909 { 910 910 HKEY hNewKey; 911 LSTATUS rc = vbpsCreateRegKeyA(pState, hkeyParent, pszKey, &hNewKey, uLine);912 if ( rc == ERROR_SUCCESS)913 { 914 rc = vbpsSetRegValueWW(pState, hNewKey, NULL /*pwszValueNm*/, pwszValue, uLine);911 LSTATUS lrc = vbpsCreateRegKeyA(pState, hkeyParent, pszKey, &hNewKey, uLine); 912 if (lrc == ERROR_SUCCESS) 913 { 914 lrc = vbpsSetRegValueWW(pState, hNewKey, NULL /*pwszValueNm*/, pwszValue, uLine); 915 915 vbpsCloseKey(pState, hNewKey, uLine); 916 916 } 917 917 else 918 918 { 919 AssertLogRelMsg(VBPS_LOGREL_NO_ASSERT( rc == ERROR_ACCESS_DENIED),920 ("%d: create key '%s'(/Default='%ls') -> %u\n", uLine, pszKey, pwszValue, rc));921 pState-> rc =rc;922 } 923 return rc;919 AssertLogRelMsg(VBPS_LOGREL_NO_ASSERT(lrc == ERROR_ACCESS_DENIED), 920 ("%d: create key '%s'(/Default='%ls') -> %u\n", uLine, pszKey, pwszValue, lrc)); 921 pState->lrc = lrc; 922 } 923 return lrc; 924 924 } 925 925 … … 941 941 { 942 942 HKEY hNewKey; 943 LSTATUS rc = vbpsCreateRegKeyA(pState, hkeyParent, pszKey, &hNewKey, uLine);944 if ( rc == ERROR_SUCCESS)945 { 946 rc = vbpsSetRegValueAA(pState, hNewKey, NULL /*pszValueNm*/, pszValue, uLine);943 LSTATUS lrc = vbpsCreateRegKeyA(pState, hkeyParent, pszKey, &hNewKey, uLine); 944 if (lrc == ERROR_SUCCESS) 945 { 946 lrc = vbpsSetRegValueAA(pState, hNewKey, NULL /*pszValueNm*/, pszValue, uLine); 947 947 *phkey = hNewKey; 948 948 } 949 949 else 950 950 { 951 AssertLogRelMsg(VBPS_LOGREL_NO_ASSERT( rc == ERROR_ACCESS_DENIED),952 ("%d: create key '%s'(/Default='%s') -> %u\n", uLine, pszKey, pszValue, rc));953 pState-> rc =rc;951 AssertLogRelMsg(VBPS_LOGREL_NO_ASSERT(lrc == ERROR_ACCESS_DENIED), 952 ("%d: create key '%s'(/Default='%s') -> %u\n", uLine, pszKey, pszValue, lrc)); 953 pState->lrc = lrc; 954 954 *phkey = NULL; 955 955 } 956 return rc;956 return lrc; 957 957 } 958 958 … … 970 970 static LSTATUS vbpsDeleteKeyRecursiveA(VBPSREGSTATE *pState, HKEY hkeyParent, const char *pszKey, unsigned uLine) 971 971 { 972 LSTATUS rc;972 LSTATUS lrc; 973 973 974 974 Assert(pState->fDelete); 975 975 Assert(pszKey); 976 AssertReturn(*pszKey != '\0', pState-> rc = ERROR_INVALID_PARAMETER);976 AssertReturn(*pszKey != '\0', pState->lrc = ERROR_INVALID_PARAMETER); 977 977 978 978 #ifdef VBSP_LOG_ENABLED 979 979 { 980 980 HKEY hkeyLog; 981 rc = RegOpenKeyExA(hkeyParent, pszKey, 0 /*fOptions*/, pState->fSamDelete, &hkeyLog);982 if ( rc != ERROR_FILE_NOT_FOUND)981 lrc = RegOpenKeyExA(hkeyParent, pszKey, 0 /*fOptions*/, pState->fSamDelete, &hkeyLog); 982 if (lrc != ERROR_FILE_NOT_FOUND) 983 983 VBSP_LOG_DEL_KEY(("vbpsDeleteKeyRecursiveA: %ls/%s (at %d)\n", vbpsDebugKeyToWSZ(hkeyParent), pszKey, uLine)); 984 if ( rc == ERROR_SUCCESS)984 if (lrc == ERROR_SUCCESS) 985 985 RegCloseKey(hkeyLog); 986 986 } 987 987 #endif 988 988 989 rc = SHDeleteKeyA(hkeyParent, pszKey);990 if ( rc == ERROR_SUCCESS ||rc == ERROR_FILE_NOT_FOUND)989 lrc = SHDeleteKeyA(hkeyParent, pszKey); 990 if (lrc == ERROR_SUCCESS || lrc == ERROR_FILE_NOT_FOUND) 991 991 return ERROR_SUCCESS; 992 992 993 AssertLogRelMsg(VBPS_LOGREL_NO_ASSERT( rc == ERROR_ACCESS_DENIED),994 ("%d: delete key '%s' -> %u\n", uLine, pszKey, rc));995 pState-> rc =rc;996 return rc;993 AssertLogRelMsg(VBPS_LOGREL_NO_ASSERT(lrc == ERROR_ACCESS_DENIED), 994 ("%d: delete key '%s' -> %u\n", uLine, pszKey, lrc)); 995 pState->lrc = lrc; 996 return lrc; 997 997 } 998 998 … … 1010 1010 static LSTATUS vbpsDeleteKeyRecursiveW(VBPSREGSTATE *pState, HKEY hkeyParent, PCRTUTF16 pwszKey, unsigned uLine) 1011 1011 { 1012 LSTATUS rc;1012 LSTATUS lrc; 1013 1013 1014 1014 Assert(pState->fDelete); 1015 1015 Assert(pwszKey); 1016 AssertReturn(*pwszKey != '\0', pState-> rc = ERROR_INVALID_PARAMETER);1016 AssertReturn(*pwszKey != '\0', pState->lrc = ERROR_INVALID_PARAMETER); 1017 1017 1018 1018 #ifdef VBSP_LOG_ENABLED 1019 1019 { 1020 1020 HKEY hkeyLog; 1021 rc = RegOpenKeyExW(hkeyParent, pwszKey, 0 /*fOptions*/, pState->fSamDelete, &hkeyLog);1022 if ( rc != ERROR_FILE_NOT_FOUND)1021 lrc = RegOpenKeyExW(hkeyParent, pwszKey, 0 /*fOptions*/, pState->fSamDelete, &hkeyLog); 1022 if (lrc != ERROR_FILE_NOT_FOUND) 1023 1023 VBSP_LOG_DEL_KEY(("vbpsDeleteKeyRecursiveW: %ls/%ls (at %d)\n", vbpsDebugKeyToWSZ(hkeyParent), pwszKey, uLine)); 1024 if ( rc == ERROR_SUCCESS)1024 if (lrc == ERROR_SUCCESS) 1025 1025 RegCloseKey(hkeyLog); 1026 1026 } 1027 1027 #endif 1028 1028 1029 rc = SHDeleteKeyW(hkeyParent, pwszKey);1030 if ( rc == ERROR_SUCCESS ||rc == ERROR_FILE_NOT_FOUND)1029 lrc = SHDeleteKeyW(hkeyParent, pwszKey); 1030 if (lrc == ERROR_SUCCESS || lrc == ERROR_FILE_NOT_FOUND) 1031 1031 return ERROR_SUCCESS; 1032 1032 1033 AssertLogRelMsg(VBPS_LOGREL_NO_ASSERT( rc == ERROR_ACCESS_DENIED),1034 ("%d: delete key '%ls' -> %u\n", uLine, pwszKey, rc));1035 pState-> rc =rc;1036 return rc;1033 AssertLogRelMsg(VBPS_LOGREL_NO_ASSERT(lrc == ERROR_ACCESS_DENIED), 1034 ("%d: delete key '%ls' -> %u\n", uLine, pwszKey, lrc)); 1035 pState->lrc = lrc; 1036 return lrc; 1037 1037 } 1038 1038 … … 1052 1052 const char *pszDescription, const char *pszServiceName) 1053 1053 { 1054 LSTATUS rc;1054 LSTATUS lrc; 1055 1055 HKEY hkeyAppIds; 1056 1056 Assert(*pszAppId == '{'); … … 1064 1064 while (i-- > 0) 1065 1065 { 1066 rc = RegOpenKeyExW(pState->aAltDeletes[i].hkeyClasses, L"AppID", 0 /*fOptions*/, pState->fSamDelete, &hkeyAppIds);1067 AssertLogRelMsgStmt( rc == ERROR_SUCCESS || rc == ERROR_FILE_NOT_FOUND, ("%u\n", rc), pState->rc =rc);1068 if ( rc == ERROR_SUCCESS)1066 lrc = RegOpenKeyExW(pState->aAltDeletes[i].hkeyClasses, L"AppID", 0 /*fOptions*/, pState->fSamDelete, &hkeyAppIds); 1067 AssertLogRelMsgStmt(lrc == ERROR_SUCCESS || lrc == ERROR_FILE_NOT_FOUND, ("%u\n", lrc), pState->lrc = lrc); 1068 if (lrc == ERROR_SUCCESS) 1069 1069 { 1070 1070 vbpsDeleteKeyRecursiveA(pState, hkeyAppIds, pszAppId, __LINE__); … … 1076 1076 if (pState->fUpdate) 1077 1077 { 1078 rc = RegCreateKeyExW(pState->hkeyClassesRootDst, L"AppID", 0 /*Reserved*/, NULL /*pszClass*/, 0 /*fOptions*/,1079 pState->fSamBoth, NULL /*pSecAttr*/, &hkeyAppIds, NULL /*pdwDisposition*/);1080 if ( rc == ERROR_ACCESS_DENIED)1078 lrc = RegCreateKeyExW(pState->hkeyClassesRootDst, L"AppID", 0 /*Reserved*/, NULL /*pszClass*/, 0 /*fOptions*/, 1079 pState->fSamBoth, NULL /*pSecAttr*/, &hkeyAppIds, NULL /*pdwDisposition*/); 1080 if (lrc == ERROR_ACCESS_DENIED) 1081 1081 return ERROR_SUCCESS; 1082 1082 } 1083 1083 else 1084 1084 { 1085 rc = RegOpenKeyExW(pState->hkeyClassesRootDst, L"AppID", 0 /*fOptions*/, pState->fSamBoth, &hkeyAppIds);1086 if ( rc == ERROR_FILE_NOT_FOUND ||rc == ERROR_ACCESS_DENIED)1085 lrc = RegOpenKeyExW(pState->hkeyClassesRootDst, L"AppID", 0 /*fOptions*/, pState->fSamBoth, &hkeyAppIds); 1086 if (lrc == ERROR_FILE_NOT_FOUND || lrc == ERROR_ACCESS_DENIED) 1087 1087 return ERROR_SUCCESS; 1088 1088 } 1089 if ( rc == ERROR_ACCESS_DENIED)1090 return pState-> rc =rc;1091 AssertLogRelMsgReturn( rc == ERROR_SUCCESS, ("%u\n", rc), pState->rc =rc);1089 if (lrc == ERROR_ACCESS_DENIED) 1090 return pState->lrc = lrc; 1091 AssertLogRelMsgReturn(lrc == ERROR_SUCCESS, ("%u\n", lrc), pState->lrc = lrc); 1092 1092 1093 1093 if (pState->fDelete) … … 1103 1103 { 1104 1104 HKEY hkey; 1105 rc = vbpsCreateRegKeyA(pState, hkeyAppIds, pszAppId, &hkey, __LINE__);1106 if ( rc == ERROR_SUCCESS)1105 lrc = vbpsCreateRegKeyA(pState, hkeyAppIds, pszAppId, &hkey, __LINE__); 1106 if (lrc == ERROR_SUCCESS) 1107 1107 { 1108 1108 vbpsSetRegValueAA(pState, hkey, NULL /*pszValueNm*/, pszDescription, __LINE__); … … 1112 1112 } 1113 1113 1114 rc = vbpsCreateRegKeyA(pState, hkeyAppIds, pszModuleName, &hkey, __LINE__);1115 if ( rc == ERROR_SUCCESS)1114 lrc = vbpsCreateRegKeyA(pState, hkeyAppIds, pszModuleName, &hkey, __LINE__); 1115 if (lrc == ERROR_SUCCESS) 1116 1116 { 1117 1117 vbpsSetRegValueAA(pState, hkey, NULL /*pszValueNm*/, "", __LINE__); … … 1123 1123 vbpsCloseKey(pState, hkeyAppIds, __LINE__); 1124 1124 1125 return pState-> rc;1125 return pState->lrc; 1126 1126 } 1127 1127 … … 1142 1142 const CLSID *pClsId, const char *pszCurVerSuffIfRootName) 1143 1143 { 1144 LSTATUS rc;1144 LSTATUS lrc; 1145 1145 1146 1146 /* … … 1162 1162 /* pszClassName/Default = description. */ 1163 1163 HKEY hkeyClass; 1164 rc = vbpsCreateRegKeyWithDefaultValueAAEx(pState, pState->hkeyClassesRootDst, pszClassName, pszDescription,1165 &hkeyClass, __LINE__);1166 if ( rc == ERROR_SUCCESS)1164 lrc = vbpsCreateRegKeyWithDefaultValueAAEx(pState, pState->hkeyClassesRootDst, pszClassName, pszDescription, 1165 &hkeyClass, __LINE__); 1166 if (lrc == ERROR_SUCCESS) 1167 1167 { 1168 1168 char szClsId[CURLY_UUID_STR_BUF_SIZE]; … … 1175 1175 { 1176 1176 char szCurClassNameVer[128]; 1177 rc = RTStrCopy(szCurClassNameVer, sizeof(szCurClassNameVer), pszClassName);1178 if (RT_SUCCESS( rc))1179 rc = RTStrCat(szCurClassNameVer, sizeof(szCurClassNameVer), pszCurVerSuffIfRootName);1180 AssertStmt(RT_SUCCESS( rc), pState->rc =rc = ERROR_INVALID_DATA);1181 if ( rc == ERROR_SUCCESS)1177 lrc = RTStrCopy(szCurClassNameVer, sizeof(szCurClassNameVer), pszClassName); 1178 if (RT_SUCCESS(lrc)) 1179 lrc = RTStrCat(szCurClassNameVer, sizeof(szCurClassNameVer), pszCurVerSuffIfRootName); 1180 AssertStmt(RT_SUCCESS(lrc), pState->lrc = lrc = ERROR_INVALID_DATA); 1181 if (lrc == ERROR_SUCCESS) 1182 1182 vbpsCreateRegKeyWithDefaultValueAA(pState, hkeyClass, "CurVer", szCurClassNameVer, __LINE__); 1183 1183 } … … 1187 1187 } 1188 1188 1189 return pState-> rc;1189 return pState->lrc; 1190 1190 } 1191 1191 … … 1218 1218 const char *pszThreadingModel) 1219 1219 { 1220 LSTATUS rc;1220 LSTATUS lrc; 1221 1221 char szClsId[CURLY_UUID_STR_BUF_SIZE]; 1222 1222 RT_NOREF(pszAppId); … … 1248 1248 { 1249 1249 HKEY hkeyClass; 1250 rc = vbpsCreateRegKeyWithDefaultValueAAEx(pState, pState->hkeyClsidRootDst, szClsId, pszDescription,1251 &hkeyClass, __LINE__);1252 if ( rc == ERROR_SUCCESS)1250 lrc = vbpsCreateRegKeyWithDefaultValueAAEx(pState, pState->hkeyClsidRootDst, szClsId, pszDescription, 1251 &hkeyClass, __LINE__); 1252 if (lrc == ERROR_SUCCESS) 1253 1253 { 1254 1254 bool const fIsLocalServer32 = strcmp(pszServerType, "LocalServer32") == 0; … … 1257 1257 1258 1258 /* pszServerType/Default = module. */ 1259 rc = vbpsCreateRegKeyA(pState, hkeyClass, pszServerType, &hkeyServerType, __LINE__);1260 if ( rc == ERROR_SUCCESS)1259 lrc = vbpsCreateRegKeyA(pState, hkeyClass, pszServerType, &hkeyServerType, __LINE__); 1260 if (lrc == ERROR_SUCCESS) 1261 1261 { 1262 1262 RTUTF16 wszModule[MAX_PATH * 2]; … … 1265 1265 *pwszCur++ = '"'; 1266 1266 1267 rc = RTUtf16Copy(pwszCur, MAX_PATH, pwszVBoxDir); AssertRC(rc);1267 int vrc = RTUtf16Copy(pwszCur, MAX_PATH, pwszVBoxDir); AssertRC(vrc); 1268 1268 pwszCur += RTUtf16Len(pwszCur); 1269 rc = RTUtf16CopyAscii(pwszCur, MAX_PATH - 3, pszServerSubPath); AssertRC(rc);1269 vrc = RTUtf16CopyAscii(pwszCur, MAX_PATH - 3, pszServerSubPath); AssertRC(vrc); 1270 1270 pwszCur += RTUtf16Len(pwszCur); 1271 1271 … … 1286 1286 if (pszClassName) 1287 1287 { 1288 rc = RTStrCopy(szCurClassNameVer, sizeof(szCurClassNameVer), pszClassName);1289 if (RT_SUCCESS( rc))1290 rc = RTStrCat(szCurClassNameVer, sizeof(szCurClassNameVer), pszCurClassNameVerSuffix);1291 AssertStmt(RT_SUCCESS( rc), pState->rc =rc = ERROR_INVALID_DATA);1292 if ( rc == ERROR_SUCCESS)1288 int vrc = RTStrCopy(szCurClassNameVer, sizeof(szCurClassNameVer), pszClassName); 1289 if (RT_SUCCESS(vrc)) 1290 vrc = RTStrCat(szCurClassNameVer, sizeof(szCurClassNameVer), pszCurClassNameVerSuffix); 1291 AssertStmt(RT_SUCCESS(vrc), pState->lrc = lrc = ERROR_INVALID_DATA); 1292 if (lrc == ERROR_SUCCESS) 1293 1293 vbpsCreateRegKeyWithDefaultValueAA(pState, hkeyClass, "ProgId", szCurClassNameVer, __LINE__); 1294 1294 … … 1313 1313 } 1314 1314 1315 return pState-> rc;1315 return pState->lrc; 1316 1316 } 1317 1317 … … 1393 1393 HKEY hkeyTypeLibs; 1394 1394 HKEY hkeyTypeLibId; 1395 LSTATUS rc;1395 LSTATUS lrc; 1396 1396 RT_NOREF(fIs32On64); 1397 1397 … … 1403 1403 1404 1404 /* Open Classes/TypeLib/. */ 1405 rc = vbpsCreateRegKeyA(pState, pState->hkeyClassesRootDst, "TypeLib", &hkeyTypeLibs, __LINE__);1406 if ( rc != ERROR_SUCCESS)1405 lrc = vbpsCreateRegKeyA(pState, pState->hkeyClassesRootDst, "TypeLib", &hkeyTypeLibs, __LINE__); 1406 if (lrc != ERROR_SUCCESS) 1407 1407 return; 1408 1408 1409 1409 /* Create TypeLib/{UUID}. */ 1410 rc = vbpsCreateRegKeyA(pState, hkeyTypeLibs, vbpsFormatUuidInCurly(szTypeLibId, &LIBID_VirtualBox), &hkeyTypeLibId, __LINE__);1411 if ( rc == ERROR_SUCCESS)1410 lrc = vbpsCreateRegKeyA(pState, hkeyTypeLibs, vbpsFormatUuidInCurly(szTypeLibId, &LIBID_VirtualBox), &hkeyTypeLibId, __LINE__); 1411 if (lrc == ERROR_SUCCESS) 1412 1412 { 1413 1413 /* {UUID}/Major.Minor/Default = pszDescription. */ … … 1415 1415 char szMajMin[64]; 1416 1416 sprintf(szMajMin, "%u.%u", kTypeLibraryMajorVersion, kTypeLibraryMinorVersion); 1417 rc = vbpsCreateRegKeyWithDefaultValueAAEx(pState, hkeyTypeLibId, szMajMin, pszDescription, &hkeyMajMin, __LINE__);1418 if ( rc == ERROR_SUCCESS)1417 lrc = vbpsCreateRegKeyWithDefaultValueAAEx(pState, hkeyTypeLibId, szMajMin, pszDescription, &hkeyMajMin, __LINE__); 1418 if (lrc == ERROR_SUCCESS) 1419 1419 { 1420 1420 RTUTF16 wszBuf[MAX_PATH * 2]; … … 1422 1422 /* {UUID}/Major.Minor/0. */ 1423 1423 HKEY hkey0; 1424 rc = vbpsCreateRegKeyA(pState, hkeyMajMin, "0", &hkey0, __LINE__);1425 if ( rc == ERROR_SUCCESS)1424 lrc = vbpsCreateRegKeyA(pState, hkeyMajMin, "0", &hkey0, __LINE__); 1425 if (lrc == ERROR_SUCCESS) 1426 1426 { 1427 1427 /* {UUID}/Major.Minor/0/winXX/Default = VBoxProxyStub. */ 1428 rc = RTUtf16Copy(wszBuf, MAX_PATH, pwszVBoxDir); AssertRC(rc);1429 rc = RTUtf16CatAscii(wszBuf, MAX_PATH * 2, pszTypeLibDll); AssertRC(rc);1428 int vrc = RTUtf16Copy(wszBuf, MAX_PATH, pwszVBoxDir); AssertRC(vrc); 1429 vrc = RTUtf16CatAscii(wszBuf, MAX_PATH * 2, pszTypeLibDll); AssertRC(vrc); 1430 1430 1431 1431 vbpsCreateRegKeyWithDefaultValueAW(pState, hkey0, pszWinXx, wszBuf, __LINE__); … … 1437 1437 1438 1438 /* {UUID}/Major.Minor/HELPDIR */ 1439 rc = RTUtf16Copy(wszBuf, MAX_PATH, pwszVBoxDir); AssertRC(rc);1439 int vrc = RTUtf16Copy(wszBuf, MAX_PATH, pwszVBoxDir); AssertRC(vrc); 1440 1440 #if 0 /* MSI: trailing slash; regsvr32/comregister: strip unnecessary trailing slash. Go with MSI to avoid user issues. */ 1441 1441 { … … 1497 1497 const ProxyFileInfo **ppProxyFile = &g_apProxyFiles[0]; 1498 1498 const ProxyFileInfo *pProxyFile; 1499 LSTATUS rc;1499 LSTATUS lrc; 1500 1500 char szProxyClsId[CURLY_UUID_STR_BUF_SIZE]; 1501 1501 char szTypeLibId[CURLY_UUID_STR_BUF_SIZE]; … … 1507 1507 1508 1508 Assert(pState->fUpdate && !pState->fDelete); 1509 rc = vbpsRegOpenInterfaceKeys(pState);1510 if ( rc != ERROR_SUCCESS)1509 lrc = vbpsRegOpenInterfaceKeys(pState); 1510 if (lrc != ERROR_SUCCESS) 1511 1511 return; 1512 1512 … … 1534 1534 HKEY hkeyIfId; 1535 1535 1536 AssertReturnVoidStmt(cchIfNm >= 3 && cchIfNm <= 72, pState-> rc = ERROR_INVALID_DATA);1537 1538 AssertReturnVoidStmt(cMethods >= 3 && cMethods < 1024, pState-> rc = ERROR_INVALID_DATA);1536 AssertReturnVoidStmt(cchIfNm >= 3 && cchIfNm <= 72, pState->lrc = ERROR_INVALID_DATA); 1537 1538 AssertReturnVoidStmt(cMethods >= 3 && cMethods < 1024, pState->lrc = ERROR_INVALID_DATA); 1539 1539 sprintf(szMethods, "%u", cMethods); 1540 1540 1541 rc = vbpsCreateRegKeyWithDefaultValueAAEx(pState, pState->hkeyInterfaceRootDst,1542 vbpsFormatUuidInCurly(szIfId, papStubVtbls[iIf]->header.piid),1543 pszIfNm, &hkeyIfId, __LINE__);1544 if ( rc == ERROR_SUCCESS)1541 lrc = vbpsCreateRegKeyWithDefaultValueAAEx(pState, pState->hkeyInterfaceRootDst, 1542 vbpsFormatUuidInCurly(szIfId, papStubVtbls[iIf]->header.piid), 1543 pszIfNm, &hkeyIfId, __LINE__); 1544 if (lrc == ERROR_SUCCESS) 1545 1545 { 1546 1546 HKEY hkeyTypeLib; … … 1549 1549 1550 1550 /* The MSI seems to still be putting TypeLib keys here. So, let's do that too. */ 1551 rc = vbpsCreateRegKeyWithDefaultValueAAEx(pState, hkeyIfId, "TypeLib", szTypeLibId, &hkeyTypeLib, __LINE__);1552 if ( rc == ERROR_SUCCESS)1551 lrc = vbpsCreateRegKeyWithDefaultValueAAEx(pState, hkeyIfId, "TypeLib", szTypeLibId, &hkeyTypeLib, __LINE__); 1552 if (lrc == ERROR_SUCCESS) 1553 1553 { 1554 1554 vbpsSetRegValueAA(pState, hkeyTypeLib, "Version", szTypeLibVersion, __LINE__); … … 1629 1629 #endif 1630 1630 VBPSREGSTATE State; 1631 LSTATUS rc;1631 LSTATUS lrc; 1632 1632 1633 1633 /* 1634 1634 * Do registration for the current execution mode of the DLL. 1635 1635 */ 1636 rc = vbpsRegInit(&State, HKEY_CLASSES_ROOT, NULL /* Alt: HKEY_LOCAL_MACHINE, "Software\\Classes", */, fDelete, fUpdate, 0);1637 if ( rc == ERROR_SUCCESS)1636 lrc = vbpsRegInit(&State, HKEY_CLASSES_ROOT, NULL /* Alt: HKEY_LOCAL_MACHINE, "Software\\Classes", */, fDelete, fUpdate, 0); 1637 if (lrc == ERROR_SUCCESS) 1638 1638 { 1639 1639 if (!fUpdate) … … 1646 1646 1647 1647 RegisterXidlModulesAndClassesGenerated(&State, pwszVBoxDir, fIs32On64); 1648 rc = State.rc;1648 lrc = State.lrc; 1649 1649 } 1650 1650 vbpsRegTerm(&State); … … 1653 1653 * Translate error code? Return. 1654 1654 */ 1655 if ( rc == ERROR_SUCCESS)1655 if (lrc == ERROR_SUCCESS) 1656 1656 return S_OK; 1657 1657 return E_FAIL; … … 1880 1880 */ 1881 1881 HKEY hkeyInterfaces; 1882 LRESULT rc = RegOpenKeyExW(pState->aAltDeletes[iAlt].hkeyClasses, L"Interface",1883 0 /*fOptions*/, pState->fSamDelete, &hkeyInterfaces);1884 if ( rc == ERROR_SUCCESS)1882 LRESULT lrc = RegOpenKeyExW(pState->aAltDeletes[iAlt].hkeyClasses, L"Interface", 1883 0 /*fOptions*/, pState->fSamDelete, &hkeyInterfaces); 1884 if (lrc == ERROR_SUCCESS) 1885 1885 { 1886 1886 /* … … 1893 1893 RTUTF16 wszCurNm[128 + 48]; 1894 1894 DWORD cwcCurNm = 128; 1895 rc = RegEnumKeyExW(hkeyInterfaces, idxKey, wszCurNm, &cwcCurNm,1896 NULL /*pdwReserved*/, NULL /*pwszClass*/, NULL /*pcwcClass*/, NULL /*pLastWriteTime*/);1897 if ( rc == ERROR_SUCCESS)1895 lrc = RegEnumKeyExW(hkeyInterfaces, idxKey, wszCurNm, &cwcCurNm, 1896 NULL /*pdwReserved*/, NULL /*pwszClass*/, NULL /*pcwcClass*/, NULL /*pLastWriteTime*/); 1897 if (lrc == ERROR_SUCCESS) 1898 1898 { 1899 1899 /* … … 1918 1918 /* Try the TypeLib sub-key. */ 1919 1919 memcpy(&wszCurNm[cwcCurNm], s_wszTypeLib, sizeof(s_wszTypeLib)); 1920 rc = RegOpenKeyExW(hkeyInterfaces, wszCurNm, 0 /*fOptions*/, KEY_QUERY_VALUE, &hkeySub);1921 if ( rc == ERROR_SUCCESS)1920 lrc = RegOpenKeyExW(hkeyInterfaces, wszCurNm, 0 /*fOptions*/, KEY_QUERY_VALUE, &hkeySub); 1921 if (lrc == ERROR_SUCCESS) 1922 1922 { 1923 1923 cbValue = sizeof(wszValue) - sizeof(RTUTF16); 1924 rc = RegQueryValueExW(hkeySub, NULL /*pszValueNm*/, NULL /*pdwReserved*/,1925 &dwType, (PBYTE)&wszValue[0], &cbValue);1926 if ( rc != ERROR_SUCCESS || dwType != REG_SZ)1924 lrc = RegQueryValueExW(hkeySub, NULL /*pszValueNm*/, NULL /*pdwReserved*/, 1925 &dwType, (PBYTE)&wszValue[0], &cbValue); 1926 if (lrc != ERROR_SUCCESS || dwType != REG_SZ) 1927 1927 cbValue = 0; 1928 1928 wszValue[cbValue / sizeof(RTUTF16)] = '\0'; 1929 1929 1930 if ( rc == ERROR_SUCCESS1930 if ( lrc == ERROR_SUCCESS 1931 1931 && vbpsIsTypeLibIdToRemove(wszValue)) 1932 1932 { 1933 1933 /* Check the TypeLib/Version value to make sure. */ 1934 1934 cbValue = sizeof(wszValue) - sizeof(RTUTF16); 1935 rc = RegQueryValueExW(hkeySub, L"Version", 0 /*pdwReserved*/, &dwType, (PBYTE)&wszValue[0], &cbValue);1936 if ( rc != ERROR_SUCCESS)1935 lrc = RegQueryValueExW(hkeySub, L"Version", 0 /*pdwReserved*/, &dwType, (PBYTE)&wszValue[0], &cbValue); 1936 if (lrc != ERROR_SUCCESS) 1937 1937 cbValue = 0; 1938 1938 wszValue[cbValue] = '\0'; 1939 1939 1940 if ( rc == ERROR_SUCCESS1940 if ( lrc == ERROR_SUCCESS 1941 1941 && vbpsIsTypeLibVersionToRemove(wszValue)) 1942 1942 fDeleteMe = true; … … 1944 1944 vbpsCloseKey(pState, hkeySub, __LINE__); 1945 1945 } 1946 else if ( rc == ERROR_FILE_NOT_FOUND)1946 else if (lrc == ERROR_FILE_NOT_FOUND) 1947 1947 { 1948 1948 /* No TypeLib, try the ProxyStubClsid32 sub-key next. */ 1949 1949 static RTUTF16 const s_wszProxyStubClsid32[] = L"\\ProxyStubClsid32"; 1950 1950 memcpy(&wszCurNm[cwcCurNm], s_wszProxyStubClsid32, sizeof(s_wszProxyStubClsid32)); 1951 rc = RegOpenKeyExW(hkeyInterfaces, wszCurNm, 0 /*fOptions*/, KEY_QUERY_VALUE, &hkeySub);1952 if ( rc == ERROR_SUCCESS)1951 lrc = RegOpenKeyExW(hkeyInterfaces, wszCurNm, 0 /*fOptions*/, KEY_QUERY_VALUE, &hkeySub); 1952 if (lrc == ERROR_SUCCESS) 1953 1953 { 1954 1954 cbValue = sizeof(wszValue) - sizeof(RTUTF16); 1955 rc = RegQueryValueExW(hkeySub, NULL /*pszValueNm*/, NULL /*pdwReserved*/,1956 &dwType, (PBYTE)&wszValue[0], &cbValue);1957 if ( rc != ERROR_SUCCESS || dwType != REG_SZ)1955 lrc = RegQueryValueExW(hkeySub, NULL /*pszValueNm*/, NULL /*pdwReserved*/, 1956 &dwType, (PBYTE)&wszValue[0], &cbValue); 1957 if (lrc != ERROR_SUCCESS || dwType != REG_SZ) 1958 1958 cbValue = 0; 1959 1959 wszValue[cbValue / sizeof(RTUTF16)] = '\0'; 1960 1960 1961 if ( rc == ERROR_SUCCESS1961 if ( lrc == ERROR_SUCCESS 1962 1962 && vbpsIsProxyStubClsIdToRemove(wszValue)) 1963 1963 fDeleteMe = true; … … 1978 1978 else 1979 1979 { 1980 Assert( rc == ERROR_NO_MORE_ITEMS);1980 Assert(lrc == ERROR_NO_MORE_ITEMS); 1981 1981 break; 1982 1982 } … … 2004 2004 */ 2005 2005 HKEY hkeyClsIds; 2006 LRESULT rc;2007 rc = RegOpenKeyExW(pState->aAltDeletes[iAlt].hkeyClasses, L"CLSID", 0 /*fOptions*/, pState->fSamDelete, &hkeyClsIds);2008 if ( rc == ERROR_SUCCESS)2006 LRESULT lrc; 2007 lrc = RegOpenKeyExW(pState->aAltDeletes[iAlt].hkeyClasses, L"CLSID", 0 /*fOptions*/, pState->fSamDelete, &hkeyClsIds); 2008 if (lrc == ERROR_SUCCESS) 2009 2009 { 2010 2010 /* … … 2017 2017 RTUTF16 wszCurNm[128 + 48]; 2018 2018 DWORD cwcCurNm = 128; 2019 rc = RegEnumKeyExW(hkeyClsIds, idxKey, wszCurNm, &cwcCurNm,2020 NULL /*pdwReserved*/, NULL /*pwszClass*/, NULL /*pcwcClass*/, NULL /*pLastWriteTime*/);2021 if ( rc == ERROR_SUCCESS)2019 lrc = RegEnumKeyExW(hkeyClsIds, idxKey, wszCurNm, &cwcCurNm, 2020 NULL /*pdwReserved*/, NULL /*pwszClass*/, NULL /*pcwcClass*/, NULL /*pLastWriteTime*/); 2021 if (lrc == ERROR_SUCCESS) 2022 2022 { 2023 2023 /* … … 2039 2039 /* The TypeLib sub-key. */ 2040 2040 memcpy(&wszCurNm[cwcCurNm], s_wszTypeLib, sizeof(s_wszTypeLib)); 2041 rc = RegOpenKeyExW(hkeyClsIds, wszCurNm, 0 /*fOptions*/, KEY_QUERY_VALUE, &hkeySub);2042 if ( rc == ERROR_SUCCESS)2041 lrc = RegOpenKeyExW(hkeyClsIds, wszCurNm, 0 /*fOptions*/, KEY_QUERY_VALUE, &hkeySub); 2042 if (lrc == ERROR_SUCCESS) 2043 2043 { 2044 2044 bool fDeleteMe = false; 2045 2045 2046 2046 cbValue = sizeof(wszValue) - sizeof(RTUTF16); 2047 rc = RegQueryValueExW(hkeySub, NULL /*pszValueNm*/, NULL /*pdwReserved*/,2048 &dwType, (PBYTE)&wszValue[0], &cbValue);2049 if ( rc != ERROR_SUCCESS || dwType != REG_SZ)2047 lrc = RegQueryValueExW(hkeySub, NULL /*pszValueNm*/, NULL /*pdwReserved*/, 2048 &dwType, (PBYTE)&wszValue[0], &cbValue); 2049 if (lrc != ERROR_SUCCESS || dwType != REG_SZ) 2050 2050 cbValue = 0; 2051 2051 wszValue[cbValue / sizeof(RTUTF16)] = '\0'; 2052 2052 2053 if ( rc == ERROR_SUCCESS2053 if ( lrc == ERROR_SUCCESS 2054 2054 && vbpsIsTypeLibIdToRemove(wszValue)) 2055 2055 fDeleteMe = true; … … 2062 2062 static RTUTF16 const s_wszProgId[] = L"\\ProgId"; 2063 2063 memcpy(&wszCurNm[cwcCurNm], s_wszProgId, sizeof(s_wszProgId)); 2064 rc = RegOpenKeyExW(hkeyClsIds, wszCurNm, 0 /*fOptions*/, KEY_QUERY_VALUE, &hkeySub);2065 if ( rc == ERROR_SUCCESS)2064 lrc = RegOpenKeyExW(hkeyClsIds, wszCurNm, 0 /*fOptions*/, KEY_QUERY_VALUE, &hkeySub); 2065 if (lrc == ERROR_SUCCESS) 2066 2066 { 2067 2067 static RTUTF16 const s_wszProgIdPrefix[] = L"VirtualBox."; 2068 2068 2069 2069 cbValue = sizeof(wszValue) - sizeof(RTUTF16); 2070 rc = RegQueryValueExW(hkeySub, NULL /*pszValueNm*/, NULL /*pdwReserved*/,2071 &dwType, (PBYTE)&wszValue[0], &cbValue);2072 if ( rc != ERROR_SUCCESS || dwType != REG_SZ)2070 lrc = RegQueryValueExW(hkeySub, NULL /*pszValueNm*/, NULL /*pdwReserved*/, 2071 &dwType, (PBYTE)&wszValue[0], &cbValue); 2072 if (lrc != ERROR_SUCCESS || dwType != REG_SZ) 2073 2073 cbValue = 0; 2074 2074 wszValue[cbValue / sizeof(RTUTF16)] = '\0'; … … 2081 2081 } 2082 2082 else 2083 AssertStmt( rc == ERROR_FILE_NOT_FOUND, fDeleteMe = false);2083 AssertStmt(lrc == ERROR_FILE_NOT_FOUND, fDeleteMe = false); 2084 2084 2085 2085 if (fDeleteMe) … … 2094 2094 } 2095 2095 else 2096 Assert( rc == ERROR_FILE_NOT_FOUND);2096 Assert(lrc == ERROR_FILE_NOT_FOUND); 2097 2097 } 2098 2098 else 2099 2099 { 2100 Assert( rc == ERROR_NO_MORE_ITEMS);2100 Assert(lrc == ERROR_NO_MORE_ITEMS); 2101 2101 break; 2102 2102 } … … 2106 2106 } 2107 2107 else 2108 Assert( rc == ERROR_FILE_NOT_FOUND);2108 Assert(lrc == ERROR_FILE_NOT_FOUND); 2109 2109 } 2110 2110 } … … 2123 2123 */ 2124 2124 HKEY hkeyTypeLibs; 2125 LSTATUS rc;2126 rc = RegOpenKeyExW(pState->aAltDeletes[iAlt].hkeyClasses, L"TypeLib", 0 /*fOptions*/, pState->fSamDelete, &hkeyTypeLibs);2127 if ( rc == ERROR_SUCCESS)2125 LSTATUS lrc; 2126 lrc = RegOpenKeyExW(pState->aAltDeletes[iAlt].hkeyClasses, L"TypeLib", 0 /*fOptions*/, pState->fSamDelete, &hkeyTypeLibs); 2127 if (lrc == ERROR_SUCCESS) 2128 2128 { 2129 2129 /* … … 2134 2134 { 2135 2135 HKEY hkeyTypeLibId; 2136 rc = RegOpenKeyExW(hkeyTypeLibs, g_apwszTypeLibIds[iTlb], 0 /*fOptions*/, pState->fSamDelete, &hkeyTypeLibId);2137 if ( rc == ERROR_SUCCESS)2136 lrc = RegOpenKeyExW(hkeyTypeLibs, g_apwszTypeLibIds[iTlb], 0 /*fOptions*/, pState->fSamDelete, &hkeyTypeLibId); 2137 if (lrc == ERROR_SUCCESS) 2138 2138 { 2139 2139 unsigned iVer = RT_ELEMENTS(g_apwszTypelibVersions); … … 2141 2141 { 2142 2142 HKEY hkeyVer; 2143 rc = RegOpenKeyExW(hkeyTypeLibId, g_apwszTypelibVersions[iVer], 0, KEY_READ, &hkeyVer);2144 if ( rc == ERROR_SUCCESS)2143 lrc = RegOpenKeyExW(hkeyTypeLibId, g_apwszTypelibVersions[iVer], 0, KEY_READ, &hkeyVer); 2144 if (lrc == ERROR_SUCCESS) 2145 2145 { 2146 2146 char szValue[128]; 2147 2147 DWORD cbValue = sizeof(szValue) - 1; 2148 rc = RegQueryValueExA(hkeyVer, NULL, NULL, NULL, (PBYTE)&szValue[0], &cbValue);2148 lrc = RegQueryValueExA(hkeyVer, NULL, NULL, NULL, (PBYTE)&szValue[0], &cbValue); 2149 2149 vbpsCloseKey(pState, hkeyVer, __LINE__); 2150 if ( rc == ERROR_SUCCESS)2150 if (lrc == ERROR_SUCCESS) 2151 2151 { 2152 2152 szValue[cbValue] = '\0'; … … 2167 2167 * The type library ID key should be empty now, so we can try remove it (non-recursively). 2168 2168 */ 2169 rc = RegDeleteKeyW(hkeyTypeLibs, g_apwszTypeLibIds[iTlb]);2170 Assert( rc == ERROR_SUCCESS);2169 lrc = RegDeleteKeyW(hkeyTypeLibs, g_apwszTypeLibIds[iTlb]); 2170 Assert(lrc == ERROR_SUCCESS); 2171 2171 } 2172 2172 } 2173 2173 } 2174 2174 else 2175 Assert( rc == ERROR_FILE_NOT_FOUND);2175 Assert(lrc == ERROR_FILE_NOT_FOUND); 2176 2176 } 2177 2177 } … … 2188 2188 */ 2189 2189 VBPSREGSTATE State; 2190 LRESULT rc = vbpsRegInit(&State, HKEY_CLASSES_ROOT, NULL, true /*fDelete*/, false /*fUpdate*/, fSamWow);2191 if ( rc == ERROR_SUCCESS)2190 LRESULT lrc = vbpsRegInit(&State, HKEY_CLASSES_ROOT, NULL, true /*fDelete*/, false /*fUpdate*/, fSamWow); 2191 if (lrc == ERROR_SUCCESS) 2192 2192 { 2193 2193 vbpsRegAddAltDelete(&State, HKEY_CURRENT_USER, "Software\\Classes"); … … 2342 2342 */ 2343 2343 WCHAR wszFilePath[MAX_PATH + 2]; 2344 int rc = RTUtf16CopyAscii(wszFilePath, RT_ELEMENTS(wszFilePath), "\"");2345 if (RT_SUCCESS( rc))2346 rc = RTUtf16Cat(wszFilePath, RT_ELEMENTS(wszFilePath), pwszVBoxDir);2347 if (RT_SUCCESS( rc))2348 rc = RTUtf16Cat(wszFilePath, RT_ELEMENTS(wszFilePath), pwszModule);2349 if (RT_SUCCESS( rc))2350 rc = RTUtf16CatAscii(wszFilePath, RT_ELEMENTS(wszFilePath), "\"");2351 AssertLogRelRCReturnVoid( rc);2344 int vrc = RTUtf16CopyAscii(wszFilePath, RT_ELEMENTS(wszFilePath), "\""); 2345 if (RT_SUCCESS(vrc)) 2346 vrc = RTUtf16Cat(wszFilePath, RT_ELEMENTS(wszFilePath), pwszVBoxDir); 2347 if (RT_SUCCESS(vrc)) 2348 vrc = RTUtf16Cat(wszFilePath, RT_ELEMENTS(wszFilePath), pwszModule); 2349 if (RT_SUCCESS(vrc)) 2350 vrc = RTUtf16CatAscii(wszFilePath, RT_ELEMENTS(wszFilePath), "\""); 2351 AssertLogRelRCReturnVoid(vrc); 2352 2352 2353 2353 /* … … 2463 2463 else 2464 2464 { 2465 pState-> rc = GetLastError();2466 LogRel(("Failed to not open service %ls for stop+delete: %u\n", pwszServiceName, pState-> rc));2465 pState->lrc = GetLastError(); 2466 LogRel(("Failed to not open service %ls for stop+delete: %u\n", pwszServiceName, pState->lrc)); 2467 2467 hService = OpenServiceW(hSCM, pwszServiceName, SERVICE_CHANGE_CONFIG); 2468 2468 } … … 2506 2506 else 2507 2507 { 2508 pState-> rc = GetLastError();2509 AssertMsgFailed(("Failed to create service '%ls': %u\n", pwszServiceName, pState-> rc));2508 pState->lrc = GetLastError(); 2509 AssertMsgFailed(("Failed to create service '%ls': %u\n", pwszServiceName, pState->lrc)); 2510 2510 } 2511 2511 CloseServiceHandle(hSCM); … … 2513 2513 else 2514 2514 { 2515 pState-> rc = GetLastError();2516 LogRel(("Failed to open service manager with create service access: %u\n", pState-> rc));2515 pState->lrc = GetLastError(); 2516 LogRel(("Failed to open service manager with create service access: %u\n", pState->lrc)); 2517 2517 } 2518 2518 } … … 2535 2535 DECLEXPORT(uint32_t) VbpsUpdateRegistrations(void) 2536 2536 { 2537 LSTATUS rc;2537 LSTATUS lrc; 2538 2538 VBPSREGSTATE State; 2539 2539 #ifdef VBOX_IN_32_ON_64_MAIN_API … … 2557 2557 * Update registry entries for the current CPU bitness. 2558 2558 */ 2559 rc = vbpsRegInit(&State, HKEY_CLASSES_ROOT, NULL, false /*fDelete*/, true /*fUpdate*/, 0);2560 if ( rc == ERROR_SUCCESS && !vbpsIsUpToDate(&State))2559 lrc = vbpsRegInit(&State, HKEY_CLASSES_ROOT, NULL, false /*fDelete*/, true /*fUpdate*/, 0); 2560 if (lrc == ERROR_SUCCESS && !vbpsIsUpToDate(&State)) 2561 2561 { 2562 2562 … … 2570 2570 RegisterXidlModulesAndClassesGenerated(&State, wszVBoxDir, fIs32On64); 2571 2571 vbpsMarkUpToDate(&State); 2572 rc = State.rc;2572 lrc = State.lrc; 2573 2573 } 2574 2574 vbpsRegTerm(&State); … … 2579 2579 * Update registry entries for the other CPU bitness. 2580 2580 */ 2581 if ( rc == ERROR_SUCCESS)2582 { 2583 rc = vbpsRegInit(&State, HKEY_CLASSES_ROOT, NULL, false /*fDelete*/, true /*fUpdate*/,2584 !fIs32On64 ? KEY_WOW64_32KEY : KEY_WOW64_64KEY);2585 if ( rc == ERROR_SUCCESS && !vbpsIsUpToDate(&State))2581 if (lrc == ERROR_SUCCESS) 2582 { 2583 lrc = vbpsRegInit(&State, HKEY_CLASSES_ROOT, NULL, false /*fDelete*/, true /*fUpdate*/, 2584 !fIs32On64 ? KEY_WOW64_32KEY : KEY_WOW64_64KEY); 2585 if (lrc == ERROR_SUCCESS && !vbpsIsUpToDate(&State)) 2586 2586 { 2587 2587 vbpsUpdateTypeLibRegistration(&State, wszVBoxDir, !fIs32On64); … … 2590 2590 RegisterXidlModulesAndClassesGenerated(&State, wszVBoxDir, !fIs32On64); 2591 2591 vbpsMarkUpToDate(&State); 2592 rc = State.rc;2592 lrc = State.lrc; 2593 2593 } 2594 2594 vbpsRegTerm(&State);
Note:
See TracChangeset
for help on using the changeset viewer.