Author: ion
Date: Sun Jul 16 00:10:13 2006
New Revision: 23067
URL:
http://svn.reactos.org/svn/reactos?rev=23067&view=rev
Log:
- Remove some debug prints that are not needed anymore
- NtCurrentTeb now returns the TEB instead of the KCPR, so re-enable the codepath that set
the CurrentLocale and IdealProcessor in the TEB from the KTHREAD.
Modified:
trunk/reactos/ntoskrnl/ps/thread.c
trunk/reactos/ntoskrnl/ps/win32.c
Modified: trunk/reactos/ntoskrnl/ps/thread.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ps/thread.c?rev=2…
==============================================================================
--- trunk/reactos/ntoskrnl/ps/thread.c (original)
+++ trunk/reactos/ntoskrnl/ps/thread.c Sun Jul 16 00:10:13 2006
@@ -9,10 +9,9 @@
/*
* Alex FIXMEs:
- * - CRITICAL: NtCurrentTeb returns KPCR.
* - MAJOR: Use Process Rundown
* - MAJOR: Use Process Pushlock Locks
- * - MAJOR: Implement Safe Referencing (See PsGetNextProcess/Thread).
+ * - MAJOR: Use Safe Referencing in PsGetNextProcess/Thread.
* - MAJOR: Use Guarded Mutex instead of Fast Mutex for Active Process Locks.
* - Generate process cookie for user-more thread.
* - Add security calls where necessary.
@@ -56,15 +55,14 @@
if (Thread->DeadThread)
{
/* Remember that we're dead */
- DPRINT1("This thread is already dead\n");
DeadThread = TRUE;
}
else
{
/* Get the Locale ID and save Preferred Proc */
- Teb = NtCurrentTeb(); /* FIXME: This returns KPCR!!! */
- //Teb->CurrentLocale = MmGetSessionLocaleId();
- //Teb->IdealProcessor = Thread->Tcb.IdealProcessor;
+ Teb = NtCurrentTeb();
+ Teb->CurrentLocale = MmGetSessionLocaleId();
+ Teb->IdealProcessor = Thread->Tcb.IdealProcessor;
}
/* Check if this is a system thread, or if we're hiding */
@@ -191,11 +189,7 @@
}
/* Check for success */
- if(!NT_SUCCESS(Status))
- {
- DPRINT1("Invalid Process Handle, or no handle given\n");
- return Status;
- }
+ if (!NT_SUCCESS(Status)) return Status;
/* Also make sure that User-Mode isn't trying to create a system thread */
if ((PreviousMode != KernelMode) && (Process == PsInitialSystemProcess))
@@ -217,7 +211,6 @@
if (!NT_SUCCESS(Status))
{
/* We failed; dereference the process and exit */
- DPRINT1("Failed to Create Thread Object\n");
ObDereferenceObject(Process);
return Status;
}
@@ -236,7 +229,6 @@
if (!Thread->Cid.UniqueThread)
{
/* We couldn't create the CID, dereference everything and fail */
- DPRINT1("Failed to create Thread Handle (CID)\n");
ObDereferenceObject(Process);
ObDereferenceObject(Thread);
return STATUS_INSUFFICIENT_RESOURCES;
@@ -628,11 +620,7 @@
if(KeGetPreviousMode() != KernelMode)
{
/* Make sure that we got a context */
- if (!ThreadContext)
- {
- DPRINT1("No context for User-Mode Thread!!\n");
- return STATUS_INVALID_PARAMETER;
- }
+ if (!ThreadContext) return STATUS_INVALID_PARAMETER;
/* Protect checks */
_SEH_TRY
@@ -761,9 +749,8 @@
DesiredAccess,
NULL,
&hThread);
- if (!NT_SUCCESS(Status)) DPRINT1("Could not open object by name\n");
- }
- else if (ClientId != NULL)
+ }
+ else if (ClientId)
{
/* Open by Thread ID */
if (ClientId->UniqueProcess)
@@ -780,11 +767,8 @@
&Thread);
}
- if(!NT_SUCCESS(Status))
- {
- DPRINT1("Failure to find Thread\n");
- return Status;
- }
+ /* Fail if we didn't find anything */
+ if(!NT_SUCCESS(Status)) return Status;
/* Open the Thread Object */
Status = ObOpenObjectByPointer(Thread,
@@ -794,10 +778,6 @@
PsThreadType,
PreviousMode,
&hThread);
- if(!NT_SUCCESS(Status))
- {
- DPRINT1("Failure to open Thread\n");
- }
/* Dereference the thread */
ObDereferenceObject(Thread);
@@ -809,7 +789,7 @@
}
/* Check for success */
- if(NT_SUCCESS(Status))
+ if (NT_SUCCESS(Status))
{
/* Protect against bad user-mode pointers */
_SEH_TRY
Modified: trunk/reactos/ntoskrnl/ps/win32.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ps/win32.c?rev=23…
==============================================================================
--- trunk/reactos/ntoskrnl/ps/win32.c (original)
+++ trunk/reactos/ntoskrnl/ps/win32.c Sun Jul 16 00:10:13 2006
@@ -72,23 +72,15 @@
PAGED_CODE();
/* Validate the previous mode */
- if (KeGetPreviousMode() == KernelMode)
- {
- DPRINT1("Danger: win32k call being made in kernel-mode?!\n");
- return STATUS_INVALID_PARAMETER;
- }
+ if (KeGetPreviousMode() == KernelMode) return STATUS_INVALID_PARAMETER;
/* Make sure win32k is here */
- if (!PspW32ProcessCallout)
- {
- DPRINT1("Danger: Win32K call attempted but Win32k not ready!\n");
- return STATUS_ACCESS_DENIED;
- }
+ if (!PspW32ProcessCallout) return STATUS_ACCESS_DENIED;
/* Make sure it's not already win32 */
if (Thread->Tcb.ServiceTable != KeServiceDescriptorTable)
{
- DPRINT1("Danger: Thread is already a win32 thread. Limit
bypassed?\n");
+ /* We're already a win32 thread */
return STATUS_ALREADY_WIN32;
}
@@ -123,11 +115,7 @@
{
/* Now tell win32k about us */
Status = PspW32ProcessCallout(Process, TRUE);
- if (!NT_SUCCESS(Status))
- {
- DPRINT1("Danger: Win32k wasn't happy about us!\n");
- return Status;
- }
+ if (!NT_SUCCESS(Status)) return Status;
}
/* Set the new service table */
@@ -139,7 +127,6 @@
if (!NT_SUCCESS(Status))
{
/* Revert our table */
- DPRINT1("Danger: Win32k wasn't happy about us!\n");
Thread->Tcb.ServiceTable = KeServiceDescriptorTable;
}