Changeset 77473 in vbox for trunk/src/VBox/Runtime/r0drv/nt/dbgkrnlinfo-r0drv-nt.cpp
- Timestamp:
- Feb 26, 2019 4:24:35 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r0drv/nt/dbgkrnlinfo-r0drv-nt.cpp
r76553 r77473 158 158 * @param pModInfo The module info. 159 159 * @param pszSymbol The symbol to find. 160 * @param cForwarders Forwarder nesting depth. 160 161 * @param ppvSymbol Where to put the symbol address. 161 162 * 162 163 * @note Support library has similar code for in the importless area. 163 164 */ 164 static int rtR0DbgKrnlInfoLookupSymbol(PCRTDBGNTKRNLMODINFO pModInfo, const char *pszSymbol, void **ppvSymbol) 165 static int rtR0DbgKrnlInfoLookupSymbol(PCRTDBGNTKRNLMODINFO pModInfo, const char *pszSymbol, unsigned cForwarders, 166 void **ppvSymbol) 165 167 { 166 168 if (pModInfo->fOkay) … … 202 204 *ppvSymbol = (void *)&pModInfo->pbImageBase[offExport]; 203 205 return VINF_SUCCESS; 206 } 207 208 /* 209 * Deal with forwarders to NT and HAL. No ordinals. 210 */ 211 const char *pszForwarder = (const char *)&pModInfo->pbImageBase[offExport]; 212 uint32_t cbMax = pModInfo->cbImage - offExpName; 213 size_t cchForwarder = RTStrNLen(pszForwarder, cbMax); 214 if (cchForwarder < cbMax) 215 { 216 if ( cchForwarder > 9 217 && pModInfo != &g_NtOsKrnlInfo 218 && g_NtOsKrnlInfo.pbImageBase != NULL 219 && cForwarders < 2 220 && (pszForwarder[0] == 'n' || pszForwarder[0] == 'N') 221 && (pszForwarder[1] == 't' || pszForwarder[1] == 'T') 222 && (pszForwarder[2] == 'o' || pszForwarder[2] == 'O') 223 && (pszForwarder[3] == 's' || pszForwarder[3] == 'S') 224 && (pszForwarder[4] == 'k' || pszForwarder[4] == 'K') 225 && (pszForwarder[5] == 'r' || pszForwarder[5] == 'R') 226 && (pszForwarder[6] == 'n' || pszForwarder[6] == 'N') 227 && (pszForwarder[7] == 'l' || pszForwarder[7] == 'L') 228 && pszForwarder[8] == '.') 229 return rtR0DbgKrnlInfoLookupSymbol(&g_NtOsKrnlInfo, pszForwarder + 9, cForwarders + 1, ppvSymbol); 230 231 if ( cchForwarder > 4 232 && pModInfo != &g_HalInfo 233 && g_HalInfo.pbImageBase != NULL 234 && cForwarders < 2 235 && (pszForwarder[0] == 'h' || pszForwarder[0] == 'H') 236 && (pszForwarder[1] == 'a' || pszForwarder[1] == 'A') 237 && (pszForwarder[2] == 'l' || pszForwarder[2] == 'L') 238 && pszForwarder[3] == '.') 239 return rtR0DbgKrnlInfoLookupSymbol(&g_HalInfo, pszForwarder + 4, cForwarders + 1, ppvSymbol); 204 240 } 205 241 … … 497 533 { 498 534 //RTR0DBG_NT_DEBUG_LOG(("rtR0DbgKrnlNtInit: Looking up 'MmGetSystemRoutineAddress'...\n")); 499 rtR0DbgKrnlInfoLookupSymbol(&g_NtOsKrnlInfo, "MmGetSystemRoutineAddress", (void **)&g_pfnMmGetSystemRoutineAddress); 535 rtR0DbgKrnlInfoLookupSymbol(&g_NtOsKrnlInfo, "MmGetSystemRoutineAddress", 0, 536 (void **)&g_pfnMmGetSystemRoutineAddress); 500 537 } 501 538 } … … 641 678 Assert(g_HalInfo.fOkay); 642 679 //RTR0DBG_NT_DEBUG_LOG(("RTR0DbgKrnlInfoQuerySymbol: Calling RTR0DbgKrnlInfoQuerySymbol on NT kernel...\n")); 643 rc = rtR0DbgKrnlInfoLookupSymbol(&g_NtOsKrnlInfo, pszSymbol, ppvSymbol);680 rc = rtR0DbgKrnlInfoLookupSymbol(&g_NtOsKrnlInfo, pszSymbol, 0, ppvSymbol); 644 681 if (RT_FAILURE(rc)) 645 682 { 646 683 //RTR0DBG_NT_DEBUG_LOG(("RTR0DbgKrnlInfoQuerySymbol: Calling RTR0DbgKrnlInfoQuerySymbol on HAL kernel...\n")); 647 rc = rtR0DbgKrnlInfoLookupSymbol(&g_HalInfo, pszSymbol, ppvSymbol);684 rc = rtR0DbgKrnlInfoLookupSymbol(&g_HalInfo, pszSymbol, 0, ppvSymbol); 648 685 } 649 686 RTR0DBG_NT_DEBUG_LOG(("RTR0DbgKrnlInfoQuerySymbol: #1 returns %d *ppvSymbol=%p\n", rc, *ppvSymbol)); … … 654 691 int rc2 = VERR_SYMBOL_NOT_FOUND; 655 692 if (g_NtOsKrnlInfo.fOkay) 656 rc2 = rtR0DbgKrnlInfoLookupSymbol(&g_NtOsKrnlInfo, pszSymbol, ppvSymbol);693 rc2 = rtR0DbgKrnlInfoLookupSymbol(&g_NtOsKrnlInfo, pszSymbol, 0, ppvSymbol); 657 694 if (g_HalInfo.fOkay && rc2 == VERR_SYMBOL_NOT_FOUND) 658 rc2 = rtR0DbgKrnlInfoLookupSymbol(&g_HalInfo, pszSymbol, ppvSymbol);695 rc2 = rtR0DbgKrnlInfoLookupSymbol(&g_HalInfo, pszSymbol, 0, ppvSymbol); 659 696 if ( rc2 == VERR_SYMBOL_NOT_FOUND 660 697 && g_pfnMmGetSystemRoutineAddress) … … 741 778 if (pModInfo) 742 779 { 743 rc = rtR0DbgKrnlInfoLookupSymbol(pModInfo, pszSymbol, ppvSymbol);780 rc = rtR0DbgKrnlInfoLookupSymbol(pModInfo, pszSymbol, 0, ppvSymbol); 744 781 RTR0DBG_NT_DEBUG_LOG(("RTR0DbgKrnlInfoQuerySymbol: #3 returns %d *ppvSymbol=%p\n", rc, *ppvSymbol)); 745 782 }
Note:
See TracChangeset
for help on using the changeset viewer.