Skip to content

Commit 7fa3b2f

Browse files
committed
DotNetTools: Fix missing .NET6 assemblies
1 parent 1e0d018 commit 7fa3b2f

File tree

2 files changed

+45
-5
lines changed

2 files changed

+45
-5
lines changed

plugins/DotNetTools/asmpage.c

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1598,7 +1598,7 @@ NTSTATUS DotNetTraceQueryThreadStart(
15981598
}
15991599
}
16001600

1601-
if ((context->ClrVersions & PH_CLR_VERSION_4_ABOVE) || (context->ClrVersions & PH_CLR_CORELIB_PRESENT))
1601+
if ((context->ClrVersions & PH_CLR_VERSION_4_ABOVE) || (context->ClrVersions & PH_CLR_CORE_3_0_ABOVE) || (context->ClrVersions & PH_CLR_CORELIB_PRESENT))
16021602
{
16031603
result = UpdateDotNetTraceInfoWithTimeout(context, FALSE, &timeout);
16041604

@@ -1779,13 +1779,22 @@ VOID CreateDotNetTraceQueryThread(
17791779
context->NodeList = PhCreateList(64);
17801780
context->NodeRootList = PhCreateList(2);
17811781

1782-
PhGetProcessIsDotNetEx(
1782+
if (!NT_SUCCESS(PhGetProcessIsDotNetEx(
17831783
ProcessId,
17841784
NULL,
1785-
0,
1785+
PH_CLR_USE_SECTION_CHECK,
17861786
NULL,
17871787
&context->ClrVersions
1788-
);
1788+
)))
1789+
{
1790+
PhGetProcessIsDotNetEx(
1791+
ProcessId,
1792+
NULL,
1793+
0,
1794+
NULL,
1795+
&context->ClrVersions
1796+
);
1797+
}
17891798

17901799
if (EnableTrace)
17911800
PhQueueItemWorkQueue(PhGetGlobalWorkQueue(), DotNetTraceQueryThreadStart, context);

plugins/DotNetTools/clrsup.c

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1081,6 +1081,7 @@ static BOOLEAN NTAPI DnpGetCoreClrPathCallback(
10811081

10821082
_Success_(return)
10831083
BOOLEAN DnGetProcessCoreClrPath(
1084+
_In_ HANDLE ProcessId,
10841085
_In_ ICLRDataTarget* DataTarget,
10851086
_Out_ PPH_STRING *FileName
10861087
)
@@ -1112,7 +1113,33 @@ BOOLEAN DnGetProcessCoreClrPath(
11121113
}
11131114

11141115
if (!context.FileName)
1116+
{
1117+
//PPH_PROCESS_ITEM processItem;
1118+
//
1119+
//// This image is probably 'SelfContained' since we couldn't find coreclr.dll,
1120+
//// return the path to the executable so we can check the embedded CLRDEBUGINFO. (dmex)
1121+
//
1122+
//if (processItem = PhReferenceProcessItem(ProcessId))
1123+
//{
1124+
// if (!PhIsNullOrEmptyString(processItem->FileName))
1125+
// {
1126+
// *FileName = PhReferenceObject(processItem->FileName);
1127+
// PhDereferenceObject(processItem);
1128+
// return TRUE;
1129+
// }
1130+
//
1131+
// PhDereferenceObject(processItem);
1132+
//}
1133+
//
1134+
//PPH_STRING fileName;
1135+
//if (NT_SUCCESS(PhGetProcessImageFileNameByProcessId(ProcessId, &fileName)))
1136+
//{
1137+
// *FileName = fileName;
1138+
// return TRUE;
1139+
//}
1140+
11151141
return FALSE;
1142+
}
11161143

11171144
// DAC copies the debuginfo resource from the process memory. (dmex)
11181145
//PH_REMOTE_MAPPED_IMAGE remoteMappedImage;
@@ -1161,7 +1188,7 @@ PVOID DnLoadMscordaccore(
11611188
ULONG dataTargetTimeStamp = 0;
11621189
ULONG dataTargetSizeOfImage = 0;
11631190

1164-
if (DnGetProcessCoreClrPath(Target, &dataTargetFileName))
1191+
if (DnGetProcessCoreClrPath(ProcessId, Target, &dataTargetFileName))
11651192
{
11661193
PVOID imageBaseAddress;
11671194

@@ -1191,6 +1218,8 @@ PVOID DnLoadMscordaccore(
11911218
}
11921219

11931220
dataTargetDirectory = PhGetBaseDirectory(dataTargetFileName);
1221+
1222+
PhDereferenceObject(dataTargetFileName);
11941223
}
11951224

11961225
if (!(directoryPath = PhExpandEnvironmentStrings(&mscordaccorePathSr)))
@@ -1267,6 +1296,8 @@ PVOID DnLoadMscordaccore(
12671296
&mscordaccoreNameSr
12681297
);
12691298

1299+
PhMoveReference(&fileName, PhGetFileName(fileName));
1300+
12701301
verifyResult = PhVerifyFile(
12711302
PhGetString(fileName),
12721303
&signerName

0 commit comments

Comments
 (0)