Add PhGetThreadTimes
@@ -966,7 +966,7 @@ PhGetThreadBreakOnTermination(
FORCEINLINE
NTSTATUS
PhSetThreadBreakOnTermination(
- _In_ HANDLE ProcessHandle,
+ _In_ HANDLE ThreadHandle,
_In_ BOOLEAN BreakOnTermination
)
{
@@ -975,13 +975,36 @@ PhSetThreadBreakOnTermination(
breakOnTermination = BreakOnTermination ? 1 : 0;
return NtSetInformationThread(
- ProcessHandle,
+ ThreadHandle,
ThreadBreakOnTermination,
&breakOnTermination,
sizeof(ULONG)
);
}
+/**
+ * Gets time information for a thread.
+ *
+ * \param ProcessHandle A handle to a thread. The handle must have
+ * THREAD_QUERY_LIMITED_INFORMATION access.
+ * \param Times A variable which receives the information.
+ */
+FORCEINLINE
+NTSTATUS
+PhGetThreadTimes(
+ _In_ HANDLE ThreadHandle,
+ _Out_ PKERNEL_USER_TIMES Times
+ )
+{
+ return NtQueryInformationThread(
+ ThreadHandle,
+ ThreadTimes,
+ Times,
+ sizeof(KERNEL_USER_TIMES),
+ NULL
+ );
+}
+
/**
* Sets a thread's affinity mask.
*
