Changeset 74676 in vbox for trunk/src/VBox/Runtime/common/ldr/ldrMachO.cpp
- Timestamp:
- Oct 8, 2018 12:51:07 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/ldr/ldrMachO.cpp
r74664 r74676 1748 1748 { 1749 1749 /* simplify validation. */ 1750 if (cchStrings <= cchSymbol) 1750 /** @todo figure out a better way to deal with underscore prefixes. sigh. */ 1751 if (cchStrings <= cchSymbol + 1) 1751 1752 return VERR_SYMBOL_NOT_FOUND; 1752 cchStrings -= cchSymbol ;1753 cchStrings -= cchSymbol + 1; 1753 1754 1754 1755 /* external symbols are usually at the end, so search the other way. */ … … 1773 1774 continue; 1774 1775 psz = &pchStrings[paSyms[iSymbol].n_un.n_strx]; 1775 if (psz[cchSymbol ])1776 if (psz[cchSymbol + 1]) 1776 1777 continue; 1777 if (memcmp(psz, pchSymbol, cchSymbol)) 1778 /** @todo figure out a better way to deal with underscore prefixes. sigh. */ 1779 if (*psz != '_' || memcmp(psz + 1, pchSymbol, cchSymbol)) 1778 1780 continue; 1779 1781 … … 1876 1878 { 1877 1879 /* simplify validation. */ 1878 if (cchStrings <= cchSymbol) 1880 /** @todo figure out a better way to deal with underscore prefixes. sigh. */ 1881 if (cchStrings <= cchSymbol + 1) 1879 1882 return VERR_SYMBOL_NOT_FOUND; 1880 cchStrings -= cchSymbol ;1883 cchStrings -= cchSymbol + 1; 1881 1884 1882 1885 /* external symbols are usually at the end, so search the other way. */ … … 1901 1904 continue; 1902 1905 psz = &pchStrings[paSyms[iSymbol].n_un.n_strx]; 1903 if (psz[cchSymbol ])1906 if (psz[cchSymbol + 1]) 1904 1907 continue; 1905 if ( memcmp(psz, pchSymbol, cchSymbol))1908 if (*psz != '_' || memcmp(psz + 1, pchSymbol, cchSymbol)) 1906 1909 continue; 1907 1910 … … 2128 2131 * Do callback. 2129 2132 */ 2133 /** @todo figure out a better way to deal with underscore prefixes. sigh. */ 2134 if (cch > 1 && *psz == '_') 2135 psz++; 2130 2136 rc = pfnCallback(&pThis->Core, psz, iSym, uValue/*, fKind*/, pvUser); 2131 2137 if (rc != VINF_SUCCESS) … … 2240 2246 * Do callback. 2241 2247 */ 2248 /** @todo figure out a better way to deal with underscore prefixes. sigh. */ 2249 if (cch > 1 && *psz == '_') 2250 psz++; 2242 2251 rc = pfnCallback(&pThis->Core, psz, iSym, uValue/*, fKind*/, pvUser); 2243 2252 if (rc != VINF_SUCCESS) … … 2609 2618 2610 2619 /* Ask the user for an address to the symbol. */ 2620 /** @todo figure out a better way to deal with underscore prefixes. sigh. */ 2611 2621 if (RT_FAILURE_NP(rc)) 2612 rc = pfnGetImport(&pThis->Core, NULL /*pszModule*/, pszSymbol, iSym, &Value/*, &fKind*/, pvUser); 2622 rc = pfnGetImport(&pThis->Core, NULL /*pszModule*/, pszSymbol + (pszSymbol[0] == '_'), 2623 UINT32_MAX, &Value/*, &fKind*/, pvUser); 2613 2624 if (RT_FAILURE(rc)) 2614 2625 { … … 2668 2679 2669 2680 /* Ask the user for an address to the symbol. */ 2681 /** @todo figure out a better way to deal with underscore prefixes. sigh. */ 2670 2682 if (RT_FAILURE_NP(rc)) 2671 rc = pfnGetImport(&pThis->Core, NULL, pszSymbol, iSym, &Value, /*&fKind,*/ pvUser); 2683 rc = pfnGetImport(&pThis->Core, NULL, pszSymbol + (*pszSymbol == '_'), 2684 UINT32_MAX, &Value, /*&fKind,*/ pvUser); 2672 2685 if (RT_FAILURE(rc)) 2673 2686 {
Note:
See TracChangeset
for help on using the changeset viewer.