Changeset 56798 in vbox
- Timestamp:
- Jul 3, 2015 6:23:57 PM (10 years ago)
- svn:sync-xref-src-repo-rev:
- 101448
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/Support/SUPLibLdr.cpp
r56293 r56798 96 96 * Internal Functions * 97 97 *******************************************************************************/ 98 static int supLoadModule(const char *pszFilename, const char *pszModule, const char *pszSrvReqHandler, void **ppvImageBase); 99 static DECLCALLBACK(int) supLoadModuleResolveImport(RTLDRMOD hLdrMod, const char *pszModule, const char *pszSymbol, unsigned uSymbol, RTUINTPTR *pValue, void *pvUser); 98 static int supLoadModule(const char *pszFilename, const char *pszModule, const char *pszSrvReqHandler, 99 PRTERRINFO pErrInfo, void **ppvImageBase); 100 static DECLCALLBACK(int) supLoadModuleResolveImport(RTLDRMOD hLdrMod, const char *pszModule, const char *pszSymbol, 101 unsigned uSymbol, RTUINTPTR *pValue, void *pvUser); 100 102 101 103 … … 108 110 if (RT_SUCCESS(rc)) 109 111 { 110 rc = supLoadModule(pszFilename, pszModule, NULL, p pvImageBase);112 rc = supLoadModule(pszFilename, pszModule, NULL, pErrInfo, ppvImageBase); 111 113 if (RT_FAILURE(rc)) 112 114 RTErrInfoSetF(pErrInfo, rc, "SUPR3LoadModule: supLoadModule returned %Rrc", rc); … … 126 128 int rc = SUPR3HardenedVerifyPlugIn(pszFilename, NULL /*pErrInfo*/); 127 129 if (RT_SUCCESS(rc)) 128 rc = supLoadModule(pszFilename, pszModule, pszSrvReqHandler, ppvImageBase);130 rc = supLoadModule(pszFilename, pszModule, pszSrvReqHandler, NULL /*pErrInfo*/, ppvImageBase); 129 131 else 130 132 LogRel(("SUPR3LoadServiceModule: Verification of \"%s\" failed, rc=%Rrc\n", rc)); … … 132 134 } 133 135 136 137 /** 138 * Argument package for supLoadModuleResolveImport. 139 */ 140 typedef struct SUPLDRRESIMPARGS 141 { 142 const char *pszModule; 143 PRTERRINFO pErrInfo; 144 } SUPLDRRESIMPARGS, *PSUPLDRRESIMPARGS; 134 145 135 146 /** … … 147 158 const char *pszSymbol, unsigned uSymbol, RTUINTPTR *pValue, void *pvUser) 148 159 { 149 NOREF(hLdrMod); NOREF( pvUser); NOREF(uSymbol);160 NOREF(hLdrMod); NOREF(uSymbol); 150 161 AssertPtr(pValue); 151 162 AssertPtr(pvUser); 163 PSUPLDRRESIMPARGS pArgs = (PSUPLDRRESIMPARGS)pvUser; 152 164 153 165 /* … … 159 171 && strcmp(pszModule, "VMMR0.r0")) 160 172 { 161 AssertMsgFailed(("%s is importing from %s! (expected 'SUPR0.dll' or 'VMMR0.r0', case-sensitive)\n", pvUser, pszModule)); 162 return VERR_SYMBOL_NOT_FOUND; 173 AssertMsgFailed(("%s is importing from %s! (expected 'SUPR0.dll' or 'VMMR0.r0', case-sensitive)\n", pArgs->pszModule, pszModule)); 174 return RTErrInfoSetF(pArgs->pErrInfo, VERR_SYMBOL_NOT_FOUND, 175 "Unexpected import module '%s' in '%s'", pszModule, pArgs->pszModule); 163 176 } 164 177 … … 166 179 * No ordinals. 167 180 */ 168 if (pszSymbol < (const char*)0x10000) 169 { 170 AssertMsgFailed(("%s is importing by ordinal (ord=%d)\n", pvUser, (int)(uintptr_t)pszSymbol)); 171 return VERR_SYMBOL_NOT_FOUND; 181 if (uSymbol != ~0U) 182 { 183 AssertMsgFailed(("%s is importing by ordinal (ord=%d)\n", pArgs->pszModule, uSymbol)); 184 return RTErrInfoSetF(pArgs->pErrInfo, VERR_SYMBOL_NOT_FOUND, 185 "Unexpected ordinal import (%#x) in '%s'", uSymbol, pArgs->pszModule); 172 186 } 173 187 … … 254 268 pFunc++; 255 269 } 256 257 AssertLogRelMsgFailed(("%s is importing %s which we couldn't find\n", pvUser, pszSymbol)); 270 RTAssertMsg2Weak("%s is importing %s which we couldn't find\n", pArgs->pszModule, pszSymbol); 271 272 AssertLogRelMsgFailed(("%s is importing %s which we couldn't find\n", pArgs->pszModule, pszSymbol)); 258 273 if (g_uSupFakeMode) 259 274 { … … 261 276 return VINF_SUCCESS; 262 277 } 263 return VERR_SYMBOL_NOT_FOUND; 278 return RTErrInfoSetF(pArgs->pErrInfo, VERR_SYMBOL_NOT_FOUND, 279 "Unable to local imported symbol '%s%s%s' for module '%s'", 280 pszModule ? pszModule : "", 281 pszModule && *pszModule ? "." : "", 282 pArgs->pszModule); 264 283 } 265 284 … … 331 350 * @param pszFilename Name of the VMMR0 image file 332 351 */ 333 static int supLoadModule(const char *pszFilename, const char *pszModule, const char *pszSrvReqHandler, void **ppvImageBase) 352 static int supLoadModule(const char *pszFilename, const char *pszModule, const char *pszSrvReqHandler, 353 PRTERRINFO pErrInfo, void **ppvImageBase) 334 354 { 335 355 int rc; … … 413 433 * Get the image bits. 414 434 */ 435 436 SUPLDRRESIMPARGS Args = { pszModule, pErrInfo }; 415 437 rc = RTLdrGetBits(hLdrMod, &pLoadReq->u.In.abImage[0], (uintptr_t)OpenReq.u.Out.pvImageBase, 416 supLoadModuleResolveImport, (void *)pszModule);438 supLoadModuleResolveImport, &Args); 417 439 418 440 if (RT_SUCCESS(rc))
Note:
See TracChangeset
for help on using the changeset viewer.