Author: greatlrd
Date: Sun Jul 16 00:14:44 2006
New Revision: 23068
URL: http://svn.reactos.org/svn/reactos?rev=23068&view=rev
Log:
Tempary fixing kbdclass and mouse class u can not call on IoDeleteDevice before disabler the keyboard or mouse driver other wise it will bsod at shoutdown of ReactOS, create the frist boot problem. that we have seen on BootCD; Hpoussin I have comment out iodevice for now, please look at it when u got time.
Modified:
trunk/reactos/drivers/input/kbdclass/kbdclass.c
trunk/reactos/drivers/input/mouclass/mouclass.c
Modified: trunk/reactos/drivers/input/kbdclass/kbdclass.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/input/kbdclass/kbd…
==============================================================================
--- trunk/reactos/drivers/input/kbdclass/kbdclass.c (original)
+++ trunk/reactos/drivers/input/kbdclass/kbdclass.c Sun Jul 16 00:14:44 2006
@@ -126,7 +126,7 @@
PLIST_ENTRY Head = &((PCLASS_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->ListHead;
if (Head->Flink != Head)
{
- /* We have at least one device */
+ /* We have at least one keyboard */
PPORT_DEVICE_EXTENSION DevExt = CONTAINING_RECORD(Head->Flink, PORT_DEVICE_EXTENSION, ListEntry);
IoGetCurrentIrpStackLocation(Irp)->MajorFunction = IRP_MJ_INTERNAL_DEVICE_CONTROL;
IoSkipCurrentIrpStackLocation(Irp);
@@ -711,7 +711,8 @@
PCLASS_DEVICE_EXTENSION ClassDeviceExtension;
ClassDeviceExtension = (PCLASS_DEVICE_EXTENSION)DeviceExtension->ClassDO->DeviceExtension;
ExFreePool(ClassDeviceExtension->PortData);
- IoDeleteDevice(DeviceExtension->ClassDO);
+ /* FIXME BSOD for second boot when u press on finsih buttom or wait timeout */
+ //IoDeleteDevice(DeviceExtension->ClassDO);
}
}
if (Fdo)
Modified: trunk/reactos/drivers/input/mouclass/mouclass.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/input/mouclass/mou…
==============================================================================
--- trunk/reactos/drivers/input/mouclass/mouclass.c (original)
+++ trunk/reactos/drivers/input/mouclass/mouclass.c Sun Jul 16 00:14:44 2006
@@ -123,7 +123,7 @@
PLIST_ENTRY Head = &((PCLASS_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->ListHead;
if (Head->Flink != Head)
{
- /* We have at least one device */
+ /* We have at least one mouse */
PPORT_DEVICE_EXTENSION DevExt = CONTAINING_RECORD(Head->Flink, PORT_DEVICE_EXTENSION, ListEntry);
IoGetCurrentIrpStackLocation(Irp)->MajorFunction = IRP_MJ_INTERNAL_DEVICE_CONTROL;
IoSkipCurrentIrpStackLocation(Irp);
@@ -687,7 +687,8 @@
PCLASS_DEVICE_EXTENSION ClassDeviceExtension;
ClassDeviceExtension = (PCLASS_DEVICE_EXTENSION)DeviceExtension->ClassDO->DeviceExtension;
ExFreePool(ClassDeviceExtension->PortData);
- IoDeleteDevice(DeviceExtension->ClassDO);
+ /* FIXME BSOD for second boot when u press on finsih buttom or wait timeout */
+ // IoDeleteDevice(DeviceExtension->ClassDO);
}
}
if (Fdo)
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;
}
Author: ion
Date: Sat Jul 15 01:45:27 2006
New Revision: 23063
URL: http://svn.reactos.org/svn/reactos?rev=23063&view=rev
Log:
- Add IN/OUT annotations for KeWaitForSIngleObject
- Set the wait block outside the loop, small optimization in case we get alerted by an APC and have to loop again.
- Set the wait block pointer in the KTHREAD structure only *after* checking if a wait is actually needed. That way, if the object is already signaled, we don't set anything in the WaitBlockList.
- Small optimization: only set the caller's WAitBlock as the next wait block if a timer wasn't specificed, else we ended up overwriting the value.
- Small optimziation: don't write the thread in the wait block, this is a wait for a signle object so this isn't needed.
Modified:
trunk/reactos/ntoskrnl/ke/wait.c
Modified: trunk/reactos/ntoskrnl/ke/wait.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/wait.c?rev=230…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/wait.c (original)
+++ trunk/reactos/ntoskrnl/ke/wait.c Sat Jul 15 01:45:27 2006
@@ -379,11 +379,11 @@
*/
NTSTATUS
NTAPI
-KeWaitForSingleObject(PVOID Object,
- KWAIT_REASON WaitReason,
- KPROCESSOR_MODE WaitMode,
- BOOLEAN Alertable,
- PLARGE_INTEGER Timeout)
+KeWaitForSingleObject(IN PVOID Object,
+ IN KWAIT_REASON WaitReason,
+ IN KPROCESSOR_MODE WaitMode,
+ IN BOOLEAN Alertable,
+ IN PLARGE_INTEGER Timeout OPTIONAL)
{
PKMUTANT CurrentObject;
PKWAIT_BLOCK WaitBlock;
@@ -406,6 +406,7 @@
}
/* Start the actual Loop */
+ WaitBlock = &CurrentThread->WaitBlock[0];
do
{
/* Check if a kernel APC is pending and we're below APC_LEVEL */
@@ -420,10 +421,6 @@
{
/* Set default status */
CurrentThread->WaitStatus = STATUS_WAIT_0;
-
- /* Append wait block to the KTHREAD wait block list */
- WaitBlock = &CurrentThread->WaitBlock[0];
- CurrentThread->WaitBlockList = WaitBlock;
/* Get the Current Object */
CurrentObject = (PKMUTANT)Object;
@@ -460,12 +457,13 @@
goto DontWait;
}
+ /* Append wait block to the KTHREAD wait block list */
+ CurrentThread->WaitBlockList = WaitBlock;
+
/* Set up the Wait Block */
WaitBlock->Object = CurrentObject;
- WaitBlock->Thread = CurrentThread;
WaitBlock->WaitKey = (USHORT)(STATUS_SUCCESS);
WaitBlock->WaitType = WaitAny;
- WaitBlock->NextWaitBlock = WaitBlock;
/* Make sure we can satisfy the Alertable request */
KiCheckAlertability();
@@ -508,6 +506,11 @@
WaitStatus = STATUS_TIMEOUT;
goto DontWait;
}
+ }
+ else
+ {
+ /* No timer block, so just set our wait block as next */
+ WaitBlock->NextWaitBlock = WaitBlock;
}
/* Link the Object to this Wait Block */
Author: fireball
Date: Sat Jul 15 01:04:31 2006
New Revision: 23062
URL: http://svn.reactos.org/svn/reactos?rev=23062&view=rev
Log:
Add tests for Create/Open/Set/Cancel Timer in Executive. Under Win2003 SP1 works perfectly, however ReactOS hangs.
Added:
trunk/reactos/drivers/test/kmtest/ntos_ex.c
Modified:
trunk/reactos/drivers/test/kmtest/kmtest.c
trunk/reactos/drivers/test/kmtest/kmtest.rbuild
Modified: trunk/reactos/drivers/test/kmtest/kmtest.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/test/kmtest/kmtest…
==============================================================================
--- trunk/reactos/drivers/test/kmtest/kmtest.c (original)
+++ trunk/reactos/drivers/test/kmtest/kmtest.c Sat Jul 15 01:04:31 2006
@@ -106,6 +106,7 @@
VOID FASTCALL NtoskrnlIoMdlTest();
VOID FASTCALL NtoskrnlIoDeviceInterface();
VOID FASTCALL NtoskrnlObTest();
+VOID FASTCALL NtoskrnlExecutiveTests();
/*
* DriverEntry
@@ -116,6 +117,7 @@
PUNICODE_STRING RegistryPath)
{
DbgPrint("\n===============================================\nKernel Mode Regression Test driver starting...\n");
+ NtoskrnlExecutiveTests();
NtoskrnlIoDeviceInterface();
NtoskrnlIoMdlTest();
NtoskrnlObTest();
Modified: trunk/reactos/drivers/test/kmtest/kmtest.rbuild
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/test/kmtest/kmtest…
==============================================================================
--- trunk/reactos/drivers/test/kmtest/kmtest.rbuild (original)
+++ trunk/reactos/drivers/test/kmtest/kmtest.rbuild Sat Jul 15 01:04:31 2006
@@ -7,6 +7,7 @@
<file>kmtest.c</file>
<file>deviface.c</file>
<file>deviface_test.c</file>
+ <file>ntos_ex.c</file>
<file>ntos_io.c</file>
<file>ntos_ob.c</file>
<file>kmtest.rc</file>
Added: trunk/reactos/drivers/test/kmtest/ntos_ex.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/test/kmtest/ntos_e…
==============================================================================
--- trunk/reactos/drivers/test/kmtest/ntos_ex.c (added)
+++ trunk/reactos/drivers/test/kmtest/ntos_ex.c Sat Jul 15 01:04:31 2006
@@ -1,0 +1,110 @@
+/*
+ * NTOSKRNL Executive Regressions KM-Test
+ * ReactOS Kernel Mode Regression Testing framework
+ *
+ * Copyright 2006 Aleksey Bragin <aleksey(a)reactos.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; see the file COPYING.LIB.
+ * If not, write to the Free Software Foundation,
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+/* INCLUDES *******************************************************************/
+
+#include <ddk/ntddk.h>
+#include <ntifs.h>
+#include <ndk/ntndk.h>
+#include "kmtest.h"
+
+#define NDEBUG
+#include "debug.h"
+
+/* PRIVATE FUNCTIONS ***********************************************************/
+
+VOID
+ExTimerTest()
+{
+ UNICODE_STRING TimerName;
+ OBJECT_ATTRIBUTES ObjectAttributes;
+ HANDLE TimerHandle;
+ HANDLE HandleOpened;
+ LARGE_INTEGER DueTime;
+ BOOLEAN PreviousState, CurrentState;
+ NTSTATUS Status;
+
+ StartTest();
+
+ // Create the timer
+ RtlInitUnicodeString(&TimerName, L"\\TestTimer");
+ InitializeObjectAttributes(&ObjectAttributes, &TimerName, 0, NULL, NULL);
+ Status = ZwCreateTimer(&TimerHandle, TIMER_ALL_ACCESS,
+ &ObjectAttributes, NotificationTimer);
+ ok(Status == STATUS_SUCCESS, "ZwCreateTimer failed with Status=0x%08lX", Status);
+
+ // Open the timer
+ Status = ZwOpenTimer(&HandleOpened, TIMER_ALL_ACCESS, &ObjectAttributes);
+ ok(Status == STATUS_SUCCESS, "ZwOpenTimer failed with Status=0x%08lX", Status);
+
+ // Set the timer, to some rather high value so it doesn't expire
+ DueTime.LowPart = -10000;
+ DueTime.HighPart = -10;
+ PreviousState = TRUE;
+ Status = ZwSetTimer(HandleOpened, &DueTime, NULL, NULL, FALSE, 0L, &PreviousState);
+ ok(Status == STATUS_SUCCESS, "ZwSetTimer failed with Status=0x%08lX", Status);
+ ok(PreviousState == FALSE, "Incorrect PreviousState returned when setting the timer");
+
+ // Cancel the timer
+ CurrentState = TRUE;
+ Status = ZwCancelTimer(HandleOpened, &CurrentState);
+ ok(Status == STATUS_SUCCESS, "ZwCancelTimer failed with Status=0x%08lX", Status);
+ ok(CurrentState == FALSE, "Incorrect CurrentState returned when canceling the timer");
+
+ // Set the timer to some small value, because we'll wait for it to expire
+ DueTime.LowPart = -100;
+ DueTime.HighPart = -1;
+ PreviousState = TRUE;
+ Status = ZwSetTimer(HandleOpened, &DueTime, NULL, NULL, FALSE, 0L, &PreviousState);
+ ok(Status == STATUS_SUCCESS, "ZwSetTimer failed with Status=0x%08lX", Status);
+ ok(PreviousState == FALSE, "Incorrect PreviousState returned when setting the timer");
+
+ // Wait until it expires
+ Status = ZwWaitForSingleObject(HandleOpened, FALSE, NULL);
+ ok(Status == STATUS_SUCCESS, "ZwWaitForSingleObject failed with Status=0x%08lX", Status);
+
+ // And cancel it
+ CurrentState = FALSE;
+ Status = ZwCancelTimer(HandleOpened, &CurrentState);
+ ok(Status == STATUS_SUCCESS, "ZwCancelTimer failed with Status=0x%08lX", Status);
+ ok(CurrentState == TRUE, "Incorrect CurrentState returned when setting the timer");
+
+ // TODO: Add tests for a timer with APC routines
+
+ // Cleanup...
+ Status = ZwClose(HandleOpened);
+ ok(Status == STATUS_SUCCESS, "ZwClose failed with Status=0x%08lX", Status);
+
+ Status = ZwClose(TimerHandle);
+ ok(Status == STATUS_SUCCESS, "ZwClose failed with Status=0x%08lX", Status);
+
+ FinishTest("NTOSKRNL Executive Timer");
+}
+
+/* PUBLIC FUNCTIONS ***********************************************************/
+
+VOID
+FASTCALL
+NtoskrnlExecutiveTests()
+{
+ ExTimerTest();
+}