- Timestamp:
- Jan 11, 2017 10:38:38 AM (8 years ago)
- Location:
- trunk/src/VBox/Runtime
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/ldr/ldrFile.cpp
r62477 r65239 243 243 244 244 /** 245 * Open a binary image file , extended version.245 * Open a binary image file. 246 246 * 247 247 * @returns iprt status code. 248 248 * @param pszFilename Image filename. 249 * @param fFlags Reserved, MBZ.249 * @param fFlags Valid RTLDR_O_XXX combination. 250 250 * @param enmArch CPU architecture specifier for the image to be loaded. 251 251 * @param phLdrMod Where to store the handle to the loader module. … … 253 253 RTDECL(int) RTLdrOpen(const char *pszFilename, uint32_t fFlags, RTLDRARCH enmArch, PRTLDRMOD phLdrMod) 254 254 { 255 LogFlow(("RTLdrOpen: pszFilename=%p:{%s} fFlags=%#x enmArch=%d phLdrMod=%p\n", 255 return RTLdrOpenEx(pszFilename, fFlags, enmArch, phLdrMod, NULL /*pErrInfo*/); 256 } 257 RT_EXPORT_SYMBOL(RTLdrOpen); 258 259 260 /** 261 * Open a binary image file, extended version. 262 * 263 * @returns iprt status code. 264 * @param pszFilename Image filename. 265 * @param fFlags Valid RTLDR_O_XXX combination. 266 * @param enmArch CPU architecture specifier for the image to be loaded. 267 * @param phLdrMod Where to store the handle to the loader module. 268 * @param pErrInfo Where to return extended error information. Optional. 269 */ 270 RTDECL(int) RTLdrOpenEx(const char *pszFilename, uint32_t fFlags, RTLDRARCH enmArch, PRTLDRMOD phLdrMod, PRTERRINFO pErrInfo) 271 { 272 LogFlow(("RTLdrOpenEx: pszFilename=%p:{%s} fFlags=%#x enmArch=%d phLdrMod=%p\n", 256 273 pszFilename, pszFilename, fFlags, enmArch, phLdrMod)); 257 274 AssertMsgReturn(!(fFlags & ~RTLDR_O_VALID_MASK), ("%#x\n", fFlags), VERR_INVALID_PARAMETER); … … 265 282 if (RT_SUCCESS(rc)) 266 283 { 267 rc = RTLdrOpenWithReader(pReader, fFlags, enmArch, phLdrMod, NULL);284 rc = RTLdrOpenWithReader(pReader, fFlags, enmArch, phLdrMod, pErrInfo); 268 285 if (RT_SUCCESS(rc)) 269 286 { 270 LogFlow(("RTLdrOpen : return %Rrc *phLdrMod=%p\n", rc, *phLdrMod));287 LogFlow(("RTLdrOpenEx: return %Rrc *phLdrMod=%p\n", rc, *phLdrMod)); 271 288 return rc; 272 289 } … … 274 291 } 275 292 *phLdrMod = NIL_RTLDRMOD; 276 LogFlow(("RTLdrOpen : return %Rrc\n", rc));277 return rc; 278 } 279 RT_EXPORT_SYMBOL(RTLdrOpen );293 LogFlow(("RTLdrOpenEx: return %Rrc\n", rc)); 294 return rc; 295 } 296 RT_EXPORT_SYMBOL(RTLdrOpenEx); 280 297 281 298 -
trunk/src/VBox/Runtime/testcase/tstLdr-2.cpp
r62724 r65239 94 94 static int testLdrOne(const char *pszFilename) 95 95 { 96 RTERRINFOSTATIC ErrInfo; 96 97 RTLDRMOD hLdrMod; 97 int rc = RTLdrOpen (pszFilename, 0, RTLDRARCH_WHATEVER, &hLdrMod);98 int rc = RTLdrOpenEx(pszFilename, 0, RTLDRARCH_WHATEVER, &hLdrMod, RTErrInfoInitStatic(&ErrInfo)); 98 99 if (RT_FAILURE(rc)) 99 100 { 100 101 RTPrintf("tstLdr: Failed to open '%s', rc=%Rrc. aborting test.\n", pszFilename, rc); 102 if (ErrInfo.szMsg[0]) 103 RTPrintf("tstLdr: %s\n", ErrInfo.szMsg); 101 104 Assert(hLdrMod == NIL_RTLDRMOD); 102 105 return 1; -
trunk/src/VBox/Runtime/testcase/tstLdr-3.cpp
r63063 r65239 302 302 * Load the module. 303 303 */ 304 RTERRINFOSTATIC ErrInfo; 304 305 g_uLoadAddr = (RTUINTPTR)RTStrToUInt64(argv[1]); 305 int rc = RTLdrOpen (argv[2], 0, RTLDRARCH_WHATEVER, &g_hLdrMod);306 int rc = RTLdrOpenEx(argv[2], 0, RTLDRARCH_WHATEVER, &g_hLdrMod, RTErrInfoInitStatic(&ErrInfo)); 306 307 if (RT_FAILURE(rc)) 307 308 { 308 309 RTPrintf("tstLdr-3: Failed to open '%s': %Rra\n", argv[2], rc); 310 if (ErrInfo.szMsg[0]) 311 RTPrintf("tstLdr-3: %s\n", ErrInfo.szMsg); 309 312 return 1; 310 313 }
Note:
See TracChangeset
for help on using the changeset viewer.