Changeset 74646 in vbox for trunk/src/VBox/Runtime/testcase
- Timestamp:
- Oct 6, 2018 9:03:45 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/testcase/tstLdr-3.cpp
r69111 r74646 226 226 } 227 227 228 static uint32_t g_iSegNo = 0; 229 static DECLCALLBACK(int) testEnumSegment1(RTLDRMOD hLdrMod, PCRTLDRSEG pSeg, void *pvUser) 230 { 231 if (hLdrMod != g_hLdrMod || pvUser != NULL) 232 return VERR_INTERNAL_ERROR_3; 233 RTPrintf("Seg#%02u: %RTptr LB %RTptr %s\n", g_iSegNo++, pSeg->RVA, pSeg->cbMapped, pSeg->pszName); 234 235 return VINF_SUCCESS; 236 } 237 228 238 229 239 /** … … 239 249 static DECLCALLBACK(int) testEnumSymbol1(RTLDRMOD hLdrMod, const char *pszSymbol, unsigned uSymbol, RTUINTPTR Value, void *pvUser) 240 250 { 241 RT_NOREF2(hLdrMod, pvUser); 251 if (hLdrMod != g_hLdrMod || pvUser != NULL) 252 return VERR_INTERNAL_ERROR_3; 242 253 RTPrintf(" %RTptr %s (%d)\n", Value, pszSymbol, uSymbol); 243 254 return VINF_SUCCESS; … … 354 365 rcRet++; 355 366 } 367 368 /* 369 * Query various properties. 370 */ 371 union 372 { 373 char szName[256]; 374 uint32_t iImpModule; 375 RTUUID Uuid; 376 } uBuf; 377 rc = RTLdrQueryProp(g_hLdrMod, RTLDRPROP_INTERNAL_NAME, &uBuf, sizeof(uBuf)); 378 if (RT_SUCCESS(rc)) 379 RTPrintf("tstLdr-3: Internal name: %s\n", uBuf.szName); 380 else if (rc != VERR_NOT_FOUND && rc != VERR_NOT_SUPPORTED) 381 { 382 RTPrintf("tstLdr-3: Internal name: failed - %Rrc\n", rc); 383 rcRet++; 384 } 385 386 uint32_t cImports = 0; 387 rc = RTLdrQueryProp(g_hLdrMod, RTLDRPROP_IMPORT_COUNT, &cImports, sizeof(cImports)); 388 if (RT_SUCCESS(rc)) 389 { 390 RTPrintf("tstLdr-3: Import count: %u\n", cImports); 391 for (uint32_t i = 0; i < cImports; i++) 392 { 393 uBuf.iImpModule = i; 394 rc = RTLdrQueryProp(g_hLdrMod, RTLDRPROP_IMPORT_MODULE, &uBuf, sizeof(uBuf)); 395 if (RT_SUCCESS(rc)) 396 RTPrintf("tstLdr-3: Import module #%u: %s\n", i, uBuf.szName); 397 else 398 { 399 RTPrintf("tstLdr-3: Import module #%u: failed - %Rrc\n", i, rc); 400 rcRet++; 401 } 402 } 403 } 404 else if (rc != VERR_NOT_FOUND && rc != VERR_NOT_SUPPORTED) 405 { 406 RTPrintf("tstLdr-3: Import count: failed - %Rrc\n", rc); 407 rcRet++; 408 } 409 410 rc = RTLdrQueryProp(g_hLdrMod, RTLDRPROP_UUID, &uBuf.Uuid, sizeof(uBuf.Uuid)); 411 if (RT_SUCCESS(rc)) 412 RTPrintf("tstLdr-3: UUID: %RTuuid\n", uBuf.Uuid); 413 else if (rc != VERR_NOT_FOUND && rc != VERR_NOT_SUPPORTED) 414 { 415 RTPrintf("tstLdr-3: UUID: failed - %Rrc\n", rc); 416 rcRet++; 417 } 418 419 /* 420 * Enumerate segments. 421 */ 422 RTPrintf("tstLdr-3: Segments:\n"); 423 rc = RTLdrEnumSegments(g_hLdrMod, testEnumSegment1, NULL); 424 if (RT_FAILURE(rc)) 425 { 426 RTPrintf("tstLdr-3: Failed to enumerate symbols: %Rra\n", rc); 427 rcRet++; 428 } 356 429 } 357 430 }
Note:
See TracChangeset
for help on using the changeset viewer.