ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
March 2005
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
26 participants
609 discussions
Start a n
N
ew thread
[ion] 14175: Update ETHREAD fields and termination port stucture to XP, and do necessary code changes. This makes reaping even faster. It's 2:30am, i hope there's no bugs ; -)
by ion@svn.reactos.com
Update ETHREAD fields and termination port stucture to XP, and do necessary code changes. This makes reaping even faster. It's 2:30am, i hope there's no bugs ;-) Modified: trunk/reactos/ntoskrnl/include/internal/port.h Modified: trunk/reactos/ntoskrnl/include/internal/ps.h Modified: trunk/reactos/ntoskrnl/ke/kthread.c Modified: trunk/reactos/ntoskrnl/ps/create.c Modified: trunk/reactos/ntoskrnl/ps/kill.c Modified: trunk/reactos/ntoskrnl/ps/suspend.c Modified: trunk/reactos/ntoskrnl/ps/thread.c _____ Modified: trunk/reactos/ntoskrnl/include/internal/port.h --- trunk/reactos/ntoskrnl/include/internal/port.h 2005-03-18 05:53:04 UTC (rev 14174) +++ trunk/reactos/ntoskrnl/include/internal/port.h 2005-03-18 07:19:30 UTC (rev 14175) @@ -52,7 +52,7 @@ } EPORT_CONNECT_REPLY_MESSAGE, *PEPORT_CONNECT_REPLY_MESSAGE; typedef struct _TERMINATION_PORT { - LIST_ENTRY Links; + struct _TERMINATION_PORT *Next; PVOID Port; } TERMINATION_PORT, *PTERMINATION_PORT; _____ Modified: trunk/reactos/ntoskrnl/include/internal/ps.h --- trunk/reactos/ntoskrnl/include/internal/ps.h 2005-03-18 05:53:04 UTC (rev 14174) +++ trunk/reactos/ntoskrnl/include/internal/ps.h 2005-03-18 07:19:30 UTC (rev 14175) @@ -156,6 +156,7 @@ #include <pshpack1.h> +/* This needs to be fixed ASAP! */ typedef struct _ETHREAD { KTHREAD Tcb; @@ -169,7 +170,10 @@ NTSTATUS ExitStatus; PVOID OfsChain; LIST_ENTRY PostBlockList; - LIST_ENTRY TerminationPortList; + union { + struct _TERMINATION_PORT *TerminationPort; + struct _ETHREAD* ReaperLink; + }; KSPIN_LOCK ActiveTimerListLock; LIST_ENTRY ActiveTimerListHead; CLIENT_ID Cid; _____ Modified: trunk/reactos/ntoskrnl/ke/kthread.c --- trunk/reactos/ntoskrnl/ke/kthread.c 2005-03-18 05:53:04 UTC (rev 14174) +++ trunk/reactos/ntoskrnl/ke/kthread.c 2005-03-18 07:19:30 UTC (rev 14175) @@ -25,6 +25,7 @@ static ULONG PriorityListMask = 0; ULONG IdleProcessorMask = 0; extern BOOLEAN DoneInitYet; +extern PETHREAD PspReaperList; /* FUNCTIONS *****************************************************************/ @@ -331,13 +332,13 @@ PKTHREAD CurrentThread = KeGetCurrentThread(); /* Non-alertable kernel-mode suspended wait */ - DPRINT1("Waiting...\n"); + DPRINT("Waiting...\n"); KeWaitForSingleObject(&CurrentThread->SuspendSemaphore, Suspended, KernelMode, FALSE, NULL); - DPRINT1("Done Waiting\n"); + DPRINT("Done Waiting\n"); } VOID @@ -389,7 +390,7 @@ ULONG PreviousCount; KIRQL OldIrql; - DPRINT1("KeResumeThread (Thread %p called). %x, %x\n", Thread, Thread->SuspendCount, Thread->FreezeCount); + DPRINT("KeResumeThread (Thread %p called). %x, %x\n", Thread, Thread->SuspendCount, Thread->FreezeCount); /* Lock the Dispatcher */ OldIrql = KeAcquireDispatcherDatabaseLock(); @@ -428,7 +429,7 @@ ULONG PreviousCount; KIRQL OldIrql; - DPRINT1("KeSuspendThread (Thread %p called). %x, %x\n", Thread, Thread->SuspendCount, Thread->FreezeCount); + DPRINT("KeSuspendThread (Thread %p called). %x, %x\n", Thread, Thread->SuspendCount, Thread->FreezeCount); /* Lock the Dispatcher */ OldIrql = KeAcquireDispatcherDatabaseLock(); @@ -802,6 +803,7 @@ /* Set up the Suspend Counts */ Thread->FreezeCount = 0; Thread->SuspendCount = 0; + ((PETHREAD)Thread)->ReaperLink = NULL; /* Union. Will also clear termination port */ /* Do x86 specific part */ } @@ -1194,18 +1196,21 @@ PKTHREAD Thread = KeGetCurrentThread(); /* Lock the Dispatcher Database and the APC Queue */ - DPRINT1("Terminating\n"); + DPRINT("Terminating\n"); OldIrql = KeAcquireDispatcherDatabaseLock(); /* Insert into the Reaper List */ - InsertTailList(&PspReaperListHead, &((PETHREAD)Thread)->TerminationPortList); + DPRINT("List: %p\n", PspReaperList); + ((PETHREAD)Thread)->ReaperLink = PspReaperList; + PspReaperList = (PETHREAD)Thread; + DPRINT("List: %p\n", PspReaperList); /* Check if it's active */ if (PspReaping == FALSE) { /* Activate it. We use the internal function for speed, and use the Hyper Critical Queue */ PspReaping = TRUE; - DPRINT1("Terminating\n"); + DPRINT("Terminating\n"); KiInsertQueue(&ExWorkerQueue[HyperCriticalWorkQueue].WorkerQueue, &PspReaperWorkItem.List, FALSE); @@ -1214,7 +1219,7 @@ /* Handle Kernel Queues */ if (Thread->Queue) { - DPRINT1("Waking Queue\n"); + DPRINT("Waking Queue\n"); RemoveEntryList(&Thread->QueueListEntry); KiWakeQueue(Thread->Queue); } _____ Modified: trunk/reactos/ntoskrnl/ps/create.c --- trunk/reactos/ntoskrnl/ps/create.c 2005-03-18 05:53:04 UTC (rev 14174) +++ trunk/reactos/ntoskrnl/ps/create.c 2005-03-18 07:19:30 UTC (rev 14175) @@ -93,7 +93,6 @@ DPRINT("Thread = %x\n",Thread); KeInitializeThread(&Process->Pcb, &Thread->Tcb, First); - InitializeListHead(&Thread->TerminationPortList); InitializeListHead(&Thread->ActiveTimerListHead); KeInitializeSpinLock(&Thread->ActiveTimerListLock); InitializeListHead(&Thread->IrpList); _____ Modified: trunk/reactos/ntoskrnl/ps/kill.c --- trunk/reactos/ntoskrnl/ps/kill.c 2005-03-18 05:53:04 UTC (rev 14174) +++ trunk/reactos/ntoskrnl/ps/kill.c 2005-03-18 07:19:30 UTC (rev 14175) @@ -18,7 +18,7 @@ #define TAG_TERMINATE_APC TAG('T', 'A', 'P', 'C') -LIST_ENTRY PspReaperListHead; +PETHREAD PspReaperList = NULL; WORK_QUEUE_ITEM PspReaperWorkItem; BOOLEAN PspReaping = FALSE; extern LIST_ENTRY PsActiveProcessHead; @@ -31,30 +31,51 @@ PspReapRoutine(PVOID Context) { KIRQL OldIrql; - PETHREAD Thread; - PLIST_ENTRY ListEntry; + PETHREAD Thread, NewThread; /* Acquire lock */ DPRINT("Evil reaper running!!\n"); OldIrql = KeAcquireDispatcherDatabaseLock(); - /* Loop the reap list */ - while((ListEntry = RemoveHeadList(&PspReaperListHead)) != &PspReaperListHead) { + /* Get the first Thread Entry */ + Thread = PspReaperList; + PspReaperList = NULL; + DPRINT("PspReaperList: %x\n", Thread); + + /* Check to see if the list is empty */ + do { - /* Get the Current Thread to Terminate */ - Thread = CONTAINING_RECORD(ListEntry, ETHREAD, TerminationPortList); - /* Unlock the Dispatcher */ KeReleaseDispatcherDatabaseLock(OldIrql); - - /* Remove the Reference */ - ObDereferenceObject(Thread); - /* Reacquire the Lock */ + /* Is there a thread on the list? */ + while (Thread) { + + /* Get the next Thread */ + DPRINT("Thread: %x\n", Thread); + DPRINT("Thread: %x\n", Thread->ReaperLink); + NewThread = Thread->ReaperLink; + + /* Remove reference to current thread */ + ObDereferenceObject(Thread); + + /* Move to next Thread */ + Thread = NewThread; + } + + /* No more linked threads... Reacquire the Lock */ OldIrql = KeAcquireDispatcherDatabaseLock(); - } + + /* Now try to get a new thread from the list */ + Thread = PspReaperList; + PspReaperList = NULL; + DPRINT("PspReaperList: %x\n", Thread); + + /* Loop again if there is a new thread */ + } while (Thread); PspReaping = FALSE; + DPRINT("Done reaping\n"); KeReleaseDispatcherDatabaseLock(OldIrql); } @@ -158,7 +179,6 @@ PEPROCESS CurrentProcess; SIZE_T Length = PAGE_SIZE; PVOID TebBlock; - PLIST_ENTRY CurrentEntry; PTERMINATION_PORT TerminationPort; DPRINT("PsTerminateCurrentThread(ExitStatus %x)\n", ExitStatus); @@ -204,19 +224,19 @@ } /* Process the Termination Ports */ - while ((CurrentEntry = RemoveHeadList(&CurrentThread->TerminationPortList)) != - &CurrentThread->TerminationPortList) { + TerminationPort = CurrentThread->TerminationPort; + DPRINT("TerminationPort: %p\n", TerminationPort); + while (TerminationPort) { - /* Get the Termination Port */ - TerminationPort = CONTAINING_RECORD(CurrentEntry, - TERMINATION_PORT, - Links); - /* Send the LPC Message */ LpcSendTerminationPort(TerminationPort->Port, CurrentThread->CreateTime); /* Free the Port */ ExFreePool(TerminationPort); + + /* Get the next one */ + TerminationPort = TerminationPort->Next; + DPRINT("TerminationPort: %p\n", TerminationPort); } /* Rundown Win32 Structures */ @@ -508,6 +528,7 @@ NTSTATUS Status; PTERMINATION_PORT TerminationPort; PVOID TerminationLpcPort; + PETHREAD Thread; PAGED_CODE(); @@ -530,8 +551,12 @@ TAG('P', 's', 'T', '=')))) { /* Associate the Port */ + Thread = PsGetCurrentThread(); TerminationPort->Port = TerminationLpcPort; - InsertTailList(&PsGetCurrentThread()->TerminationPortList, &TerminationPort->Links); + DPRINT("TerminationPort: %p\n", TerminationPort); + TerminationPort->Next = Thread->TerminationPort; + Thread->TerminationPort = TerminationPort; + DPRINT("TerminationPort: %p\n", Thread->TerminationPort); /* Return success */ return(STATUS_SUCCESS); _____ Modified: trunk/reactos/ntoskrnl/ps/suspend.c --- trunk/reactos/ntoskrnl/ps/suspend.c 2005-03-18 05:53:04 UTC (rev 14174) +++ trunk/reactos/ntoskrnl/ps/suspend.c 2005-03-18 07:19:30 UTC (rev 14175) @@ -40,8 +40,8 @@ PAGED_CODE(); - DPRINT1("NtResumeThead(ThreadHandle %lx SuspendCount %p)\n", - ThreadHandle, SuspendCount); + DPRINT("NtResumeThead(ThreadHandle %lx SuspendCount %p)\n", + ThreadHandle, SuspendCount); /* Get the Thread Object */ Status = ObReferenceObjectByHandle(ThreadHandle, _____ Modified: trunk/reactos/ntoskrnl/ps/thread.c --- trunk/reactos/ntoskrnl/ps/thread.c 2005-03-18 05:53:04 UTC (rev 14174) +++ trunk/reactos/ntoskrnl/ps/thread.c 2005-03-18 07:19:30 UTC (rev 14175) @@ -473,7 +473,6 @@ DoneInitYet = TRUE; - InitializeListHead(&PspReaperListHead); ExInitializeWorkItem(&PspReaperWorkItem, PspReapRoutine, NULL); }
19 years, 9 months
1
0
0
0
[ion] 14174: Thread/Process Termination/Repeaing Rewrite + Fixes
by ion@svn.reactos.com
Thread/Process Termination/Repeaing Rewrite + Fixes --------------------------------------------------- - ps/cid.c: * Moved CID Lookup functions here - ps/security.c: * Moved all security related functions here. Makes other files neater and security functions easier to locate. - ps/thread.c: * Moved most of the Thread Scheduling/Dispatching code that belongs in the Kernel to /ke and renamed functions from Ps to Ki. * Implemented PsIsSystemThread. * Removed Reaper Thread Init (now obsolete). * Renamed PiDeleteThread to PspDeleteThread. * Moved Thread State functions from tinfo.c to here. - ps/process.c: * Removed Query/Set Process functions and moved to ps/query.c * Renamed PiDeletePRocess to PspDeleteProcess * Removed obsoleted Process Termination functions, moved persistent one to kill.c - ps/create.c: * Moved the security APIs to security.c * Correctly implemented PsCreateSystemThread to actually create system threads. - ps/suspend.c * Rewrote Nt Executive functions to use Kernel functions. * Moved Ps* Routines into ke/kthread.c and fixed them. The implementation was wrong in some aspects, especially the issue of the APC looping around the KeWaitXxx call and the fact that the routines excluded/ignored the FreezeCount. - ps/debug.c * Fixed completely broken implementation of Get/SetThreadContext. The old version crashed when called and did not work at all. Suspend Regression test now works. * Moved Context<->TrapFrame functions to ke/i386/ * Combined Set/GetThreadContext APCs into a single one, and used special context structure. - ps/query.c: * Moved Thread/Process Query/Set Routines here. - ps/tinfo.c: * Removed. - ps/kill.c * Removed complicated Process Termination semantics and useless Attach/Detach in favor for a much more lightweight function which performs the same tasks as before and actually works. TaskManager can now terminate foreign processes. * Rewrote Thread Reaping to use the HyperCritical Work Queue instead of manually controlled thread. This results in much less code as well as an increase in speed and less micro management. The reaper is PspReapRoutine. Closing CMD.EXE now works properly without requiring masks that were added as hacks to allow it. * Renamed PiTerminateProcessThreads to PspTerminateProcessThreads. Fixed it to work with new termination code. * Added PspDeleteProcess to handle Process Object deletion. Kills the CID Handle here as done by Hartmut. * Added PspDeletethread here. * Renamed and rewrote PsTerminateCurrentThread to PspExitThread. Used NT Implementation out- lined in Windows Internals, Chapter 13. Uses less locks, a more concise order of actions, actually parses the Termination Ports, handles Dbgk notification. Timers are now rundown, and Mutex rundown is in a dedicated Kernel function. Final termination handled by KeTerminate Thread as documented. * Renamed PsTerminateOtherThread to PspTerminateThreadByPointer and modified implementation to be compatible with the changes above. * Renamed and regrouped Process Termination into PspExitProcess. Also implemented as described above, and moved each subsystem specific termination helper into its own subsytem. * Improved NtTerminateProcess and added more debugging messages. * Improved NtTerminateThread and added check against System Thread and made it compatible with new implementation. * Corrected PsTerminateSystemThread now that we support System Threads. * Corrected NtRegisterThreadTerminatePort to use same structure name as on windows for the port, and added tag to pool allocation (documented in pooltag.txt) include/internal/*.h: * Defined Scheduler Functions and misc new functions or renamed functions. ke/apc.c: * Fixed critical bug where APCs were not delivered at all if the thread wastion and cancels any timers that are associated to a thread, as well as their APCs and DPCs. REGRESSIONS FOUND: NONE BUGS/REGRESSIOSN FIXED: * Thread/Get Set Context now works. * Suspend Regression test now works. * Task manager can now kill foreign processes, even hung ones (like it should). * ExitProcess/closing cmd.exe with the 'x' button now works correctly without hacks. KNOWN ISSUES: I left a bit of a mess in the headers and some stuff still needs to be moved into the right places. I just wanted to have this first part ready first, so that it won't get too big. Modified: trunk/reactos/ntoskrnl/Makefile Modified: trunk/reactos/ntoskrnl/cm/ntfunc.c Modified: trunk/reactos/ntoskrnl/ex/timer.c Modified: trunk/reactos/ntoskrnl/include/internal/ex.h Modified: trunk/reactos/ntoskrnl/include/internal/ke.h Modified: trunk/reactos/ntoskrnl/include/internal/ob.h Modified: trunk/reactos/ntoskrnl/include/internal/port.h Modified: trunk/reactos/ntoskrnl/include/internal/ps.h Modified: trunk/reactos/ntoskrnl/ke/apc.c Modified: trunk/reactos/ntoskrnl/ke/dpc.c Modified: trunk/reactos/ntoskrnl/ke/i386/exp.c Modified: trunk/reactos/ntoskrnl/ke/i386/tskswitch.S Modified: trunk/reactos/ntoskrnl/ke/kthread.c Modified: trunk/reactos/ntoskrnl/ke/main.c Modified: trunk/reactos/ntoskrnl/ke/process.c Modified: trunk/reactos/ntoskrnl/ke/queue.c Modified: trunk/reactos/ntoskrnl/ke/wait.c Modified: trunk/reactos/ntoskrnl/ob/handle.c Modified: trunk/reactos/ntoskrnl/ps/cid.c Modified: trunk/reactos/ntoskrnl/ps/create.c Modified: trunk/reactos/ntoskrnl/ps/debug.c Modified: trunk/reactos/ntoskrnl/ps/idle.c Modified: trunk/reactos/ntoskrnl/ps/kill.c Modified: trunk/reactos/ntoskrnl/ps/process.c Modified: trunk/reactos/ntoskrnl/ps/psmgr.c Added: trunk/reactos/ntoskrnl/ps/query.c Added: trunk/reactos/ntoskrnl/ps/security.c Modified: trunk/reactos/ntoskrnl/ps/suspend.c Modified: trunk/reactos/ntoskrnl/ps/thread.c Deleted: trunk/reactos/ntoskrnl/ps/tinfo.c _____ Modified: trunk/reactos/ntoskrnl/Makefile --- trunk/reactos/ntoskrnl/Makefile 2005-03-18 03:26:12 UTC (rev 14173) +++ trunk/reactos/ntoskrnl/Makefile 2005-03-18 05:53:04 UTC (rev 14174) @@ -226,9 +226,10 @@ ps/locale.o \ ps/process.o \ ps/psmgr.o \ + ps/query.o \ + ps/security.o \ ps/suspend.o \ ps/thread.o \ - ps/tinfo.o \ ps/win32.o \ ps/w32call.o _____ Modified: trunk/reactos/ntoskrnl/cm/ntfunc.c --- trunk/reactos/ntoskrnl/cm/ntfunc.c 2005-03-18 03:26:12 UTC (rev 14173) +++ trunk/reactos/ntoskrnl/cm/ntfunc.c 2005-03-18 05:53:04 UTC (rev 14174) @@ -2003,7 +2003,35 @@ return(STATUS_NOT_IMPLEMENTED); } +#if 0 +NTSTATUS STDCALL +NtNotifyChangeKey (IN HANDLE KeyHandle, + IN HANDLE Event, + IN PIO_APC_ROUTINE ApcRoutine OPTIONAL, + IN PVOID ApcContext OPTIONAL, + OUT PIO_STATUS_BLOCK IoStatusBlock, + IN ULONG CompletionFilter, + IN BOOLEAN WatchSubtree, + OUT PVOID Buffer, + IN ULONG Length, + IN BOOLEAN Asynchronous) +{ + return NtNotifyChangeMultipleKeys(KeyHandle, + 0, + NULL, + Event, + ApcRoutine, + ApcContext, + IoStatusBlock, + CompletionFilter, + WatchTree, + Buffer, + Length, + Asynchronous); +} +#endif + NTSTATUS STDCALL NtQueryMultipleValueKey (IN HANDLE KeyHandle, IN OUT PKEY_VALUE_ENTRY ValueList, _____ Modified: trunk/reactos/ntoskrnl/ex/timer.c --- trunk/reactos/ntoskrnl/ex/timer.c 2005-03-18 03:26:12 UTC (rev 14173) +++ trunk/reactos/ntoskrnl/ex/timer.c 2005-03-18 05:53:04 UTC (rev 14174) @@ -55,6 +55,66 @@ VOID STDCALL +ExTimerRundown(VOID) +{ + PETHREAD Thread = PsGetCurrentThread(); + KIRQL OldIrql; + PLIST_ENTRY CurrentEntry; + BOOLEAN KillTimer = FALSE; + PETIMER Timer; + + /* Lock the Thread's Active Timer List*/ + KeAcquireSpinLock(&Thread->ActiveTimerListLock, &OldIrql); + + /* Loop through all the timers */ + CurrentEntry = Thread->ActiveTimerListHead.Flink; + while (CurrentEntry != &Thread->ActiveTimerListHead) { + + /* Get the Timer */ + Timer = CONTAINING_RECORD(CurrentEntry, ETIMER, ActiveTimerListEntry); + DPRINT("Timer, ThreadList: %x, %x\n", Timer, Thread); + + /* Unlock the list */ + KeReleaseSpinLock(&Thread->ActiveTimerListLock, OldIrql); + + /* Lock the Timer */ + KeAcquireSpinLock(&Timer->Lock, &OldIrql); + + /* Relock the active list */ + KeAcquireSpinLockAtDpcLevel(&Thread->ActiveTimerListLock); + + /* Make sure it's associated to us */ + if ((Timer->ApcAssociated) && (&Thread->Tcb == Timer->TimerApc.Thread)) { + + /* Remove it */ + DPRINT("Removing from Thread: %x\n", Thread); + RemoveEntryList(&Thread->ActiveTimerListHead); + KeCancelTimer(&Timer->KeTimer); + KeRemoveQueueDpc(&Timer->TimerDpc); + KeRemoveQueueApc(&Timer->TimerApc); + Timer->ApcAssociated = FALSE; + KillTimer = TRUE; + } + + /* Unlock the list */ + KeReleaseSpinLockFromDpcLevel(&Thread->ActiveTimerListLock); + + /* Unlock the Timer */ + KeReleaseSpinLock(&Timer->Lock, OldIrql); + + /* Dereference it, if needed */ + if (KillTimer) ObDereferenceObject(Timer); + + /* Loop again */ + KeAcquireSpinLock(&Thread->ActiveTimerListLock, &OldIrql); + CurrentEntry = CurrentEntry->Flink; + } + + KeReleaseSpinLock(&Thread->ActiveTimerListLock, OldIrql); +} + +VOID +STDCALL ExpDeleteTimer(PVOID ObjectBody) { KIRQL OldIrql; _____ Modified: trunk/reactos/ntoskrnl/include/internal/ex.h --- trunk/reactos/ntoskrnl/include/internal/ex.h 2005-03-18 03:26:12 UTC (rev 14173) +++ trunk/reactos/ntoskrnl/include/internal/ex.h 2005-03-18 05:53:04 UTC (rev 14174) @@ -185,6 +185,10 @@ NTSTATUS ExpAllocateLocallyUniqueId(OUT LUID *LocallyUniqueId); +VOID +STDCALL +ExTimerRundown(VOID); + #define InterlockedDecrementUL(Addend) \ (ULONG)InterlockedDecrement((PLONG)(Addend)) _____ Modified: trunk/reactos/ntoskrnl/include/internal/ke.h --- trunk/reactos/ntoskrnl/include/internal/ke.h 2005-03-18 03:26:12 UTC (rev 14173) +++ trunk/reactos/ntoskrnl/include/internal/ke.h 2005-03-18 05:53:04 UTC (rev 14174) @@ -49,6 +49,35 @@ #define IPI_REQUEST_DPC 2 #define IPI_REQUEST_FREEZE 3 +/* threadsch.c ********************************************************************/ + +/* Thread Scheduler Functions */ + +/* Readies a Thread for Execution. */ +VOID +STDCALL +KiDispatchThreadNoLock(ULONG NewThreadStatus); + +/* Readies a Thread for Execution. */ +VOID +STDCALL +KiDispatchThread(ULONG NewThreadStatus); + +/* Puts a Thread into a block state. */ +VOID +STDCALL +KiBlockThread(PNTSTATUS Status, + UCHAR Alertable, + ULONG WaitMode, + UCHAR WaitReason); + +/* Removes a thread out of a block state. */ +VOID +STDCALL +KiUnblockThread(PKTHREAD Thread, + PNTSTATUS WaitStatus, + KPRIORITY Increment); + /* ipi.c ********************************************************************/ BOOLEAN STDCALL @@ -150,6 +179,29 @@ VOID inline FASTCALL KeReleaseDispatcherDatabaseLock(KIRQL Irql); VOID inline FASTCALL KeReleaseDispatcherDatabaseLockFromDpcLevel(VOID); +VOID +STDCALL +KeInitializeThread(struct _KPROCESS* Process, PKTHREAD Thread, BOOLEAN First); + +VOID +STDCALL +KeRundownThread(VOID); + +NTSTATUS KeReleaseThread(PKTHREAD Thread); + +VOID +STDCALL +KeStackAttachProcess ( + IN struct _KPROCESS* Process, + OUT PKAPC_STATE ApcState + ); + +VOID +STDCALL +KeUnstackDetachProcess ( + IN PKAPC_STATE ApcState + ); + BOOLEAN KiDispatcherObjectWake(DISPATCHER_HEADER* hdr, KPRIORITY increment); VOID STDCALL KeExpireTimers(PKDPC Apc, PVOID Arg1, @@ -165,6 +217,10 @@ KiAbortWaitThread(PKTHREAD Thread, NTSTATUS WaitStatus, KPRIORITY Increment); + +ULONG +STDCALL +KeForceResumeThread(IN PKTHREAD Thread); BOOLEAN STDCALL KiInsertTimer(PKTIMER Timer, LARGE_INTEGER DueTime); @@ -182,6 +238,18 @@ PVOID Reserved, PKTRAP_FRAME TrapFrame); +LONG +STDCALL +KiInsertQueue(IN PKQUEUE Queue, + IN PLIST_ENTRY Entry, + BOOLEAN Head); + +ULONG +STDCALL +KeSetProcess(struct _KPROCESS* Process, + KPRIORITY Increment); + + VOID STDCALL KeInitializeEventPair(PKEVENT_PAIR EventPair); VOID STDCALL KiInitializeUserApc(IN PVOID Reserved, _____ Modified: trunk/reactos/ntoskrnl/include/internal/ob.h --- trunk/reactos/ntoskrnl/include/internal/ob.h 2005-03-18 03:26:12 UTC (rev 14173) +++ trunk/reactos/ntoskrnl/include/internal/ob.h 2005-03-18 05:53:04 UTC (rev 14174) @@ -302,7 +302,9 @@ VOID FASTCALL ObpSetPermanentObject (IN PVOID ObjectBody, IN BOOLEAN Permanent); - +VOID +STDCALL +ObKillProcess(PEPROCESS Process); /* Security descriptor cache functions */ NTSTATUS _____ Modified: trunk/reactos/ntoskrnl/include/internal/port.h --- trunk/reactos/ntoskrnl/include/internal/port.h 2005-03-18 03:26:12 UTC (rev 14173) +++ trunk/reactos/ntoskrnl/include/internal/port.h 2005-03-18 05:53:04 UTC (rev 14174) @@ -29,14 +29,6 @@ ULONG MaxPoolUsage; /* size of NP zone */ } EPORT, * PEPORT; - -typedef struct _EPORT_TERMINATION_REQUEST -{ - LIST_ENTRY ThreadListEntry; - PEPORT Port; -} EPORT_TERMINATION_REQUEST, *PEPORT_TERMINATION_REQUEST; - - typedef struct _EPORT_CONNECT_REQUEST_MESSAGE { LPC_MESSAGE MessageHeader; @@ -59,6 +51,11 @@ UCHAR ConnectData[0]; } EPORT_CONNECT_REPLY_MESSAGE, *PEPORT_CONNECT_REPLY_MESSAGE; +typedef struct _TERMINATION_PORT { + LIST_ENTRY Links; + PVOID Port; +} TERMINATION_PORT, *PTERMINATION_PORT; + NTSTATUS STDCALL LpcRequestPort (PEPORT Port, PLPC_MESSAGE LpcMessage); _____ Modified: trunk/reactos/ntoskrnl/include/internal/ps.h --- trunk/reactos/ntoskrnl/include/internal/ps.h 2005-03-18 03:26:12 UTC (rev 14173) +++ trunk/reactos/ntoskrnl/include/internal/ps.h 2005-03-18 05:53:04 UTC (rev 14174) @@ -201,6 +201,7 @@ UCHAR ActiveImpersonationInfo; ULONG PerformanceCountHigh; LIST_ENTRY ThreadListEntry; + BOOLEAN SystemThread; } ETHREAD; #include <poppack.h> @@ -437,7 +438,6 @@ VOID PsInitThreadManagment(VOID); VOID PsInitProcessManagment(VOID); VOID PsInitIdleThread(VOID); -VOID PsDispatchThreadNoLock(ULONG NewThreadStatus); VOID PiTerminateProcessThreads(PEPROCESS Process, NTSTATUS ExitStatus); VOID PsTerminateCurrentThread(NTSTATUS ExitStatus); VOID PsTerminateOtherThread(PETHREAD Thread, NTSTATUS ExitStatus); @@ -458,17 +458,23 @@ KPROCESSOR_MODE AccessMode, BOOLEAN First); -PACCESS_TOKEN PsReferenceEffectiveToken(PETHREAD Thread, +PACCESS_TOKEN STDCALL PsReferenceEffectiveToken(PETHREAD Thread, PTOKEN_TYPE TokenType, PUCHAR b, PSECURITY_IMPERSONATION_LEVEL Level); -NTSTATUS PsOpenTokenOfProcess(HANDLE ProcessHandle, +NTSTATUS STDCALL PsOpenTokenOfProcess(HANDLE ProcessHandle, PACCESS_TOKEN* Token); - +VOID +STDCALL +PspTerminateProcessThreads(PEPROCESS Process, + NTSTATUS ExitStatus); NTSTATUS PsSuspendThread(PETHREAD Thread, PULONG PreviousCount); NTSTATUS PsResumeThread(PETHREAD Thread, PULONG PreviousCount); - +NTSTATUS +STDCALL +PspAssignPrimaryToken(PEPROCESS Process, + HANDLE TokenHandle); VOID STDCALL PsExitSpecialApc(PKAPC Apc, PKNORMAL_ROUTINE *NormalRoutine, PVOID *NormalContext, @@ -497,27 +503,25 @@ #define PROCESS_PRIO_RT 18 -VOID STDCALL -KeInitializeThread(PKPROCESS Process, PKTHREAD Thread, BOOLEAN First); -NTSTATUS KeReleaseThread(PKTHREAD Thread); +VOID STDCALL PiDeleteProcess(PVOID ObjectBody); +VOID +STDCALL +PspReapRoutine(PVOID Context); + VOID STDCALL -KeStackAttachProcess ( - IN PKPROCESS Process, - OUT PKAPC_STATE ApcState - ); +PspExitThread(NTSTATUS ExitStatus); +extern LIST_ENTRY PspReaperListHead; +extern WORK_QUEUE_ITEM PspReaperWorkItem; +extern BOOLEAN PspReaping; + VOID STDCALL -KeUnstackDetachProcess ( - IN PKAPC_STATE ApcState - ); +PspTerminateThreadByPointer(PETHREAD Thread, + NTSTATUS ExitStatus); -VOID STDCALL PiDeleteProcess(PVOID ObjectBody); -VOID PsReapThreads(VOID); -VOID PsInitializeThreadReaper(VOID); -VOID PsQueueThreadReap(PETHREAD Thread); VOID PsUnfreezeOtherThread(PETHREAD Thread); VOID PsFreezeOtherThread(PETHREAD Thread); VOID PsFreezeProcessThreads(PEPROCESS Process); @@ -525,19 +529,9 @@ ULONG PsEnumThreadsByProcess(PEPROCESS Process); PEPROCESS PsGetNextProcess(PEPROCESS OldProcess); VOID -STDCALL -PsBlockThread(PNTSTATUS Status, - UCHAR Alertable, - ULONG WaitMode, - UCHAR WaitReason); -VOID -PsUnblockThread(PETHREAD Thread, PNTSTATUS WaitStatus, KPRIORITY Increment); -VOID PsApplicationProcessorInit(VOID); VOID PsPrepareForApplicationProcessorInit(ULONG Id); -VOID -PsInitReaperThread(VOID); VOID STDCALL PsIdleThreadMain(PVOID Context); @@ -553,11 +547,20 @@ PiSuspendThreadNormalRoutine(PVOID NormalContext, PVOID SystemArgument1, PVOID SystemArgument2); -VOID STDCALL -PsDispatchThread(ULONG NewThreadStatus); VOID PsInitialiseSuspendImplementation(VOID); +NTSTATUS +STDCALL +PspExitProcess(PEPROCESS Process); +VOID +STDCALL +PspDeleteProcess(PVOID ObjectBody); + +VOID +STDCALL +PspDeleteThread(PVOID ObjectBody); + extern LONG PiNrThreadsAwaitingReaping; NTSTATUS _____ Modified: trunk/reactos/ntoskrnl/ke/apc.c --- trunk/reactos/ntoskrnl/ke/apc.c 2005-03-18 03:26:12 UTC (rev 14173) +++ trunk/reactos/ntoskrnl/ke/apc.c 2005-03-18 05:53:04 UTC (rev 14174) @@ -14,10 +14,6 @@ #define NDEBUG #include <internal/debug.h> -/* GLOBALS *******************************************************************/ - -VOID PsTerminateCurrentThread(NTSTATUS ExitStatus); - /* FUNCTIONS *****************************************************************/ /*++ @@ -145,19 +141,15 @@ } /*++ - * KeInsertQueueApc - * @implemented NT4 + * KiInsertQueueApc * - * The KeInsertQueueApc routine queues a APC for execution when the right + * The KiInsertQueueApc routine queues a APC for execution when the right * scheduler environment exists. * * Params: * Apc - Pointer to an initialized control object of type DPC for which the * caller provides the storage. * - * SystemArgument[1,2] - Pointer to a set of two parameters that contain - * untyped data. - * * PriorityBoost - Priority Boost to apply to the Thread. * * Returns: @@ -173,45 +165,16 @@ *--*/ BOOLEAN STDCALL -KeInsertQueueApc(PKAPC Apc, - PVOID SystemArgument1, - PVOID SystemArgument2, +KiInsertQueueApc(PKAPC Apc, KPRIORITY PriorityBoost) - { - KIRQL OldIrql; - PKTHREAD Thread; + PKTHREAD Thread = Apc->Thread; PLIST_ENTRY ApcListEntry; PKAPC QueuedApc; - - ASSERT_IRQL_LESS_OR_EQUAL(DISPATCH_LEVEL); - DPRINT("KeInsertQueueApc(Apc %x, SystemArgument1 %x, " - "SystemArgument2 %x)\n",Apc,SystemArgument1, - SystemArgument2); - - /* Lock the Dispatcher Database */ - OldIrql = KeAcquireDispatcherDatabaseLock(); - /* Get the Thread specified in the APC */ - Thread = Apc->Thread; - - /* Make sure the thread allows APC Queues. - * The thread is not apc queueable, for instance, when it's (about to be) terminated. - */ - if (Thread->ApcQueueable == FALSE) { - DPRINT("Thread doesn't allow APC Queues\n"); - KeReleaseDispatcherDatabaseLock(OldIrql); - return FALSE; - } - - /* Set the System Arguments */ - Apc->SystemArgument1 = SystemArgument1; - Apc->SystemArgument2 = SystemArgument2; - /* Don't do anything if the APC is already inserted */ if (Apc->Inserted) { - KeReleaseDispatcherDatabaseLock(OldIrql); return FALSE; } @@ -247,7 +210,7 @@ DPRINT ("Inserting Normal APC %x into the %x Queue\n", Apc, Apc->ApcMode); InsertTailList(&Thread->ApcStatePointer[(int)Apc->ApcStateIndex]->ApcLis tHead[(int)Apc->ApcMode], - &Apc->ApcListEntry); + &Apc->ApcListEntry); } /* Confirm Insertion */ @@ -271,9 +234,9 @@ DPRINT ("Requesting APC Interrupt for Running Thread \n"); HalRequestSoftwareInterrupt(APC_LEVEL); - } else if ((Thread->State == THREAD_STATE_BLOCKED) && - (Thread->WaitIrql < APC_LEVEL) && - (Apc->NormalRoutine == NULL)) { + } else if ((Thread->State == THREAD_STATE_BLOCKED) && (Thread->WaitIrql == PASSIVE_LEVEL) && + ((Apc->NormalRoutine == NULL) || + ((!Thread->KernelApcDisable) && (!Thread->ApcState.KernelApcInProgress)))) { DPRINT("Waking up Thread for Kernel-Mode APC Delivery \n"); KiAbortWaitThread(Thread, STATUS_KERNEL_APC, PriorityBoost); @@ -287,10 +250,79 @@ Thread->ApcState.UserApcPending = TRUE; KiAbortWaitThread(Thread, STATUS_USER_APC, PriorityBoost); } + + return TRUE; +} + +/*++ + * KeInsertQueueApc + * @implemented NT4 + * + * The KeInsertQueueApc routine queues a APC for execution when the right + * scheduler environment exists. + * + * Params: + * Apc - Pointer to an initialized control object of type DPC for which the + * caller provides the storage. + * + * SystemArgument[1,2] - Pointer to a set of two parameters that contain + * untyped data. + * + * PriorityBoost - Priority Boost to apply to the Thread. + * + * Returns: + * If the APC is already inserted or APC queueing is disabled, FALSE. + * Otherwise, TRUE. + * + * Remarks: + * The APC will execute at APC_LEVEL for the KernelRoutine registered, and + * at PASSIVE_LEVEL for the NormalRoutine registered. + * + * Callers of this routine must be running at IRQL = PASSIVE_LEVEL. + * + *--*/ +BOOLEAN +STDCALL +KeInsertQueueApc(PKAPC Apc, + PVOID SystemArgument1, + PVOID SystemArgument2, + KPRIORITY PriorityBoost) +{ + KIRQL OldIrql; + PKTHREAD Thread; + BOOLEAN Inserted; + + ASSERT_IRQL_LESS_OR_EQUAL(DISPATCH_LEVEL); + DPRINT("KeInsertQueueApc(Apc %x, SystemArgument1 %x, " + "SystemArgument2 %x)\n",Apc,SystemArgument1, + SystemArgument2); + + /* Lock the Dispatcher Database */ + OldIrql = KeAcquireDispatcherDatabaseLock(); + + /* Get the Thread specified in the APC */ + Thread = Apc->Thread; + + /* Make sure the thread allows APC Queues. + * The thread is not apc queueable, for instance, when it's (about to be) terminated. + */ + if (Thread->ApcQueueable == FALSE) { + DPRINT("Thread doesn't allow APC Queues\n"); + KeReleaseDispatcherDatabaseLock(OldIrql); + return FALSE; + } + + /* Set the System Arguments */ + Apc->SystemArgument1 = SystemArgument1; + Apc->SystemArgument2 = SystemArgument2; + + /* Call the Internal Function */ + Inserted = KiInsertQueueApc(Apc, PriorityBoost); + /* Return Sucess if we are here */ KeReleaseDispatcherDatabaseLock(OldIrql); - return TRUE; + return Inserted; } /*++ _____ Modified: trunk/reactos/ntoskrnl/ke/dpc.c --- trunk/reactos/ntoskrnl/ke/dpc.c 2005-03-18 03:26:12 UTC (rev 14173) +++ trunk/reactos/ntoskrnl/ke/dpc.c 2005-03-18 05:53:04 UTC (rev 14174) @@ -491,7 +491,7 @@ /* Dispatch the Thread */ KeLowerIrql(DISPATCH_LEVEL); - PsDispatchThread(THREAD_STATE_READY); + KiDispatchThread(THREAD_STATE_READY); } /* _____ Modified: trunk/reactos/ntoskrnl/ke/i386/exp.c --- trunk/reactos/ntoskrnl/ke/i386/exp.c 2005-03-18 03:26:12 UTC (rev 14173) +++ trunk/reactos/ntoskrnl/ke/i386/exp.c 2005-03-18 05:53:04 UTC (rev 14174) @@ -582,6 +582,125 @@ } VOID +KeContextToTrapFrame(PCONTEXT Context, + PKTRAP_FRAME TrapFrame) +{ + if ((Context->ContextFlags & CONTEXT_CONTROL) == CONTEXT_CONTROL) + { + TrapFrame->Esp = Context->Esp; + TrapFrame->Ss = Context->SegSs; + TrapFrame->Cs = Context->SegCs; + TrapFrame->Eip = Context->Eip; + TrapFrame->Eflags = Context->EFlags; + TrapFrame->Ebp = Context->Ebp; + } + if ((Context->ContextFlags & CONTEXT_INTEGER) == CONTEXT_INTEGER) + { + TrapFrame->Eax = Context->Eax; + TrapFrame->Ebx = Context->Ebx; + TrapFrame->Ecx = Context->Ecx; + TrapFrame->Edx = Context->Edx; + TrapFrame->Esi = Context->Esi; + TrapFrame->Edi = Context->Edi; + } + if ((Context->ContextFlags & CONTEXT_SEGMENTS) == CONTEXT_SEGMENTS) + { + TrapFrame->Ds = Context->SegDs; + TrapFrame->Es = Context->SegEs; + TrapFrame->Fs = Context->SegFs; + TrapFrame->Gs = Context->SegGs; + } + if ((Context->ContextFlags & CONTEXT_FLOATING_POINT) == CONTEXT_FLOATING_POINT) + { + /* + * Not handled + * + * This should be handled separately I think. + * - blight + */ + } + if ((Context->ContextFlags & CONTEXT_DEBUG_REGISTERS) == CONTEXT_DEBUG_REGISTERS) + { + /* + * Not handled + */ + } +} + +VOID +KeTrapFrameToContext(PKTRAP_FRAME TrapFrame, + PCONTEXT Context) +{ + if ((Context->ContextFlags & CONTEXT_CONTROL) == CONTEXT_CONTROL) + { + Context->SegSs = TrapFrame->Ss; + Context->Esp = TrapFrame->Esp; + Context->SegCs = TrapFrame->Cs; + Context->Eip = TrapFrame->Eip; + Context->EFlags = TrapFrame->Eflags; + Context->Ebp = TrapFrame->Ebp; + } + if ((Context->ContextFlags & CONTEXT_INTEGER) == CONTEXT_INTEGER) + { + Context->Eax = TrapFrame->Eax; + Context->Ebx = TrapFrame->Ebx; + Context->Ecx = TrapFrame->Ecx; + /* + * NOTE: In the trap frame which is built on entry to a system + * call TrapFrame->Edx will actually hold the address of the + * previous TrapFrame. I don't believe leaking this information + * has security implications. Also EDX holds the address of the + * arguments to the system call in progress so it isn't of much + * interest to the debugger. + */ + Context->Edx = TrapFrame->Edx; + Context->Esi = TrapFrame->Esi; + Context->Edi = TrapFrame->Edi; + } + if ((Context->ContextFlags & CONTEXT_SEGMENTS) == CONTEXT_SEGMENTS) + { + Context->SegDs = TrapFrame->Ds; + Context->SegEs = TrapFrame->Es; + Context->SegFs = TrapFrame->Fs; + Context->SegGs = TrapFrame->Gs; + } + if ((Context->ContextFlags & CONTEXT_DEBUG_REGISTERS) == CONTEXT_DEBUG_REGISTERS) + { + /* + * FIXME: Implement this case + */ + Context->ContextFlags &= (~CONTEXT_DEBUG_REGISTERS) | CONTEXT_i386; + } + if ((Context->ContextFlags & CONTEXT_FLOATING_POINT) == CONTEXT_FLOATING_POINT) + { + /* + * FIXME: Implement this case + * + * I think this should only be filled for FPU exceptions, otherwise I + * would not know where to get it from as it can be the current state + * of the FPU or already saved in the thread's FPU save area. + * -blight + */ + Context->ContextFlags &= (~CONTEXT_FLOATING_POINT) | CONTEXT_i386; + } +#if 0 + if ((Context->ContextFlags & CONTEXT_EXTENDED_REGISTERS) == CONTEXT_EXTENDED_REGISTERS) + { + /* + * FIXME: Investigate this + * + * This is the XMM state (first 512 bytes of FXSAVE_FORMAT/FX_SAVE_AREA) + * This should only be filled in case of a SIMD exception I think, so + * this is not the right place (like for FPU the state could already be + * saved in the thread's FX_SAVE_AREA or still be in the CPU) + * -blight + */ + Context->ContextFlags &= ~CONTEXT_EXTENDED_REGISTERS; + } +#endif +} + +VOID KeDumpStackFrames(PULONG Frame) { PULONG StackBase, StackEnd; _____ Modified: trunk/reactos/ntoskrnl/ke/i386/tskswitch.S --- trunk/reactos/ntoskrnl/ke/i386/tskswitch.S 2005-03-18 03:26:12 UTC (rev 14173) +++ trunk/reactos/ntoskrnl/ke/i386/tskswitch.S 2005-03-18 05:53:04 UTC (rev 14174) @@ -206,11 +206,6 @@ call @KeReleaseDispatcherDatabaseLockFromDpcLevel@0 - cmpl $0, _PiNrThreadsAwaitingReaping - je 5f - call _PiWakeupReaperThread@0 -5: - /* * Restore the saved register and exit */ _____ Modified: trunk/reactos/ntoskrnl/ke/kthread.c --- trunk/reactos/ntoskrnl/ke/kthread.c 2005-03-18 03:26:12 UTC (rev 14173) +++ trunk/reactos/ntoskrnl/ke/kthread.c 2005-03-18 05:53:04 UTC (rev 14174) @@ -15,10 +15,478 @@ #include <internal/debug.h> #define THREAD_ALERT_INCREMENT 2 + +extern EX_WORK_QUEUE ExWorkerQueue[MaximumWorkQueue]; + +/* + * PURPOSE: List of threads associated with each priority level + */ +LIST_ENTRY PriorityListHead[MAXIMUM_PRIORITY]; +static ULONG PriorityListMask = 0; +ULONG IdleProcessorMask = 0; +extern BOOLEAN DoneInitYet; + /* FUNCTIONS *****************************************************************/ +STATIC +VOID +KiRequestReschedule(CCHAR Processor) +{ + PKPCR Pcr; + + Pcr = (PKPCR)(KPCR_BASE + Processor * PAGE_SIZE); + Pcr->Prcb->QuantumEnd = TRUE; + KiIpiSendRequest(1 << Processor, IPI_REQUEST_DPC); +} + +STATIC +VOID +KiInsertIntoThreadList(KPRIORITY Priority, + PKTHREAD Thread) +{ + ASSERT(THREAD_STATE_READY == Thread->State); + ASSERT(Thread->Priority == Priority); + + if (Priority >= MAXIMUM_PRIORITY || Priority < LOW_PRIORITY) { + + DPRINT1("Invalid thread priority (%d)\n", Priority); + KEBUGCHECK(0); + } + + InsertTailList(&PriorityListHead[Priority], &Thread->QueueListEntry); + PriorityListMask |= (1 << Priority); +} + +STATIC +VOID +KiRemoveFromThreadList(PKTHREAD Thread) +{ + ASSERT(THREAD_STATE_READY == Thread->State); + RemoveEntryList(&Thread->QueueListEntry); + if (IsListEmpty(&PriorityListHead[(ULONG)Thread->Priority])) { + + PriorityListMask &= ~(1 << Thread->Priority); + } +} + +STATIC +PKTHREAD +KiScanThreadList(KPRIORITY Priority, + KAFFINITY Affinity) +{ + PLIST_ENTRY current_entry; + PKTHREAD current; + ULONG Mask; + + Mask = (1 << Priority); + + if (PriorityListMask & Mask) { + + current_entry = PriorityListHead[Priority].Flink; + + while (current_entry != &PriorityListHead[Priority]) { + + current = CONTAINING_RECORD(current_entry, KTHREAD, QueueListEntry); + + if (current->State != THREAD_STATE_READY) { + + DPRINT1("%d/%d\n", ¤t, current->State); + } + + ASSERT(current->State == THREAD_STATE_READY); + + if (current->Affinity & Affinity) { + + KiRemoveFromThreadList(current); + return(current); + } + + current_entry = current_entry->Flink; + } + } + + return(NULL); +} + +VOID +STDCALL +KiDispatchThreadNoLock(ULONG NewThreadStatus) +{ + KPRIORITY CurrentPriority; + PKTHREAD Candidate; + ULONG Affinity; + PKTHREAD CurrentThread = KeGetCurrentThread(); + + DPRINT("KiDispatchThreadNoLock() %d/%d/%d/%d\n", KeGetCurrentProcessorNumber(), + CurrentThread, NewThreadStatus, CurrentThread->State); + + CurrentThread->State = (UCHAR)NewThreadStatus; + + if (NewThreadStatus == THREAD_STATE_READY) { + + KiInsertIntoThreadList(CurrentThread->Priority, + CurrentThread); + } + + Affinity = 1 << KeGetCurrentProcessorNumber(); + + for (CurrentPriority = HIGH_PRIORITY; CurrentPriority >= LOW_PRIORITY; CurrentPriority--) { + + Candidate = KiScanThreadList(CurrentPriority, Affinity); + + if (Candidate == CurrentThread) { + + Candidate->State = THREAD_STATE_RUNNING; + KeReleaseDispatcherDatabaseLockFromDpcLevel(); + return; + } + + if (Candidate != NULL) { + + PKTHREAD OldThread; + PKTHREAD IdleThread; + + DPRINT("Scheduling %x(%d)\n",Candidate, CurrentPriority); + + Candidate->State = THREAD_STATE_RUNNING; + + OldThread = CurrentThread; + CurrentThread = Candidate; + IdleThread = KeGetCurrentPrcb()->IdleThread; + + if (OldThread == IdleThread) { + + IdleProcessorMask &= ~Affinity; + + } else if (CurrentThread == IdleThread) { + + IdleProcessorMask |= Affinity; + } + + MmUpdatePageDir(PsGetCurrentProcess(),((PETHREAD)CurrentThread)->Threads Process, sizeof(EPROCESS)); + + /* Special note for Filip: This will release the Dispatcher DB Lock ;-) -- Alex */ + KiArchContextSwitch(CurrentThread, OldThread); + return; + } + } + + DPRINT1("CRITICAL: No threads are ready (CPU%d)\n", KeGetCurrentProcessorNumber()); + KEBUGCHECK(0); +} + +VOID +STDCALL +KiBlockThread(PNTSTATUS Status, + UCHAR Alertable, + ULONG WaitMode, + UCHAR WaitReason) +{ + PKTHREAD Thread = KeGetCurrentThread(); + PKWAIT_BLOCK WaitBlock; + + if (Thread->ApcState.KernelApcPending) { + + DPRINT("Dispatching Thread as ready (APC!)\n"); + + /* Remove Waits */ + WaitBlock = Thread->WaitBlockList; + while (WaitBlock) { + RemoveEntryList (&WaitBlock->WaitListEntry); + WaitBlock = WaitBlock->NextWaitBlock; + } + Thread->WaitBlockList = NULL; + + /* Dispatch it and return status */ + KiDispatchThreadNoLock (THREAD_STATE_READY); + if (Status != NULL) *Status = STATUS_KERNEL_APC; + + } else { + + /* Set the Thread Data as Requested */ + DPRINT("Dispatching Thread as blocked\n"); + Thread->Alertable = Alertable; + Thread->WaitMode = (UCHAR)WaitMode; + Thread->WaitReason = WaitReason; + + /* Dispatch it and return status */ + KiDispatchThreadNoLock(THREAD_STATE_BLOCKED); + if (Status != NULL) *Status = Thread->WaitStatus; + } + + DPRINT("Releasing Dispatcher Lock\n"); + KfLowerIrql(Thread->WaitIrql); +} + +VOID +STDCALL +KiDispatchThread(ULONG NewThreadStatus) +{ + KIRQL OldIrql; + + if (!DoneInitYet || KeGetCurrentPrcb()->IdleThread == NULL) { + return; + } + + OldIrql = KeAcquireDispatcherDatabaseLock(); + KiDispatchThreadNoLock(NewThreadStatus); + KeLowerIrql(OldIrql); +} + +VOID +STDCALL +KiUnblockThread(PKTHREAD Thread, + PNTSTATUS WaitStatus, + KPRIORITY Increment) +{ + if (THREAD_STATE_TERMINATED_1 == Thread->State || + THREAD_STATE_TERMINATED_2 == Thread->State) { [truncated at 1000 lines; 7432 more skipped]
19 years, 9 months
1
0
0
0
[arty] 14173: Added simple dword OID query to lan.
by arty@svn.reactos.com
Added simple dword OID query to lan. Correct oper status, admin status and type settings in iinfo. Small fixes in lan.c for adapter name. Modified: trunk/reactos/drivers/lib/ip/network/interface.c Modified: trunk/reactos/drivers/net/tcpip/datalink/lan.c Modified: trunk/reactos/drivers/net/tcpip/include/interface.h Modified: trunk/reactos/drivers/net/tcpip/include/lan.h Modified: trunk/reactos/drivers/net/tcpip/include/precomp.h Modified: trunk/reactos/drivers/net/tcpip/tcpip/iinfo.c _____ Modified: trunk/reactos/drivers/lib/ip/network/interface.c --- trunk/reactos/drivers/lib/ip/network/interface.c 2005-03-18 02:56:29 UTC (rev 14172) +++ trunk/reactos/drivers/lib/ip/network/interface.c 2005-03-18 03:26:12 UTC (rev 14173) @@ -209,3 +209,28 @@ return NULL; } + +NTSTATUS GetInterfaceConnectionStatus +( PIP_INTERFACE Interface, PDWORD Result ) { + NTSTATUS Status = TcpipLanGetDwordOid + ( Interface, OID_GEN_HARDWARE_STATUS, Result ); + if( NT_SUCCESS(Status) ) switch( *Result ) { + case NdisHardwareStatusReady: + *Result = MIB_IF_OPER_STATUS_OPERATIONAL; + break; + case NdisHardwareStatusInitializing: + *Result = MIB_IF_OPER_STATUS_CONNECTING; + break; + case NdisHardwareStatusReset: + *Result = MIB_IF_OPER_STATUS_DISCONNECTED; + break; + case NdisHardwareStatusNotReady: + *Result = MIB_IF_OPER_STATUS_DISCONNECTED; + break; + case NdisHardwareStatusClosing: + default: + *Result = MIB_IF_OPER_STATUS_NON_OPERATIONAL; + break; + } + return Status; +} _____ Modified: trunk/reactos/drivers/net/tcpip/datalink/lan.c --- trunk/reactos/drivers/net/tcpip/datalink/lan.c 2005-03-18 02:56:29 UTC (rev 14172) +++ trunk/reactos/drivers/net/tcpip/datalink/lan.c 2005-03-18 03:26:12 UTC (rev 14173) @@ -165,6 +165,28 @@ } +NTSTATUS TcpipLanGetDwordOid +( PIP_INTERFACE Interface, + NDIS_OID Oid, + PDWORD Result ) { + /* Get maximum frame size */ + if( Interface->Context ) { + return NDISCall((PLAN_ADAPTER)Interface->Context, + NdisRequestQueryInformation, + Oid, + Result, + sizeof(DWORD)); + } else switch( Oid ) { /* Loopback Case */ + case OID_GEN_HARDWARE_STATUS: + *Result = NdisHardwareStatusReady; + return STATUS_SUCCESS; + + default: + return STATUS_INVALID_PARAMETER; + } +} + + VOID STDCALL ProtocolOpenAdapterComplete( NDIS_HANDLE BindingContext, NDIS_STATUS Status, @@ -916,11 +938,10 @@ TI_DbgPrint(MID_TRACE,("BCAST(IF) %s\n", A2S(&IF->Broadcast))); if(NT_SUCCESS(Status)) { + RtlZeroMemory( &IF->Name, sizeof(IF->Name) ); Status = ReadStringFromRegistry( RegHandle, L"DeviceDesc", &IF->Name ); - RtlZeroMemory( &IF->Name, sizeof( IF->Name ) ); - /* I think that not getting a devicedesc is not a fatal error */ if( !NT_SUCCESS(Status) ) { if( IF->Name.Buffer ) exFreePool( IF->Name.Buffer ); @@ -929,6 +950,8 @@ Status = STATUS_SUCCESS; } + TI_DbgPrint(MID_TRACE,("Adapter Name: %wZ\n", &IF->Name)); + if(!NT_SUCCESS(Status)) { TI_DbgPrint(MIN_TRACE, ("Unable to open protocol-specific registry key: 0x%x\n", Status)); _____ Modified: trunk/reactos/drivers/net/tcpip/include/interface.h --- trunk/reactos/drivers/net/tcpip/include/interface.h 2005-03-18 02:56:29 UTC (rev 14172) +++ trunk/reactos/drivers/net/tcpip/include/interface.h 2005-03-18 03:26:12 UTC (rev 14173) @@ -13,6 +13,8 @@ NTSTATUS GetInterfaceSpeed( PIP_INTERFACE Interface, PUINT Speed ); NTSTATUS GetInterfaceName( PIP_INTERFACE Interface, PCHAR NameBuffer, UINT NameMaxLen ); +NTSTATUS GetInterfaceConnectionStatus( PIP_INTERFACE Interface, + PDWORD OperStatus ); PIP_INTERFACE FindOnLinkInterface(PIP_ADDRESS Address); #endif//_TCPIP_INTERFACE_H _____ Modified: trunk/reactos/drivers/net/tcpip/include/lan.h --- trunk/reactos/drivers/net/tcpip/include/lan.h 2005-03-18 02:56:29 UTC (rev 14172) +++ trunk/reactos/drivers/net/tcpip/include/lan.h 2005-03-18 03:26:12 UTC (rev 14173) @@ -98,6 +98,9 @@ VOID LANStartup(); VOID LANShutdown(); +NTSTATUS TcpipLanGetDwordOid( PIP_INTERFACE Interface, NDIS_OID Oid, + PDWORD Result ); + NDIS_STATUS NDISCall( PLAN_ADAPTER Adapter, NDIS_REQUEST_TYPE Type, _____ Modified: trunk/reactos/drivers/net/tcpip/include/precomp.h --- trunk/reactos/drivers/net/tcpip/include/precomp.h 2005-03-18 02:56:29 UTC (rev 14172) +++ trunk/reactos/drivers/net/tcpip/include/precomp.h 2005-03-18 03:26:12 UTC (rev 14173) @@ -35,5 +35,6 @@ #include <oskittcp.h> #include <interface.h> #include <ports.h> +#include <ipifcons.h> #define NTOS_MODE_USER #include <ntos.h> _____ Modified: trunk/reactos/drivers/net/tcpip/tcpip/iinfo.c --- trunk/reactos/drivers/net/tcpip/tcpip/iinfo.c 2005-03-18 02:56:29 UTC (rev 14172) +++ trunk/reactos/drivers/net/tcpip/tcpip/iinfo.c 2005-03-18 03:26:12 UTC (rev 14173) @@ -35,14 +35,20 @@ OutData->Index = ID->tei_instance + 1; /* viz: tcpip keeps those indices */ - OutData->Type = Interface == Loopback ? IFENT_SOFTWARE_LOOPBACK : 0; + OutData->Type = Interface == + Loopback ? MIB_IF_TYPE_LOOPBACK : MIB_IF_TYPE_ETHERNET; OutData->Mtu = Interface->MTU; TI_DbgPrint(MAX_TRACE, ("Getting interface speed\n")); OutData->PhysAddrLen = Interface->AddressLength; - OutData->AdminStatus = 1; /* XXX Up -- How do I know? */ - OutData->OperStatus = 1; /* XXX Up -- How do I know? */ + OutData->AdminStatus = MIB_IF_ADMIN_STATUS_UP; + /* NDIS_HARDWARE_STATUS -> ROUTER_CONNECTION_STATE */ + Status = GetInterfaceConnectionStatus( Interface, &OutData->OperStatus ); + /* Not sure what to do here, but not ready seems a safe bet on failure */ + if( !NT_SUCCESS(Status) ) + OutData->OperStatus = NdisHardwareStatusNotReady; + IFDescr = (PCHAR)&OutData[1]; if( IF ) {
19 years, 9 months
1
0
0
0
[arty] 14172: Don't let sign extension mess us up here.
by arty@svn.reactos.com
Don't let sign extension mess us up here. Modified: trunk/reactos/drivers/net/tcpip/include/tcpip.h _____ Modified: trunk/reactos/drivers/net/tcpip/include/tcpip.h --- trunk/reactos/drivers/net/tcpip/include/tcpip.h 2005-03-18 02:10:50 UTC (rev 14171) +++ trunk/reactos/drivers/net/tcpip/include/tcpip.h 2005-03-18 02:56:29 UTC (rev 14172) @@ -136,7 +136,7 @@ } TDIEntityInfo; #ifndef htons -#define htons(x) (((x) << 8) | (((x) >> 8) & 0xff)) +#define htons(x) ((((x) & 0xff) << 8) | (((x) >> 8) & 0xff)) #endif /* Global variable */
19 years, 9 months
1
0
0
0
[navaraf] 14171: - Correctly initialize the standard handles for console-less applications.
by navaraf@svn.reactos.com
- Correctly initialize the standard handles for console-less applications. - Simplify _isatty and fix it to not set the errno for "invalid" handles. Modified: trunk/reactos/lib/crt/io/isatty.c Modified: trunk/reactos/lib/crt/io/open.c _____ Modified: trunk/reactos/lib/crt/io/isatty.c --- trunk/reactos/lib/crt/io/isatty.c 2005-03-18 00:56:34 UTC (rev 14170) +++ trunk/reactos/lib/crt/io/isatty.c 2005-03-18 02:10:50 UTC (rev 14171) @@ -1,5 +1,4 @@ -#include <io.h> -#include <sys/stat.h> +#include <internal/file.h> #define NDEBUG #include <internal/debug.h> @@ -7,13 +6,10 @@ /* * @implemented */ -int _isatty( int fd ) +int _isatty(int fd) { - struct _stat buf; - DPRINT("_isatty(fd %d)\n", fd); - if (_fstat (fd, &buf) < 0) + HANDLE hFile = fdinfo(fd)->hFile; + if (hFile == INVALID_HANDLE_VALUE) return 0; - if (S_ISCHR (buf.st_mode)) - return 1; - return 0; + return GetFileType(hFile) == FILE_TYPE_CHAR ? 1 : 0; } _____ Modified: trunk/reactos/lib/crt/io/open.c --- trunk/reactos/lib/crt/io/open.c 2005-03-18 00:56:34 UTC (rev 14170) +++ trunk/reactos/lib/crt/io/open.c 2005-03-18 02:10:50 UTC (rev 14171) @@ -608,14 +608,20 @@ if (fdinfo(0)->hFile == INVALID_HANDLE_VALUE || !(fdinfo(0)->fdflags & FOPEN)) { fdinfo(0)->hFile = GetStdHandle(STD_INPUT_HANDLE); + if (fdinfo(0)->hFile == NULL) + fdinfo(0)->hFile = INVALID_HANDLE_VALUE; fdinfo(0)->fdflags = FOPEN|FTEXT; } if (fdinfo(1)->hFile == INVALID_HANDLE_VALUE || !(fdinfo(1)->fdflags & FOPEN)) { fdinfo(1)->hFile = GetStdHandle(STD_OUTPUT_HANDLE); + if (fdinfo(1)->hFile == NULL) + fdinfo(1)->hFile = INVALID_HANDLE_VALUE; fdinfo(1)->fdflags = FOPEN|FTEXT; } if (fdinfo(2)->hFile == INVALID_HANDLE_VALUE || !(fdinfo(2)->fdflags & FOPEN)) { fdinfo(2)->hFile = GetStdHandle(STD_ERROR_HANDLE); + if (fdinfo(2)->hFile == NULL) + fdinfo(2)->hFile = INVALID_HANDLE_VALUE; fdinfo(2)->fdflags = FOPEN|FTEXT; }
19 years, 9 months
1
0
0
0
[sedwards] 14170: Lined up Buttons.
by sedwards@svn.reactos.com
Lined up Buttons. Removed my broken attempt at understaind comboboxes. Cleaned up WM_INITDIALOG. Modified: trunk/reactos/lib/cpl/liccpa/liccpa.c Modified: trunk/reactos/lib/cpl/liccpa/liccpa.rc Modified: trunk/reactos/lib/cpl/liccpa/resource.h _____ Modified: trunk/reactos/lib/cpl/liccpa/liccpa.c --- trunk/reactos/lib/cpl/liccpa/liccpa.c 2005-03-17 23:52:28 UTC (rev 14169) +++ trunk/reactos/lib/cpl/liccpa/liccpa.c 2005-03-18 00:56:34 UTC (rev 14170) @@ -29,14 +29,10 @@ ) { TCHAR szString[256]; - HWND hPlacementCombo; switch(uMsg) { case WM_INITDIALOG: - hPlacementCombo = GetDlgItem(hwndDlg, IDC_LICENSE); - LoadString(hApplet, IDS_REACTOS, szString, sizeof(szString) / sizeof(TCHAR)); - SendMessage(hPlacementCombo, CB_INSERTSTRING, 0, (LPARAM)szString); break; case WM_COMMAND: @@ -69,16 +65,6 @@ } break; } - - - - - - - - - - case WM_CLOSE: { EndDialog(hwndDlg, IDC_CANCEL); _____ Modified: trunk/reactos/lib/cpl/liccpa/liccpa.rc --- trunk/reactos/lib/cpl/liccpa/liccpa.rc 2005-03-17 23:52:28 UTC (rev 14169) +++ trunk/reactos/lib/cpl/liccpa/liccpa.rc 2005-03-18 00:56:34 UTC (rev 14170) @@ -22,10 +22,10 @@ CONTROL "Per Device or Per User", 102, "BUTTON", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE, 13, 79, 107, 12 CONTROL "Per Server. Number of concurrent connections:", 103, "BUTTON", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE, 13, 38, 163, 9 CONTROL "Product:", 105, "STATIC", SS_LEFT | WS_CHILD | WS_VISIBLE, 13, 20, 31, 8 - CONTROL "", 106, "COMBOBOX", CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP, 49, 20, 171, 12 - CONTROL "OK", 107, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 261, 7, 47, 14 - CONTROL "Cancel", 108, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 263, 27, 45, 14 - CONTROL "Help", 109, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 263, 48, 47, 14 + CONTROL "", 106, "COMBOBOX", CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP, 49, 20, 171, 12 + CONTROL "OK", 107, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 263, 7, 46, 14 + CONTROL "Cancel", 108, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 263, 27, 46, 14 + CONTROL "Help", 109, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 263, 48, 46, 14 CONTROL "Replication...", 110, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 263, 68, 46, 14 CONTROL "Add Licenses", 111, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 30, 56, 65, 15 CONTROL "Remove Licenses", 112, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 112, 56, 61, 16 _____ Modified: trunk/reactos/lib/cpl/liccpa/resource.h --- trunk/reactos/lib/cpl/liccpa/resource.h 2005-03-17 23:52:28 UTC (rev 14169) +++ trunk/reactos/lib/cpl/liccpa/resource.h 2005-03-18 00:56:34 UTC (rev 14170) @@ -6,8 +6,8 @@ #define IDC_CPLICON_1 1 #define IDD_PROPPAGE1 100 #define IDS_CPLNAME_1 1001 -#define IDS_REACTOS 1002 #define IDS_CPLDESCRIPTION_1 2001 +#define IDS_REACTOS 2002 #define IDC_LICENSE 106 #define IDC_OK 107
19 years, 9 months
1
0
0
0
[navaraf] 14169: It's not exactly wise to call GetFileTime and CloseHandle with invalid handle, so don't do it.
by navaraf@svn.reactos.com
It's not exactly wise to call GetFileTime and CloseHandle with invalid handle, so don't do it. Modified: trunk/reactos/lib/kernel32/misc/profile.c _____ Modified: trunk/reactos/lib/kernel32/misc/profile.c --- trunk/reactos/lib/kernel32/misc/profile.c 2005-03-17 23:16:12 UTC (rev 14168) +++ trunk/reactos/lib/kernel32/misc/profile.c 2005-03-17 23:52:28 UTC (rev 14169) @@ -819,7 +819,10 @@ MRUProfile[j] = MRUProfile[j-1]; CurProfile=tempProfile; } - GetFileTime(hFile, NULL, NULL, &LastWriteTime); + if (hFile != INVALID_HANDLE_VALUE) + GetFileTime(hFile, NULL, NULL, &LastWriteTime); + else + LastWriteTime.dwHighDateTime = LastWriteTime.dwLowDateTime = 0; if (memcmp(&CurProfile->LastWriteTime, &LastWriteTime, sizeof(FILETIME))) { DPRINT("(%S): already opened (mru = %d)\n", @@ -830,9 +833,10 @@ DPRINT("(%S): already opened, needs refreshing (mru = %d)\n", buffer, i ); } - CloseHandle(hFile); + if (hFile != INVALID_HANDLE_VALUE) + CloseHandle(hFile); return TRUE; - } + } } /* Flush the old current profile */
19 years, 9 months
1
0
0
0
[navaraf] 14168: Don't try to release mutex with NULL handle. Also prevent releasing the same mutex twice.
by navaraf@svn.reactos.com
Don't try to release mutex with NULL handle. Also prevent releasing the same mutex twice. Modified: trunk/reactos/lib/kernel32/debug/output.c _____ Modified: trunk/reactos/lib/kernel32/debug/output.c --- trunk/reactos/lib/kernel32/debug/output.c 2005-03-17 22:40:19 UTC (rev 14167) +++ trunk/reactos/lib/kernel32/debug/output.c 2005-03-17 23:16:12 UTC (rev 14168) @@ -456,7 +456,8 @@ if(hDBMonDataReady) CloseHandle(hDBMonDataReady); /* leave the critical section */ - ReleaseMutex(hDBMonMutex); + if(hDBMonDataReady != NULL) + ReleaseMutex(hDBMonMutex); #if 0 } }
19 years, 9 months
1
0
0
0
[navaraf] 14167: Don't try to duplicate NULL handles.
by navaraf@svn.reactos.com
Don't try to duplicate NULL handles. Modified: trunk/reactos/lib/kernel32/process/create.c _____ Modified: trunk/reactos/lib/kernel32/process/create.c --- trunk/reactos/lib/kernel32/process/create.c 2005-03-17 22:00:19 UTC (rev 14166) +++ trunk/reactos/lib/kernel32/process/create.c 2005-03-17 22:40:19 UTC (rev 14167) @@ -1289,7 +1289,7 @@ } /* Now duplicate handles if required */ - if (InputDup) + if (InputDup && Ppb->hStdInput != NULL) { if (IsConsoleHandle(Ppb->hStdInput)) { @@ -1312,7 +1312,7 @@ } } - if (OutputDup) + if (OutputDup && Ppb->hStdOutput != NULL) { if (IsConsoleHandle(Ppb->hStdOutput)) { @@ -1335,7 +1335,7 @@ } } - if (ErrorDup) + if (ErrorDup && Ppb->hStdError != NULL) { if (IsConsoleHandle(Ppb->hStdError)) {
19 years, 9 months
1
0
0
0
[navaraf] 14166: (GDIOBJ_SetOwnership): Don't try to decrease the GDI object counter for global handles since they're not associated with process.
by navaraf@svn.reactos.com
(GDIOBJ_SetOwnership): Don't try to decrease the GDI object counter for global handles since they're not associated with process. Modified: trunk/reactos/subsys/win32k/objects/gdiobj.c _____ Modified: trunk/reactos/subsys/win32k/objects/gdiobj.c --- trunk/reactos/subsys/win32k/objects/gdiobj.c 2005-03-17 20:15:44 UTC (rev 14165) +++ trunk/reactos/subsys/win32k/objects/gdiobj.c 2005-03-17 22:00:19 UTC (rev 14166) @@ -1216,15 +1216,18 @@ /* dereference the process' object counter */ /* FIXME */ - Status = PsLookupProcessByProcessId((HANDLE)((ULONG_PTR)PrevProcId & ~0x1), &OldProcess); - if(NT_SUCCESS(Status)) + if((ULONG_PTR)PrevProcId & ~0x1) { - W32Process = OldProcess->Win32Process; - if(W32Process != NULL) + Status = PsLookupProcessByProcessId((HANDLE)((ULONG_PTR)PrevProcId & ~0x1), &OldProcess); + if(NT_SUCCESS(Status)) { - InterlockedDecrement(&W32Process->GDIObjects); + W32Process = OldProcess->Win32Process; + if(W32Process != NULL) + { + InterlockedDecrement(&W32Process->GDIObjects); + } + ObDereferenceObject(OldProcess); } - ObDereferenceObject(OldProcess); } if(NewOwner != NULL)
19 years, 9 months
1
0
0
0
← Newer
1
...
20
21
22
23
24
25
26
...
61
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
Results per page:
10
25
50
100
200