diff --git a/2.x/trunk/ProcessHacker/ProcessHacker.vcproj b/2.x/trunk/ProcessHacker/ProcessHacker.vcproj
index 63739d99f..18a46f8ee 100644
--- a/2.x/trunk/ProcessHacker/ProcessHacker.vcproj
+++ b/2.x/trunk/ProcessHacker/ProcessHacker.vcproj
@@ -410,6 +410,10 @@
RelativePath=".\symprv.c"
>
+
+
diff --git a/2.x/trunk/ProcessHacker/include/base.h b/2.x/trunk/ProcessHacker/include/base.h
index 2fe8a2607..85024e2a1 100644
--- a/2.x/trunk/ProcessHacker/include/base.h
+++ b/2.x/trunk/ProcessHacker/include/base.h
@@ -30,6 +30,9 @@
#define PH_INT_STR_LEN 10
#define PH_INT_STR_LEN_1 (PH_INT_STR_LEN + 1)
+#define PH_LONG_STR_LEN 40
+#define PH_LONG_STR_LEN_1 (PH_LONG_STR_LEN + 1)
+
#define PH_PTR_STR_LEN 24
#define PH_PTR_STR_LEN_1 (PH_PTR_STR_LEN + 1)
@@ -49,6 +52,22 @@ FORCEINLINE VOID PhPrintInteger(
_snwprintf(Destination, PH_INT_STR_LEN, L"%d", Integer);
}
+FORCEINLINE VOID PhPrintLong64(
+ __out PWSTR Destination,
+ __in LONG64 Long64
+ )
+{
+ _snwprintf(Destination, PH_LONG_STR_LEN, L"%I64d", Long64);
+}
+
+FORCEINLINE VOID PhPrintULong64(
+ __out PWSTR Destination,
+ __in ULONG64 ULong64
+ )
+{
+ _snwprintf(Destination, PH_LONG_STR_LEN, L"%I64u", ULong64);
+}
+
FORCEINLINE VOID PhPrintPointer(
__out PWSTR Destination,
__in PVOID Pointer
diff --git a/2.x/trunk/ProcessHacker/include/ntexapi.h b/2.x/trunk/ProcessHacker/include/ntexapi.h
index b34610a0a..519a6a343 100644
--- a/2.x/trunk/ProcessHacker/include/ntexapi.h
+++ b/2.x/trunk/ProcessHacker/include/ntexapi.h
@@ -294,6 +294,48 @@ typedef struct _SYSTEM_SESSION_PROCESS_INFORMATION
PVOID Buffer;
} SYSTEM_SESSION_PROCESS_INFORMATION, *PSYSTEM_SESSION_PROCESS_INFORMATION;
+typedef enum _KWAIT_REASON
+{
+ Executive = 0,
+ FreePage = 1,
+ PageIn = 2,
+ PoolAllocation = 3,
+ DelayExecution = 4,
+ Suspended = 5,
+ UserRequest = 6,
+ WrExecutive = 7,
+ WrFreePage = 8,
+ WrPageIn = 9,
+ WrPoolAllocation = 10,
+ WrDelayExecution = 11,
+ WrSuspended = 12,
+ WrUserRequest = 13,
+ WrEventPair = 14,
+ WrQueue = 15,
+ WrLpcReceive = 16,
+ WrLpcReply = 17,
+ WrVirtualMemory = 18,
+ WrPageOut = 19,
+ WrRendezvous = 20,
+ Spare2 = 21,
+ Spare3 = 22,
+ Spare4 = 23,
+ Spare5 = 24,
+ WrCalloutStack = 25,
+ WrKernel = 26,
+ WrResource = 27,
+ WrPushLock = 28,
+ WrMutex = 29,
+ WrQuantumEnd = 30,
+ WrDispatchInt = 31,
+ WrPreempted = 32,
+ WrYieldExecution = 33,
+ WrFastMutex = 34,
+ WrGuardedMutex = 35,
+ WrRundown = 36,
+ MaximumWaitReason = 37
+} KWAIT_REASON, *PKWAIT_REASON;
+
typedef struct _SYSTEM_THREAD_INFORMATION
{
LARGE_INTEGER KernelTime;
@@ -306,7 +348,7 @@ typedef struct _SYSTEM_THREAD_INFORMATION
LONG BasePriority;
ULONG ContextSwitches;
ULONG ThreadState;
- ULONG WaitReason;
+ KWAIT_REASON WaitReason;
} SYSTEM_THREAD_INFORMATION, *PSYSTEM_THREAD_INFORMATION;
typedef struct _SYSTEM_EXTENDED_THREAD_INFORMATION
diff --git a/2.x/trunk/ProcessHacker/include/ph.h b/2.x/trunk/ProcessHacker/include/ph.h
index 631b94f2f..d5731196f 100644
--- a/2.x/trunk/ProcessHacker/include/ph.h
+++ b/2.x/trunk/ProcessHacker/include/ph.h
@@ -317,6 +317,42 @@ VOID PhUnregisterProvider(
__inout PPH_PROVIDER_REGISTRATION Registration
);
+// symprv
+
+#ifndef SYMPRV_PRIVATE
+extern PPH_OBJECT_TYPE PhSymbolProviderType;
+#endif
+
+typedef struct _PH_SYMBOL_PROVIDER
+{
+ PPH_LIST ModulesList;
+ HANDLE ProcessHandle;
+ BOOLEAN IsRealHandle;
+} PH_SYMBOL_PROVIDER, *PPH_SYMBOL_PROVIDER;
+
+typedef enum _PH_SYMBOL_RESOLVE_LEVEL
+{
+ PhsrlFunction,
+ PhsrlModule,
+ PhsrlAddress,
+ PhsrlInvalid
+} PH_SYMBOL_RESOLVE_LEVEL, *PPH_SYMBOL_RESOLVE_LEVEL;
+
+BOOLEAN PhSymbolProviderInitialization();
+
+VOID PhSymbolProviderDynamicImport();
+
+PPH_SYMBOL_PROVIDER PhCreateSymbolProvider(
+ __in HANDLE ProcessId
+ );
+
+BOOLEAN PhSymbolProviderLoadModule(
+ __in PPH_SYMBOL_PROVIDER SymbolProvider,
+ __in PWSTR FileName,
+ __in ULONG64 BaseAddress,
+ __in ULONG Size
+ );
+
// procprv
#ifndef PROCPRV_PRIVATE
@@ -516,33 +552,51 @@ VOID PhModuleProviderUpdate(
__in PVOID Object
);
-// symprv
+// thrdprv
-#ifndef SYMPRV_PRIVATE
-extern PPH_OBJECT_TYPE PhSymbolProviderType;
+#ifndef THRDPRV_PRIVATE
+extern PPH_OBJECT_TYPE PhThreadProviderType;
+extern PPH_OBJECT_TYPE PhThreadItemType;
#endif
-typedef struct _PH_SYMBOL_PROVIDER
+#define PH_PRIORITY_STR_LEN 14
+#define PH_PRIORITY_STR_LEN_1 (PH_PRIORITY_STR_LEN + 1)
+
+typedef struct _PH_THREAD_ITEM
{
- PPH_LIST ModulesList;
+ HANDLE ThreadId;
+
+ ULONG64 ContextSwitches;
+ ULONG64 ContextSwitchesDelta;
+ ULONG64 Cycles;
+ ULONG64 CyclesDelta;
+ LONG Priority;
+ ULONG64 StartAddress;
+ PPH_STRING StartAddressString;
+ PH_SYMBOL_RESOLVE_LEVEL StartAddressResolveLevel;
+ KWAIT_REASON WaitReason;
+
+ BOOLEAN IsGuiThread;
+ BOOLEAN JustResolved;
+
+ WCHAR ThreadIdString[PH_INT_STR_LEN_1];
+ WCHAR ContextSwitchesDeltaString[PH_LONG_STR_LEN_1];
+ WCHAR CyclesDeltaString[PH_LONG_STR_LEN_1];
+ WCHAR PriorityString[PH_PRIORITY_STR_LEN_1];
+} PH_THREAD_ITEM, *PPH_THREAD_ITEM;
+
+typedef struct _PH_THREAD_PROVIDER
+{
+ PPH_HASHTABLE ThreadHashtable;
+ PH_FAST_LOCK ThreadHashtableLock;
+ PH_CALLBACK ThreadAddedEvent;
+ PH_CALLBACK ThreadModifiedEvent;
+ PH_CALLBACK ThreadRemovedEvent;
+ ULONG RunCount;
+
+ HANDLE ProcessId;
HANDLE ProcessHandle;
- BOOLEAN IsRealHandle;
-} PH_SYMBOL_PROVIDER, *PPH_SYMBOL_PROVIDER;
-
-BOOLEAN PhSymbolProviderInitialization();
-
-VOID PhSymbolProviderDynamicImport();
-
-PPH_SYMBOL_PROVIDER PhCreateSymbolProvider(
- __in HANDLE ProcessId
- );
-
-BOOLEAN PhSymbolProviderLoadModule(
- __in PPH_SYMBOL_PROVIDER SymbolProvider,
- __in PWSTR FileName,
- __in ULONG64 BaseAddress,
- __in ULONG Size
- );
+} PH_THREAD_PROVIDER, *PPH_THREAD_PROVIDER;
// support
diff --git a/2.x/trunk/ProcessHacker/thrdprv.c b/2.x/trunk/ProcessHacker/thrdprv.c
new file mode 100644
index 000000000..2825853de
--- /dev/null
+++ b/2.x/trunk/ProcessHacker/thrdprv.c
@@ -0,0 +1,29 @@
+/*
+ * Process Hacker -
+ * thread provider
+ *
+ * Copyright (C) 2010 wj32
+ *
+ * This file is part of Process Hacker.
+ *
+ * Process Hacker is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Process Hacker is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Process Hacker. If not, see .
+ */
+
+#define THRDPRV_PRIVATE
+#include
+
+PPH_OBJECT_TYPE PhThreadProviderType;
+PPH_OBJECT_TYPE PhThreadItemType;
+
+