1. implemented GetThreadSelectorEntry()

2. added missing DESCRIPTOR_TABLE_ENTRY structure

svn path=/trunk/; revision=11037
This commit is contained in:
Thomas Bluemel 2004-09-24 20:55:58 +00:00
parent 29df1f045e
commit 9e91360716
2 changed files with 28 additions and 13 deletions

View file

@ -1,4 +1,4 @@
/* $Id: thread.c,v 1.52 2004/09/19 12:45:55 weiden Exp $ /* $Id: thread.c,v 1.53 2004/09/24 20:55:58 weiden Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries * PROJECT: ReactOS system libraries
@ -365,14 +365,13 @@ GetThreadTimes(HANDLE hThread,
LPFILETIME lpUserTime) LPFILETIME lpUserTime)
{ {
KERNEL_USER_TIMES KernelUserTimes; KERNEL_USER_TIMES KernelUserTimes;
ULONG ReturnLength;
NTSTATUS Status; NTSTATUS Status;
Status = NtQueryInformationThread(hThread, Status = NtQueryInformationThread(hThread,
ThreadTimes, ThreadTimes,
&KernelUserTimes, &KernelUserTimes,
sizeof(KERNEL_USER_TIMES), sizeof(KERNEL_USER_TIMES),
&ReturnLength); NULL);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
SetLastErrorByStatus(Status); SetLastErrorByStatus(Status);
@ -445,14 +444,13 @@ GetExitCodeThread(HANDLE hThread,
LPDWORD lpExitCode) LPDWORD lpExitCode)
{ {
THREAD_BASIC_INFORMATION ThreadBasic; THREAD_BASIC_INFORMATION ThreadBasic;
ULONG DataWritten;
NTSTATUS Status; NTSTATUS Status;
Status = NtQueryInformationThread(hThread, Status = NtQueryInformationThread(hThread,
ThreadBasicInformation, ThreadBasicInformation,
&ThreadBasic, &ThreadBasic,
sizeof(THREAD_BASIC_INFORMATION), sizeof(THREAD_BASIC_INFORMATION),
&DataWritten); NULL);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
SetLastErrorByStatus(Status); SetLastErrorByStatus(Status);
@ -543,7 +541,6 @@ SetThreadAffinityMask(HANDLE hThread,
{ {
THREAD_BASIC_INFORMATION ThreadBasic; THREAD_BASIC_INFORMATION ThreadBasic;
KAFFINITY AffinityMask; KAFFINITY AffinityMask;
ULONG DataWritten;
NTSTATUS Status; NTSTATUS Status;
AffinityMask = (KAFFINITY)dwThreadAffinityMask; AffinityMask = (KAFFINITY)dwThreadAffinityMask;
@ -552,7 +549,7 @@ SetThreadAffinityMask(HANDLE hThread,
ThreadBasicInformation, ThreadBasicInformation,
&ThreadBasic, &ThreadBasic,
sizeof(THREAD_BASIC_INFORMATION), sizeof(THREAD_BASIC_INFORMATION),
&DataWritten); NULL);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
SetLastErrorByStatus(Status); SetLastErrorByStatus(Status);
@ -602,14 +599,13 @@ int STDCALL
GetThreadPriority(HANDLE hThread) GetThreadPriority(HANDLE hThread)
{ {
THREAD_BASIC_INFORMATION ThreadBasic; THREAD_BASIC_INFORMATION ThreadBasic;
ULONG DataWritten;
NTSTATUS Status; NTSTATUS Status;
Status = NtQueryInformationThread(hThread, Status = NtQueryInformationThread(hThread,
ThreadBasicInformation, ThreadBasicInformation,
&ThreadBasic, &ThreadBasic,
sizeof(THREAD_BASIC_INFORMATION), sizeof(THREAD_BASIC_INFORMATION),
&DataWritten); NULL);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
SetLastErrorByStatus(Status); SetLastErrorByStatus(Status);
@ -628,14 +624,13 @@ GetThreadPriorityBoost(IN HANDLE hThread,
OUT PBOOL pDisablePriorityBoost) OUT PBOOL pDisablePriorityBoost)
{ {
ULONG PriorityBoost; ULONG PriorityBoost;
ULONG DataWritten;
NTSTATUS Status; NTSTATUS Status;
Status = NtQueryInformationThread(hThread, Status = NtQueryInformationThread(hThread,
ThreadPriorityBoost, ThreadPriorityBoost,
&PriorityBoost, &PriorityBoost,
sizeof(ULONG), sizeof(ULONG),
&DataWritten); NULL);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
SetLastErrorByStatus(Status); SetLastErrorByStatus(Status);
@ -682,8 +677,23 @@ GetThreadSelectorEntry(IN HANDLE hThread,
IN DWORD dwSelector, IN DWORD dwSelector,
OUT LPLDT_ENTRY lpSelectorEntry) OUT LPLDT_ENTRY lpSelectorEntry)
{ {
SetLastError(ERROR_CALL_NOT_IMPLEMENTED); DESCRIPTOR_TABLE_ENTRY DescriptionTableEntry;
return(FALSE); NTSTATUS Status;
DescriptionTableEntry.Selector = dwSelector;
Status = NtQueryInformationThread(hThread,
ThreadDescriptorTableEntry,
&DescriptionTableEntry,
sizeof(DESCRIPTOR_TABLE_ENTRY),
NULL);
if(!NT_SUCCESS(Status))
{
SetLastErrorByStatus(Status);
return FALSE;
}
*lpSelectorEntry = DescriptionTableEntry.Descriptor;
return TRUE;
} }

View file

@ -1254,6 +1254,11 @@ typedef struct _KERNEL_USER_TIMES {
LARGE_INTEGER UserTime; LARGE_INTEGER UserTime;
} KERNEL_USER_TIMES, *PKERNEL_USER_TIMES; } KERNEL_USER_TIMES, *PKERNEL_USER_TIMES;
typedef struct _DESCRIPTOR_TABLE_ENTRY {
ULONG Selector;
LDT_ENTRY Descriptor;
} DESCRIPTOR_TABLE_ENTRY, *PDESCRIPTOR_TABLE_ENTRY;
NTOSAPI NTOSAPI
NTSTATUS NTSTATUS
NTAPI NTAPI