KeGetPreviousMode (useless)

svn path=/trunk/; revision=562
This commit is contained in:
Emanuele Aliberti 1999-06-24 22:40:06 +00:00
parent 62cdaf7f99
commit 9ccf887c5a
6 changed files with 91 additions and 62 deletions

View file

@ -207,6 +207,8 @@ enum
IRP_MN_POWER_SEQUENCE,
};
/* Values returned by KeGetPreviousMode() */
#define KernelMode (0)
#define UserMode (1)

View file

@ -44,6 +44,7 @@ KIRQL KeGetCurrentIrql(VOID);
ULONG KeGetCurrentProcessorNumber(VOID);
ULONG KeGetDcacheFillSize(VOID);
PKTHREAD KeGetCurrentThread(VOID);
ULONG KeGetPreviousMode(VOID);
VOID KeInitializeCallbackRecord(PKBUGCHECK_CALLBACK_RECORD CallbackRecord);
VOID KeInitializeDeviceQueue(PKDEVICE_QUEUE DeviceQueue);
VOID KeInitializeDpc(PKDPC Dpc, PKDEFERRED_ROUTINE DeferredRoutine,

View file

@ -6,8 +6,10 @@
extern PEPROCESS SystemProcess;
extern HANDLE SystemProcessHandle;
extern POBJECT_TYPE PsThreadType;
extern POBJECT_TYPE PsProcessType;
/* ntoskrnl/ps/thread.c */
extern POBJECT_TYPE PsThreadType;
extern POBJECT_TYPE PsProcessType;
extern PETHREAD CurrentThread;
void PsInitThreadManagment(void);
VOID PsInitProcessManagment(VOID);

View file

@ -70,6 +70,7 @@ KeBugCheck
KeBugCheckEx
KeFlushIoBuffers
KeGetCurrentIrql
KeGetPreviousMode = KeGetPreviousMode@0
KeInitializeDpc
KeInitializeEvent
KeInitializeSpinLock

View file

@ -50,7 +50,7 @@ static BOOLEAN DoneInitYet = FALSE;
ULONG PiNrThreads = 0;
ULONG PiNrRunnableThreads = 0;
static PETHREAD CurrentThread = NULL;
PETHREAD CurrentThread = NULL;
static ULONG PiNextThreadUniqueId = 0;

View file

@ -18,6 +18,7 @@
/* FUNCTIONS *****************************************************************/
NTSTATUS
STDCALL
NtSetInformationThread (
HANDLE ThreadHandle,
THREADINFOCLASS ThreadInformationClass,
@ -25,85 +26,95 @@ NtSetInformationThread (
ULONG ThreadInformationLength
)
{
PETHREAD Thread;
NTSTATUS Status;
PTHREAD_BASIC_INFORMATION ThreadBasicInformationP;
PETHREAD Thread;
NTSTATUS Status;
PTHREAD_BASIC_INFORMATION ThreadBasicInformationP;
Status = ObReferenceObjectByHandle(ThreadHandle,
THREAD_SET_INFORMATION,
PsThreadType,
UserMode,
(PVOID*)&Thread,
NULL);
if (Status != STATUS_SUCCESS)
{
return(Status);
}
Status = ObReferenceObjectByHandle(
ThreadHandle,
THREAD_SET_INFORMATION,
PsThreadType,
UserMode,
(PVOID*) & Thread,
NULL
);
if (Status != STATUS_SUCCESS)
{
return Status;
}
switch (ThreadInformationClass)
{
case ThreadBasicInformation:
ThreadBasicInformationP = (PTHREAD_BASIC_INFORMATION)ThreadInformation;
ThreadBasicInformationP->ExitStatus = Thread->ExitStatus;
ThreadBasicInformationP->TebBaseAddress = Thread->Tcb.Teb;
ThreadBasicInformationP->AffinityMask = Thread->Tcb.Affinity;
ThreadBasicInformationP->BasePriority = Thread->Tcb.BasePriority;
ThreadBasicInformationP->UniqueThreadId = (ULONG)
Thread->Cid.UniqueThread;
Status = STATUS_SUCCESS;
break;
switch (ThreadInformationClass)
{
case ThreadBasicInformation:
ThreadBasicInformationP =
(PTHREAD_BASIC_INFORMATION) ThreadInformation;
ThreadBasicInformationP->ExitStatus =
Thread->ExitStatus;
ThreadBasicInformationP->TebBaseAddress =
Thread->Tcb.Teb;
ThreadBasicInformationP->AffinityMask =
Thread->Tcb.Affinity;
ThreadBasicInformationP->BasePriority =
Thread->Tcb.BasePriority;
ThreadBasicInformationP->UniqueThreadId =
(ULONG) Thread->Cid.UniqueThread;
Status = STATUS_SUCCESS;
break;
case ThreadTimes:
break;
case ThreadTimes:
break;
case ThreadPriority:
KeSetPriorityThread(&Thread->Tcb,*(KPRIORITY *)ThreadInformation);
Status = STATUS_SUCCESS;
break;
case ThreadPriority:
KeSetPriorityThread(
& Thread->Tcb,
* (KPRIORITY *) ThreadInformation
);
Status = STATUS_SUCCESS;
break;
case ThreadBasePriority:
break;
case ThreadBasePriority:
break;
case ThreadAffinityMask:
break;
case ThreadAffinityMask:
break;
case ThreadImpersonationToken:
break;
case ThreadImpersonationToken:
break;
case ThreadDescriptorTableEntry:
UNIMPLEMENTED;
break;
case ThreadDescriptorTableEntry:
UNIMPLEMENTED;
break;
case ThreadEventPair:
UNIMPLEMENTED;
break;
case ThreadEventPair:
UNIMPLEMENTED;
break;
case ThreadQuerySetWin32StartAddress:
break;
case ThreadQuerySetWin32StartAddress:
break;
case ThreadZeroTlsCell:
break;
case ThreadZeroTlsCell:
break;
case ThreadPerformanceCount:
break;
case ThreadPerformanceCount:
break;
case ThreadAmILastThread:
break;
case ThreadAmILastThread:
break;
case ThreadPriorityBoost:
break;
case ThreadPriorityBoost:
break;
default:
Status = STATUS_UNSUCCESSFUL;
}
ObDereferenceObject(Thread);
return(Status);
default:
Status = STATUS_UNSUCCESSFUL;
}
ObDereferenceObject(Thread);
return Status;
}
NTSTATUS
STDCALL
NtQueryInformationThread(
NtQueryInformationThread (
IN HANDLE ThreadHandle,
IN THREADINFOCLASS ThreadInformationClass,
OUT PVOID ThreadInformation,
@ -112,3 +123,15 @@ NtQueryInformationThread(
{
UNIMPLEMENTED
}
ULONG
STDCALL
KeGetPreviousMode (VOID)
{
/* CurrentThread is in ntoskrnl/ps/thread.c */
return (ULONG) CurrentThread->Tcb.PreviousMode;
}
/* EOF */