Changeset 46070 in vbox
- Timestamp:
- May 14, 2013 3:21:57 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/http.h
r46050 r46070 97 97 98 98 /** 99 * Tells the HTTP interface to use the system proxy configuration. 100 * 101 * @returns iprt status code. 102 * @param hHttp HTTP interface handle. 103 */ 104 RTR3DECL(int) RTHttpUseSystemProxySettings(RTHTTP hHttp); 105 106 /** 99 107 * Specify proxy settings. 100 108 * -
trunk/include/iprt/mangling.h
r46050 r46070 599 599 # define RTHeapSimpleSize RT_MANGLER(RTHeapSimpleSize) 600 600 # define RTHttpGetFile RT_MANGLER(RTHttpGetFile) 601 # define RTHttpUseSystemProxySettings RT_MANGLER(RTHttpUseSystemProxySettings) 601 602 # define RTIsoFsClose RT_MANGLER(RTIsoFsClose) 602 603 # define RTIsoFsExtractFile RT_MANGLER(RTIsoFsExtractFile) -
trunk/src/VBox/Runtime/common/dbg/dbgcfg.cpp
r46053 r46070 48 48 #include <iprt/mem.h> 49 49 #include <iprt/path.h> 50 #include <iprt/process.h> 50 51 #include <iprt/semaphore.h> 51 52 #include <iprt/string.h> … … 147 148 /** The operative system mask. The values are RT_OPSYS_XXX. */ 148 149 #define RTDBGCFG_O_OPSYS_MASK UINT32_C(0x000000ff) 150 /** The files may be compressed MS styled. */ 151 #define RTDBGCFG_O_MAYBE_COMPRESSED_MS RT_BIT_32(26) 149 152 /** Whether to make a recursive search. */ 150 153 #define RTDBGCFG_O_RECURSIVE RT_BIT_32(27) … … 284 287 285 288 /* 289 * Try some simple case folding games. 290 */ 291 RTStrToLower(&pszPath[offLastComp]); 292 if (RTFileExists(pszPath)) 293 return true; 294 295 RTStrToUpper(&pszPath[offLastComp]); 296 if (RTFileExists(pszPath)) 297 return true; 298 299 /* 286 300 * Open the directory and check each entry in it. 287 301 */ … … 289 303 PRTDIR pDir; 290 304 int rc = RTDirOpen(&pDir, pszPath); 291 if (RT_ SUCCESS(rc))305 if (RT_FAILURE(rc)) 292 306 return false; 293 307 … … 371 385 if (fCaseInsensitive) 372 386 return rtDbgCfgIsXxxxAndFixCaseWorker(pszPath, cchPath, pszSubDir, RTDIRENTRYTYPE_DIRECTORY); 387 388 pszPath[cchPath] = '\0'; 373 389 return false; 374 390 } … … 387 403 * @param pszFilename The file name to append. 388 404 * @param fCaseInsensitive Whether case insensitive searching is required. 405 * @param fMsCompressed Whether to look for the MS compressed file name 406 * variant. 407 * @param pfProbablyCompressed This is set to true if a MS compressed 408 * filename variant is returned. Optional. 389 409 */ 390 static bool rtDbgCfgIsFileAndFixCase(char *pszPath, const char *pszFilename, bool fCaseInsensitive) 410 static bool rtDbgCfgIsFileAndFixCase(char *pszPath, const char *pszFilename, bool fCaseInsensitive, 411 bool fMsCompressed, bool *pfProbablyCompressed) 391 412 { 392 413 /* Save the length of the input path so we can restore it in the case 393 414 insensitive branch further down. */ 394 415 size_t cchPath = strlen(pszPath); 416 if (pfProbablyCompressed) 417 *pfProbablyCompressed = false; 395 418 396 419 /* … … 405 428 406 429 /* 407 * Do case insensitive lookup if requested.430 * Do case insensitive file lookup if requested. 408 431 */ 409 432 if (fCaseInsensitive) 410 return rtDbgCfgIsXxxxAndFixCaseWorker(pszPath, cchPath, pszFilename, RTDIRENTRYTYPE_FILE); 433 { 434 if (rtDbgCfgIsXxxxAndFixCaseWorker(pszPath, cchPath, pszFilename, RTDIRENTRYTYPE_FILE)) 435 return true; 436 } 437 438 /* 439 * Look for MS compressed file if requested. 440 */ 441 if ( fMsCompressed 442 && (unsigned char)pszFilename[strlen(pszFilename) - 1] < 0x7f) 443 { 444 pszPath[cchPath] = '\0'; 445 rc = RTPathAppend(pszPath, RTPATH_MAX, pszFilename); 446 AssertRCReturn(rc, rc); 447 pszPath[strlen(pszPath) - 1] = '_'; 448 449 if (pfProbablyCompressed) 450 *pfProbablyCompressed = true; 451 452 if (RTFileExists(pszPath)) 453 return true; 454 455 if (fCaseInsensitive) 456 { 457 /* Note! Ugly hack here, the pszName parameter points into pszPath! */ 458 if (rtDbgCfgIsXxxxAndFixCaseWorker(pszPath, cchPath, RTPathFilename(pszPath), RTDIRENTRYTYPE_FILE)) 459 return true; 460 } 461 462 if (pfProbablyCompressed) 463 *pfProbablyCompressed = false; 464 } 465 466 pszPath[cchPath] = '\0'; 411 467 return false; 412 468 } … … 434 490 that way. */ 435 491 bool const fCaseInsensitive = (fFlags & RTDBGCFG_O_CASE_INSENSITIVE) 436 && rtDbgCfgIsFsCaseInsensitive(pszPath);492 && !rtDbgCfgIsFsCaseInsensitive(pszPath); 437 493 438 494 size_t const cchPath = strlen(pszPath); … … 452 508 if (RT_SUCCESS(rc2)) 453 509 { 454 if (rtDbgCfgIsFileAndFixCase(pszPath, pSplitFn->apszComps[pSplitFn->cComps - 1], fCaseInsensitive ))510 if (rtDbgCfgIsFileAndFixCase(pszPath, pSplitFn->apszComps[pSplitFn->cComps - 1], fCaseInsensitive, false, NULL)) 455 511 { 456 512 rtDbgCfgLog1(pThis, "Trying '%s'...\n", pszPath); … … 459 515 { 460 516 if (rc2 == VINF_CALLBACK_RETURN) 461 rtDbgCfgLog1(pThis, "Found '%s'. ", pszPath);517 rtDbgCfgLog1(pThis, "Found '%s'.\n", pszPath); 462 518 else 463 519 rtDbgCfgLog1(pThis, "Error opening '%s'.\n", pszPath); … … 483 539 } 484 540 541 static int rtDbgCfgUnpackMsCacheFile(PRTDBGCFGINT pThis, char *pszPath, const char *pszFilename) 542 { 543 rtDbgCfgLog2(pThis, "Unpacking '%s'...\n", pszPath); 544 545 /* 546 * Duplicate the source file path, just for simplicity and restore the 547 * final character in the orignal. We cheerfully ignorining any 548 * possibility of multibyte UTF-8 sequences just like the caller did when 549 * setting it to '_'. 550 */ 551 char *pszSrcArchive = RTStrDup(pszPath); 552 if (!pszSrcArchive) 553 return VERR_NO_STR_MEMORY; 554 555 pszPath[strlen(pszPath) - 1] = RT_C_TO_LOWER(pszFilename[strlen(pszFilename) - 1]); 556 557 558 /* 559 * Figuring out the argument list for the platform specific unpack util. 560 */ 561 #ifdef RT_OS_WINDOWS 562 const char *papszArgs[] = 563 { 564 "expand.exe", 565 pszSrcArchive, 566 pszPath, 567 NULL 568 }; 569 570 #else 571 char szExtractDir[RTPATH_MAX]; 572 strcpy(szExtractDir, pszPath); 573 RTPathStripFilename(szExtractDir); 574 575 const char *papszArgs[] = 576 { 577 "cabextract", 578 "-L", /* Lower case extracted files. */ 579 "-d", szExtractDir, /* Extraction path */ 580 pszSrcArchive, 581 NULL 582 }; 583 #endif 584 585 /* 586 * Do the unpacking. 587 */ 588 RTPROCESS hChild; 589 int rc = RTProcCreate(papszArgs[0], papszArgs, RTENV_DEFAULT, 590 #if defined(RT_OS_WINDOWS) || defined(RT_OS_OS2) 591 RTPROC_FLAGS_NO_WINDOW | RTPROC_FLAGS_HIDDEN | RTPROC_FLAGS_SEARCH_PATH, 592 #else 593 RTPROC_FLAGS_SEARCH_PATH, 594 #endif 595 &hChild); 596 if (RT_SUCCESS(rc)) 597 { 598 RTPROCSTATUS ProcStatus; 599 rc = RTProcWait(hChild, RTPROCWAIT_FLAGS_BLOCK, &ProcStatus); 600 if (RT_SUCCESS(rc)) 601 { 602 if ( ProcStatus.enmReason == RTPROCEXITREASON_NORMAL 603 && ProcStatus.iStatus == 0) 604 { 605 if (RTPathExists(pszPath)) 606 { 607 rtDbgCfgLog1(pThis, "Successfully unpacked '%s' to '%s'.\n", pszSrcArchive, pszPath); 608 rc = VINF_SUCCESS; 609 } 610 else 611 { 612 rtDbgCfgLog1(pThis, "Successfully ran unpacker on '%s', but '%s' is missing!\n", pszSrcArchive, pszPath); 613 rc = VERR_ZIP_ERROR; 614 } 615 } 616 else 617 { 618 rtDbgCfgLog2(pThis, "Unpacking '%s' failed: iStatus=%d enmReason=%d\n", 619 pszSrcArchive, ProcStatus.iStatus, ProcStatus.enmReason); 620 rc = VERR_ZIP_CORRUPTED; 621 } 622 } 623 else 624 rtDbgCfgLog1(pThis, "Error waiting for process: %Rrc\n", rc); 625 626 } 627 else 628 rtDbgCfgLog1(pThis, "Error starting unpack process '%s': %Rrc\n", papszArgs[0], rc); 629 630 return rc; 631 } 485 632 486 633 static int rtDbgCfgTryDownloadAndOpen(PRTDBGCFGINT pThis, const char *pszServer, … … 495 642 * Create the path. 496 643 */ 644 size_t cchTmp = strlen(pszPath); 645 646 int rc = RTDirCreateFullPath(pszPath, 0766); 647 if (!RTDirExists(pszPath)) 648 { 649 Log(("Error creating cache dir '%s': %Rrc\n", pszPath, rc)); 650 return rc; 651 } 652 497 653 const char *pszFilename = pSplitFn->apszComps[pSplitFn->cComps - 1]; 498 intrc = RTPathAppend(pszPath, RTPATH_MAX, pszFilename);654 rc = RTPathAppend(pszPath, RTPATH_MAX, pszFilename); 499 655 if (RT_FAILURE(rc)) 500 656 return rc; 657 RTStrToLower(&pszPath[cchTmp]); 501 658 if (!RTDirExists(pszPath)) 502 659 { … … 521 678 522 679 /* Prepare the destination file name while we're here. */ 680 cchTmp = strlen(pszPath); 681 RTStrToLower(&pszPath[cchTmp]); 523 682 rc = RTPathAppend(pszPath, RTPATH_MAX, pszFilename); 524 683 if (RT_FAILURE(rc)) … … 532 691 if (RT_FAILURE(rc)) 533 692 return rc; 693 RTHttpUseSystemProxySettings(hHttp); 534 694 535 695 static const char * const s_apszHeaders[] = 536 696 { 537 697 "User-Agent: Microsoft-Symbol-Server/6.6.0999.9", 538 " Cache-Control: no-cache",698 "Pragma: no-cache", 539 699 }; 540 700 … … 545 705 RTStrPrintf(szUrl, sizeof(szUrl), "%s/%s/%s/%s", pszServer, pszFilename, pszCacheSubDir, pszFilename); 546 706 547 /** @todo Use some temporary file name and rename it after the operation. */ 707 /** @todo Use some temporary file name and rename it after the operation 708 * since not all systems support read-deny file sharing 709 * settings. */ 710 rtDbgCfgLog2(pThis, "Downloading '%s' to '%s'...\n", szUrl, pszPath); 548 711 rc = RTHttpGetFile(hHttp, szUrl, pszPath); 549 712 if (RT_FAILURE(rc)) 713 { 550 714 RTFileDelete(pszPath); 715 rtDbgCfgLog1(pThis, "%Rrc on URL '%s'\n", rc, pszPath); 716 } 717 if (rc == VERR_HTTP_NOT_FOUND) 718 { 719 /* Try the compressed version of the file. */ 720 pszPath[strlen(pszPath) - 1] = '_'; 721 szUrl[strlen(szUrl) - 1] = '_'; 722 rtDbgCfgLog2(pThis, "Downloading '%s' to '%s'...\n", szUrl, pszPath); 723 rc = RTHttpGetFile(hHttp, szUrl, pszPath); 724 if (RT_SUCCESS(rc)) 725 rc = rtDbgCfgUnpackMsCacheFile(pThis, pszPath, pszFilename); 726 else 727 { 728 rtDbgCfgLog1(pThis, "%Rrc on URL '%s'\n", rc, pszPath); 729 RTFileDelete(pszPath); 730 } 731 } 551 732 } 552 733 553 734 RTHttpDestroy(hHttp); 735 736 /* 737 * If we succeeded, give it a try. 738 */ 739 if (RT_SUCCESS(rc)) 740 { 741 Assert(RTFileExists(pszPath)); 742 rtDbgCfgLog1(pThis, "Trying '%s'...\n", pszPath); 743 rc = pfnCallback(pThis, pszPath, pvUser1, pvUser2); 744 if (rc == VINF_CALLBACK_RETURN) 745 rtDbgCfgLog1(pThis, "Found '%s'.\n", pszPath); 746 else if (rc == VERR_CALLBACK_RETURN) 747 rtDbgCfgLog1(pThis, "Error opening '%s'.\n", pszPath); 748 else 749 rtDbgCfgLog1(pThis, "Error %Rrc opening '%s'.\n", rc, pszPath); 750 } 751 554 752 return rc; 555 753 … … 588 786 */ 589 787 bool const fCaseInsensitive = (fFlags & RTDBGCFG_O_CASE_INSENSITIVE) 590 && rtDbgCfgIsFsCaseInsensitive(pszPath); 591 592 if (!rtDbgCfgIsDirAndFixCase(pszPath, pSplitFn->apszComps[pSplitFn->cComps - 1], fCaseInsensitive)) 788 && !rtDbgCfgIsFsCaseInsensitive(pszPath); 789 const char *pszFilename = pSplitFn->apszComps[pSplitFn->cComps - 1]; 790 791 if (!rtDbgCfgIsDirAndFixCase(pszPath, pszFilename, fCaseInsensitive)) 593 792 return VWRN_NOT_FOUND; 594 793 … … 596 795 return VWRN_NOT_FOUND; 597 796 598 if (!rtDbgCfgIsFileAndFixCase(pszPath, pSplitFn->apszComps[pSplitFn->cComps - 1], fCaseInsensitive)) 797 bool fProbablyCompressed = false; 798 if (!rtDbgCfgIsFileAndFixCase(pszPath, pszFilename, fCaseInsensitive, 799 RT_BOOL(fFlags & RTDBGCFG_O_MAYBE_COMPRESSED_MS), &fProbablyCompressed)) 599 800 return VWRN_NOT_FOUND; 801 if (fProbablyCompressed) 802 { 803 int rc = rtDbgCfgUnpackMsCacheFile(pThis, pszPath, pszFilename); 804 if (RT_FAILURE(rc)) 805 return VWRN_NOT_FOUND; 806 } 600 807 601 808 rtDbgCfgLog1(pThis, "Trying '%s'...\n", pszPath); 602 809 int rc2 = pfnCallback(pThis, pszPath, pvUser1, pvUser2); 603 810 if (rc2 == VINF_CALLBACK_RETURN) 604 rtDbgCfgLog1(pThis, "Found '%s'. ", pszPath);811 rtDbgCfgLog1(pThis, "Found '%s'.\n", pszPath); 605 812 else if (rc2 == VERR_CALLBACK_RETURN) 606 813 rtDbgCfgLog1(pThis, "Error opening '%s'.\n", pszPath); … … 619 826 const char *pchCache = NULL; 620 827 size_t cchCache = 0; 828 int rcCache = VWRN_NOT_FOUND; 621 829 622 830 PRTDBGCFGSTR pCur; … … 668 876 memcpy(pszPath, pchCache, cchCache); 669 877 pszPath[cchCache] = '\0'; 670 rc 2 = rtDbgCfgTryOpenCache(pThis, pszPath, pszCacheSubDir, pSplitFn, fFlags,671 pfnCallback, pvUser1, pvUser2);878 rcCache = rc2 = rtDbgCfgTryOpenCache(pThis, pszPath, pszCacheSubDir, pSplitFn, fFlags, 879 pfnCallback, pvUser1, pvUser2); 672 880 if (rc2 == VINF_CALLBACK_RETURN || rc2 == VERR_CALLBACK_RETURN) 673 881 return rc2; … … 675 883 676 884 /* Try downloading the file. */ 677 memcpy(pszPath, pchCache, cchCache); 678 pszPath[cchCache] = '\0'; 679 rc2 = rtDbgCfgTryDownloadAndOpen(pThis, pszServer, pszPath, pszCacheSubDir, pSplitFn, fFlags, 680 pfnCallback, pvUser1, pvUser2); 681 if (rc2 == VINF_CALLBACK_RETURN || rc2 == VERR_CALLBACK_RETURN) 682 return rc2; 885 if (rcCache == VWRN_NOT_FOUND) 886 { 887 memcpy(pszPath, pchCache, cchCache); 888 pszPath[cchCache] = '\0'; 889 rc2 = rtDbgCfgTryDownloadAndOpen(pThis, pszServer, pszPath, pszCacheSubDir, pSplitFn, fFlags, 890 pfnCallback, pvUser1, pvUser2); 891 if (rc2 == VINF_CALLBACK_RETURN || rc2 == VERR_CALLBACK_RETURN) 892 return rc2; 893 } 683 894 } 684 895 else if (!strncmp(pszDir, RT_STR_TUPLE("cache*"))) … … 696 907 memcpy(pszPath, pchCache, cchCache); 697 908 pszPath[cchCache] = '\0'; 698 rc 2 = rtDbgCfgTryOpenCache(pThis, pszPath, pszCacheSubDir, pSplitFn, fFlags,699 pfnCallback, pvUser1, pvUser2);909 rcCache = rc2 = rtDbgCfgTryOpenCache(pThis, pszPath, pszCacheSubDir, pSplitFn, fFlags, 910 pfnCallback, pvUser1, pvUser2); 700 911 if (rc2 == VINF_CALLBACK_RETURN || rc2 == VERR_CALLBACK_RETURN) 701 912 return rc2; … … 734 945 } 735 946 } 947 948 /* Propagate errors. */ 949 if (RT_FAILURE(rc2) && RT_SUCCESS_NP(rcRet)) 950 rcRet = rc2; 736 951 } 737 952 … … 786 1001 fFlags |= RTDBGCFG_O_CASE_INSENSITIVE; 787 1002 788 rtDbgCfgLog2(pThis, "Looking for '%s' w/ cache subdir '%s' and %#x flags \n", pszFilename, pszCacheSubDir, fFlags);1003 rtDbgCfgLog2(pThis, "Looking for '%s' w/ cache subdir '%s' and %#x flags...\n", pszFilename, pszCacheSubDir, fFlags); 789 1004 790 1005 PRTPATHSPLIT pSplitFn; … … 875 1090 { 876 1091 char szSubDir[32]; 877 RTStrPrintf(szSubDir, sizeof(szSubDir), "%08X% X", uTimestamp, cbImage);1092 RTStrPrintf(szSubDir, sizeof(szSubDir), "%08X%x", uTimestamp, cbImage); 878 1093 return rtDbgCfgOpenWithSubDir(hDbgCfg, pszFilename, szSubDir, 879 1094 RT_OPSYS_WINDOWS /* approx */ | RTDBGCFG_O_SYMSRV | RTDBGCFG_O_CASE_INSENSITIVE 880 | RTDBGCFG_O_ EXECUTABLE_IMAGE,1095 | RTDBGCFG_O_MAYBE_COMPRESSED_MS | RTDBGCFG_O_EXECUTABLE_IMAGE, 881 1096 pfnCallback, pvUser1, pvUser2); 882 1097 } … … 900 1115 while ((ch = *pszSrc++)) 901 1116 if (ch != '-') 902 *pszDst++ = ch;903 else if (RT_C_IS_LOWER(ch))904 1117 *pszDst++ = RT_C_TO_UPPER(ch); 905 1118 … … 909 1122 return rtDbgCfgOpenWithSubDir(hDbgCfg, pszFilename, szSubDir, 910 1123 RT_OPSYS_WINDOWS /* approx */ | RTDBGCFG_O_SYMSRV | RTDBGCFG_O_CASE_INSENSITIVE 911 | RTDBGCFG_O_ EXT_DEBUG_FILE,1124 | RTDBGCFG_O_MAYBE_COMPRESSED_MS | RTDBGCFG_O_EXT_DEBUG_FILE, 912 1125 pfnCallback, pvUser1, pvUser2); 913 1126 } … … 919 1132 /** @todo test this! */ 920 1133 char szSubDir[32]; 921 RTStrPrintf(szSubDir, sizeof(szSubDir), "%08X% X", uTimestamp, uAge);1134 RTStrPrintf(szSubDir, sizeof(szSubDir), "%08X%x", uTimestamp, uAge); 922 1135 return rtDbgCfgOpenWithSubDir(hDbgCfg, pszFilename, szSubDir, 923 1136 RT_OPSYS_WINDOWS /* approx */ | RTDBGCFG_O_SYMSRV | RTDBGCFG_O_CASE_INSENSITIVE 924 | RTDBGCFG_O_ EXT_DEBUG_FILE,1137 | RTDBGCFG_O_MAYBE_COMPRESSED_MS | RTDBGCFG_O_EXT_DEBUG_FILE, 925 1138 pfnCallback, pvUser1, pvUser2); 926 1139 } … … 931 1144 { 932 1145 char szSubDir[32]; 933 RTStrPrintf(szSubDir, sizeof(szSubDir), "%08X% X", uTimestamp, cbImage);1146 RTStrPrintf(szSubDir, sizeof(szSubDir), "%08X%x", uTimestamp, cbImage); 934 1147 return rtDbgCfgOpenWithSubDir(hDbgCfg, pszFilename, szSubDir, 935 1148 RT_OPSYS_WINDOWS /* approx */ | RTDBGCFG_O_SYMSRV | RTDBGCFG_O_CASE_INSENSITIVE 936 | RTDBGCFG_O_ EXT_DEBUG_FILE,1149 | RTDBGCFG_O_MAYBE_COMPRESSED_MS | RTDBGCFG_O_EXT_DEBUG_FILE, 937 1150 pfnCallback, pvUser1, pvUser2); 938 1151 } -
trunk/src/VBox/Runtime/common/dbg/dbgmod.cpp
r46048 r46070 785 785 786 786 /* 787 * Replace the image file name while probing it. 788 */ 789 const char *pszNewImgFile = RTStrCacheEnter(g_hDbgModStrCache, pszFilename); 790 if (!pszNewImgFile) 791 return VERR_NO_STR_MEMORY; 792 const char *pszOldImgFile = pDbgMod->pszImgFile; 793 pDbgMod->pszImgFile = pszNewImgFile; 794 795 /* 787 796 * Find an image reader which groks the file. 788 797 */ … … 802 811 Assert(pDbgMod->pvImgPriv == NULL); 803 812 } 804 } 805 RTSemRWReleaseRead(g_hDbgModRWSem); 806 if (RT_FAILURE(rc)) 807 { 808 LogFlow(("rtDbgModFromPeImageOpenCallback: Failed %Rrc - %s\n", rc, pszFilename)); 809 return rc; 810 } 811 812 /* 813 * Check the deferred info. 814 */ 815 RTUINTPTR cbImage = pDbgMod->pImgVt->pfnImageSize(pDbgMod); 816 if ( pDeferred->cbImage == 0 817 || pDeferred->cbImage == cbImage) 818 { 819 uint32_t uTimestamp = pDeferred->u.PeImage.uTimestamp; /** @todo add method for getting the timestamp. */ 820 if ( pDeferred->u.PeImage.uTimestamp == 0 821 || pDeferred->u.PeImage.uTimestamp == uTimestamp) 813 RTSemRWReleaseRead(g_hDbgModRWSem); 814 if (RT_SUCCESS(rc)) 822 815 { 823 Log(("RTDbgMod: Found matching PE image '%s'\n", pszFilename));824 825 816 /* 826 * We found the executable image we need, now go find any debug 827 * info associated with it. For PE images, this is generally 828 * found in an external file, so we do a sweep for that first. 817 * Check the deferred info. 829 818 */ 830 rc = rtDbgModOpenDebugInfoExternalToImage(pDbgMod, pDeferred->hDbgCfg); 831 if (RT_SUCCESS(rc)) 832 return VINF_CALLBACK_RETURN; 833 834 /* 835 * Try open debug info inside the module, falling back on exports. 836 */ 837 rc = rtDbgModOpenDebugInfoInsideImage(pDbgMod); 838 if (RT_SUCCESS(rc)) 839 return VINF_CALLBACK_RETURN; 840 /** @todo search for external files that could contain more useful info, like 841 * .map files?? No? */ 842 rc = rtDbgModCreateForExports(pDbgMod); 843 if (RT_SUCCESS(rc)) 844 return VINF_CALLBACK_RETURN; 845 846 /* Something bad happened, just give up. */ 847 Log(("rtDbgModFromPeImageOpenCallback: rtDbgModCreateForExports failed: %Rrc\n", rc)); 819 RTUINTPTR cbImage = pDbgMod->pImgVt->pfnImageSize(pDbgMod); 820 if ( pDeferred->cbImage == 0 821 || pDeferred->cbImage == cbImage) 822 { 823 uint32_t uTimestamp = pDeferred->u.PeImage.uTimestamp; /** @todo add method for getting the timestamp. */ 824 if ( pDeferred->u.PeImage.uTimestamp == 0 825 || pDeferred->u.PeImage.uTimestamp == uTimestamp) 826 { 827 Log(("RTDbgMod: Found matching PE image '%s'\n", pszFilename)); 828 829 /* 830 * We found the executable image we need, now go find any 831 * debug info associated with it. For PE images, this is 832 * generally found in an external file, so we do a sweep 833 * for that first. 834 * 835 * Then try open debug inside the module, and finally 836 * falling back on exports. 837 */ 838 rc = rtDbgModOpenDebugInfoExternalToImage(pDbgMod, pDeferred->hDbgCfg); 839 if (RT_FAILURE(rc)) 840 rc = rtDbgModOpenDebugInfoInsideImage(pDbgMod); 841 if (RT_FAILURE(rc)) 842 rc = rtDbgModCreateForExports(pDbgMod); 843 if (RT_SUCCESS(rc)) 844 { 845 RTStrCacheRelease(g_hDbgModStrCache, pszOldImgFile); 846 return VINF_CALLBACK_RETURN; 847 } 848 849 /* Something bad happened, just give up. */ 850 Log(("rtDbgModFromPeImageOpenCallback: rtDbgModCreateForExports failed: %Rrc\n", rc)); 851 } 852 else 853 { 854 LogFlow(("rtDbgModFromPeImageOpenCallback: uTimestamp mismatch (found %#x, expected %#x) - %s\n", 855 uTimestamp, pDeferred->u.PeImage.uTimestamp, pszFilename)); 856 rc = VERR_DBG_FILE_MISMATCH; 857 } 858 } 859 else 860 { 861 LogFlow(("rtDbgModFromPeImageOpenCallback: cbImage mismatch (found %#x, expected %#x) - %s\n", 862 cbImage, pDeferred->cbImage, pszFilename)); 863 rc = VERR_DBG_FILE_MISMATCH; 864 } 865 866 pDbgMod->pImgVt->pfnClose(pDbgMod); 867 pDbgMod->pImgVt = NULL; 868 pDbgMod->pvImgPriv = NULL; 848 869 } 849 870 else 850 { 851 LogFlow(("rtDbgModFromPeImageOpenCallback: uTimestamp mismatch (found %#x, expected %#x) - %s\n", 852 uTimestamp, pDeferred->u.PeImage.uTimestamp, pszFilename)); 853 rc = VERR_DBG_FILE_MISMATCH; 854 } 871 LogFlow(("rtDbgModFromPeImageOpenCallback: Failed %Rrc - %s\n", rc, pszFilename)); 855 872 } 856 else 857 { 858 LogFlow(("rtDbgModFromPeImageOpenCallback: cbImage mismatch (found %#x, expected %#x) - %s\n", 859 cbImage, pDeferred->cbImage, pszFilename)); 860 rc = VERR_DBG_FILE_MISMATCH; 861 } 862 863 pDbgMod->pImgVt->pfnClose(pDbgMod); 864 pDbgMod->pImgVt = NULL; 865 pDbgMod->pvImgPriv = NULL; 866 873 874 /* Restore image name. */ 875 pDbgMod->pszImgFile = pszOldImgFile; 876 RTStrCacheRelease(g_hDbgModStrCache, pszNewImgFile); 867 877 return rc; 868 878 } -
trunk/src/VBox/Runtime/common/misc/http.cpp
r46050 r46070 30 30 *******************************************************************************/ 31 31 #include <iprt/http.h> 32 #include "internal/iprt.h" 33 32 34 #include <iprt/assert.h> 35 #include <iprt/env.h> 33 36 #include <iprt/err.h> 34 37 #include <iprt/mem.h> … … 170 173 171 174 return VINF_SUCCESS; 175 } 176 177 RTR3DECL(int) RTHttpUseSystemProxySettings(RTHTTP hHttp) 178 { 179 PRTHTTPINTERNAL pHttpInt = hHttp; 180 RTHTTP_VALID_RETURN(pHttpInt); 181 182 /* 183 * Very limited right now, just enought to make it work for ourselves. 184 */ 185 char szProxy[_1K]; 186 int rc = RTEnvGetEx(RTENV_DEFAULT, "http_proxy", szProxy, sizeof(szProxy), NULL); 187 if (RT_SUCCESS(rc)) 188 { 189 int rcCurl; 190 if (!strncmp(szProxy, RT_STR_TUPLE("http://"))) 191 { 192 rcCurl = curl_easy_setopt(pHttpInt->pCurl, CURLOPT_PROXY, &szProxy[sizeof("http://") - 1]); 193 if (CURL_FAILED(rcCurl)) 194 return VERR_INVALID_PARAMETER; 195 rcCurl = curl_easy_setopt(pHttpInt->pCurl, CURLOPT_PROXYPORT, 80); 196 if (CURL_FAILED(rcCurl)) 197 return VERR_INVALID_PARAMETER; 198 } 199 else 200 { 201 rcCurl = curl_easy_setopt(pHttpInt->pCurl, CURLOPT_PROXY, &szProxy[sizeof("http://") - 1]); 202 if (CURL_FAILED(rcCurl)) 203 return VERR_INVALID_PARAMETER; 204 } 205 } 206 else if (rc == VERR_ENV_VAR_NOT_FOUND) 207 rc = VINF_SUCCESS; 208 209 return rc; 172 210 } 173 211 -
trunk/src/VBox/Runtime/tools/RTLdrFlt.cpp
r46050 r46070 145 145 { 146 146 { "--input", 'i', RTGETOPT_REQ_STRING }, 147 { "--local-file", 'l', RTGETOPT_REQ_NOTHING }, 148 { "--cache-file", 'c', RTGETOPT_REQ_NOTHING }, 147 149 { "--pe-image", 'p', RTGETOPT_REQ_NOTHING }, 148 150 { "--verbose", 'v', RTGETOPT_REQ_NOTHING }, … … 156 158 kOpenMethod_FromPeImage 157 159 } enmOpenMethod = kOpenMethod_FromImage; 160 bool fCacheFile = false; 158 161 159 162 RTGETOPTUNION ValueUnion; … … 168 171 if (RT_FAILURE(rc)) 169 172 return RTMsgErrorExit(RTEXITCODE_FAILURE, "Failed to open '%s' for reading: %Rrc", ValueUnion.psz, rc); 173 break; 174 175 case 'c': 176 fCacheFile = true; 177 break; 178 179 case 'l': 180 fCacheFile = false; 170 181 break; 171 182 … … 209 220 uint64_t u64Address = ValueUnion.u64; 210 221 222 uint32_t cbImage = 0; 223 uint32_t uTimestamp = 0; 224 if (fCacheFile) 225 { 226 rc = RTGetOptFetchValue(&GetState, &ValueUnion, RTGETOPT_REQ_UINT32 | RTGETOPT_FLAG_HEX); 227 if (RT_FAILURE(rc)) 228 return RTGetOptPrintError(rc, &ValueUnion); 229 cbImage = ValueUnion.u32; 230 231 rc = RTGetOptFetchValue(&GetState, &ValueUnion, RTGETOPT_REQ_UINT32 | RTGETOPT_FLAG_HEX); 232 if (RT_FAILURE(rc)) 233 return RTGetOptPrintError(rc, &ValueUnion); 234 uTimestamp = ValueUnion.u32; 235 } 236 211 237 RTDBGMOD hMod; 212 238 if (enmOpenMethod == kOpenMethod_FromImage) 213 239 rc = RTDbgModCreateFromImage(&hMod, pszModule, NULL, hDbgCfg); 214 240 else 215 rc = RTDbgModCreateFromPeImage(&hMod, pszModule, NULL, 0, 0, hDbgCfg);241 rc = RTDbgModCreateFromPeImage(&hMod, pszModule, NULL, cbImage, uTimestamp, hDbgCfg); 216 242 if (RT_FAILURE(rc)) 217 243 return RTMsgErrorExit(RTEXITCODE_FAILURE, "RTDbgModCreateFromImage(,%s,,) -> %Rrc", pszModule, rc);
Note:
See TracChangeset
for help on using the changeset viewer.