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
August 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
23 participants
669 discussions
Start a n
N
ew thread
[ion] 17058: - Add comments to code and clean it up
by ion@svn.reactos.com
- Add comments to code and clean it up - Fix some incorrect operations - Optimize and fix loops Modified: trunk/reactos/ntoskrnl/ex/zone.c _____ Modified: trunk/reactos/ntoskrnl/ex/zone.c --- trunk/reactos/ntoskrnl/ex/zone.c 2005-08-05 06:53:56 UTC (rev 17057) +++ trunk/reactos/ntoskrnl/ex/zone.c 2005-08-05 06:54:15 UTC (rev 17058) @@ -1,57 +1,68 @@ -/* $Id$ - * +/* * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel - * FILE: ntoskrnl/mm/zone.c + * FILE: ntoskrnl/ex/zone.c * PURPOSE: Implements zone buffers * - * PROGRAMMERS: David Welch (welch(a)mcmail.com) + * PROGRAMMERS: Alex Ionescu (alex(a)relsoft.net) + * David Welch (welch(a)mcmail.com) */ /* INCLUDES ****************************************************************/ #include <ntoskrnl.h> +#define NDEBUG +#include <debug.h> /* FUNCTIONS ***************************************************************/ -// undocumented? from extypes.h in here for now... - -//typedef struct _ZONE_ENTRY -//{ -// SINGLE_LIST_ENTRY Entry; -//} ZONE_ENTRY, *PZONE_ENTRY; - - - /* * @implemented */ NTSTATUS STDCALL -ExExtendZone ( - PZONE_HEADER Zone, - PVOID Segment, - ULONG SegmentSize - ) +ExExtendZone(PZONE_HEADER Zone, + PVOID Segment, + ULONG SegmentSize) { - PZONE_SEGMENT_HEADER entry; - PZONE_SEGMENT_HEADER seg; - unsigned int i; + ULONG_PTR Entry; + ULONG i; - seg = (PZONE_SEGMENT_HEADER)Segment; - seg->Reserved = (PVOID) SegmentSize; + /* + * BlockSize and Segment must be 8-byte aligned. + * Blocksize cannot exceed Segment Size. + */ + if (((ULONG_PTR)Segment & 7) || + (SegmentSize & 7) || + (Zone->BlockSize > SegmentSize)) + { + DPRINT1("Invalid ExExtendZone Alignment and/or Size\n"); + return STATUS_INVALID_PARAMETER; + } - PushEntryList(&Zone->SegmentList,&seg->SegmentList); + /* Link the Zone and Segment */ + PushEntryList(&Zone->SegmentList,&((PZONE_SEGMENT_HEADER)Segment)->Segme ntList); - entry = (PZONE_SEGMENT_HEADER)( ((char*)seg) + sizeof(ZONE_SEGMENT_HEADER) ); + /* Get to the first entry */ + Entry = (ULONG_PTR)Segment + sizeof(ZONE_SEGMENT_HEADER); - for (i=0;i<(SegmentSize / Zone->BlockSize);i++) - { - PushEntryList(&Zone->FreeList,&entry->SegmentList); - entry = (PZONE_SEGMENT_HEADER)(((char*)entry) + sizeof(PZONE_SEGMENT_HEADER) + - Zone->BlockSize); - } - return(STATUS_SUCCESS); + /* Loop through the segments */ + for (i = sizeof(ZONE_SEGMENT_HEADER); + i <= SegmentSize - Zone->BlockSize; + i+= Zone->BlockSize) + { + /* Link the Free and Segment Lists */ + PushEntryList(&Zone->FreeList, (PSINGLE_LIST_ENTRY)Entry); + + /* Go to the next entry */ + Entry += Zone->BlockSize; + } + + /* Update Segment Size */ + Zone->TotalSegmentSize += i; + + /* Return Success */ + return STATUS_SUCCESS; } @@ -60,35 +71,27 @@ */ NTSTATUS STDCALL -ExInterlockedExtendZone ( - PZONE_HEADER Zone, - PVOID Segment, - ULONG SegmentSize, - PKSPIN_LOCK Lock - ) +ExInterlockedExtendZone(PZONE_HEADER Zone, + PVOID Segment, + ULONG SegmentSize, + PKSPIN_LOCK Lock) { - NTSTATUS ret; - KIRQL oldlvl; + NTSTATUS Status; + KIRQL OldIrql; - KeAcquireSpinLock(Lock,&oldlvl); - ret = ExExtendZone(Zone,Segment,SegmentSize); - KeReleaseSpinLock(Lock,oldlvl); - return(ret); + /* Get the lock */ + KeAcquireSpinLock(Lock, &OldIrql); + + /* Extend the Zone */ + Status = ExExtendZone(Zone, Segment, SegmentSize); + + /* Release lock and return status */ + KeReleaseSpinLock(Lock, OldIrql); + return Status; } /* - * @implemented - */ -NTSTATUS -STDCALL -ExInitializeZone ( - PZONE_HEADER Zone, - ULONG BlockSize, - PVOID InitialSegment, - ULONG InitialSegmentSize - ) -/* * FUNCTION: Initalizes a zone header * ARGUMENTS: * Zone = zone header to be initialized @@ -96,31 +99,60 @@ * InitialSegment = Initial segment of storage allocated by the * caller * InitialSegmentSize = Initial size of the segment + * + * @implemented */ +NTSTATUS +STDCALL +ExInitializeZone(PZONE_HEADER Zone, + ULONG BlockSize, + PVOID InitialSegment, + ULONG InitialSegmentSize) { - unsigned int i; - PZONE_SEGMENT_HEADER seg; - PZONE_SEGMENT_HEADER entry; + ULONG i; + ULONG_PTR Entry; - Zone->FreeList.Next=NULL; - Zone->SegmentList.Next=NULL; - Zone->BlockSize=BlockSize; - Zone->TotalSegmentSize = InitialSegmentSize; + /* + * BlockSize and Segment must be 8-byte aligned. + * Blocksize cannot exceed Segment Size. + */ + if (((ULONG_PTR)InitialSegment & 7) || + (InitialSegmentSize & 7) || + (BlockSize > InitialSegmentSize)) + { + DPRINT1("Invalid ExInitializeZone Alignment and/or Size\n"); + return STATUS_INVALID_PARAMETER; + } - seg = (PZONE_SEGMENT_HEADER)InitialSegment; - seg->Reserved = (PVOID*) InitialSegmentSize; + /* Set the Zone Header */ + Zone->BlockSize = BlockSize; - PushEntryList(&Zone->SegmentList,&seg->SegmentList); + /* Link empty list */ + Zone->FreeList.Next = NULL; + Zone->SegmentList.Next = NULL; + PushEntryList(&Zone->SegmentList, &((PZONE_SEGMENT_HEADER)InitialSegment)->SegmentList); + ((PZONE_SEGMENT_HEADER)InitialSegment)->Reserved = NULL; - entry = (PZONE_SEGMENT_HEADER)( ((char*)seg) + sizeof(ZONE_SEGMENT_HEADER) ); + /* Get first entry */ + Entry = (ULONG_PTR)InitialSegment + sizeof(ZONE_SEGMENT_HEADER); - for (i=0;i<(InitialSegmentSize / BlockSize);i++) - { - PushEntryList(&Zone->FreeList,&entry->SegmentList); - entry = (PZONE_SEGMENT_HEADER)(((char*)entry) + sizeof(PZONE_SEGMENT_HEADER) + BlockSize); - } + /* Loop through the segments */ + for (i = sizeof(ZONE_SEGMENT_HEADER); + i <= InitialSegmentSize - BlockSize; + i+= BlockSize) + { + /* Link the Free and Segment Lists */ + PushEntryList(&Zone->FreeList, (PSINGLE_LIST_ENTRY)Entry); - return(STATUS_SUCCESS); + /* Go to the next entry */ + Entry += Zone->BlockSize; + } + + /* Update Segment Size */ + Zone->TotalSegmentSize += i; + + /* Return success */ + return STATUS_SUCCESS; } /* EOF */
19 years, 4 months
1
0
0
0
[ion] 17057: - Optimize locking so that the Wake Lock is only entered after a first attempt determines the timer is a wake timer.
by ion@svn.reactos.com
- Optimize locking so that the Wake Lock is only entered after a first attempt determines the timer is a wake timer. After the lock, a second check is done to make sure. However, since the first check will fail 99% of times, we will not acquire/release a spinlock, and thus decrease contention. - Fix Object Type Initializer to actually use ExpTimerDelete when the object is deleted. - Fix Initializer to report correct memory usage of timer object. - Fix Initializer to report OBJ_OPENLINK as an invalid attribute for timer objects. - Use correct access masks when modifying or querying timer objects. - Handle wake timers in NtCancelTimer. - Return warning NTSTATUS code if a wake timer is requested but not supported by the system (default on ROS). - Check for valid timer type in NtCreateTimer. - Check for valid period in NtSetTimer. - Don't dereference the timer in NtSetTimer three times. - Return the correct Due Time in NtQueryTimer by substracting the stable interrupt time. - Harmonize formatting, fix some comments. Modified: trunk/reactos/ntoskrnl/ex/timer.c _____ Modified: trunk/reactos/ntoskrnl/ex/timer.c --- trunk/reactos/ntoskrnl/ex/timer.c 2005-08-05 06:13:43 UTC (rev 17056) +++ trunk/reactos/ntoskrnl/ex/timer.c 2005-08-05 06:53:56 UTC (rev 17057) @@ -2,23 +2,23 @@ * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel * FILE: ntoskrnl/ex/timer.c - * PURPOSE: User-mode timers + * PURPOSE: Executive Timer Implementation * - * PROGRAMMERS: Alex Ionescu (alex(a)relsoft.net) - Reimplemented + * PROGRAMMERS: Alex Ionescu (alex(a)relsoft.net) * David Welch (welch(a)mcmail.com) */ /* INCLUDES *****************************************************************/ #include <ntoskrnl.h> - #define NDEBUG #include <internal/debug.h> /* TYPES ********************************************************************/ /* Executive Timer Object */ -typedef struct _ETIMER { +typedef struct _ETIMER +{ KTIMER KeTimer; KAPC TimerApc; KDPC TimerDpc; @@ -38,7 +38,8 @@ LIST_ENTRY ExpWakeList; /* Timer Mapping */ -static GENERIC_MAPPING ExpTimerMapping = { +static GENERIC_MAPPING ExpTimerMapping = +{ STANDARD_RIGHTS_READ | TIMER_QUERY_STATE, STANDARD_RIGHTS_WRITE | TIMER_MODIFY_STATE, STANDARD_RIGHTS_EXECUTE | SYNCHRONIZE, @@ -46,8 +47,8 @@ }; /* Timer Information Classes */ -static const INFORMATION_CLASS_INFO ExTimerInfoClass[] = { - +static const INFORMATION_CLASS_INFO ExTimerInfoClass[] = +{ /* TimerBasicInformation */ ICI_SQ_SAME( sizeof(TIMER_BASIC_INFORMATION), sizeof(ULONG), ICIF_QUERY ), }; @@ -68,42 +69,42 @@ while (!IsListEmpty(&Thread->ActiveTimerListHead)) { - /* Remove a Timer */ - CurrentEntry = RemoveTailList(&Thread->ActiveTimerListHead); + CurrentEntry = RemoveTailList(&Thread->ActiveTimerListHead); /* Get the Timer */ Timer = CONTAINING_RECORD(CurrentEntry, ETIMER, ActiveTimerListEntry); + DPRINT("Timer, ThreadList: 0x%p, 0x%p\n", Timer, Thread); + /* Mark it as deassociated */ ASSERT (Timer->ApcAssociated); - Timer->ApcAssociated = FALSE; + Timer->ApcAssociated = FALSE; - DPRINT("Timer, ThreadList: 0x%p, 0x%p\n", Timer, Thread); - /* Unlock the list */ KeReleaseSpinLockFromDpcLevel(&Thread->ActiveTimerListLock); /* Lock the Timer */ KeAcquireSpinLockAtDpcLevel(&Timer->Lock); - ASSERT (&Thread->Tcb == Timer->TimerApc.Thread); - + /* Cancel the timer and remove its DPC and APC */ + ASSERT(&Thread->Tcb == Timer->TimerApc.Thread); KeCancelTimer(&Timer->KeTimer); KeRemoveQueueDpc(&Timer->TimerDpc); KeRemoveQueueApc(&Timer->TimerApc); - /* Unlock the Timer */ KeReleaseSpinLock(&Timer->Lock, OldIrql); - /* Dereference it, if needed */ + /* Dereference it */ ObDereferenceObject(Timer); /* Loop again */ KeAcquireSpinLock(&Thread->ActiveTimerListLock, &OldIrql); } + /* Release lock and return */ KeReleaseSpinLock(&Thread->ActiveTimerListLock, OldIrql); + return; } VOID @@ -112,24 +113,27 @@ { KIRQL OldIrql; PETIMER Timer = ObjectBody; - DPRINT("ExpDeleteTimer(Timer: 0x%p)\n", Timer); - /* Lock the Wake List */ - KeAcquireSpinLock(&ExpWakeListLock, &OldIrql); - /* Check if it has a Wait List */ - if (Timer->WakeTimer) { + if (Timer->WakeTimer) + { + /* Lock the Wake List */ + KeAcquireSpinLock(&ExpWakeListLock, &OldIrql); - /* Remove it from the Wait List */ - DPRINT("Removing wake list\n"); - RemoveEntryList(&Timer->WakeTimerListEntry); - Timer->WakeTimer = FALSE; + /* Check again, since it might've changed before we locked */ + if (Timer->WakeTimer) + { + /* Remove it from the Wait List */ + DPRINT("Removing wake list\n"); + RemoveEntryList(&Timer->WakeTimerListEntry); + Timer->WakeTimer = FALSE; + } + + /* Release the Wake List */ + KeReleaseSpinLock(&ExpWakeListLock, OldIrql); } - /* Release the Wake List */ - KeReleaseSpinLock(&ExpWakeListLock, OldIrql); - /* Tell the Kernel to cancel the Timer */ DPRINT("Cancelling Timer\n"); KeCancelTimer(&Timer->KeTimer); @@ -154,8 +158,8 @@ KeAcquireSpinLock(&Timer->Lock, &OldIrql); /* Queue the APC */ - if(Timer->ApcAssociated) { - + if(Timer->ApcAssociated) + { DPRINT("Queuing APC\n"); KeInsertQueueApc(&Timer->TimerApc, SystemArgument1, @@ -165,6 +169,7 @@ /* Release the Timer */ KeReleaseSpinLock(&Timer->Lock, OldIrql); + return; } @@ -196,8 +201,8 @@ */ if ((Timer->ApcAssociated) && (&CurrentThread->Tcb == Timer->TimerApc.Thread) && - (!Timer->KeTimer.Period)) { - + (!Timer->KeTimer.Period)) + { /* Remove it from the Active Timers List */ DPRINT("Removing Timer\n"); RemoveEntryList(&Timer->ActiveTimerListEntry); @@ -233,11 +238,12 @@ RtlZeroMemory(&ObjectTypeInitializer, sizeof(ObjectTypeInitializer)); RtlInitUnicodeString(&Name, L"Timer"); ObjectTypeInitializer.Length = sizeof(ObjectTypeInitializer); - ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(KTIMER); + ObjectTypeInitializer.InvalidAttributes = OBJ_OPENLINK; + ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(ETIMER); ObjectTypeInitializer.GenericMapping = ExpTimerMapping; ObjectTypeInitializer.PoolType = NonPagedPool; ObjectTypeInitializer.ValidAccessMask = TIMER_ALL_ACCESS; - ObjectTypeInitializer.UseDefaultObject = TRUE; + ObjectTypeInitializer.DeleteProcedure = ExpDeleteTimer; ObpCreateTypeObject(&ObjectTypeInitializer, &Name, &ExTimerType); /* Initialize the Wait List and Lock */ @@ -245,7 +251,6 @@ InitializeListHead(&ExpWakeList); } - NTSTATUS STDCALL NtCancelTimer(IN HANDLE TimerHandle, @@ -258,44 +263,46 @@ PETHREAD TimerThread; BOOLEAN KillTimer = FALSE; NTSTATUS Status = STATUS_SUCCESS; - PAGED_CODE(); DPRINT("NtCancelTimer(0x%p, 0x%x)\n", TimerHandle, CurrentState); /* Check Parameter Validity */ - if(CurrentState != NULL && PreviousMode != KernelMode) { - _SEH_TRY { + if(CurrentState && PreviousMode != KernelMode) + { + _SEH_TRY + { ProbeForWrite(CurrentState, sizeof(BOOLEAN), sizeof(BOOLEAN)); - } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) { + } + _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) + { Status = _SEH_GetExceptionCode(); - } _SEH_END; + } + _SEH_END; - if(!NT_SUCCESS(Status)) { - return Status; - } + if(!NT_SUCCESS(Status)) return Status; } /* Get the Timer Object */ Status = ObReferenceObjectByHandle(TimerHandle, - TIMER_ALL_ACCESS, + TIMER_MODIFY_STATE, ExTimerType, PreviousMode, (PVOID*)&Timer, NULL); /* Check for success */ - if(NT_SUCCESS(Status)) { - + if(NT_SUCCESS(Status)) + { DPRINT("Timer Referenced: 0x%p\n", Timer); /* Lock the Timer */ KeAcquireSpinLock(&Timer->Lock, &OldIrql); /* Check if it's enabled */ - if (Timer->ApcAssociated) { - + if (Timer->ApcAssociated) + { /* * First, remove it from the Thread's Active List * Get the Thread. @@ -318,39 +325,58 @@ KeRemoveQueueApc(&Timer->TimerApc); Timer->ApcAssociated = FALSE; KillTimer = TRUE; - - } else { - + } + else + { /* If timer was disabled, we still need to cancel it */ DPRINT("APC was not Associated. Cancelling Timer\n"); KeCancelTimer(&Timer->KeTimer); } + /* Handle a Wake Timer */ + if (Timer->WakeTimer) + { + /* Lock the Wake List */ + KeAcquireSpinLockAtDpcLevel(&ExpWakeListLock); + + /* Check again, since it might've changed before we locked */ + if (Timer->WakeTimer) + { + /* Remove it from the Wait List */ + DPRINT("Removing wake list\n"); + RemoveEntryList(&Timer->WakeTimerListEntry); + Timer->WakeTimer = FALSE; + } + + /* Release the Wake List */ + KeReleaseSpinLockFromDpcLevel(&ExpWakeListLock); + } + + /* Unlock the Timer */ + KeReleaseSpinLock(&Timer->Lock, OldIrql); + /* Read the old State */ State = KeReadStateTimer(&Timer->KeTimer); /* Dereference the Object */ ObDereferenceObject(Timer); - /* Unlock the Timer */ - KeReleaseSpinLock(&Timer->Lock, OldIrql); - /* Dereference if it was previously enabled */ if (KillTimer) ObDereferenceObject(Timer); DPRINT1("Timer disabled\n"); /* Make sure it's safe to write to the handle */ - if(CurrentState != NULL) { - - _SEH_TRY { - + if(CurrentState) + { + _SEH_TRY + { *CurrentState = State; - - } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) { - + } + _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) + { Status = _SEH_GetExceptionCode(); - - } _SEH_END; + } + _SEH_END; } } @@ -358,7 +384,6 @@ return Status; } - NTSTATUS STDCALL NtCreateTimer(OUT PHANDLE TimerHandle, @@ -370,41 +395,48 @@ HANDLE hTimer; KPROCESSOR_MODE PreviousMode = ExGetPreviousMode(); NTSTATUS Status = STATUS_SUCCESS; - PAGED_CODE(); DPRINT("NtCreateTimer(Handle: 0x%p, Type: %d)\n", TimerHandle, TimerType); /* Check Parameter Validity */ - if (PreviousMode != KernelMode) { - - _SEH_TRY { - + if (PreviousMode != KernelMode) + { + _SEH_TRY + { ProbeForWrite(TimerHandle, sizeof(HANDLE), sizeof(ULONG)); - } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) { - + } + _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) + { Status = _SEH_GetExceptionCode(); + } + _SEH_END; - } _SEH_END; - if(!NT_SUCCESS(Status)) return Status; } + /* Check for correct timer type */ + if ((TimerType != NotificationTimer) && (TimerType != SynchronizationTimer)) + { + DPRINT1("Invalid Timer Type!\n"); + return STATUS_INVALID_PARAMETER_4; + } + /* Create the Object */ Status = ObCreateObject(PreviousMode, - ExTimerType, - ObjectAttributes, - PreviousMode, - NULL, - sizeof(ETIMER), - 0, - 0, - (PVOID*)&Timer); + ExTimerType, + ObjectAttributes, + PreviousMode, + NULL, + sizeof(ETIMER), + 0, + 0, + (PVOID*)&Timer); /* Check for Success */ - if(NT_SUCCESS(Status)) { - + if(NT_SUCCESS(Status)) + { /* Initialize the Kernel Timer */ DPRINT("Initializing Timer: 0x%p\n", Timer); KeInitializeTimerEx(&Timer->KeTimer, TimerType); @@ -428,24 +460,22 @@ &hTimer); DPRINT("Timer Inserted\n"); - /* Make sure it's safe to write to the handle */ - _SEH_TRY { - + _SEH_TRY + { *TimerHandle = hTimer; - - } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) { - + } + _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) + { Status = _SEH_GetExceptionCode(); - - } _SEH_END; + } + _SEH_END; } /* Return to Caller */ return Status; } - NTSTATUS STDCALL NtOpenTimer(OUT PHANDLE TimerHandle, @@ -455,25 +485,24 @@ HANDLE hTimer; KPROCESSOR_MODE PreviousMode = ExGetPreviousMode(); NTSTATUS Status = STATUS_SUCCESS; - PAGED_CODE(); DPRINT("NtOpenTimer(TimerHandle: 0x%p)\n", TimerHandle); /* Check Parameter Validity */ - if (PreviousMode != KernelMode) { - - _SEH_TRY { - + if (PreviousMode != KernelMode) + { + _SEH_TRY + { ProbeForWrite(TimerHandle, sizeof(HANDLE), sizeof(ULONG)); - - } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) { - + } + _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) + { Status = _SEH_GetExceptionCode(); + } + _SEH_END; - } _SEH_END; - if(!NT_SUCCESS(Status)) return Status; } @@ -487,18 +516,18 @@ &hTimer); /* Check for success */ - if(NT_SUCCESS(Status)) { - + if(NT_SUCCESS(Status)) + { /* Make sure it's safe to write to the handle */ - _SEH_TRY { - + _SEH_TRY + { *TimerHandle = hTimer; - - } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) { - + } + _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) + { Status = _SEH_GetExceptionCode(); - - } _SEH_END; + } + _SEH_END; } /* Return to Caller */ @@ -518,7 +547,6 @@ KPROCESSOR_MODE PreviousMode = ExGetPreviousMode(); NTSTATUS Status = STATUS_SUCCESS; PTIMER_BASIC_INFORMATION BasicInfo = (PTIMER_BASIC_INFORMATION)TimerInformation; - PAGED_CODE(); DPRINT("NtQueryTimer(TimerHandle: 0x%p, Class: %d)\n", TimerHandle, TimerInformationClass); @@ -530,8 +558,8 @@ ReturnLength, PreviousMode, &Status); - if(!NT_SUCCESS(Status)) { - + if(!NT_SUCCESS(Status)) + { DPRINT1("NtQueryTimer() failed, Status: 0x%x\n", Status); return Status; } @@ -545,24 +573,30 @@ NULL); /* Check for Success */ - if(NT_SUCCESS(Status)) { - + if(NT_SUCCESS(Status)) + { /* Return the Basic Information */ - _SEH_TRY { + _SEH_TRY + { + /* Return the remaining time, corrected */ + BasicInfo->TimeRemaining.QuadPart = Timer->KeTimer.DueTime.QuadPart - + KeQueryInterruptTime(); - /* FIXME: Interrupt correction based on Interrupt Time */ - DPRINT("Returning Information for Timer: 0x%p. Time Remaining: %I64x\n", Timer, Timer->KeTimer.DueTime.QuadPart); - BasicInfo->TimeRemaining.QuadPart = Timer->KeTimer.DueTime.QuadPart; + /* Return the current state */ BasicInfo->SignalState = KeReadStateTimer(&Timer->KeTimer); + /* Return the buffer length if requested */ if(ReturnLength != NULL) *ReturnLength = sizeof(TIMER_BASIC_INFORMATION); - } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) { - + DPRINT("Returning Information for Timer: 0x%p. Time Remaining: %I64x\n", + Timer, BasicInfo->TimeRemaining.QuadPart); + } + _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) + { Status = _SEH_GetExceptionCode(); + } + _SEH_END; - } _SEH_END; - /* Dereference Object */ ObDereferenceObject(Timer); } @@ -590,54 +624,69 @@ PETHREAD TimerThread; BOOLEAN KillTimer = FALSE; NTSTATUS Status = STATUS_SUCCESS; - PAGED_CODE(); - DPRINT("NtSetTimer(TimerHandle: 0x%p, DueTime: %I64x, Apc: 0x%p, Period: %d)\n", TimerHandle, DueTime->QuadPart, TimerApcRoutine, Period); + DPRINT("NtSetTimer(TimerHandle: 0x%p, DueTime: %I64x, Apc: 0x%p, Period: %d)\n", + TimerHandle, DueTime->QuadPart, TimerApcRoutine, Period); /* Check Parameter Validity */ - if (PreviousMode != KernelMode) { - - _SEH_TRY { - + if (PreviousMode != KernelMode) + { + _SEH_TRY + { ProbeForRead(DueTime, sizeof(LARGE_INTEGER), sizeof(ULONG)); TimerDueTime = *DueTime; - if(PreviousState != NULL) { - + if(PreviousState) + { ProbeForWrite(PreviousState, sizeof(BOOLEAN), sizeof(BOOLEAN)); } - - } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) { - + } + _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) + { Status = _SEH_GetExceptionCode(); + } + _SEH_END; - } _SEH_END; - if(!NT_SUCCESS(Status)) return Status; } + /* Check for a valid Period */ + if (Period < 0) + { + DPRINT1("Invalid Period for timer\n"); + return STATUS_INVALID_PARAMETER_6; + } + /* Get the Timer Object */ Status = ObReferenceObjectByHandle(TimerHandle, - TIMER_ALL_ACCESS, + TIMER_MODIFY_STATE, ExTimerType, PreviousMode, (PVOID*)&Timer, NULL); + /* + * Tell the user we don't support Wake Timers... + * when we have the ability to use/detect the Power Management + * functionatliy required to support them, make this check dependent + * on the actual PM capabilities + */ + if (WakeTimer) Status = STATUS_TIMER_RESUME_IGNORED; + /* Check status */ - if (NT_SUCCESS(Status)) { - + if (NT_SUCCESS(Status)) + { /* Lock the Timer */ DPRINT("Timer Referencced: 0x%p\n", Timer); KeAcquireSpinLock(&Timer->Lock, &OldIrql); /* Cancel Running Timer */ - if (Timer->ApcAssociated) { - + if (Timer->ApcAssociated) + { /* * First, remove it from the Thread's Active List * Get the Thread. @@ -674,13 +723,14 @@ /* Handle Wake Timers */ DPRINT("Doing Wake Semantics\n"); KeAcquireSpinLockAtDpcLevel(&ExpWakeListLock); - if (WakeTimer && !Timer->WakeTimer) { - + if (WakeTimer && !Timer->WakeTimer) + { /* Insert it into the list */ Timer->WakeTimer = TRUE; InsertTailList(&ExpWakeList, &Timer->WakeTimerListEntry); - } else if (!WakeTimer && Timer->WakeTimer) { - + } + else if (!WakeTimer && Timer->WakeTimer) + { /* Remove it from the list */ RemoveEntryList(&Timer->WakeTimerListEntry); Timer->WakeTimer = FALSE; @@ -688,8 +738,8 @@ KeReleaseSpinLockFromDpcLevel(&ExpWakeListLock); /* Set up the APC Routine if specified */ - if (TimerApcRoutine) { - + if (TimerApcRoutine) + { /* Initialize the APC */ DPRINT("Initializing APC: 0x%p\n", Timer->TimerApc); KeInitializeApc(&Timer->TimerApc, @@ -720,26 +770,23 @@ /* Unlock the Timer */ KeReleaseSpinLock(&Timer->Lock, OldIrql); - /* Dereference the Object */ - ObDereferenceObject(Timer); - /* Dereference if it was previously enabled */ if (!TimerApcRoutine) ObDereferenceObject(Timer); if (KillTimer) ObDereferenceObject(Timer); DPRINT("Finished Setting the Timer\n"); /* Make sure it's safe to write to the handle */ - if(PreviousState != NULL) { - - _SEH_TRY { - + if(PreviousState != NULL) + { + _SEH_TRY + { *PreviousState = State; - - } _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) { - + } + _SEH_EXCEPT(_SEH_ExSystemExceptionFilter) + { Status = _SEH_GetExceptionCode(); - - } _SEH_END; + } + _SEH_END; } }
19 years, 4 months
1
0
0
0
[ion] 17056: - Makefile change for previous commit.
by ion@svn.reactos.com
- Makefile change for previous commit. Modified: trunk/reactos/ntoskrnl/ntoskrnl.xml _____ Modified: trunk/reactos/ntoskrnl/ntoskrnl.xml --- trunk/reactos/ntoskrnl/ntoskrnl.xml 2005-08-05 06:13:23 UTC (rev 17055) +++ trunk/reactos/ntoskrnl/ntoskrnl.xml 2005-08-05 06:13:43 UTC (rev 17056) @@ -142,7 +142,6 @@ <file>sysinfo.c</file> <file>time.c</file> <file>timer.c</file> - <file>util.c</file> <file>uuid.c</file> <file>win32k.c</file> <file>work.c</file>
19 years, 4 months
1
0
0
0
[ion] 17055: - Move ExCreateUUID to uuid.c
by ion@svn.reactos.com
- Move ExCreateUUID to uuid.c - Move ExpVerifiySuite to sysinfo.c - Delete util.c Modified: trunk/reactos/ntoskrnl/ex/sysinfo.c Deleted: trunk/reactos/ntoskrnl/ex/util.c Modified: trunk/reactos/ntoskrnl/ex/uuid.c _____ Modified: trunk/reactos/ntoskrnl/ex/sysinfo.c --- trunk/reactos/ntoskrnl/ex/sysinfo.c 2005-08-05 03:59:05 UTC (rev 17054) +++ trunk/reactos/ntoskrnl/ex/sysinfo.c 2005-08-05 06:13:23 UTC (rev 17055) @@ -95,6 +95,17 @@ return(SharedUserData->ProcessorFeatures[ProcessorFeature]); } +/* + * @implemented + */ +BOOLEAN +STDCALL +ExVerifySuite(SUITE_TYPE SuiteType) +{ + if (SuiteType == Personal) return TRUE; + return FALSE; +} + NTSTATUS STDCALL NtQuerySystemEnvironmentValue (IN PUNICODE_STRING VariableName, OUT PWSTR ValueBuffer, _____ Deleted: trunk/reactos/ntoskrnl/ex/util.c --- trunk/reactos/ntoskrnl/ex/util.c 2005-08-05 03:59:05 UTC (rev 17054) +++ trunk/reactos/ntoskrnl/ex/util.c 2005-08-05 06:13:23 UTC (rev 17055) @@ -1,45 +0,0 @@ -/* $Id$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * FILE: ntoskrnl/ex/misc.c - * PURPOSE: Executive Utility Functions - * - * PROGRAMMERS: No programmer listed. - */ - -/* INCLUDES *****************************************************************/ - -#include <ntoskrnl.h> -#define NDEBUG -#include <internal/debug.h> - -/* FUNCTIONS *****************************************************************/ - -/* - * @unimplemented - */ -NTSTATUS -STDCALL -ExUuidCreate( - OUT UUID *Uuid - ) -{ - UNIMPLEMENTED; - return FALSE; -} - -/* - * @implemented - */ -BOOLEAN -STDCALL -ExVerifySuite( - SUITE_TYPE SuiteType - ) -{ - if (SuiteType == Personal) return TRUE; - return FALSE; -} - -/* EOF */ _____ Modified: trunk/reactos/ntoskrnl/ex/uuid.c --- trunk/reactos/ntoskrnl/ex/uuid.c 2005-08-05 03:59:05 UTC (rev 17054) +++ trunk/reactos/ntoskrnl/ex/uuid.c 2005-08-05 06:13:23 UTC (rev 17055) @@ -212,6 +212,18 @@ return STATUS_SUCCESS; } +/* + * @unimplemented + */ +NTSTATUS +STDCALL +ExUuidCreate( + OUT UUID *Uuid + ) +{ + UNIMPLEMENTED; + return FALSE; +} /* * @unimplemented
19 years, 4 months
1
0
0
0
[sedwards] 17054: added oledlg.dll to the build. Needed by visio2k setup.
by sedwards@svn.reactos.com
added oledlg.dll to the build. Needed by visio2k setup. Modified: trunk/reactos/bootdata/packages/reactos.dff Modified: trunk/reactos/lib/directory.xml Added: trunk/reactos/lib/oledlg/oledlg.xml _____ Modified: trunk/reactos/bootdata/packages/reactos.dff --- trunk/reactos/bootdata/packages/reactos.dff 2005-08-05 03:44:24 UTC (rev 17053) +++ trunk/reactos/bootdata/packages/reactos.dff 2005-08-05 03:59:05 UTC (rev 17054) @@ -118,6 +118,7 @@ lib\objsel\objsel.dll 1 lib\ole32\ole32.dll 1 lib\oleaut32\oleaut32.dll 1 +lib\oledlg\oledlg.dll 1 lib\olepro32\olepro32.dll 1 lib\opengl32\opengl32.dll 1 lib\psapi\psapi.dll 1 _____ Modified: trunk/reactos/lib/directory.xml --- trunk/reactos/lib/directory.xml 2005-08-05 03:44:24 UTC (rev 17053) +++ trunk/reactos/lib/directory.xml 2005-08-05 03:59:05 UTC (rev 17054) @@ -203,6 +203,9 @@ <directory name="oleaut32"> <xi:include href="oleaut32/oleaut32.xml" /> </directory> +<directory name="oledlg"> + <xi:include href="oledlg/oledlg.xml" /> +</directory> <directory name="olepro32"> <xi:include href="olepro32/olepro32.xml" /> </directory> _____ Added: trunk/reactos/lib/oledlg/oledlg.xml --- trunk/reactos/lib/oledlg/oledlg.xml 2005-08-05 03:44:24 UTC (rev 17053) +++ trunk/reactos/lib/oledlg/oledlg.xml 2005-08-05 03:59:05 UTC (rev 17054) @@ -0,0 +1,19 @@ +<module name="oledlg" type="win32dll" baseaddress="${BASEADDRESS_OLEDLG}" installbase="system32" installname="oledlg.dll"> + <importlibrary definition="oledlg.spec.def" /> + <include base="oledlg">.</include> + <include base="ReactOS">include/wine</include> + <define name="__REACTOS__" /> + <define name="__USE_W32API" /> + <define name="_WIN32_IE">0x600</define> + <define name="_WIN32_WINNT">0x501</define> + <define name="WINVER">0x501</define> + <library>wine</library> + <library>ntdll</library> + <library>kernel32</library> + <library>comdlg32</library> + <library>ole32</library> + <file>oledlg_main.c</file> + <file>insobjdlg.c</file> + <file>rsrc.rc</file> + <file>oledlg.spec</file> +</module>
19 years, 4 months
1
0
0
0
[ion] 17053: - Remove unused ldr/userldr.c
by ion@svn.reactos.com
- Remove unused ldr/userldr.c - Rename LdrLoadInitialProcess to Exp... and move to executive initialization. - Removed ldr/init.c - Renamed ldr/sysdll.c functions to Psp (correct naming) and deleted file. - Renamed SystemDll... ntdll pointers to correct Ke names - Use direct Ke names instead of going through an API call. - Make ExpInit... functions STDCALL Modified: trunk/reactos/ntoskrnl/ex/callback.c Modified: trunk/reactos/ntoskrnl/ex/event.c Modified: trunk/reactos/ntoskrnl/ex/evtpair.c Modified: trunk/reactos/ntoskrnl/ex/init.c Modified: trunk/reactos/ntoskrnl/ex/lookas.c Modified: trunk/reactos/ntoskrnl/ex/mutant.c Modified: trunk/reactos/ntoskrnl/ex/profile.c Modified: trunk/reactos/ntoskrnl/ex/sem.c Modified: trunk/reactos/ntoskrnl/ex/time.c Modified: trunk/reactos/ntoskrnl/ex/timer.c Modified: trunk/reactos/ntoskrnl/ex/uuid.c Modified: trunk/reactos/ntoskrnl/ex/win32k.c Modified: trunk/reactos/ntoskrnl/ex/work.c Modified: trunk/reactos/ntoskrnl/include/internal/ex.h Modified: trunk/reactos/ntoskrnl/include/internal/ke.h Modified: trunk/reactos/ntoskrnl/include/internal/ldr.h Modified: trunk/reactos/ntoskrnl/include/internal/ps.h Modified: trunk/reactos/ntoskrnl/ke/apc.c Modified: trunk/reactos/ntoskrnl/ke/catch.c Modified: trunk/reactos/ntoskrnl/ke/i386/exp.c Modified: trunk/reactos/ntoskrnl/ke/main.c Modified: trunk/reactos/ntoskrnl/ke/usercall.c Deleted: trunk/reactos/ntoskrnl/ldr/init.c Deleted: trunk/reactos/ntoskrnl/ldr/sysdll.c Deleted: trunk/reactos/ntoskrnl/ldr/userldr.c Modified: trunk/reactos/ntoskrnl/ntoskrnl.xml Modified: trunk/reactos/ntoskrnl/ps/process.c Modified: trunk/reactos/ntoskrnl/ps/psmgr.c Modified: trunk/reactos/ntoskrnl/ps/thread.c _____ Modified: trunk/reactos/ntoskrnl/ex/callback.c --- trunk/reactos/ntoskrnl/ex/callback.c 2005-08-05 01:25:43 UTC (rev 17052) +++ trunk/reactos/ntoskrnl/ex/callback.c 2005-08-05 03:44:24 UTC (rev 17053) @@ -71,6 +71,8 @@ * TRUE if the Callback Object Type was successfully created. */ VOID +INIT_FUNCTION +STDCALL ExpInitializeCallbacks(VOID) { OBJECT_ATTRIBUTES ObjectAttributes; _____ Modified: trunk/reactos/ntoskrnl/ex/event.c --- trunk/reactos/ntoskrnl/ex/event.c 2005-08-05 01:25:43 UTC (rev 17052) +++ trunk/reactos/ntoskrnl/ex/event.c 2005-08-05 03:44:24 UTC (rev 17053) @@ -34,6 +34,7 @@ VOID INIT_FUNCTION +STDCALL ExpInitializeEventImplementation(VOID) { OBJECT_TYPE_INITIALIZER ObjectTypeInitializer; _____ Modified: trunk/reactos/ntoskrnl/ex/evtpair.c --- trunk/reactos/ntoskrnl/ex/evtpair.c 2005-08-05 01:25:43 UTC (rev 17052) +++ trunk/reactos/ntoskrnl/ex/evtpair.c 2005-08-05 03:44:24 UTC (rev 17053) @@ -31,6 +31,7 @@ VOID INIT_FUNCTION +STDCALL ExpInitializeEventPairImplementation(VOID) { OBJECT_TYPE_INITIALIZER ObjectTypeInitializer; _____ Modified: trunk/reactos/ntoskrnl/ex/init.c --- trunk/reactos/ntoskrnl/ex/init.c 2005-08-05 01:25:43 UTC (rev 17052) +++ trunk/reactos/ntoskrnl/ex/init.c 2005-08-05 03:44:24 UTC (rev 17053) @@ -405,6 +405,79 @@ HalDisplayString(str); } + +INIT_FUNCTION +NTSTATUS +ExpLoadInitialProcess(PHANDLE ProcessHandle, + PHANDLE ThreadHandle) +{ + UNICODE_STRING ImagePath = RTL_CONSTANT_STRING(L"\\SystemRoot\\system32\\smss.exe"); + HANDLE SystemProcessHandle; + NTSTATUS Status; + PRTL_USER_PROCESS_PARAMETERS Params=NULL; + RTL_USER_PROCESS_INFORMATION Info; + + /* Create a handle to the process */ + Status = ObpCreateHandle(PsGetCurrentProcess(), + PsInitialSystemProcess, + PROCESS_CREATE_PROCESS | PROCESS_CREATE_THREAD | PROCESS_QUERY_INFORMATION, + FALSE, + &SystemProcessHandle); + if(!NT_SUCCESS(Status)) + { + DPRINT1("Failed to create a handle for the system process!\n"); + return Status; + } + + /* Create the Parameters */ + Status = RtlCreateProcessParameters(&Params, + &ImagePath, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL); + if(!NT_SUCCESS(Status)) + { + DPRINT1("Failed to create ppb!\n"); + ZwClose(SystemProcessHandle); + return Status; + } + + DPRINT("Creating process\n"); + Status = RtlCreateUserProcess(&ImagePath, + OBJ_CASE_INSENSITIVE, + Params, + NULL, + NULL, + SystemProcessHandle, + FALSE, + NULL, + NULL, + &Info); + + /* Close the handle and free the params */ + ZwClose(SystemProcessHandle); + RtlDestroyProcessParameters(Params); + + if (!NT_SUCCESS(Status)) + { + DPRINT1("NtCreateProcess() failed (Status %lx)\n", Status); + return(Status); + } + + /* Start it up */ + ZwResumeThread(Info.ThreadHandle, NULL); + + /* Return Handles */ + *ProcessHandle = Info.ProcessHandle; + *ThreadHandle = Info.ThreadHandle; + DPRINT("Process created successfully\n"); + return STATUS_SUCCESS; +} VOID INIT_FUNCTION @@ -468,7 +541,7 @@ ObInit(); /* Initialize Lookaside Lists */ - ExInit2(); + ExpInitLookasideLists(); /* Set up Region Maps, Sections and the Paging File */ MmInit2(); @@ -506,7 +579,7 @@ HalInitSystem(1, (PLOADER_PARAMETER_BLOCK)&KeLoaderBlock); /* Initialize Basic System Objects and Worker Threads */ - ExInit3(); + ExInit2(); /* Create the system handle table, assign it to the system process, create the client id table and assign a PID for the system process. This needs @@ -575,7 +648,7 @@ IoInit3(); /* Load the System DLL and its Entrypoints */ - LdrpInitializeSystemDll(); + PsLocateSystemDll(); /* Initialize the Default Locale */ PiInitDefaultLocale(); @@ -604,7 +677,7 @@ } /* Launch initial process */ - Status = LdrLoadInitialProcess(&ProcessHandle, + Status = ExpLoadInitialProcess(&ProcessHandle, &ThreadHandle); /* Check for success, Bugcheck if we failed */ @@ -671,25 +744,21 @@ ZwClose(ProcessHandle); } -VOID INIT_FUNCTION +VOID +STDCALL +INIT_FUNCTION ExInit2(VOID) { - ExpInitLookasideLists(); + ExpInitializeEventImplementation(); + ExpInitializeEventPairImplementation(); + ExpInitializeMutantImplementation(); + ExpInitializeSemaphoreImplementation(); + ExpInitializeTimerImplementation(); + LpcpInitSystem(); + ExpInitializeProfileImplementation(); + ExpWin32kInit(); + ExpInitUuids(); + ExpInitializeHandleTables(); } -VOID INIT_FUNCTION -ExInit3 (VOID) -{ - ExpInitializeEventImplementation(); - ExpInitializeEventPairImplementation(); - ExpInitializeMutantImplementation(); - ExpInitializeSemaphoreImplementation(); - ExpInitializeTimerImplementation(); - LpcpInitSystem(); - ExpInitializeProfileImplementation(); - ExpWin32kInit(); - ExpInitUuids(); - ExpInitializeHandleTables(); -} - /* EOF */ _____ Modified: trunk/reactos/ntoskrnl/ex/lookas.c --- trunk/reactos/ntoskrnl/ex/lookas.c 2005-08-05 01:25:43 UTC (rev 17052) +++ trunk/reactos/ntoskrnl/ex/lookas.c 2005-08-05 03:44:24 UTC (rev 17053) @@ -26,6 +26,7 @@ VOID INIT_FUNCTION +STDCALL ExpInitLookasideLists() { /* Initialize Lock and Listhead */ _____ Modified: trunk/reactos/ntoskrnl/ex/mutant.c --- trunk/reactos/ntoskrnl/ex/mutant.c 2005-08-05 01:25:43 UTC (rev 17052) +++ trunk/reactos/ntoskrnl/ex/mutant.c 2005-08-05 03:44:24 UTC (rev 17053) @@ -51,6 +51,7 @@ VOID INIT_FUNCTION +STDCALL ExpInitializeMutantImplementation(VOID) { OBJECT_TYPE_INITIALIZER ObjectTypeInitializer; _____ Modified: trunk/reactos/ntoskrnl/ex/profile.c --- trunk/reactos/ntoskrnl/ex/profile.c 2005-08-05 01:25:43 UTC (rev 17052) +++ trunk/reactos/ntoskrnl/ex/profile.c 2005-08-05 03:44:24 UTC (rev 17053) @@ -74,6 +74,7 @@ VOID INIT_FUNCTION +STDCALL ExpInitializeProfileImplementation(VOID) { OBJECT_TYPE_INITIALIZER ObjectTypeInitializer; _____ Modified: trunk/reactos/ntoskrnl/ex/sem.c --- trunk/reactos/ntoskrnl/ex/sem.c 2005-08-05 01:25:43 UTC (rev 17052) +++ trunk/reactos/ntoskrnl/ex/sem.c 2005-08-05 03:44:24 UTC (rev 17053) @@ -32,6 +32,7 @@ VOID INIT_FUNCTION +STDCALL ExpInitializeSemaphoreImplementation(VOID) { OBJECT_TYPE_INITIALIZER ObjectTypeInitializer; _____ Modified: trunk/reactos/ntoskrnl/ex/time.c --- trunk/reactos/ntoskrnl/ex/time.c 2005-08-05 01:25:43 UTC (rev 17052) +++ trunk/reactos/ntoskrnl/ex/time.c 2005-08-05 03:44:24 UTC (rev 17053) @@ -27,7 +27,9 @@ /* FUNCTIONS ****************************************************************/ -VOID INIT_FUNCTION +VOID +INIT_FUNCTION +STDCALL ExpInitTimeZoneInfo(VOID) { LARGE_INTEGER CurrentTime; _____ Modified: trunk/reactos/ntoskrnl/ex/timer.c --- trunk/reactos/ntoskrnl/ex/timer.c 2005-08-05 01:25:43 UTC (rev 17052) +++ trunk/reactos/ntoskrnl/ex/timer.c 2005-08-05 03:44:24 UTC (rev 17053) @@ -221,6 +221,7 @@ VOID INIT_FUNCTION +STDCALL ExpInitializeTimerImplementation(VOID) { OBJECT_TYPE_INITIALIZER ObjectTypeInitializer; _____ Modified: trunk/reactos/ntoskrnl/ex/uuid.c --- trunk/reactos/ntoskrnl/ex/uuid.c 2005-08-05 01:25:43 UTC (rev 17052) +++ trunk/reactos/ntoskrnl/ex/uuid.c 2005-08-05 03:44:24 UTC (rev 17053) @@ -41,7 +41,9 @@ /* FUNCTIONS ****************************************************************/ -VOID INIT_FUNCTION +VOID +INIT_FUNCTION +STDCALL ExpInitUuids(VOID) { ExInitializeFastMutex(&UuidMutex); _____ Modified: trunk/reactos/ntoskrnl/ex/win32k.c --- trunk/reactos/ntoskrnl/ex/win32k.c 2005-08-05 01:25:43 UTC (rev 17052) +++ trunk/reactos/ntoskrnl/ex/win32k.c 2005-08-05 03:44:24 UTC (rev 17053) @@ -119,6 +119,7 @@ VOID INIT_FUNCTION +STDCALL ExpWin32kInit(VOID) { OBJECT_TYPE_INITIALIZER ObjectTypeInitializer; _____ Modified: trunk/reactos/ntoskrnl/ex/work.c --- trunk/reactos/ntoskrnl/ex/work.c 2005-08-05 01:25:43 UTC (rev 17052) +++ trunk/reactos/ntoskrnl/ex/work.c 2005-08-05 03:44:24 UTC (rev 17053) @@ -132,6 +132,7 @@ VOID INIT_FUNCTION +STDCALL ExpInitializeWorkerThreads(VOID) { ULONG WorkQueueType; _____ Modified: trunk/reactos/ntoskrnl/include/internal/ex.h --- trunk/reactos/ntoskrnl/include/internal/ex.h 2005-08-05 01:25:43 UTC (rev 17052) +++ trunk/reactos/ntoskrnl/include/internal/ex.h 2005-08-05 03:44:24 UTC (rev 17053) @@ -11,27 +11,31 @@ /* INITIALIZATION FUNCTIONS *************************************************/ VOID +STDCALL ExpWin32kInit(VOID); VOID +STDCALL ExInit2(VOID); VOID -ExInit3(VOID); - -VOID +STDCALL ExpInitTimeZoneInfo(VOID); VOID +STDCALL ExpInitializeWorkerThreads(VOID); VOID +STDCALL ExpInitLookasideLists(VOID); VOID +STDCALL ExpInitializeCallbacks(VOID); VOID +STDCALL ExpInitUuids(VOID); VOID @@ -39,24 +43,31 @@ ExpInitializeExecutive(VOID); VOID +STDCALL ExpInitializeEventImplementation(VOID); VOID +STDCALL ExpInitializeEventImplementation(VOID); VOID +STDCALL ExpInitializeEventPairImplementation(VOID); VOID +STDCALL ExpInitializeSemaphoreImplementation(VOID); VOID +STDCALL ExpInitializeMutantImplementation(VOID); VOID +STDCALL ExpInitializeTimerImplementation(VOID); VOID +STDCALL ExpInitializeProfileImplementation(VOID); /* HANDLE TABLE FUNCTIONS ***************************************************/ _____ Modified: trunk/reactos/ntoskrnl/include/internal/ke.h --- trunk/reactos/ntoskrnl/include/internal/ke.h 2005-08-05 01:25:43 UTC (rev 17052) +++ trunk/reactos/ntoskrnl/include/internal/ke.h 2005-08-05 03:44:24 UTC (rev 17053) @@ -19,6 +19,11 @@ struct _KPRCB; struct _KEXCEPTION_FRAME; +extern PVOID KeUserApcDispatcher; +extern PVOID KeUserCallbackDispatcher; +extern PVOID KeUserExceptionDispatcher; +extern PVOID KeRaiseUserExceptionDispatcher; + #define IPI_REQUEST_FUNCTIONCALL 0 #define IPI_REQUEST_APC 1 #define IPI_REQUEST_DPC 2 _____ Modified: trunk/reactos/ntoskrnl/include/internal/ldr.h --- trunk/reactos/ntoskrnl/include/internal/ldr.h 2005-08-05 01:25:43 UTC (rev 17052) +++ trunk/reactos/ntoskrnl/include/internal/ldr.h 2005-08-05 03:44:24 UTC (rev 17053) @@ -21,36 +21,6 @@ LdrInitModuleManagement (VOID); NTSTATUS -STDCALL -LdrpMapSystemDll( - PEPROCESS Process, - PVOID *DllBase -); - -NTSTATUS -STDCALL -LdrpInitializeSystemDll(VOID); - -NTSTATUS -STDCALL -LdrpGetSystemDllEntryPoints(VOID); - -PVOID -LdrpGetSystemDllEntryPoint (VOID); - -PVOID -LdrpGetSystemDllApcDispatcher(VOID); - -PVOID -LdrpGetSystemDllExceptionDispatcher(VOID); - -PVOID -LdrpGetSystemDllCallbackDispatcher(VOID); - -PVOID -LdrpGetSystemDllRaiseExceptionDispatcher(VOID); - -NTSTATUS LdrpMapImage( HANDLE ProcessHandle, HANDLE SectionHandle, _____ Modified: trunk/reactos/ntoskrnl/include/internal/ps.h --- trunk/reactos/ntoskrnl/include/internal/ps.h 2005-08-05 01:25:43 UTC (rev 17052) +++ trunk/reactos/ntoskrnl/include/internal/ps.h 2005-08-05 03:44:24 UTC (rev 17053) @@ -199,6 +199,21 @@ STDCALL PspDestroyQuotaBlock(PEPROCESS Process); +NTSTATUS +STDCALL +PspMapSystemDll( + PEPROCESS Process, + PVOID *DllBase +); + +NTSTATUS +STDCALL +PsLocateSystemDll(VOID); + +NTSTATUS +STDCALL +PspGetSystemDllEntryPoints(VOID); + /* CLIENT ID */ NTSTATUS PsCreateCidHandle(PVOID Object, POBJECT_TYPE ObjectType, PHANDLE Handle); _____ Modified: trunk/reactos/ntoskrnl/ke/apc.c --- trunk/reactos/ntoskrnl/ke/apc.c 2005-08-05 01:25:43 UTC (rev 17052) +++ trunk/reactos/ntoskrnl/ke/apc.c 2005-08-05 03:44:24 UTC (rev 17053) @@ -847,7 +847,7 @@ Esp[3] = (ULONG)SystemArgument1; Esp[4] = (ULONG)SystemArgument2; Esp[5] = (ULONG)Context; - TrapFrame->Eip = (ULONG)LdrpGetSystemDllApcDispatcher(); + TrapFrame->Eip = (ULONG)KeUserApcDispatcher; DPRINT("TrapFrame->Eip: %x\n", TrapFrame->Eip); TrapFrame->Esp = (ULONG)Esp; } _____ Modified: trunk/reactos/ntoskrnl/ke/catch.c --- trunk/reactos/ntoskrnl/ke/catch.c 2005-08-05 01:25:43 UTC (rev 17052) +++ trunk/reactos/ntoskrnl/ke/catch.c 2005-08-05 03:44:24 UTC (rev 17053) @@ -161,7 +161,7 @@ DPRINT1("User-mode stack was invalid. Terminating target thread\n"); } /* Set EIP to the User-mode Dispathcer */ - Tf->Eip = (ULONG)LdrpGetSystemDllExceptionDispatcher(); + Tf->Eip = (ULONG)KeRaiseUserExceptionDispatcher; return; } _____ Modified: trunk/reactos/ntoskrnl/ke/i386/exp.c --- trunk/reactos/ntoskrnl/ke/i386/exp.c 2005-08-05 01:25:43 UTC (rev 17052) +++ trunk/reactos/ntoskrnl/ke/i386/exp.c 2005-08-05 03:44:24 UTC (rev 17053) @@ -923,7 +923,7 @@ } _SEH_END; OldEip = Thread->TrapFrame->Eip; - Thread->TrapFrame->Eip = (ULONG_PTR)LdrpGetSystemDllRaiseExceptionDispatcher(); + Thread->TrapFrame->Eip = (ULONG_PTR)KeRaiseUserExceptionDispatcher; return((NTSTATUS)OldEip); } _____ Modified: trunk/reactos/ntoskrnl/ke/main.c --- trunk/reactos/ntoskrnl/ke/main.c 2005-08-05 01:25:43 UTC (rev 17052) +++ trunk/reactos/ntoskrnl/ke/main.c 2005-08-05 03:44:24 UTC (rev 17053) @@ -41,6 +41,11 @@ ULONG_PTR LastKrnlPhysAddr; ULONG_PTR LastKernelAddress; +PVOID KeUserApcDispatcher = NULL; +PVOID KeUserCallbackDispatcher = NULL; +PVOID KeUserExceptionDispatcher = NULL; +PVOID KeRaiseUserExceptionDispatcher = NULL; + ULONG KeLargestCacheLine = 0x40; /* FIXME: Arch-specific */ /* We allocate 4 pages, but we only use 3. The 4th is to guarantee page alignment */ _____ Modified: trunk/reactos/ntoskrnl/ke/usercall.c --- trunk/reactos/ntoskrnl/ke/usercall.c 2005-08-05 01:25:43 UTC (rev 17052) +++ trunk/reactos/ntoskrnl/ke/usercall.c 2005-08-05 03:44:24 UTC (rev 17053) @@ -207,7 +207,7 @@ NewFrame = (PKTRAP_FRAME)((char*)NewStack + StackSize - sizeof(KTRAP_FRAME) - sizeof(FX_SAVE_AREA)); /* We need the stack pointer to remain 4-byte aligned */ NewFrame->Esp -= (((ArgumentLength + 3) & (~ 0x3)) + (4 * sizeof(ULONG))); - NewFrame->Eip = (ULONG)LdrpGetSystemDllCallbackDispatcher(); + NewFrame->Eip = (ULONG)KeUserCallbackDispatcher; UserEsp = (PULONG)NewFrame->Esp; UserEsp[0] = 0; /* Return address. */ UserEsp[1] = RoutineIndex; _____ Deleted: trunk/reactos/ntoskrnl/ldr/init.c --- trunk/reactos/ntoskrnl/ldr/init.c 2005-08-05 01:25:43 UTC (rev 17052) +++ trunk/reactos/ntoskrnl/ldr/init.c 2005-08-05 03:44:24 UTC (rev 17053) @@ -1,103 +0,0 @@ -/* $Id$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * FILE: ntoskrnl/ldr/init.c - * PURPOSE: Loaders for PE executables - * - * PROGRAMMERS: Jean Michault - * Rex Jolliff (rex(a)lvcablemodem.com) - */ - -/* INCLUDES *****************************************************************/ - - -#include <ntoskrnl.h> - -#define NDEBUG -#include <internal/debug.h> - -/* FUNCTIONS *****************************************************************/ - -INIT_FUNCTION -NTSTATUS -LdrLoadInitialProcess(PHANDLE ProcessHandle, - PHANDLE ThreadHandle) -{ - UNICODE_STRING ImagePath = RTL_CONSTANT_STRING(L"\\SystemRoot\\system32\\smss.exe"); - HANDLE SystemProcessHandle; - NTSTATUS Status; - PRTL_USER_PROCESS_PARAMETERS Params=NULL; - RTL_USER_PROCESS_INFORMATION Info; - - Status = ObpCreateHandle( - PsGetCurrentProcess(), - PsInitialSystemProcess, - PROCESS_CREATE_PROCESS | PROCESS_CREATE_THREAD | PROCESS_QUERY_INFORMATION, - FALSE, - &SystemProcessHandle - ); - - if(!NT_SUCCESS(Status)) - { - DPRINT1("Failed to create a handle for the system process!\n"); - return Status; - } - - - Status = RtlCreateProcessParameters( - &Params, - &ImagePath, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL - ); - - if(!NT_SUCCESS(Status)) - { - DPRINT1("Failed to create ppb!\n"); - ZwClose(SystemProcessHandle); - return Status; - } - - - DPRINT("Creating process\n"); - - Status = RtlCreateUserProcess( - &ImagePath, - OBJ_CASE_INSENSITIVE, //Valid are OBJ_INHERIT and OBJ_CASE_INSENSITIVE. - Params, - NULL, - NULL, - SystemProcessHandle, - FALSE, - NULL, - NULL, - &Info - ); - - ZwClose(SystemProcessHandle); - RtlDestroyProcessParameters(Params); - - if (!NT_SUCCESS(Status)) - { - DPRINT1("NtCreateProcess() failed (Status %lx)\n", Status); - return(Status); - } - - ZwResumeThread(Info.ThreadHandle, NULL); - - *ProcessHandle = Info.ProcessHandle; - *ThreadHandle= Info.ThreadHandle; - - DPRINT("Process created successfully\n"); - - return(STATUS_SUCCESS); -} - -/* EOF */ _____ Deleted: trunk/reactos/ntoskrnl/ldr/sysdll.c --- trunk/reactos/ntoskrnl/ldr/sysdll.c 2005-08-05 01:25:43 UTC (rev 17052) +++ trunk/reactos/ntoskrnl/ldr/sysdll.c 2005-08-05 03:44:24 UTC (rev 17053) @@ -1,278 +0,0 @@ -/* $Id$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * FILE: ntoskrnl/ldr/sysdll.c - * PURPOSE: Loaders for PE executables - * - * PROGRAMMERS: Jean Michault - * Rex Jolliff (rex(a)lvcablemodem.com) - * Skywing - */ - -/* INCLUDES *****************************************************************/ - -#include <ntoskrnl.h> -#define NDEBUG -#include <internal/debug.h> - -/* GLOBALS *******************************************************************/ - -PVOID SystemDllEntryPoint = NULL; -PVOID SystemDllApcDispatcher = NULL; -PVOID SystemDllCallbackDispatcher = NULL; -PVOID SystemDllExceptionDispatcher = NULL; -PVOID SystemDllRaiseExceptionDispatcher = NULL; - -PVOID LdrpSystemDllBase = NULL; -PVOID LdrpSystemDllSection = NULL; - -/* FUNCTIONS *****************************************************************/ - -PVOID LdrpGetSystemDllExceptionDispatcher(VOID) -{ - return(SystemDllExceptionDispatcher); -} - -PVOID LdrpGetSystemDllCallbackDispatcher(VOID) -{ - return(SystemDllCallbackDispatcher); -} - -PVOID LdrpGetSystemDllEntryPoint(VOID) -{ - return(SystemDllEntryPoint); -} - -PVOID LdrpGetSystemDllApcDispatcher(VOID) -{ - return(SystemDllApcDispatcher); -} - -PVOID LdrpGetSystemDllRaiseExceptionDispatcher(VOID) -{ - return(SystemDllRaiseExceptionDispatcher); -} - -NTSTATUS -STDCALL -INIT_FUNCTION -LdrpGetSystemDllEntryPoints(VOID) -{ - ANSI_STRING ProcedureName; - NTSTATUS Status; - - /* Retrieve ntdll's startup address */ - DPRINT("Getting Entrypoint: %p\n", LdrpSystemDllBase); - RtlInitAnsiString(&ProcedureName, "LdrInitializeThunk"); - Status = LdrGetProcedureAddress((PVOID)LdrpSystemDllBase, - &ProcedureName, - 0, - &SystemDllEntryPoint); - - if (!NT_SUCCESS(Status)) { - - DPRINT1 ("LdrGetProcedureAddress failed (Status %x)\n", Status); - return (Status); - } - - /* Get User APC Dispatcher */ - DPRINT("Getting Entrypoint\n"); - RtlInitAnsiString(&ProcedureName, "KiUserApcDispatcher"); - Status = LdrGetProcedureAddress((PVOID)LdrpSystemDllBase, - &ProcedureName, - 0, - &SystemDllApcDispatcher); - - if (!NT_SUCCESS(Status)) { - - DPRINT1 ("LdrGetProcedureAddress failed (Status %x)\n", Status); - return (Status); - } - - /* Get Exception Dispatcher */ - DPRINT("Getting Entrypoint\n"); - RtlInitAnsiString(&ProcedureName, "KiUserExceptionDispatcher"); - Status = LdrGetProcedureAddress((PVOID)LdrpSystemDllBase, - &ProcedureName, - 0, - &SystemDllExceptionDispatcher); - - if (!NT_SUCCESS(Status)) { - - DPRINT1 ("LdrGetProcedureAddress failed (Status %x)\n", Status); - return (Status); - } - - /* Get Callback Dispatcher */ - DPRINT("Getting Entrypoint\n"); - RtlInitAnsiString(&ProcedureName, "KiUserCallbackDispatcher"); - Status = LdrGetProcedureAddress((PVOID)LdrpSystemDllBase, - &ProcedureName, - 0, - &SystemDllCallbackDispatcher); - - if (!NT_SUCCESS(Status)) { - - DPRINT1 ("LdrGetProcedureAddress failed (Status %x)\n", Status); - return (Status); - } - - /* Get Raise Exception Dispatcher */ - DPRINT("Getting Entrypoint\n"); - RtlInitAnsiString(&ProcedureName, "KiRaiseUserExceptionDispatcher"); - Status = LdrGetProcedureAddress((PVOID)LdrpSystemDllBase, - &ProcedureName, - 0, - &SystemDllRaiseExceptionDispatcher); - - if (!NT_SUCCESS(Status)) { - - DPRINT1 ("LdrGetProcedureAddress failed (Status %x)\n", Status); - return (Status); - } - - /* Return success */ - return(STATUS_SUCCESS); -} - -NTSTATUS -STDCALL -LdrpMapSystemDll(PEPROCESS Process, - PVOID *DllBase) -{ - NTSTATUS Status; - ULONG ViewSize = 0; - PVOID ImageBase = 0; - - /* Map the System DLL */ - DPRINT("Mapping System DLL\n"); - Status = MmMapViewOfSection(LdrpSystemDllSection, - Process, - (PVOID*)&ImageBase, - 0, - 0, - NULL, - &ViewSize, - 0, - MEM_COMMIT, - PAGE_READWRITE); - - if (!NT_SUCCESS(Status)) { - - DPRINT1("Failed to map System DLL Into Process\n"); - } - - if (DllBase) *DllBase = ImageBase; - - return Status; -} - -NTSTATUS -STDCALL -INIT_FUNCTION -LdrpInitializeSystemDll(VOID) -{ - UNICODE_STRING DllPathname = RTL_CONSTANT_STRING(L"\\SystemRoot\\system32\\ntdll.dll"); - OBJECT_ATTRIBUTES FileObjectAttributes; - IO_STATUS_BLOCK Iosb; - HANDLE FileHandle; - HANDLE NTDllSectionHandle; - NTSTATUS Status; - CHAR BlockBuffer[1024]; - PIMAGE_DOS_HEADER DosHeader; - PIMAGE_NT_HEADERS NTHeaders; - - /* Locate and open NTDLL to determine ImageBase and LdrStartup */ - InitializeObjectAttributes(&FileObjectAttributes, - &DllPathname, - 0, - NULL, - NULL); - - DPRINT("Opening NTDLL\n"); - Status = ZwOpenFile(&FileHandle, - FILE_READ_ACCESS, - &FileObjectAttributes, - &Iosb, - FILE_SHARE_READ, - FILE_SYNCHRONOUS_IO_NONALERT); - - if (!NT_SUCCESS(Status)) { - DPRINT1("NTDLL open failed (Status %x)\n", Status); - return Status; - } - - /* Load NTDLL is valid */ - DPRINT("Reading NTDLL\n"); - Status = ZwReadFile(FileHandle, - 0, - 0, - 0, - &Iosb, - BlockBuffer, - sizeof(BlockBuffer), - 0, - 0); - if (!NT_SUCCESS(Status) || Iosb.Information != sizeof(BlockBuffer)) { - - DPRINT1("NTDLL header read failed (Status %x)\n", Status); - ZwClose(FileHandle); - return Status; - } - - /* Check if it's valid */ - DosHeader = (PIMAGE_DOS_HEADER)BlockBuffer; - NTHeaders = (PIMAGE_NT_HEADERS)(BlockBuffer + DosHeader->e_lfanew); - - if ((DosHeader->e_magic != IMAGE_DOS_SIGNATURE) || - (DosHeader->e_lfanew == 0L) || - (*(PULONG) NTHeaders != IMAGE_NT_SIGNATURE)) { - - DPRINT1("NTDLL format invalid\n"); - ZwClose(FileHandle); - return(STATUS_UNSUCCESSFUL); - } - - /* Create a section for NTDLL */ - DPRINT("Creating section\n"); - Status = ZwCreateSection(&NTDllSectionHandle, - SECTION_ALL_ACCESS, - NULL, - NULL, - PAGE_READONLY, - SEC_IMAGE | SEC_COMMIT, - FileHandle); - if (!NT_SUCCESS(Status)) { - - DPRINT1("NTDLL create section failed (Status %x)\n", Status); - ZwClose(FileHandle); - return(Status); - } - ZwClose(FileHandle); - - /* Reference the Section */ - DPRINT("ObReferenceObjectByHandle section: %d\n", NTDllSectionHandle); - Status = ObReferenceObjectByHandle(NTDllSectionHandle, - SECTION_ALL_ACCESS, - MmSectionObjectType, - KernelMode, - (PVOID*)&LdrpSystemDllSection, - NULL); - if (!NT_SUCCESS(Status)) { - - DPRINT1("NTDLL section reference failed (Status %x)\n", Status); - return(Status); - } - - /* Map it */ - LdrpMapSystemDll(PsGetCurrentProcess(), &LdrpSystemDllBase); - DPRINT("LdrpSystemDllBase: %x\n", LdrpSystemDllBase); - - /* Now get the Entrypoints */ - LdrpGetSystemDllEntryPoints(); - - return STATUS_SUCCESS; -} - -/* EOF */ _____ Deleted: trunk/reactos/ntoskrnl/ldr/userldr.c --- trunk/reactos/ntoskrnl/ldr/userldr.c 2005-08-05 01:25:43 UTC (rev 17052) +++ trunk/reactos/ntoskrnl/ldr/userldr.c 2005-08-05 03:44:24 UTC (rev 17053) @@ -1,62 +0,0 @@ -/* $Id$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * FILE: ntoskrnl/ldr/userldr.c - * PURPOSE: Loaders for PE executables - * - * PROGRAMMERS: Jean Michault - * Rex Jolliff (rex(a)lvcablemodem.com) - */ - -/* INCLUDES *****************************************************************/ - -#include <ntoskrnl.h> -#define NDEBUG -#include <internal/debug.h> - - -/* FUNCTIONS *****************************************************************/ - -NTSTATUS LdrpMapImage(HANDLE ProcessHandle, - HANDLE SectionHandle, - PVOID* ReturnedImageBase) -/* - * FUNCTION: LdrpMapImage maps a user-mode image into an address space - * PARAMETERS: - * ProcessHandle - * Points to the process to map the image into - * - * SectionHandle - * Points to the section to map - * - * RETURNS: Status - */ -{ - ULONG ViewSize; - PVOID ImageBase; - NTSTATUS Status; - - ViewSize = 0; - ImageBase = 0; - - Status = ZwMapViewOfSection(SectionHandle, - ProcessHandle, - (PVOID*)&ImageBase, - 0, - ViewSize, - NULL, - &ViewSize, - 0, - MEM_COMMIT, - PAGE_READWRITE); - if (!NT_SUCCESS(Status)) - { - CPRINT("Image map view of section failed (Status %x)", Status); - return(Status); - } - - *ReturnedImageBase = ImageBase; - - return(STATUS_SUCCESS); -} _____ Modified: trunk/reactos/ntoskrnl/ntoskrnl.xml --- trunk/reactos/ntoskrnl/ntoskrnl.xml 2005-08-05 01:25:43 UTC (rev 17052) +++ trunk/reactos/ntoskrnl/ntoskrnl.xml 2005-08-05 03:44:24 UTC (rev 17053) @@ -212,12 +212,9 @@ <file>kdmain.c</file> </directory> <directory name="ldr"> - <file>init.c</file> <file>loader.c</file> [truncated at 1000 lines; 291 more skipped]
19 years, 4 months
1
0
0
0
[navaraf] 17052: Fix a wrong size calculation.
by navaraf@svn.reactos.com
Fix a wrong size calculation. Modified: branches/win32k rewrite attempt/win32k/ntuser/msgqueue.c _____ Modified: branches/win32k rewrite attempt/win32k/ntuser/msgqueue.c --- branches/win32k rewrite attempt/win32k/ntuser/msgqueue.c 2005-08-04 22:08:16 UTC (rev 17051) +++ branches/win32k rewrite attempt/win32k/ntuser/msgqueue.c 2005-08-05 01:25:43 UTC (rev 17052) @@ -1491,7 +1491,7 @@ { PUSER_MESSAGE_QUEUE Queue; - Queue = UserAllocZeroTag(sizeof(USER_MESSAGE_QUEUE) + sizeof(PUSER_THREAD_INPUT),// + sizeof(THRDCARETINFO), + Queue = UserAllocZeroTag(sizeof(USER_MESSAGE_QUEUE) + sizeof(USER_THREAD_INPUT),// + sizeof(THRDCARETINFO), TAG_MSGQ); if (!Queue)
19 years, 4 months
1
0
0
0
[Greatlrd] 17051: fix a small bug in cd, it did make all char lower case. done by me and Brandon Turner. clean up CD source bit more. Bug fix GetRootPath. it did not accepted upper case as driver letter. done by me
by Greatlrd@svn.reactos.com
fix a small bug in cd, it did make all char lower case. done by me and Brandon Turner. clean up CD source bit more. Bug fix GetRootPath. it did not accepted upper case as driver letter. done by me Modified: trunk/reactos/subsys/system/cmd/internal.c _____ Modified: trunk/reactos/subsys/system/cmd/internal.c --- trunk/reactos/subsys/system/cmd/internal.c 2005-08-04 21:55:43 UTC (rev 17050) +++ trunk/reactos/subsys/system/cmd/internal.c 2005-08-04 22:08:16 UTC (rev 17051) @@ -170,13 +170,8 @@ { if (InPath[1]==_T(':')) { - TCHAR num[2]; INT t=0; - - num[1] = _T('\0'); - num[0] = InPath[0]; - _tcslwr(num); - + if ((InPath[0] >= _T('0')) && (InPath[0] <= _T('9'))) { t = (InPath[0] - _T('0')) +28; @@ -185,7 +180,13 @@ if ((InPath[0] >= _T('a')) && (InPath[0] <= _T('z'))) { t = (InPath[0] - _T('a')) +1; + InPath[0] = t + _T('A') - 1; } + + if ((InPath[0] >= _T('A')) && (InPath[0] <= _T('Z'))) + { + t = (InPath[0] - _T('A')) +1; + } if (_tgetdcwd(t,OutPath,size) != NULL) { @@ -214,8 +215,10 @@ { TCHAR oldpath[MAX_PATH]; TCHAR OutPath[MAX_PATH]; + TCHAR OutPathUpper[MAX_PATH]; BOOL fail; + /* Get The current directory path and save it */ fail = GetCurrentDirectory(MAX_PATH,oldpath); if (!fail) @@ -225,18 +228,23 @@ if (_tcsncicmp(&InPath[1],_T(":\\"),2)!=0) { - if (!GetRootPath(InPath,OutPath,MAX_PATH)) - _tcscpy(OutPath,InPath); + if (!GetRootPath(InPath,OutPathUpper,MAX_PATH)) + _tcscpy(OutPathUpper,InPath); } else { - _tcscpy(OutPath,InPath); + _tcscpy(OutPathUpper,InPath); } + _tcsupr(OutPathUpper); + GetLongPathName(OutPathUpper, OutPath, MAX_PATH); + fail = SetCurrentDirectory(OutPath); if (!fail) return 1; + + SetCurrentDirectory(OutPath); GetCurrentDirectory(MAX_PATH,OutPath); _tchdir(OutPath); @@ -302,7 +310,6 @@ } ConOutPuts(szCurrent); return 0; - } /* Get Current Directory */ @@ -376,17 +383,22 @@ else break; - _tcscat(szFinalPath,f.cFileName); + _tcscat(szFinalPath,f.cFileName); - if(IsExistingDirectory(szFinalPath)) - { + if ((f.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY) + { if(!SetRootPath(szFinalPath)) { /* Change for /D */ if(bChangeDrive) - SetCurrentDirectory(szFinalPath); + { + _tcsupr(szFinalPath); + GetLongPathName(szFinalPath, szPath, MAX_PATH); + SetCurrentDirectory(szPath); + } return 0; } + } }while(FindNextFile (hFile, &f));
19 years, 4 months
1
0
0
0
[navaraf] 17050: Fix keyboard input in usetup.
by navaraf@svn.reactos.com
Fix keyboard input in usetup. Modified: trunk/reactos/subsys/system/usetup/usetup.c _____ Modified: trunk/reactos/subsys/system/usetup/usetup.c --- trunk/reactos/subsys/system/usetup/usetup.c 2005-08-04 21:42:32 UTC (rev 17049) +++ trunk/reactos/subsys/system/usetup/usetup.c 2005-08-04 21:55:43 UTC (rev 17050) @@ -1445,7 +1445,7 @@ return SELECT_FILE_SYSTEM_PAGE; } - else if (Ir->Event.KeyEvent.wVirtualKeyCode == 'c') /* C */ + else if (Ir->Event.KeyEvent.wVirtualKeyCode == 'C') /* C */ { if (PartitionList->CurrentPartition->Unpartitioned == FALSE) { @@ -1461,7 +1461,7 @@ return CREATE_PARTITION_PAGE; } - else if (Ir->Event.KeyEvent.wVirtualKeyCode == 'd') /* D */ + else if (Ir->Event.KeyEvent.wVirtualKeyCode == 'D') /* D */ { if (PartitionList->CurrentPartition->Unpartitioned == TRUE) { @@ -1971,7 +1971,7 @@ { return SELECT_PARTITION_PAGE; } - else if (Ir->Event.KeyEvent.wVirtualKeyCode == 'd') /* D */ + else if (Ir->Event.KeyEvent.wVirtualKeyCode == 'D') /* D */ { DeleteCurrentPartition (PartitionList);
19 years, 4 months
1
0
0
0
[sedwards] 17049: took a stab at write support and turned it on. Removed getopt as its not needed.
by sedwards@svn.reactos.com
took a stab at write support and turned it on. Removed getopt as its not needed. Modified: trunk/rosapps/sysutils/dosfsck/Makefile Deleted: trunk/rosapps/sysutils/dosfsck/getopt.c Modified: trunk/rosapps/sysutils/dosfsck/io.c _____ Modified: trunk/rosapps/sysutils/dosfsck/Makefile --- trunk/rosapps/sysutils/dosfsck/Makefile 2005-08-04 21:35:00 UTC (rev 17048) +++ trunk/rosapps/sysutils/dosfsck/Makefile 2005-08-04 21:42:32 UTC (rev 17049) @@ -1,5 +1,5 @@ CC=mingw32-gcc -OBJECTS = getopt.o boot.o check.o common.o dosfsck.o fat.o file.o io.o lfn.o +OBJECTS = boot.o check.o common.o dosfsck.o fat.o file.o io.o lfn.o all: dosfsck.exe _____ Deleted: trunk/rosapps/sysutils/dosfsck/getopt.c --- trunk/rosapps/sysutils/dosfsck/getopt.c 2005-08-04 21:35:00 UTC (rev 17048) +++ trunk/rosapps/sysutils/dosfsck/getopt.c 2005-08-04 21:42:32 UTC (rev 17049) @@ -1,63 +0,0 @@ -/* - * $Id$ - * This is an unpublished work copyright (c) 1998 HELIOS Software GmbH - * 30827 Garbsen, Germany - */ - - -#include <stdio.h> -#include <string.h> -#ifdef HAS_UNISTD -# include <unistd.h> -#endif - -char *optarg; -int optind = 1; -int opterr = 1; -int optopt; -static int subopt; -static int suboptind = 1; - -int getopt(int argc, char *const argv[], const char * optstring) -{ - char *curopt; - char *p; - int cursubopt; - - if (suboptind == optind-1 && argv[suboptind][subopt] != '\0') { - curopt = (char *)argv[suboptind]; - } else { - curopt = (char *)argv[optind]; - if (curopt == NULL || curopt[0] != '-' || strcmp(curopt, "-") == 0) - return -1; - suboptind = optind; - subopt = 1; - optind++; - if (strcmp(curopt, "--") == 0) - return -1; - } - cursubopt = subopt++; - if ((p = strchr(optstring, curopt[cursubopt])) == NULL) { - optopt = curopt[cursubopt]; - if (opterr) - fprintf(stderr, "%s: illegal option -- %c\n", argv[0], optopt); - return '?'; - } - if (p[1] == ':') { - if (curopt[cursubopt+1] != '\0') { - optarg = curopt+cursubopt+1; - suboptind++; - return p[0]; - } - if (argv[optind] == NULL) { - optopt = p[0]; - if (opterr) - fprintf(stderr, "%s: option requires an argument -- %c\n", argv[0], optopt); - if (*optstring == ':') - return ':'; - return '?'; - } - optarg = argv[optind++]; - } - return p[0]; -} _____ Modified: trunk/rosapps/sysutils/dosfsck/io.c --- trunk/rosapps/sysutils/dosfsck/io.c 2005-08-04 21:35:00 UTC (rev 17048) +++ trunk/rosapps/sysutils/dosfsck/io.c 2005-08-04 21:42:32 UTC (rev 17049) @@ -164,9 +164,37 @@ { CHANGE *new; int did; - + +#if 1 //SAE + void *scratch; + const size_t readsize_aligned = (size % 512) ? (size + (512 - (size % 512))) : size; + const loff_t seekpos_aligned = pos - (pos % 512); + const size_t seek_delta = (size_t)(pos - seekpos_aligned); + const size_t readsize = (size_t)(pos - seekpos_aligned) + readsize_aligned; + scratch = alloc(readsize_aligned); + if (write_immed) { did_change = 1; + if (llseek(fd,seekpos_aligned,0) != seekpos_aligned) pdie("Seek to %lld",pos); + if ((did = write(fd,data,readsize_aligned)) == (int)readsize_aligned) + { + free(scratch); + return; + } + if (did < 0) pdie("Write %d bytes at %lld",size,pos); + die("Wrote %d bytes instead of %d at %lld",did,size,pos); + } + new = alloc(sizeof(CHANGE)); + new->pos = pos; + memcpy(new->data = alloc(new->size = size),data,size); + new->next = NULL; + if (last) last->next = new; + else changes = new; + last = new; + +#else //SAE + if (write_immed) { + did_change = 1; if (llseek(fd,pos,0) != pos) pdie("Seek to %lld",pos); if ((did = write(fd,data,size)) == size) return; if (did < 0) pdie("Write %d bytes at %lld",size,pos); @@ -178,7 +206,8 @@ new->next = NULL; if (last) last->next = new; else changes = new; - last = new; + last = new; +#endif //SAE } @@ -261,22 +290,18 @@ shareMode = FILE_SHARE_READ|FILE_SHARE_WRITE; // TMN: break; case O_WRONLY: - exit(42); desiredAccess = GENERIC_WRITE; shareMode = 0; break; case O_RDWR: - exit(43); desiredAccess = GENERIC_READ|GENERIC_WRITE; shareMode = 0; break; case O_NONE: - exit(44); desiredAccess = 0; shareMode = FILE_SHARE_READ|FILE_SHARE_WRITE; } if (oflag & O_APPEND) { - exit(45); desiredAccess |= FILE_APPEND_DATA|SYNCHRONIZE; shareMode = FILE_SHARE_READ|FILE_SHARE_WRITE; } @@ -288,27 +313,22 @@ creationDisposition = OPEN_EXISTING; break; case O_CREAT: - exit(46); creationDisposition = OPEN_ALWAYS; break; case O_CREAT|O_EXCL: case O_CREAT|O_TRUNC|O_EXCL: - exit(47); creationDisposition = CREATE_NEW; break; case O_TRUNC: case O_TRUNC|O_EXCL: - exit(48); creationDisposition = TRUNCATE_EXISTING; break; case O_CREAT|O_TRUNC: - exit(49); creationDisposition = OPEN_ALWAYS; trunc = TRUE; break; } if (oflag & O_CREAT) { - exit(50); va_start(ap, oflag); pmode = va_arg(ap, int); va_end(ap); @@ -316,7 +336,6 @@ flagsAttributes |= FILE_ATTRIBUTE_READONLY; } if (oflag & O_TEMPORARY) { - exit(51); flagsAttributes |= FILE_FLAG_DELETE_ON_CLOSE; desiredAccess |= DELETE; } @@ -334,7 +353,6 @@ return -1; } if (trunc) { - exit(52); if (!SetEndOfFile(fh)) { errno = GetLastError(); CloseHandle(fh);
19 years, 4 months
1
0
0
0
← Newer
1
...
52
53
54
55
56
57
58
...
67
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
62
63
64
65
66
67
Results per page:
10
25
50
100
200