break;
}
+ // Skip any dynamic modules. The Request call below on some DACs crashes on dynamic modules.
+ ULONG32 flags;
+ if ((hr = pClrDataModule->GetFlags(&flags)) != S_OK) {
+ TRACE("MODULE: GetFlags FAILED %08x\n", hr);
+ continue;
+ }
+ if (flags & CLRDATA_MODULE_IS_DYNAMIC) {
+ TRACE("MODULE: Skipping dynamic module\n");
+ continue;
+ }
+
DacpGetModuleData moduleData;
if (SUCCEEDED(hr = moduleData.Request(pClrDataModule.GetPtr())))
{
ArrayHolder<WCHAR> wszUnicodeName = new WCHAR[MAX_LONGPATH + 1];
if (SUCCEEDED(hr = pClrDataModule->GetFileName(MAX_LONGPATH, nullptr, wszUnicodeName)))
{
- char* pszName = (char*)malloc(MAX_LONGPATH + 1);
- if (pszName == nullptr) {
- fprintf(stderr, "Allocating module name FAILED\n");
- result = false;
- break;
+ // If the module file name isn't empty
+ if (wszUnicodeName[0] != 0) {
+ char* pszName = (char*)malloc(MAX_LONGPATH + 1);
+ if (pszName == nullptr) {
+ fprintf(stderr, "Allocating module name FAILED\n");
+ result = false;
+ break;
+ }
+ sprintf_s(pszName, MAX_LONGPATH, "%S", (WCHAR*)wszUnicodeName);
+ TRACE(" %s\n", pszName);
+
+ // Change the module mapping name
+ ReplaceModuleMapping(moduleData.LoadedPEAddress, pszName);
}
- sprintf_s(pszName, MAX_LONGPATH, "%S", (WCHAR*)wszUnicodeName);
- TRACE(" %s\n", pszName);
-
- // Change the module mapping name
- ReplaceModuleMapping(moduleData.LoadedPEAddress, pszName);
}
else {
TRACE("\nModule.GetFileName FAILED %08x\n", hr);
COUNT_T peSize;
outGMD->LoadedPEAddress = TO_CDADDR(PTR_TO_TADDR(pPEFile->GetLoadedImageContents(&peSize)));
outGMD->LoadedPESize = (ULONG64)peSize;
- outGMD->IsFileLayout = pPEFile->GetLoaded()->IsFlat();
+
+ // Can not get the file layout for a dynamic module
+ if (!outGMD->IsDynamic)
+ {
+ outGMD->IsFileLayout = pPEFile->GetLoaded()->IsFlat();
+ }
}
// If there is a in memory symbol stream