DotNetTools: Change AppDomain threads column to always visible
@@ -178,6 +178,11 @@ VOID NTAPI ThreadsContextCreateCallback(
context->Type = THREAD_TREE_CONTEXT_TYPE;
context->ProcessId = threadsContext->Provider->ProcessId;
+ if (threadsContext->Provider->ProcessHandle)
+ {
+ PhGetProcessIsWow64(threadsContext->Provider->ProcessHandle, &context->IsWow64);
+ }
+
PhRegisterCallback(
&threadsContext->Provider->ThreadAddedEvent,
ThreadAddedHandler,
@@ -231,22 +236,31 @@ VOID ThreadTreeNewInitializing(
PPH_PLUGIN_TREENEW_INFORMATION info = Parameter;
PPH_THREADS_CONTEXT threadsContext;
PTHREAD_TREE_CONTEXT context;
+
BOOLEAN isDotNet;
+ ULONG flags = 0;
threadsContext = info->SystemContext;
context = PhPluginGetObjectExtension(PluginInstance, threadsContext, EmThreadsContextType);
- if (NT_SUCCESS(PhGetProcessIsDotNet(threadsContext->Provider->ProcessId, &isDotNet)) && isDotNet)
- {
-#if _WIN64
- HANDLE processHandle;
+ PhGetProcessIsDotNetEx(
+ threadsContext->Provider->ProcessId,
+ threadsContext->Provider->ProcessHandle,
+#ifdef _WIN64
+ PH_CLR_USE_SECTION_CHECK | PH_CLR_NO_WOW64_CHECK | (context->IsWow64 ? PH_CLR_KNOWN_IS_WOW64 : 0),
+#else
+ PH_CLR_USE_SECTION_CHECK,
+#endif
+ &isDotNet,
+ NULL
+ );
- if (NT_SUCCESS(PhOpenProcess(&processHandle, PROCESS_QUERY_LIMITED_INFORMATION, threadsContext->Provider->ProcessId)))
- {
- PhGetProcessIsWow64(processHandle, &context->IsWow64);
- NtClose(processHandle);
- }
+ if (!isDotNet && (flags & PH_CLR_JIT_PRESENT))
+ isDotNet = TRUE;
+ if (isDotNet)
+ {
+#if _WIN64
if (context->IsWow64)
{
context->ConnectedToPhSvc = PhUiConnectToPhSvcEx(NULL, Wow64PhSvcMode, FALSE);
@@ -256,17 +270,15 @@ VOID ThreadTreeNewInitializing(
{
PCLR_PROCESS_SUPPORT support;
- support = CreateClrProcessSupport(threadsContext->Provider->ProcessId);
-
- if (!support)
- return;
-
+ if (support = CreateClrProcessSupport(context->ProcessId))
+ {
context->Support = support;
}
+ }
+ }
AddTreeNewColumn(info, context, DNTHTNC_APPDOMAIN, TRUE, L"AppDomain", 120, PH_ALIGN_LEFT, 0, FALSE, ThreadTreeNewSortFunction);
}
-}
VOID ThreadTreeNewUninitializing(
_In_ PVOID Parameter
