mirror of
https://github.com/mirror/processhacker
synced 2026-06-08 16:03:24 +00:00
began thread provider
git-svn-id: svn://svn.code.sf.net/p/processhacker/code@2560 21ef857c-d57f-4fe0-8362-d861dc6d29cd
This commit is contained in:
@@ -410,6 +410,10 @@
|
||||
RelativePath=".\symprv.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\thrdprv.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\verify.c"
|
||||
>
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#define THRDPRV_PRIVATE
|
||||
#include <ph.h>
|
||||
|
||||
PPH_OBJECT_TYPE PhThreadProviderType;
|
||||
PPH_OBJECT_TYPE PhThreadItemType;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user