diff --git a/reactos/ChangeLog b/reactos/ChangeLog index 2841e2605fd..38f7eb02216 100644 --- a/reactos/ChangeLog +++ b/reactos/ChangeLog @@ -1,3 +1,38 @@ +2003-07-12 Casper S. Hornstrup + + Changes for compiling with w32api + + * include/ddk/extypes.h (NPAGED_LOOKASIDE_LIST, PAGED_LOOKASIDE_LIST): + Match w32api fields. + * include/ddk/halfuncs.h (HalReturnToFirmware, HalReleaseDisplayOwnership, + HalQueryDisplayOwnership): Move ... + * include/ntos/halfuncs.h: ... here. + * include/ntos/rtl.h: (PopEntrySList, PushEntrySList): Move to + ntoskrnl/ex/lookas.c. + * include/ntos/zw.h (NtAccessCheckAndAuditAlarm, NtCancelTimer, + NtCreatePagingFile, NtCreateThread, NtFlushInstructionCache, + NtFlushVirtualMemory, NtGetTickCount, NtLoadKey, NtLockVirtualMemory, + NtOpenObjectAuditAlarm, NtProtectVirtualMemory, NtQueryDirectoryObject, + NtQueryIntervalProfile, NtQueryVirtualMemory, NtRaiseHardError, + NtSetInformationKey, NtSetInformationObject, NtSetTimer, NtUnloadKey, + NtUnlockVirtualMemory, NtWaitForMultipleObjects, NtCreateProfile, + NtDelayExecution, NtExtendSection, NtQuerySection): Include for w32api. + * ntoskrnl/ntoskrnl.def (ExInterlockedAddUlong, + ExInterlockedInsertHeadList, ExInterlockedInsertTailList, + ExInterlockedPopEntryList, ExInterlockedPushEntryList, + ExInterlockedRemoveHeadList): Make FASTCALL. + * ntoskrnl/ntoskrnl.edf: Ditto. + * ntoskrnl/ex/list.c: Ditto. + * include/ddk/exfuncs.h: Ditto. + (InterlockedPopEntrySList, InterlockedPushEntrySList, + ExAllocateFromPagedLookasideList, ExFreeToPagedLookasideList): Add. + * ntoskrnl/ex/interlck.c (ExInterlockedDecrementLong, + ExInterlockedAddUlong, ExInterlockedIncrementLong): Undefine if defined. + * ntoskrnl/ex/lookas.c (PopEntrySList, PushEntrySList, + LookasideListLock): Add. + * drivers/dd/blue/blue.c: Include . + * drivers/dd/videoprt/videoprt.c: Ditto. + 2003-07-11 Casper S. Hornstrup * lib/user32/controls/edit.c (EDIT_EM_SetLimitText, diff --git a/reactos/drivers/dd/blue/blue.c b/reactos/drivers/dd/blue/blue.c index 818f2c3da99..c0da5a6bfd3 100644 --- a/reactos/drivers/dd/blue/blue.c +++ b/reactos/drivers/dd/blue/blue.c @@ -1,4 +1,4 @@ -/* $Id: blue.c,v 1.39 2003/06/21 14:25:30 gvg Exp $ +/* $Id: blue.c,v 1.40 2003/07/12 10:24:45 chorns Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -11,7 +11,7 @@ /* INCLUDES ******************************************************************/ -#include +#include #include #include #include diff --git a/reactos/drivers/dd/videoprt/videoprt.c b/reactos/drivers/dd/videoprt/videoprt.c index 0f40acac6a1..b1df1f4f1f0 100644 --- a/reactos/drivers/dd/videoprt/videoprt.c +++ b/reactos/drivers/dd/videoprt/videoprt.c @@ -1,4 +1,4 @@ -/* $Id: videoprt.c,v 1.8 2003/07/10 21:12:40 chorns Exp $ +/* $Id: videoprt.c,v 1.9 2003/07/12 10:24:45 chorns Exp $ * * VideoPort driver * Written by Rex Jolliff @@ -6,7 +6,7 @@ */ #include -#include +#include #include #include "../../../ntoskrnl/include/internal/v86m.h" diff --git a/reactos/include/ddk/exfuncs.h b/reactos/include/ddk/exfuncs.h index b9cc4e7a76d..c1c93ff56b7 100644 --- a/reactos/include/ddk/exfuncs.h +++ b/reactos/include/ddk/exfuncs.h @@ -288,7 +288,7 @@ ExInterlockedAddLargeStatistic ( ); ULONG -STDCALL +FASTCALL ExInterlockedAddUlong ( PULONG Addend, ULONG Increment, @@ -355,21 +355,21 @@ ExInterlockedIncrementLong ( PKSPIN_LOCK Lock ); PLIST_ENTRY -STDCALL +FASTCALL ExInterlockedInsertHeadList ( PLIST_ENTRY ListHead, PLIST_ENTRY ListEntry, PKSPIN_LOCK Lock ); PLIST_ENTRY -STDCALL +FASTCALL ExInterlockedInsertTailList ( PLIST_ENTRY ListHead, PLIST_ENTRY ListEntry, PKSPIN_LOCK Lock ); PSINGLE_LIST_ENTRY -STDCALL +FASTCALL ExInterlockedPopEntryList ( PSINGLE_LIST_ENTRY ListHead, PKSPIN_LOCK Lock @@ -381,7 +381,7 @@ ExInterlockedPopEntrySList ( PKSPIN_LOCK Lock ); PSINGLE_LIST_ENTRY -STDCALL +FASTCALL ExInterlockedPushEntryList ( PSINGLE_LIST_ENTRY ListHead, PSINGLE_LIST_ENTRY ListEntry, @@ -403,7 +403,7 @@ ExInterlockedRemoveEntryList ( ); PLIST_ENTRY -STDCALL +FASTCALL ExInterlockedRemoveHeadList ( PLIST_ENTRY Head, PKSPIN_LOCK Lock @@ -586,6 +586,18 @@ ExUnregisterCallback ( IN PVOID CallbackRegistration ); +PSLIST_ENTRY +FASTCALL +InterlockedPopEntrySList ( + IN PSLIST_HEADER ListHead + ); + +PSLIST_ENTRY +FASTCALL +InterlockedPushEntrySList( + IN PSLIST_HEADER ListHead, + IN PSLIST_ENTRY ListEntry + ); /* * PVOID @@ -614,7 +626,7 @@ ExAllocateFromNPagedLookasideList ( Lookaside->TotalAllocates++; Entry = ExInterlockedPopEntrySList (&Lookaside->ListHead, - &Lookaside->Lock); + &Lookaside->Obsoleted); if (Entry == NULL) { Lookaside->AllocateMisses++; @@ -626,11 +638,21 @@ ExAllocateFromNPagedLookasideList ( return Entry; } -PVOID -STDCALL -ExAllocateFromPagedLookasideList ( - PPAGED_LOOKASIDE_LIST LookSide - ); +static inline PVOID +ExAllocateFromPagedLookasideList( + IN PPAGED_LOOKASIDE_LIST Lookaside) +{ + PVOID Entry; + + Lookaside->TotalAllocates++; + Entry = InterlockedPopEntrySList(&Lookaside->ListHead); + if (Entry == NULL) { + Lookaside->AllocateMisses++; + Entry = (Lookaside->Allocate)(Lookaside->Type, + Lookaside->Size, Lookaside->Tag); + } + return Entry; +} VOID STDCALL @@ -669,7 +691,7 @@ ExFreeToNPagedLookasideList ( ) { Lookaside->TotalFrees++; - if (ExQueryDepthSList (&Lookaside->ListHead) >= Lookaside->MinimumDepth) + if (ExQueryDepthSList (&Lookaside->ListHead) >= Lookaside->Depth) { Lookaside->FreeMisses++; (Lookaside->Free)(Entry); @@ -678,16 +700,23 @@ ExFreeToNPagedLookasideList ( { ExInterlockedPushEntrySList (&Lookaside->ListHead, (PSINGLE_LIST_ENTRY)Entry, - &Lookaside->Lock); + &Lookaside->Obsoleted); } } -VOID -STDCALL -ExFreeToPagedLookasideList ( - PPAGED_LOOKASIDE_LIST Lookaside, - PVOID Entry - ); +static inline VOID +ExFreeToPagedLookasideList( + IN PPAGED_LOOKASIDE_LIST Lookaside, + IN PVOID Entry) +{ + Lookaside->TotalFrees++; + if (ExQueryDepthSList(&Lookaside->ListHead) >= Lookaside->Depth) { + Lookaside->FreeMisses++; + (Lookaside->Free)(Entry); + } else { + InterlockedPushEntrySList(&Lookaside->ListHead, (PSLIST_ENTRY)Entry); + } +} VOID STDCALL diff --git a/reactos/include/ddk/extypes.h b/reactos/include/ddk/extypes.h index b0c9dd30169..56b5353b164 100644 --- a/reactos/include/ddk/extypes.h +++ b/reactos/include/ddk/extypes.h @@ -1,4 +1,4 @@ -/* $Id: extypes.h,v 1.15 2003/06/07 16:16:38 chorns Exp $ */ +/* $Id: extypes.h,v 1.16 2003/07/12 10:24:45 chorns Exp $ */ #ifndef __INCLUDE_DDK_EXTYPES_H #define __INCLUDE_DDK_EXTYPES_H @@ -112,7 +112,7 @@ typedef union _SLIST_HEADER typedef struct _NPAGED_LOOKASIDE_LIST { SLIST_HEADER ListHead; - USHORT MinimumDepth; + USHORT Depth; USHORT MaximumDepth; ULONG TotalAllocates; ULONG AllocateMisses; @@ -127,13 +127,13 @@ typedef struct _NPAGED_LOOKASIDE_LIST ULONG LastTotalAllocates; ULONG LastAllocateMisses; ULONG Pad[2]; - KSPIN_LOCK Lock; + KSPIN_LOCK Obsoleted; } NPAGED_LOOKASIDE_LIST, *PNPAGED_LOOKASIDE_LIST; typedef struct _PAGED_LOOKASIDE_LIST { SLIST_HEADER ListHead; - USHORT MinimumDepth; + USHORT Depth; USHORT MaximumDepth; ULONG TotalAllocates; ULONG AllocateMisses; @@ -147,7 +147,7 @@ typedef struct _PAGED_LOOKASIDE_LIST LIST_ENTRY ListEntry; ULONG LastTotalAllocates; ULONG LastAllocateMisses; - FAST_MUTEX Lock; + FAST_MUTEX Obsoleted; } PAGED_LOOKASIDE_LIST, *PPAGED_LOOKASIDE_LIST; diff --git a/reactos/include/ddk/halfuncs.h b/reactos/include/ddk/halfuncs.h index 3d8c8e2133d..352f29048ec 100644 --- a/reactos/include/ddk/halfuncs.h +++ b/reactos/include/ddk/halfuncs.h @@ -1,6 +1,6 @@ #ifndef __INCLUDE_DDK_HALFUNCS_H #define __INCLUDE_DDK_HALFUNCS_H -/* $Id: halfuncs.h,v 1.7 2003/06/21 14:25:30 gvg Exp $ */ +/* $Id: halfuncs.h,v 1.8 2003/07/12 10:24:45 chorns Exp $ */ #include @@ -145,9 +145,6 @@ FASTCALL HalRequestSoftwareInterrupt */ -VOID STDCALL -HalReturnToFirmware(ULONG Action); - ULONG STDCALL HalSetBusData(BUS_DATA_TYPE BusDataType, ULONG BusNumber, @@ -281,13 +278,6 @@ VOID STDCALL WRITE_PORT_USHORT(PUSHORT Port, USHORT Value); -/* Non-standard functions */ -VOID STDCALL -HalReleaseDisplayOwnership(); - -BOOLEAN STDCALL -HalQueryDisplayOwnership(); - #endif /* __INCLUDE_DDK_HALDDK_H */ /* EOF */ diff --git a/reactos/include/ntos/halfuncs.h b/reactos/include/ntos/halfuncs.h index 54cf4da2569..eee1b43f22c 100755 --- a/reactos/include/ntos/halfuncs.h +++ b/reactos/include/ntos/halfuncs.h @@ -46,6 +46,16 @@ KIRQL STDCALL KeRaiseIrqlToSynchLevel(VOID); +VOID STDCALL +HalReturnToFirmware(ULONG Action); + +/* Non-standard functions */ +VOID STDCALL +HalReleaseDisplayOwnership(); + +BOOLEAN STDCALL +HalQueryDisplayOwnership(); + #endif /* __INCLUDE_NTOS_HALDDK_H */ /* EOF */ diff --git a/reactos/include/ntos/rtl.h b/reactos/include/ntos/rtl.h index 569303ce13a..1fd9e48f69f 100755 --- a/reactos/include/ntos/rtl.h +++ b/reactos/include/ntos/rtl.h @@ -1,4 +1,4 @@ -/* $Id: rtl.h,v 1.12 2003/06/07 16:16:38 chorns Exp $ +/* $Id: rtl.h,v 1.13 2003/07/12 10:24:45 chorns Exp $ * */ @@ -578,94 +578,6 @@ PushEntryList ( */ -#ifndef __USE_W32API - - -/* - * An ReactOS extension - */ -static -inline -PSINGLE_LIST_ENTRY - PopEntrySList( - PSLIST_HEADER ListHead - ) -{ - PSINGLE_LIST_ENTRY ListEntry; - - ListEntry = ListHead->s.Next.Next; - if (ListEntry!=NULL) - { - ListHead->s.Next.Next = ListEntry->Next; - ListHead->s.Depth++; - ListHead->s.Sequence++; - } - return ListEntry; -} - - -/* - * An ReactOS extension - */ -static -inline -VOID -PushEntrySList ( - PSLIST_HEADER ListHead, - PSINGLE_LIST_ENTRY Entry - ) -{ - Entry->Next = ListHead->s.Next.Next; - ListHead->s.Next.Next = Entry; - ListHead->s.Depth++; - ListHead->s.Sequence++; -} - -#else /* __USE_W32API */ - -/* - * An ReactOS extension - */ -static -inline -PSINGLE_LIST_ENTRY - PopEntrySList( - PSLIST_HEADER ListHead - ) -{ - PSINGLE_LIST_ENTRY ListEntry; - - ListEntry = ListHead->Next.Next; - if (ListEntry!=NULL) - { - ListHead->Next.Next = ListEntry->Next; - ListHead->Depth++; - ListHead->Sequence++; - } - return ListEntry; -} - - -/* - * An ReactOS extension - */ -static -inline -VOID -PushEntrySList ( - PSLIST_HEADER ListHead, - PSINGLE_LIST_ENTRY Entry - ) -{ - Entry->Next = ListHead->Next.Next; - ListHead->Next.Next = Entry; - ListHead->Depth++; - ListHead->Sequence++; -} - -#endif /* __USE_W32API */ - - NTSTATUS STDCALL RtlAddAtomToAtomTable ( diff --git a/reactos/include/ntos/types.h b/reactos/include/ntos/types.h index 3fa6475edce..ad4e986f32f 100644 --- a/reactos/include/ntos/types.h +++ b/reactos/include/ntos/types.h @@ -189,6 +189,9 @@ typedef struct _SINGLE_LIST_ENTRY struct _SINGLE_LIST_ENTRY *Next; } SINGLE_LIST_ENTRY, *PSINGLE_LIST_ENTRY; +#define SLIST_ENTRY SINGLE_LIST_ENTRY +#define PSLIST_ENTRY PSINGLE_LIST_ENTRY + typedef struct _UNICODE_STRING { USHORT Length; diff --git a/reactos/include/ntos/zw.h b/reactos/include/ntos/zw.h index f513b37d7be..2f4c953620c 100755 --- a/reactos/include/ntos/zw.h +++ b/reactos/include/ntos/zw.h @@ -1,5 +1,5 @@ -/* $Id: zw.h,v 1.12 2003/06/07 16:16:38 chorns Exp $ +/* $Id: zw.h,v 1.13 2003/07/12 10:24:45 chorns Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -4269,8 +4269,51 @@ RtlOpenCurrentUser( IN ACCESS_MASK DesiredAccess, OUT PHANDLE KeyHandle); +/* + * FUNCTION: Checks a clients access rights to a object and issues a audit a alarm. ( it logs the access ) + * ARGUMENTS: + * SubsystemName = Specifies the name of the subsystem, can be "WIN32" or "DEBUG" + * ObjectHandle = + * ObjectAttributes = + * DesiredAcces = + * GenericMapping = + * ObjectCreation = + * GrantedAccess = + * AccessStatus = + * GenerateOnClose = + * REMARKS: The arguments map to the win32 AccessCheck + * RETURNS: Status + */ -#ifndef __USE_W32API +NTSTATUS +STDCALL +NtAccessCheckAndAuditAlarm( + IN PUNICODE_STRING SubsystemName, + IN PHANDLE ObjectHandle, + IN POBJECT_ATTRIBUTES ObjectAttributes, + IN ACCESS_MASK DesiredAccess, + IN PGENERIC_MAPPING GenericMapping, + IN BOOLEAN ObjectCreation, + OUT PULONG GrantedAccess, + OUT PBOOLEAN AccessStatus, + OUT PBOOLEAN GenerateOnClose + ); + +/* + * FUNCTION: Cancels a timer + * ARGUMENTS: + * TimerHandle = Handle to the timer + * CurrentState = Specifies the state of the timer when cancelled. + * REMARKS: + * The arguments to this function map to the function CancelWaitableTimer. + * RETURNS: Status + */ +NTSTATUS +STDCALL +NtCancelTimer( + IN HANDLE TimerHandle, + OUT PBOOLEAN CurrentState OPTIONAL + ); /* * FUNCTION: Continues a thread with the specified context @@ -4291,6 +4334,497 @@ NtContinue( IN BOOLEAN TestAlert ); +/* + * FUNCTION: Creates a paging file. + * ARGUMENTS: + * FileName = Name of the pagefile + * InitialSize = Specifies the initial size in bytes + * MaximumSize = Specifies the maximum size in bytes + * Reserved = Reserved for future use + * RETURNS: Status + */ +NTSTATUS +STDCALL +NtCreatePagingFile( + IN PUNICODE_STRING FileName, + IN PLARGE_INTEGER InitialSize, + IN PLARGE_INTEGER MaxiumSize, + IN ULONG Reserved + ); + + +/* + * FUNCTION: Creates a profile + * ARGUMENTS: + * ProfileHandle (OUT) = Caller supplied storage for the resulting handle + * ObjectAttribute = Initialized attributes for the object + * ImageBase = Start address of executable image + * ImageSize = Size of the image + * Granularity = Bucket size + * Buffer = Caller supplies buffer for profiling info + * ProfilingSize = Buffer size + * ClockSource = Specify 0 / FALSE ?? + * ProcessorMask = A value of -1 indicates disables per processor profiling, + otherwise bit set for the processor to profile. + * REMARKS: + * This function maps to the win32 CreateProcess. + * RETURNS: Status + */ + +NTSTATUS +STDCALL +NtCreateProfile(OUT PHANDLE ProfileHandle, + IN HANDLE ProcessHandle, + IN PVOID ImageBase, + IN ULONG ImageSize, + IN ULONG Granularity, + OUT PULONG Buffer, + IN ULONG ProfilingSize, + IN KPROFILE_SOURCE Source, + IN ULONG ProcessorMask); + +/* + * FUNCTION: Creates a user mode thread + * ARGUMENTS: + * ThreadHandle (OUT) = Caller supplied storage for the resulting handle + * DesiredAccess = Specifies the allowed or desired access to the thread. + * ObjectAttributes = Initialized attributes for the object. + * ProcessHandle = Handle to the threads parent process. + * ClientId (OUT) = Caller supplies storage for returned process id and thread id. + * ThreadContext = Initial processor context for the thread. + * InitialTeb = Initial user mode stack context for the thread. + * CreateSuspended = Specifies if the thread is ready for scheduling + * REMARKS: + * This function maps to the win32 function CreateThread. + * RETURNS: Status + */ +NTSTATUS +STDCALL +NtCreateThread( + OUT PHANDLE ThreadHandle, + IN ACCESS_MASK DesiredAccess, + IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, + IN HANDLE ProcessHandle, + OUT PCLIENT_ID ClientId, + IN PCONTEXT ThreadContext, + IN PUSER_STACK UserStack, + IN BOOLEAN CreateSuspended + ); + +/* + * FUNCTION: Delays the execution of the calling thread. + * ARGUMENTS: + * Alertable = If TRUE the thread is alertable during is wait period + * Interval = Specifies the interval to wait. + * RETURNS: Status + */ + +NTSTATUS +STDCALL +NtDelayExecution( + IN ULONG Alertable, + IN TIME *Interval + ); + +/* + * FUNCTION: Extends a section + * ARGUMENTS: + * SectionHandle = Handle to the section + * NewMaximumSize = Adjusted size + * RETURNS: Status + */ +NTSTATUS +STDCALL +NtExtendSection( + IN HANDLE SectionHandle, + IN ULONG NewMaximumSize + ); + +/* + * FUNCTION: Flushes a the processors instruction cache + * ARGUMENTS: + * ProcessHandle = Points to the process owning the cache + * BaseAddress = // might this be a image address ???? + * NumberOfBytesToFlush = + * RETURNS: Status + * REMARKS: + * This funciton is used by debuggers + */ +NTSTATUS +STDCALL +NtFlushInstructionCache( + IN HANDLE ProcessHandle, + IN PVOID BaseAddress, + IN UINT NumberOfBytesToFlush + ); + +/* + * FUNCTION: Flushes virtual memory to file + * ARGUMENTS: + * ProcessHandle = Points to the process that allocated the virtual memory + * BaseAddress = Points to the memory address + * NumberOfBytesToFlush = Limits the range to flush, + * NumberOfBytesFlushed = Actual number of bytes flushed + * RETURNS: Status + * REMARKS: + * Check return status on STATUS_NOT_MAPPED_DATA + */ +NTSTATUS +STDCALL +NtFlushVirtualMemory( + IN HANDLE ProcessHandle, + IN PVOID BaseAddress, + IN ULONG NumberOfBytesToFlush, + OUT PULONG NumberOfBytesFlushed OPTIONAL + ); + +/* + * FUNCTION: Retrieves the uptime of the system + * ARGUMENTS: + * UpTime = Number of clock ticks since boot. + * RETURNS: Status + */ +NTSTATUS +STDCALL +NtGetTickCount( + PULONG UpTime + ); + +/* + * FUNCTION: Loads a registry key. + * ARGUMENTS: + * KeyObjectAttributes = Key to be loaded + * FileObjectAttributes = File to load the key from + * REMARK: + * This procedure maps to the win32 procedure RegLoadKey + * RETURNS: Status + */ +NTSTATUS +STDCALL +NtLoadKey( + IN POBJECT_ATTRIBUTES KeyObjectAttributes, + IN POBJECT_ATTRIBUTES FileObjectAttributes + ); + + +/* + * FUNCTION: Locks a range of virtual memory. + * ARGUMENTS: + * ProcessHandle = Handle to the process + * BaseAddress = Lower boundary of the range of bytes to lock. + * NumberOfBytesLock = Offset to the upper boundary. + * NumberOfBytesLocked (OUT) = Number of bytes actually locked. + * REMARK: + This procedure maps to the win32 procedure VirtualLock. + * RETURNS: Status [STATUS_SUCCESS | STATUS_WAS_LOCKED ] + */ +NTSTATUS +STDCALL +NtLockVirtualMemory( + HANDLE ProcessHandle, + PVOID BaseAddress, + ULONG NumberOfBytesToLock, + PULONG NumberOfBytesLocked + ); + +NTSTATUS +STDCALL +NtOpenObjectAuditAlarm( + IN PUNICODE_STRING SubsystemName, + IN PVOID HandleId, + IN POBJECT_ATTRIBUTES ObjectAttributes, + IN HANDLE ClientToken, + IN ULONG DesiredAccess, + IN ULONG GrantedAccess, + IN PPRIVILEGE_SET Privileges, + IN BOOLEAN ObjectCreation, + IN BOOLEAN AccessGranted, + OUT PBOOLEAN GenerateOnClose + ); + +/* + * FUNCTION: Set the access protection of a range of virtual memory + * ARGUMENTS: + * ProcessHandle = Handle to process owning the virtual address space + * BaseAddress = Start address + * NumberOfBytesToProtect = Delimits the range of virtual memory + * for which the new access protection holds + * NewAccessProtection = The new access proctection for the pages + * OldAccessProtection = Caller should supply storage for the old + * access protection + * + * REMARKS: + * The function maps to the win32 VirtualProtectEx + * RETURNS: Status + */ +NTSTATUS +STDCALL +NtProtectVirtualMemory( + IN HANDLE ProcessHandle, + IN PVOID BaseAddress, + IN ULONG NumberOfBytesToProtect, + IN ULONG NewAccessProtection, + OUT PULONG OldAccessProtection + ); + +/* + * FUNCTION: Query information about the content of a directory object + * ARGUMENTS: + DirObjInformation = Buffer must be large enough to hold the name strings too + GetNextIndex = If TRUE :return the index of the next object in this directory in ObjectIndex + If FALSE: return the number of objects in this directory in ObjectIndex + IgnoreInputIndex= If TRUE: ignore input value of ObjectIndex always start at index 0 + If FALSE use input value of ObjectIndex + ObjectIndex = zero based index of object in the directory depends on GetNextIndex and IgnoreInputIndex + DataWritten = Actual size of the ObjectIndex ??? + * RETURNS: Status + */ +NTSTATUS +STDCALL +NtQueryDirectoryObject( + IN HANDLE DirObjHandle, + OUT POBJDIR_INFORMATION DirObjInformation, + IN ULONG BufferLength, + IN BOOLEAN GetNextIndex, + IN BOOLEAN IgnoreInputIndex, + IN OUT PULONG ObjectIndex, + OUT PULONG DataWritten OPTIONAL + ); + +/* + * FUNCTION: Query the interval and the clocksource for profiling + * ARGUMENTS: + Interval = + ClockSource = + * RETURNS: Status + */ +NTSTATUS +STDCALL +NtQueryIntervalProfile( + OUT PULONG Interval, + OUT KPROFILE_SOURCE ClockSource + ); + +/* + * FUNCTION: Queries the information of a section object. + * ARGUMENTS: + * SectionHandle = Handle to the section link object + * SectionInformationClass = Index to a certain information structure + * SectionInformation (OUT)= Caller supplies storage for resulting information + * Length = Size of the supplied storage + * ResultLength = Data written + * RETURNS: Status + * +*/ +NTSTATUS +STDCALL +NtQuerySection( + IN HANDLE SectionHandle, + IN CINT SectionInformationClass, + OUT PVOID SectionInformation, + IN ULONG Length, + OUT PULONG ResultLength + ); + +/* + * FUNCTION: Queries the virtual memory information. + * ARGUMENTS: + ProcessHandle = Process owning the virtual address space + BaseAddress = Points to the page where the information is queried for. + * VirtualMemoryInformationClass = Index to a certain information structure + + MemoryBasicInformation MEMORY_BASIC_INFORMATION + + * VirtualMemoryInformation = caller supplies storage for the information structure + * Length = size of the structure + ResultLength = Data written + * RETURNS: Status + * +*/ + +NTSTATUS +STDCALL +NtQueryVirtualMemory( + IN HANDLE ProcessHandle, + IN PVOID Address, + IN IN CINT VirtualMemoryInformationClass, + OUT PVOID VirtualMemoryInformation, + IN ULONG Length, + OUT PULONG ResultLength + ); + +/* + * FUNCTION: Raises a hard error (stops the system) + * ARGUMENTS: + * Status = Status code of the hard error + * Unknown2 = ?? + * Unknown3 = ?? + * Unknown4 = ?? + * Unknown5 = ?? + * Unknown6 = ?? + * RETURNS: Status + * + */ + +NTSTATUS +STDCALL +NtRaiseHardError( + IN NTSTATUS Status, + ULONG Unknown2, + ULONG Unknown3, + ULONG Unknown4, + ULONG Unknown5, + ULONG Unknown6 + ); + +/* + * FUNCTION: Sets the information of a registry key. + * ARGUMENTS: + * KeyHandle = Handle to the registry key + * KeyInformationClass = Index to the a certain information structure. + Can be one of the following values: + + * KeyWriteTimeInformation KEY_WRITE_TIME_INFORMATION + + KeyInformation = Storage for the new information + * KeyInformationLength = Size of the information strucure + * RETURNS: Status + */ + +NTSTATUS +STDCALL +NtSetInformationKey( + IN HANDLE KeyHandle, + IN CINT KeyInformationClass, + IN PVOID KeyInformation, + IN ULONG KeyInformationLength + ); + +/* + * FUNCTION: Changes a set of object specific parameters + * ARGUMENTS: + * ObjectHandle = + * ObjectInformationClass = Index to the set of parameters to change. + + + ObjectBasicInformation + ObjectTypeInformation OBJECT_TYPE_INFORMATION + ObjectAllInformation + ObjectDataInformation OBJECT_DATA_INFORMATION + ObjectNameInformation OBJECT_NAME_INFORMATION + + + * ObjectInformation = Caller supplies storage for parameters to set. + * Length = Size of the storage supplied + * RETURNS: Status +*/ +NTSTATUS +STDCALL +NtSetInformationObject( + IN HANDLE ObjectHandle, + IN CINT ObjectInformationClass, + IN PVOID ObjectInformation, + IN ULONG Length + ); + +/* + * FUNCTION: Sets the characteristics of a timer + * ARGUMENTS: + * TimerHandle = Handle to the timer + * DueTime = Time before the timer becomes signalled for the first time. + * TimerApcRoutine = Completion routine can be called on time completion + * TimerContext = Argument to the completion routine + * Resume = Specifies if the timer should repeated after completing one cycle + * Period = Cycle of the timer + * REMARKS: This routine maps to the win32 SetWaitableTimer. + * RETURNS: Status +*/ +NTSTATUS +STDCALL +NtSetTimer( + IN HANDLE TimerHandle, + IN PLARGE_INTEGER DueTime, + IN PTIMERAPCROUTINE TimerApcRoutine, + IN PVOID TimerContext, + IN BOOL WakeTimer, + IN ULONG Period OPTIONAL, + OUT PBOOLEAN PreviousState OPTIONAL + ); + +/* + * FUNCTION: Unloads a registry key. + * ARGUMENTS: + * KeyHandle = Handle to the registry key + * REMARK: + * This procedure maps to the win32 procedure RegUnloadKey + * RETURNS: Status + */ +NTSTATUS +STDCALL +NtUnloadKey( + IN POBJECT_ATTRIBUTES KeyObjectAttributes + ); + +/* + * FUNCTION: Unlocks a range of virtual memory. + * ARGUMENTS: + * ProcessHandle = Handle to the process + * BaseAddress = Lower boundary of the range of bytes to unlock. + * NumberOfBytesToUnlock = Offset to the upper boundary to unlock. + * NumberOfBytesUnlocked (OUT) = Number of bytes actually unlocked. + * REMARK: + This procedure maps to the win32 procedure VirtualUnlock + * RETURNS: Status [ STATUS_SUCCESS | STATUS_PAGE_WAS_ULOCKED ] + */ +NTSTATUS +STDCALL +NtUnlockVirtualMemory( + IN HANDLE ProcessHandle, + IN PVOID BaseAddress, + IN ULONG NumberOfBytesToUnlock, + OUT PULONG NumberOfBytesUnlocked OPTIONAL + ); + +/* + * FUNCTION: Waits for multiple objects to become signalled. + * ARGUMENTS: + * Count = The number of objects + * Object = The array of object handles + * WaitType = Can be one of the values UserMode or KernelMode + * Alertable = If true the wait is alertable. + * Time = The maximum wait time. + * REMARKS: + * This function maps to the win32 WaitForMultipleObjectEx. + * RETURNS: Status + */ +NTSTATUS +STDCALL +NtWaitForMultipleObjects ( + IN ULONG Count, + IN HANDLE Object[], + IN WAIT_TYPE WaitType, + IN BOOLEAN Alertable, + IN PLARGE_INTEGER Time + ); + + + + + +#ifndef __USE_W32API + +/* + * FUNCTION: Continues a thread with the specified context + * ARGUMENTS: + * Context = Specifies the processor context + * IrqLevel = Specifies the Interupt Request Level to continue with. Can + * be PASSIVE_LEVEL or APC_LEVEL + * REMARKS + * NtContinue can be used to continue after an exception or apc. + * RETURNS: Status + */ +//FIXME This function might need another parameter + NTSTATUS STDCALL ZwContinue(IN PCONTEXT Context, IN CINT IrqLevel); /* @@ -4367,20 +4901,6 @@ ZwDuplicateObject( * RETURNS: Status */ -NTSTATUS -STDCALL -NtAccessCheckAndAuditAlarm( - IN PUNICODE_STRING SubsystemName, - IN PHANDLE ObjectHandle, - IN POBJECT_ATTRIBUTES ObjectAttributes, - IN ACCESS_MASK DesiredAccess, - IN PGENERIC_MAPPING GenericMapping, - IN BOOLEAN ObjectCreation, - OUT PULONG GrantedAccess, - OUT PBOOLEAN AccessStatus, - OUT PBOOLEAN GenerateOnClose - ); - NTSTATUS STDCALL ZwAccessCheckAndAuditAlarm( @@ -4434,22 +4954,6 @@ ZwAllocateUuids( PULONG Sequence ); -/* - * FUNCTION: Cancels a timer - * ARGUMENTS: - * TimerHandle = Handle to the timer - * CurrentState = Specifies the state of the timer when cancelled. - * REMARKS: - * The arguments to this function map to the function CancelWaitableTimer. - * RETURNS: Status - */ -NTSTATUS -STDCALL -NtCancelTimer( - IN HANDLE TimerHandle, - OUT PBOOLEAN CurrentState OPTIONAL - ); - NTSTATUS STDCALL ZwCancelTimer( @@ -4468,15 +4972,6 @@ ZwCancelTimer( */ NTSTATUS STDCALL -NtCreatePagingFile( - IN PUNICODE_STRING FileName, - IN PLARGE_INTEGER InitialSize, - IN PLARGE_INTEGER MaxiumSize, - IN ULONG Reserved - ); - -NTSTATUS -STDCALL ZwCreatePagingFile( IN PUNICODE_STRING FileName, IN PLARGE_INTEGER InitialSize, @@ -4501,19 +4996,6 @@ ZwCreatePagingFile( */ NTSTATUS STDCALL -NtCreateThread( - OUT PHANDLE ThreadHandle, - IN ACCESS_MASK DesiredAccess, - IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, - IN HANDLE ProcessHandle, - OUT PCLIENT_ID ClientId, - IN PCONTEXT ThreadContext, - IN PUSER_STACK UserStack, - IN BOOLEAN CreateSuspended - ); - -NTSTATUS -STDCALL ZwCreateThread( OUT PHANDLE ThreadHandle, IN ACCESS_MASK DesiredAccess, @@ -4582,14 +5064,6 @@ ZwFindAtom( */ NTSTATUS STDCALL -NtFlushInstructionCache( - IN HANDLE ProcessHandle, - IN PVOID BaseAddress, - IN UINT NumberOfBytesToFlush - ); - -NTSTATUS -STDCALL ZwFlushInstructionCache( IN HANDLE ProcessHandle, IN PVOID BaseAddress, @@ -4609,15 +5083,6 @@ ZwFlushInstructionCache( */ NTSTATUS STDCALL -NtFlushVirtualMemory( - IN HANDLE ProcessHandle, - IN PVOID BaseAddress, - IN ULONG NumberOfBytesToFlush, - OUT PULONG NumberOfBytesFlushed OPTIONAL - ); - -NTSTATUS -STDCALL ZwFlushVirtualMemory( IN HANDLE ProcessHandle, IN PVOID BaseAddress, @@ -4633,12 +5098,6 @@ ZwFlushVirtualMemory( */ NTSTATUS STDCALL -NtGetTickCount( - PULONG UpTime - ); - -NTSTATUS -STDCALL ZwGetTickCount( PULONG UpTime ); @@ -4654,13 +5113,6 @@ ZwGetTickCount( */ NTSTATUS STDCALL -NtLoadKey( - IN POBJECT_ATTRIBUTES KeyObjectAttributes, - IN POBJECT_ATTRIBUTES FileObjectAttributes - ); - -NTSTATUS -STDCALL ZwLoadKey( IN POBJECT_ATTRIBUTES KeyObjectAttributes, IN POBJECT_ATTRIBUTES FileObjectAttributes @@ -4679,15 +5131,6 @@ ZwLoadKey( */ NTSTATUS STDCALL -NtLockVirtualMemory( - HANDLE ProcessHandle, - PVOID BaseAddress, - ULONG NumberOfBytesToLock, - PULONG NumberOfBytesLocked - ); - -NTSTATUS -STDCALL ZwLockVirtualMemory( HANDLE ProcessHandle, PVOID BaseAddress, @@ -4695,21 +5138,6 @@ ZwLockVirtualMemory( PULONG NumberOfBytesLocked ); -NTSTATUS -STDCALL -NtOpenObjectAuditAlarm( - IN PUNICODE_STRING SubsystemName, - IN PVOID HandleId, - IN POBJECT_ATTRIBUTES ObjectAttributes, - IN HANDLE ClientToken, - IN ULONG DesiredAccess, - IN ULONG GrantedAccess, - IN PPRIVILEGE_SET Privileges, - IN BOOLEAN ObjectCreation, - IN BOOLEAN AccessGranted, - OUT PBOOLEAN GenerateOnClose - ); - NTSTATUS STDCALL ZwOpenObjectAuditAlarm( @@ -4742,16 +5170,6 @@ ZwOpenObjectAuditAlarm( */ NTSTATUS STDCALL -NtProtectVirtualMemory( - IN HANDLE ProcessHandle, - IN PVOID BaseAddress, - IN ULONG NumberOfBytesToProtect, - IN ULONG NewAccessProtection, - OUT PULONG OldAccessProtection - ); - -NTSTATUS -STDCALL ZwProtectVirtualMemory( IN HANDLE ProcessHandle, IN PVOID BaseAddress, @@ -4794,18 +5212,6 @@ ZwQueryInformationAtom( */ NTSTATUS STDCALL -NtQueryDirectoryObject( - IN HANDLE DirObjHandle, - OUT POBJDIR_INFORMATION DirObjInformation, - IN ULONG BufferLength, - IN BOOLEAN GetNextIndex, - IN BOOLEAN IgnoreInputIndex, - IN OUT PULONG ObjectIndex, - OUT PULONG DataWritten OPTIONAL - ); - -NTSTATUS -STDCALL ZwQueryDirectoryObject( IN HANDLE DirObjHandle, OUT POBJDIR_INFORMATION DirObjInformation, @@ -4887,13 +5293,6 @@ ZwQueryInformationProcess( */ NTSTATUS STDCALL -NtQueryIntervalProfile( - OUT PULONG Interval, - OUT KPROFILE_SOURCE ClockSource - ); - -NTSTATUS -STDCALL ZwQueryIntervalProfile( OUT PULONG Interval, OUT KPROFILE_SOURCE ClockSource @@ -4961,17 +5360,6 @@ ZwQuerySecurityObject( * */ -NTSTATUS -STDCALL -NtQueryVirtualMemory( - IN HANDLE ProcessHandle, - IN PVOID Address, - IN IN CINT VirtualMemoryInformationClass, - OUT PVOID VirtualMemoryInformation, - IN ULONG Length, - OUT PULONG ResultLength - ); - NTSTATUS STDCALL ZwQueryVirtualMemory( @@ -4995,18 +5383,6 @@ ZwQueryVirtualMemory( * RETURNS: Status * */ - -NTSTATUS -STDCALL -NtRaiseHardError( - IN NTSTATUS Status, - ULONG Unknown2, - ULONG Unknown3, - ULONG Unknown4, - ULONG Unknown5, - ULONG Unknown6 - ); - NTSTATUS STDCALL ZwRaiseHardError( @@ -5032,15 +5408,6 @@ ZwRaiseHardError( * RETURNS: Status */ -NTSTATUS -STDCALL -NtSetInformationKey( - IN HANDLE KeyHandle, - IN CINT KeyInformationClass, - IN PVOID KeyInformation, - IN ULONG KeyInformationLength - ); - NTSTATUS STDCALL ZwSetInformationKey( @@ -5068,15 +5435,6 @@ ZwSetInformationKey( * Length = Size of the storage supplied * RETURNS: Status */ -NTSTATUS -STDCALL -NtSetInformationObject( - IN HANDLE ObjectHandle, - IN CINT ObjectInformationClass, - IN PVOID ObjectInformation, - IN ULONG Length - ); - NTSTATUS STDCALL ZwSetInformationObject( @@ -5137,18 +5495,6 @@ ZwSetInformationProcess( * REMARKS: This routine maps to the win32 SetWaitableTimer. * RETURNS: Status */ -NTSTATUS -STDCALL -NtSetTimer( - IN HANDLE TimerHandle, - IN PLARGE_INTEGER DueTime, - IN PTIMERAPCROUTINE TimerApcRoutine, - IN PVOID TimerContext, - IN BOOL WakeTimer, - IN ULONG Period OPTIONAL, - OUT PBOOLEAN PreviousState OPTIONAL - ); - NTSTATUS STDCALL ZwSetTimer( @@ -5171,12 +5517,6 @@ ZwSetTimer( */ NTSTATUS STDCALL -NtUnloadKey( - IN POBJECT_ATTRIBUTES KeyObjectAttributes - ); - -NTSTATUS -STDCALL ZwUnloadKey( IN POBJECT_ATTRIBUTES KeyObjectAttributes ); @@ -5191,16 +5531,7 @@ ZwUnloadKey( * REMARK: This procedure maps to the win32 procedure VirtualUnlock * RETURNS: Status [ STATUS_SUCCESS | STATUS_PAGE_WAS_ULOCKED ] - */ -NTSTATUS -STDCALL -NtUnlockVirtualMemory( - IN HANDLE ProcessHandle, - IN PVOID BaseAddress, - IN ULONG NumberOfBytesToUnlock, - OUT PULONG NumberOfBytesUnlocked OPTIONAL - ); - + */ NTSTATUS STDCALL ZwUnlockVirtualMemory( @@ -5224,16 +5555,6 @@ ZwUnlockVirtualMemory( */ NTSTATUS STDCALL -NtWaitForMultipleObjects ( - IN ULONG Count, - IN HANDLE Object[], - IN WAIT_TYPE WaitType, - IN BOOLEAN Alertable, - IN PLARGE_INTEGER Time - ); - -NTSTATUS -STDCALL ZwWaitForMultipleObjects ( IN ULONG Count, IN HANDLE Object[], @@ -5260,18 +5581,6 @@ ZwWaitForMultipleObjects ( * RETURNS: Status */ -NTSTATUS -STDCALL -NtCreateProfile(OUT PHANDLE ProfileHandle, - IN HANDLE ProcessHandle, - IN PVOID ImageBase, - IN ULONG ImageSize, - IN ULONG Granularity, - OUT PULONG Buffer, - IN ULONG ProfilingSize, - IN KPROFILE_SOURCE Source, - IN ULONG ProcessorMask); - NTSTATUS STDCALL ZwCreateProfile( @@ -5293,14 +5602,6 @@ ZwCreateProfile( * Interval = Specifies the interval to wait. * RETURNS: Status */ - -NTSTATUS -STDCALL -NtDelayExecution( - IN ULONG Alertable, - IN TIME *Interval - ); - NTSTATUS STDCALL ZwDelayExecution( @@ -5317,13 +5618,6 @@ ZwDelayExecution( */ NTSTATUS STDCALL -NtExtendSection( - IN HANDLE SectionHandle, - IN ULONG NewMaximumSize - ); - -NTSTATUS -STDCALL ZwExtendSection( IN HANDLE SectionHandle, IN ULONG NewMaximumSize @@ -5340,16 +5634,6 @@ ZwExtendSection( * RETURNS: Status * */ -NTSTATUS -STDCALL -NtQuerySection( - IN HANDLE SectionHandle, - IN CINT SectionInformationClass, - OUT PVOID SectionInformation, - IN ULONG Length, - OUT PULONG ResultLength - ); - NTSTATUS STDCALL ZwQuerySection( diff --git a/reactos/ntoskrnl/ex/interlck.c b/reactos/ntoskrnl/ex/interlck.c index 881d4ff08db..ff62ca813ec 100644 --- a/reactos/ntoskrnl/ex/interlck.c +++ b/reactos/ntoskrnl/ex/interlck.c @@ -1,4 +1,4 @@ -/* $Id: interlck.c,v 1.10 2003/07/10 06:27:13 royce Exp $ +/* $Id: interlck.c,v 1.11 2003/07/12 10:24:45 chorns Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -16,6 +16,10 @@ /* FUNCTIONS *****************************************************************/ +#ifdef ExInterlockedDecrementLong +#undef ExInterlockedDecrementLong +#endif + /* * @implemented */ @@ -40,6 +44,10 @@ ExInterlockedDecrementLong (PLONG Addend, } +#ifdef ExInterlockedExchangeUlong +#undef ExInterlockedExchangeUlong +#endif + /* * @implemented */ @@ -65,10 +73,14 @@ ExInterlockedExchangeUlong (PULONG Target, } +#ifdef ExInterlockedAddUlong +#undef ExInterlockedAddUlong +#endif + /* * @implemented */ -ULONG STDCALL +ULONG FASTCALL ExInterlockedAddUlong (PULONG Addend, ULONG Increment, PKSPIN_LOCK Lock) @@ -137,6 +149,10 @@ ExInterlockedAddLargeInteger (PLARGE_INTEGER Addend, return oldval; } +#ifdef ExInterlockedIncrementLong +#undef ExInterlockedIncrementLong +#endif + /* * @implemented */ diff --git a/reactos/ntoskrnl/ex/list.c b/reactos/ntoskrnl/ex/list.c index af733cb6ec9..afc5f6bd27e 100644 --- a/reactos/ntoskrnl/ex/list.c +++ b/reactos/ntoskrnl/ex/list.c @@ -1,4 +1,4 @@ -/* $Id: list.c,v 1.9 2003/07/11 01:23:14 royce Exp $ +/* $Id: list.c,v 1.10 2003/07/12 10:24:45 chorns Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -13,18 +13,22 @@ /* INCLUDES *****************************************************************/ +#ifdef __USE_W32API +#define NONAMELESSUNION +#endif #include #define NDEBUG #include -/* FUNCTIONS *************************************************************/ +static KSPIN_LOCK ExpGlobalListLock = { 0, }; +/* FUNCTIONS *************************************************************/ /* * @implemented */ -PLIST_ENTRY STDCALL +PLIST_ENTRY FASTCALL ExInterlockedInsertHeadList(PLIST_ENTRY ListHead, PLIST_ENTRY ListEntry, PKSPIN_LOCK Lock) @@ -59,7 +63,7 @@ ExInterlockedInsertHeadList(PLIST_ENTRY ListHead, /* * @implemented */ -PLIST_ENTRY STDCALL +PLIST_ENTRY FASTCALL ExInterlockedInsertTailList(PLIST_ENTRY ListHead, PLIST_ENTRY ListEntry, PKSPIN_LOCK Lock) @@ -94,7 +98,7 @@ ExInterlockedInsertTailList(PLIST_ENTRY ListHead, /* * @implemented */ -PLIST_ENTRY STDCALL +PLIST_ENTRY FASTCALL ExInterlockedRemoveHeadList(PLIST_ENTRY Head, PKSPIN_LOCK Lock) /* @@ -150,6 +154,10 @@ ExInterlockedRemoveTailList(PLIST_ENTRY Head, } +#ifdef ExInterlockedPopEntrySList +#undef ExInterlockedPopEntrySList +#endif + /* * @implemented */ @@ -179,6 +187,10 @@ ExInterlockedPopEntrySList(IN PSLIST_HEADER ListHead, } +#ifdef ExInterlockedPushEntrySList +#undef ExInterlockedPushEntrySList +#endif + /* * @implemented */ @@ -211,7 +223,7 @@ ExInterlockedPushEntrySList(IN PSLIST_HEADER ListHead, /* * @implemented */ -PSINGLE_LIST_ENTRY STDCALL +PSINGLE_LIST_ENTRY FASTCALL ExInterlockedPopEntryList(IN PSINGLE_LIST_ENTRY ListHead, IN PKSPIN_LOCK Lock) /* @@ -235,7 +247,7 @@ ExInterlockedPopEntryList(IN PSINGLE_LIST_ENTRY ListHead, /* * @implemented */ -PSINGLE_LIST_ENTRY STDCALL +PSINGLE_LIST_ENTRY FASTCALL ExInterlockedPushEntryList(IN PSINGLE_LIST_ENTRY ListHead, IN PSINGLE_LIST_ENTRY ListEntry, IN PKSPIN_LOCK Lock) @@ -410,4 +422,30 @@ ExfInterlockedRemoveHeadList(IN PLIST_ENTRY Head, return(ret); } + +/* + * @implemented + */ +PSLIST_ENTRY +FASTCALL +InterlockedPopEntrySList(IN PSLIST_HEADER ListHead) +{ + return (PSLIST_ENTRY) ExInterlockedPopEntrySList(ListHead, + &ExpGlobalListLock); +} + + +/* + * @implemented + */ +PSLIST_ENTRY +FASTCALL +InterlockedPushEntrySList(IN PSLIST_HEADER ListHead, + IN PSLIST_ENTRY ListEntry) +{ + return (PSLIST_ENTRY) ExInterlockedPushEntrySList(ListHead, + ListEntry, + &ExpGlobalListLock); +} + /* EOF */ diff --git a/reactos/ntoskrnl/ex/lookas.c b/reactos/ntoskrnl/ex/lookas.c index 18b34fbe0b1..58ec97f4fbe 100644 --- a/reactos/ntoskrnl/ex/lookas.c +++ b/reactos/ntoskrnl/ex/lookas.c @@ -1,4 +1,4 @@ -/* $Id: lookas.c,v 1.9 2003/07/11 01:23:14 royce Exp $ +/* $Id: lookas.c,v 1.10 2003/07/12 10:24:45 chorns Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -6,6 +6,7 @@ * PURPOSE: Lookaside lists * PROGRAMMERS: David Welch (welch@mcmail.com) * Casper S. Hornstrup (chorns@users.sourceforge.net) + * TODO: Use InterlockedXxxEntrySList for binary compatibility * UPDATE HISTORY: * 22-05-1998 DW Created * 02-07-2001 CSH Implemented lookaside lists @@ -13,6 +14,9 @@ /* INCLUDES *****************************************************************/ +#ifdef __USE_W32API +#define NONAMELESSUNION +#endif #include #include #define NDEBUG @@ -28,8 +32,45 @@ KSPIN_LOCK ExpPagedLookasideListLock; PLOOKASIDE_MINMAX_ROUTINE ExpMinMaxRoutine; +#define LookasideListLock(l)(&(l->Obsoleted)) + /* FUNCTIONS *****************************************************************/ +static +inline +PSINGLE_LIST_ENTRY + PopEntrySList( + PSLIST_HEADER ListHead + ) +{ + PSINGLE_LIST_ENTRY ListEntry; + + ListEntry = ListHead->s.Next.Next; + if (ListEntry!=NULL) + { + ListHead->s.Next.Next = ListEntry->Next; + ListHead->s.Depth++; + ListHead->s.Sequence++; + } + return ListEntry; +} + + +static +inline +VOID +PushEntrySList ( + PSLIST_HEADER ListHead, + PSINGLE_LIST_ENTRY Entry + ) +{ + Entry->Next = ListHead->s.Next.Next; + ListHead->s.Next.Next = Entry; + ListHead->s.Depth++; + ListHead->s.Sequence++; +} + + VOID ExpDefaultMinMax( POOL_TYPE PoolType, ULONG Size, @@ -102,12 +143,10 @@ ExpInitLookasideLists() ExpMinMaxRoutine = ExpDefaultMinMax; } -/* - * @implemented - */ + PVOID -STDCALL -ExAllocateFromPagedLookasideList ( +FASTCALL +ExiAllocateFromPagedLookasideList ( PPAGED_LOOKASIDE_LIST Lookaside ) { @@ -118,11 +157,11 @@ ExAllocateFromPagedLookasideList ( Lookaside->TotalAllocates++; -// ExAcquireFastMutex(&Lookaside->Lock); +// ExAcquireFastMutex(LookasideListLock(Lookaside)); Entry = PopEntrySList(&Lookaside->ListHead); -// ExReleaseFastMutex(&Lookaside->Lock); +// ExReleaseFastMutex(LookasideListLock(Lookaside)); if (Entry) return Entry; @@ -136,6 +175,7 @@ ExAllocateFromPagedLookasideList ( return Entry; } + /* * @implemented */ @@ -152,7 +192,7 @@ ExDeleteNPagedLookasideList ( for them */ while ((Entry = ExInterlockedPopEntrySList( &Lookaside->ListHead, - &Lookaside->Lock)) != NULL) + LookasideListLock(Lookaside))) != NULL) { (*Lookaside->Free)(Entry); } @@ -162,6 +202,7 @@ ExDeleteNPagedLookasideList ( KeReleaseSpinLock(&ExpNonPagedLookasideListLock, OldIrql); } + /* * @implemented */ @@ -179,13 +220,13 @@ ExDeletePagedLookasideList ( for (;;) { -// ExAcquireFastMutex(&Lookaside->Lock); +// ExAcquireFastMutex(LookasideListLock(Lookaside)); Entry = PopEntrySList(&Lookaside->ListHead); if (!Entry) break; -// ExReleaseFastMutex(&Lookaside->Lock); +// ExReleaseFastMutex(LookasideListLock(Lookaside)); (*Lookaside->Free)(Entry); } @@ -195,31 +236,30 @@ ExDeletePagedLookasideList ( KeReleaseSpinLock(&ExpPagedLookasideListLock, OldIrql); } -/* - * @implemented - */ + VOID STDCALL -ExFreeToPagedLookasideList ( +ExiFreeToPagedLookasideList ( PPAGED_LOOKASIDE_LIST Lookaside, PVOID Entry ) { Lookaside->TotalFrees++; - if (ExQueryDepthSList(&Lookaside->ListHead) >= Lookaside->MinimumDepth) + if (ExQueryDepthSList(&Lookaside->ListHead) >= Lookaside->Depth) { Lookaside->FreeMisses++; (*Lookaside->Free)(Entry); } else { -// ExAcquireFastMutex(&Lookaside->Lock); +// ExAcquireFastMutex(LookasideListLock(Lookaside)); PushEntrySList(&Lookaside->ListHead, (PSINGLE_LIST_ENTRY)Entry); -// ExReleaseFastMutex(&Lookaside->Lock); +// ExReleaseFastMutex(LookasideListLock(Lookaside)); } } + /* * @implemented */ @@ -261,14 +301,14 @@ ExInitializeNPagedLookasideList ( Lookaside->Free = ExpDefaultFree; ExInitializeSListHead(&Lookaside->ListHead); - KeInitializeSpinLock(&Lookaside->Lock); + KeInitializeSpinLock(LookasideListLock(Lookaside)); /* Determine minimum and maximum number of entries on the lookaside list using the configured algorithm */ (*ExpMinMaxRoutine)( NonPagedPool, Lookaside->Size, - &Lookaside->MinimumDepth, + &Lookaside->Depth, &Lookaside->MaximumDepth); ExInterlockedInsertTailList( @@ -277,6 +317,7 @@ ExInitializeNPagedLookasideList ( &ExpNonPagedLookasideListLock); } + /* * @implemented */ @@ -319,14 +360,14 @@ ExInitializePagedLookasideList ( Lookaside->Free = ExpDefaultFree; ExInitializeSListHead(&Lookaside->ListHead); - //ExInitializeFastMutex(&Lookaside->Lock); + //ExInitializeFastMutex(LookasideListLock(Lookaside)); /* Determine minimum and maximum number of entries on the lookaside list using the configured algorithm */ (*ExpMinMaxRoutine)( PagedPool, Lookaside->Size, - &Lookaside->MinimumDepth, + &Lookaside->Depth, &Lookaside->MaximumDepth); ExInterlockedInsertTailList( diff --git a/reactos/ntoskrnl/ke/bug.c b/reactos/ntoskrnl/ke/bug.c index 0cf1d853416..500ca134f91 100644 --- a/reactos/ntoskrnl/ke/bug.c +++ b/reactos/ntoskrnl/ke/bug.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: bug.c,v 1.32 2003/07/11 01:23:15 royce Exp $ +/* $Id: bug.c,v 1.33 2003/07/12 10:24:45 chorns Exp $ * * PROJECT: ReactOS kernel * FILE: ntoskrnl/ke/bug.c @@ -30,7 +30,7 @@ /* INCLUDES *****************************************************************/ -#include +#include #include #include #include diff --git a/reactos/ntoskrnl/ntoskrnl.def b/reactos/ntoskrnl/ntoskrnl.def index 962cff1d01b..afa9b4677a0 100644 --- a/reactos/ntoskrnl/ntoskrnl.def +++ b/reactos/ntoskrnl/ntoskrnl.def @@ -1,4 +1,4 @@ -; $Id: ntoskrnl.def,v 1.157 2003/06/20 16:22:56 ekohl Exp $ +; $Id: ntoskrnl.def,v 1.158 2003/07/12 10:24:45 chorns Exp $ ; ; reactos/ntoskrnl/ntoskrnl.def ; @@ -29,7 +29,7 @@ ExAcquireResourceExclusiveLite@8 ExAcquireResourceSharedLite@8 ExAcquireSharedStarveExclusive@8 ExAcquireSharedWaitForExclusive@8 -ExAllocateFromPagedLookasideList@4 +@ExAllocateFromPagedLookasideList@4 ExAllocatePool@8 ExAllocatePoolWithQuota@8 ExAllocatePoolWithQuotaTag@12 @@ -56,19 +56,19 @@ ExInitializeResourceLite@4 ExInitializeZone@16 ExInterlockedAddLargeInteger@16 @ExInterlockedAddLargeStatistic@8 -ExInterlockedAddUlong@12 +@ExInterlockedAddUlong@12 @ExInterlockedCompareExchange64@16 ExInterlockedDecrementLong@8 ExInterlockedExchangeUlong@12 ExInterlockedExtendZone@16 ExInterlockedIncrementLong@8 -ExInterlockedInsertHeadList@12 -ExInterlockedInsertTailList@12 -ExInterlockedPopEntryList@8 +@ExInterlockedInsertHeadList@12 +@ExInterlockedInsertTailList@12 +@ExInterlockedPopEntryList@8 @ExInterlockedPopEntrySList@8 -ExInterlockedPushEntryList@12 +@ExInterlockedPushEntryList@12 @ExInterlockedPushEntrySList@12 -ExInterlockedRemoveHeadList@8 +@ExInterlockedRemoveHeadList@8 ExIsProcessorFeaturePresent@4 ExIsResourceAcquiredExclusiveLite@4 ExIsResourceAcquiredSharedLite@4 @@ -217,6 +217,7 @@ HalPrivateDispatchTable DATA @InterlockedExchange@8 @InterlockedExchangeAdd@8 @InterlockedIncrement@4 +@InterlockedPopEntrySList@4 IoAcquireCancelSpinLock@4 IoAcquireRemoveLockEx@20 IoAcquireVpbSpinLock@4 diff --git a/reactos/ntoskrnl/ntoskrnl.edf b/reactos/ntoskrnl/ntoskrnl.edf index b275539a5ea..20f410f100f 100644 --- a/reactos/ntoskrnl/ntoskrnl.edf +++ b/reactos/ntoskrnl/ntoskrnl.edf @@ -1,4 +1,4 @@ -; $Id: ntoskrnl.edf,v 1.143 2003/06/20 16:22:56 ekohl Exp $ +; $Id: ntoskrnl.edf,v 1.144 2003/07/12 10:24:45 chorns Exp $ ; ; reactos/ntoskrnl/ntoskrnl.def ; @@ -29,7 +29,7 @@ ExAcquireResourceExclusiveLite=ExAcquireResourceExclusiveLite@8 ExAcquireResourceSharedLite=ExAcquireResourceSharedLite@8 ExAcquireSharedStarveExclusive=ExAcquireSharedStarveExclusive@8 ExAcquireSharedWaitForExclusive=ExAcquireSharedWaitForExclusive@8 -ExAllocateFromPagedLookasideList=ExAllocateFromPagedLookasideList@4 +@ExAllocateFromPagedLookasideList=@ExiAllocateFromPagedLookasideList@4 ExAllocatePool=ExAllocatePool@8 ExAllocatePoolWithQuota=ExAllocatePoolWithQuota@8 ExAllocatePoolWithQuotaTag=ExAllocatePoolWithQuotaTag@12 @@ -45,7 +45,7 @@ ExDisableResourceBoostLite=ExDisableResourceBoostLite@4 ExEventObjectType DATA ExExtendZone=ExExtendZone@12 ExFreePool=ExFreePool@4 -ExFreeToPagedLookasideList=ExFreeToPagedLookasideList@8 +ExFreeToPagedLookasideList=ExiFreeToPagedLookasideList@8 ExGetExclusiveWaiterCount=ExGetExclusiveWaiterCount@4 ExGetPreviousMode=ExGetPreviousMode@0 ExGetSharedWaiterCount=ExGetSharedWaiterCount@4 @@ -56,19 +56,19 @@ ExInitializeResourceLite=ExInitializeResourceLite@4 ExInitializeZone=ExInitializeZone@16 ExInterlockedAddLargeInteger=ExInterlockedAddLargeInteger@16 ExInterlockedAddLargeStatistic=@ExInterlockedAddLargeStatistic@8 -ExInterlockedAddUlong=ExInterlockedAddUlong@12 +@ExInterlockedAddUlong=@ExInterlockedAddUlong@12 ExInterlockedCompareExchange64=@ExInterlockedCompareExchange64@16 ExInterlockedDecrementLong=ExInterlockedDecrementLong@8 ExInterlockedExchangeUlong=ExInterlockedExchangeUlong@12 ExInterlockedExtendZone=ExInterlockedExtendZone@16 ExInterlockedIncrementLong=ExInterlockedIncrementLong@8 -ExInterlockedInsertHeadList=ExInterlockedInsertHeadList@12 -ExInterlockedInsertTailList=ExInterlockedInsertTailList@12 -ExInterlockedPopEntryList=ExInterlockedPopEntryList@8 -ExInterlockedPopEntrySList=@ExInterlockedPopEntrySList@8 -ExInterlockedPushEntryList=ExInterlockedPushEntryList@12 -ExInterlockedPushEntrySList=@ExInterlockedPushEntrySList@12 -ExInterlockedRemoveHeadList=ExInterlockedRemoveHeadList@8 +@ExInterlockedInsertHeadList=@ExInterlockedInsertHeadList@12 +@ExInterlockedInsertTailList=@ExInterlockedInsertTailList@12 +@ExInterlockedPopEntryList=@ExInterlockedPopEntryList@8 +@ExInterlockedPopEntrySList=@ExInterlockedPopEntrySList@8 +@ExInterlockedPushEntryList=@ExInterlockedPushEntryList@12 +@ExInterlockedPushEntrySList=@ExInterlockedPushEntrySList@12 +@ExInterlockedRemoveHeadList=@ExInterlockedRemoveHeadList@8 ExIsProcessorFeaturePresent=ExIsProcessorFeaturePresent@4 ExIsResourceAcquiredExclusiveLite=ExIsResourceAcquiredExclusiveLite@4 ExIsResourceAcquiredSharedLite=ExIsResourceAcquiredSharedLite@4 @@ -217,6 +217,7 @@ InterlockedDecrement=@InterlockedDecrement@4 InterlockedExchange=@InterlockedExchange@8 InterlockedExchangeAdd=@InterlockedExchangeAdd@8 InterlockedIncrement=@InterlockedIncrement@4 +@InterlockedPopEntrySList=@InterlockedPopEntrySList@4 IoAcquireCancelSpinLock=IoAcquireCancelSpinLock@4 IoAcquireVpbSpinLock=IoAcquireVpbSpinLock@4 IoAdapterObjectType DATA