don't remove the timer from the list before walking to the next timer.
also handle over-due timers in KeSetTimerEx(). This should make the
system bootable again.
Modified: trunk/reactos/ntoskrnl/ke/timer.c
_____
Modified: trunk/reactos/ntoskrnl/ke/timer.c
--- trunk/reactos/ntoskrnl/ke/timer.c 2005-02-14 16:16:27 UTC (rev
13565)
+++ trunk/reactos/ntoskrnl/ke/timer.c 2005-02-14 16:41:53 UTC (rev
13566)
@@ -200,9 +200,8 @@
/* Insert it */
if (!KiInsertTimer(Timer, DueTime)) {
-
- /* FIXME: I will think about how to handle this and fix it ASAP
-- Alex */
- DPRINT1("CRITICAL UNHANDLED CASE: TIMER ALREADY EXPIRED!!!\n");
+
+ KiHandleExpiredTimer(Timer);
};
/* Release Dispatcher Lock */
@@ -221,44 +220,45 @@
PVOID SystemArgument2)
{
ULONG Eip = (ULONG)SystemArgument1;
- PKTIMER Timer = NULL;
+ PKTIMER Timer;
ULONGLONG InterruptTime;
LIST_ENTRY ExpiredTimerList;
PLIST_ENTRY CurrentEntry = NULL;
KIRQL OldIrql;
DPRINT("KiExpireTimers(Dpc: %x)\n", Dpc);
+
+ /* Initialize the Expired Timer List */
+ InitializeListHead(&ExpiredTimerList);
/* Lock the Database and Raise IRQL */
OldIrql = KeAcquireDispatcherDatabaseLock();
-
- /* Initialize the Expired Timer List */
- InitializeListHead(&ExpiredTimerList);
/* Query Interrupt Times */
InterruptTime = KeQueryInterruptTime();
/* Loop through the Timer List and remove Expired Timers. Insert
them into the Expired Listhead */
- for (CurrentEntry = KiTimerListHead.Flink; CurrentEntry !=
&KiTimerListHead; CurrentEntry = CurrentEntry->Flink) {
+ CurrentEntry = KiTimerListHead.Flink;
+ while (CurrentEntry != &KiTimerListHead) {
/* Get the Current Timer */
Timer = CONTAINING_RECORD(CurrentEntry, KTIMER,
TimerListEntry);
DPRINT("Looping for Timer: %x. Duetime: %I64d. InterruptTime
%I64d \n", Timer, Timer->DueTime.QuadPart, InterruptTime);
+ CurrentEntry = CurrentEntry->Flink;
+
/* Check if we have to Expire it */
- if (InterruptTime < Timer->DueTime.QuadPart) break;
+ if (InterruptTime >= Timer->DueTime.QuadPart) {
- /* Remove it from the Timer List, add it to the Expired List */
- RemoveEntryList(&Timer->TimerListEntry);
- InsertTailList(&ExpiredTimerList, &Timer->TimerListEntry);
+ /* Remove it from the Timer List, add it to the Expired List
*/
+ RemoveEntryList(&Timer->TimerListEntry);
+ InsertTailList(&ExpiredTimerList, &Timer->TimerListEntry);
+ }
}
/* Expire the Timers */
- while (!IsListEmpty(&ExpiredTimerList)) {
+ while ((CurrentEntry = RemoveHeadList(&ExpiredTimerList)) !=
&ExpiredTimerList) {
- /* Get the Next Entry */
- CurrentEntry = RemoveHeadList(&ExpiredTimerList);
-
/* Get the Timer */
Timer = CONTAINING_RECORD(CurrentEntry, KTIMER,
TimerListEntry);
DPRINT("Expiring Timer: %x\n", Timer);
@@ -287,9 +287,12 @@
LARGE_INTEGER DueTime;
DPRINT("HandleExpiredTime(Timer %x)\n", Timer);
- /* First of all, remove the Timer */
- Timer->Header.Inserted = FALSE;
- RemoveEntryList(&Timer->TimerListEntry);
+ if(Timer->Header.Inserted) {
+
+ /* First of all, remove the Timer */
+ Timer->Header.Inserted = FALSE;
+ RemoveEntryList(&Timer->TimerListEntry);
+ }
/* Set it as Signaled */
DPRINT("Setting Timer as Signaled\n");
@@ -302,9 +305,9 @@
/* Reinsert the Timer */
DueTime.QuadPart = Timer->Period * -SYSTEM_TIME_UNITS_PER_MSEC;
if (!KiInsertTimer(Timer, DueTime)) {
-
- /* FIXME: I will think about how to handle this and fix it
ASAP -- Alex */
- DPRINT1("CRITICAL UNHANDLED CASE: TIMER ALREADY
EXPIRED!!!\n");
+
+ /* FIXME: I will think about how to handle this and fix it
ASAP -- Alex */
+ DPRINT1("CRITICAL UNHANDLED CASE: TIMER ALREADY
EXPIRED!!!\n");
};
}
Sync to Wine-20050211
James Hawkins <truiken(a)gmail.com>
- use only stored result of Interlocked* in AddRef/Release
- expand TRACEs to display the ref count
Hans Leidekker <hans(a)it.vu.nl>
- Stub implementations for PathUnExpandEnvStringsSHRegEnumUSValue{A,W},
SHRegCreateUSKey{A,W}, SHRegDeleteEmptyUSKey{A,W},
SHRegDeleteUSValue{A,W}, SHRegEnumUSValue{A,W}.
- Implement and test PathIsValidChar{A,W}.
Paul Vriens <Paul.Vriens(a)xs4all.nl>
- Change the order of Src and Dst in CopyKey calls/functions.
Modified: trunk/reactos/w32api/include/shlwapi.h
_____
Modified: trunk/reactos/w32api/include/shlwapi.h
--- trunk/reactos/w32api/include/shlwapi.h 2005-02-14 14:50:45 UTC
(rev 13559)
+++ trunk/reactos/w32api/include/shlwapi.h 2005-02-14 14:55:38 UTC
(rev 13560)
@@ -520,8 +520,8 @@
WINSHLWAPI HKEY WINAPI SHRegDuplicateHKey(HKEY);
WINSHLWAPI LONG WINAPI
SHRegEnumUSKeyA(HUSKEY,DWORD,LPSTR,LPDWORD,SHREGENUM_FLAGS);
WINSHLWAPI LONG WINAPI
SHRegEnumUSKeyW(HUSKEY,DWORD,LPWSTR,LPDWORD,SHREGENUM_FLAGS);
-WINSHLWAPI DWORD WINAPI
SHRegEnumUSValueA(HUSKEY,DWORD,LPSTR,LPDWORD,LPDWORD,LPVOID,LPDWORD,SHRE
GENUM_FLAGS);
-WINSHLWAPI DWORD WINAPI
SHRegEnumUSValueW(HUSKEY,DWORD,LPWSTR,LPDWORD,LPDWORD,LPVOID,LPDWORD,SHR
EGENUM_FLAGS);
+WINSHLWAPI LONG WINAPI
SHRegEnumUSValueA(HUSKEY,DWORD,LPSTR,LPDWORD,LPDWORD,LPVOID,LPDWORD,SHRE
GENUM_FLAGS);
+WINSHLWAPI LONG WINAPI
SHRegEnumUSValueW(HUSKEY,DWORD,LPWSTR,LPDWORD,LPDWORD,LPVOID,LPDWORD,SHR
EGENUM_FLAGS);
WINSHLWAPI BOOL WINAPI SHRegGetBoolUSValueA(LPCSTR,LPCSTR,BOOL,BOOL);
WINSHLWAPI BOOL WINAPI SHRegGetBoolUSValueW(LPCWSTR,LPCWSTR,BOOL,BOOL);
WINSHLWAPI DWORD WINAPI SHRegGetPathA(HKEY,LPCSTR,LPCSTR,LPSTR,DWORD);