diff --git a/reactos/include/ddk/pstypes.h b/reactos/include/ddk/pstypes.h index d12b9fb13f5..a1ce54d444b 100644 --- a/reactos/include/ddk/pstypes.h +++ b/reactos/include/ddk/pstypes.h @@ -74,6 +74,7 @@ typedef struct _STACK_INFORMATION } STACK_INFORMATION, *PSTACK_INFORMATION; typedef ULONG THREADINFOCLASS; +typedef ULONG PROCESSINFOCLASS; struct _KPROCESS; diff --git a/reactos/include/funcs.h b/reactos/include/funcs.h index d3eb4631970..22025482975 100644 --- a/reactos/include/funcs.h +++ b/reactos/include/funcs.h @@ -1428,7 +1428,7 @@ NtIsProcessInJob( NTSTATUS STDCALL NtMakePermanentObject( - IN HANDLE Object + IN HANDLE ObjectHandle ); NTSTATUS diff --git a/reactos/include/ntos/rtl.h b/reactos/include/ntos/rtl.h index ec64d54baa0..d6a4db053de 100755 --- a/reactos/include/ntos/rtl.h +++ b/reactos/include/ntos/rtl.h @@ -1,4 +1,4 @@ -/* $Id: rtl.h,v 1.36 2004/10/23 23:43:23 ion Exp $ +/* $Id: rtl.h,v 1.37 2004/10/24 20:37:25 weiden Exp $ * */ #ifndef __DDK_RTL_H @@ -1535,10 +1535,10 @@ NTSTATUS STDCALL RtlInitializeContext ( IN HANDLE ProcessHandle, - IN PCONTEXT Context, - IN PVOID Parameter, - IN PTHREAD_START_ROUTINE StartAddress, - IN OUT PUSER_STACK UserStack + OUT PCONTEXT ThreadContext, + IN PVOID ThreadStartParam OPTIONAL, + IN PTHREAD_START_ROUTINE ThreadStartAddress, + IN PINITIAL_TEB InitialTeb ); VOID diff --git a/reactos/include/ntos/rtltypes.h b/reactos/include/ntos/rtltypes.h index 22498327e9b..b4d7b9efc68 100755 --- a/reactos/include/ntos/rtltypes.h +++ b/reactos/include/ntos/rtltypes.h @@ -1,4 +1,4 @@ -/* $Id: rtltypes.h,v 1.15 2004/08/05 18:17:36 ion Exp $ +/* $Id: rtltypes.h,v 1.16 2004/10/24 20:37:26 weiden Exp $ * */ @@ -189,14 +189,14 @@ typedef struct _RANGE_LIST_ITERATOR } RTL_RANGE_LIST_ITERATOR, *PRTL_RANGE_LIST_ITERATOR; -typedef struct _USER_STACK +typedef struct _INITIAL_TEB { - PVOID FixedStackBase; - PVOID FixedStackLimit; - PVOID ExpandableStackBase; - PVOID ExpandableStackLimit; - PVOID ExpandableStackBottom; -} USER_STACK, *PUSER_STACK; + PVOID StackBase; + PVOID StackLimit; + PVOID StackCommit; + PVOID StackCommitMax; + PVOID StackReserved; +} INITIAL_TEB, *PINITIAL_TEB; #else /* __USE_W32API */ diff --git a/reactos/include/ntos/zw.h b/reactos/include/ntos/zw.h index 523a9ce218a..6fcf5f25e3d 100755 --- a/reactos/include/ntos/zw.h +++ b/reactos/include/ntos/zw.h @@ -1,5 +1,5 @@ -/* $Id: zw.h,v 1.33 2004/10/24 17:14:26 weiden Exp $ +/* $Id: zw.h,v 1.34 2004/10/24 20:37:26 weiden Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -997,19 +997,19 @@ ZwCreateSemaphore( NTSTATUS STDCALL NtCreateSymbolicLinkObject( - OUT PHANDLE SymbolicLinkHandle, + OUT PHANDLE LinkHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, - IN PUNICODE_STRING Name + IN PUNICODE_STRING LinkTarget ); NTSTATUS STDCALL ZwCreateSymbolicLinkObject( - OUT PHANDLE SymbolicLinkHandle, + OUT PHANDLE LinkHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, - IN PUNICODE_STRING Name + IN PUNICODE_STRING LinkTarget ); /* @@ -1532,7 +1532,7 @@ ZwFsControlFile( * FUNCTION: Retrieves the processor context of a thread * ARGUMENTS: * ThreadHandle = Handle to a thread - * Context (OUT) = Caller allocated storage for the processor context + * ThreadContext (OUT) = Caller allocated storage for the processor context * RETURNS: Status */ @@ -1540,14 +1540,14 @@ NTSTATUS STDCALL NtGetContextThread( IN HANDLE ThreadHandle, - OUT PCONTEXT Context + OUT PCONTEXT ThreadContext ); NTSTATUS STDCALL ZwGetContextThread( IN HANDLE ThreadHandle, - OUT PCONTEXT Context + OUT PCONTEXT ThreadContext ); @@ -1587,19 +1587,19 @@ ZwImpersonateThread( NTSTATUS STDCALL NtInitiatePowerAction ( - POWER_ACTION SystemAction, - SYSTEM_POWER_STATE MinSystemState, - ULONG Flags, - BOOLEAN Asynchronous + IN POWER_ACTION SystemAction, + IN SYSTEM_POWER_STATE MinSystemState, + IN ULONG Flags, + IN BOOLEAN Asynchronous ); NTSTATUS STDCALL ZwInitiatePowerAction ( - POWER_ACTION SystemAction, - SYSTEM_POWER_STATE MinSystemState, - ULONG Flags, - BOOLEAN Asynchronous + IN POWER_ACTION SystemAction, + IN SYSTEM_POWER_STATE MinSystemState, + IN ULONG Flags, + IN BOOLEAN Asynchronous ); /* * FUNCTION: Initializes the registry. @@ -1722,25 +1722,25 @@ ZwLockFile( NTSTATUS STDCALL NtMakePermanentObject( - IN HANDLE Object + IN HANDLE ObjectHandle ); NTSTATUS STDCALL ZwMakePermanentObject( - IN HANDLE Object + IN HANDLE ObjectHandle ); NTSTATUS STDCALL NtMakeTemporaryObject( - IN HANDLE Handle + IN HANDLE ObjectHandle ); NTSTATUS STDCALL ZwMakeTemporaryObject( - IN HANDLE Handle + IN HANDLE ObjectHandle ); /* * FUNCTION: Maps a view of a section into the virtual address space of a @@ -2228,14 +2228,14 @@ ZwOpenSemaphore( NTSTATUS STDCALL NtOpenSymbolicLinkObject( - OUT PHANDLE SymbolicLinkHandle, + OUT PHANDLE LinkHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes ); NTSTATUS STDCALL ZwOpenSymbolicLinkObject( - OUT PHANDLE SymbolicLinkHandle, + OUT PHANDLE LinkHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes ); @@ -2342,21 +2342,21 @@ ZwOpenTimer( NTSTATUS STDCALL NtPowerInformation( - POWER_INFORMATION_LEVEL PowerInformationLevel, - PVOID InputBuffer, - ULONG InputBufferLength, - PVOID OutputBuffer, - ULONG OutputBufferLength + IN POWER_INFORMATION_LEVEL PowerInformationLevel, + IN PVOID InputBuffer OPTIONAL, + IN ULONG InputBufferLength, + OUT PVOID OutputBuffer OPTIONAL, + IN ULONG OutputBufferLength ); NTSTATUS STDCALL ZwPowerInformation( - POWER_INFORMATION_LEVEL PowerInformationLevel, - PVOID InputBuffer, - ULONG InputBufferLength, - PVOID OutputBuffer, - ULONG OutputBufferLength + IN POWER_INFORMATION_LEVEL PowerInformationLevel, + IN PVOID InputBuffer OPTIONAL, + IN ULONG InputBufferLength, + OUT PVOID OutputBuffer OPTIONAL, + IN ULONG OutputBufferLength ); NTSTATUS @@ -2834,17 +2834,17 @@ NtQueryInformationThread( IN THREADINFOCLASS ThreadInformationClass, OUT PVOID ThreadInformation, IN ULONG ThreadInformationLength, - OUT PULONG ReturnLength + OUT PULONG ReturnLength OPTIONAL ); NTSTATUS STDCALL ZwQueryInformationThread( IN HANDLE ThreadHandle, - IN THREADINFOCLASS ThreadInformationClass, + IN THREADINFOCLASS ThreadInformationClass, OUT PVOID ThreadInformation, - IN ULONG ThreadInformationLength, - OUT PULONG ReturnLength + IN ULONG ThreadInformationLength, + OUT PULONG ReturnLength OPTIONAL ); @@ -3081,17 +3081,17 @@ ZwQuerySemaphore( NTSTATUS STDCALL NtQuerySymbolicLinkObject( - IN HANDLE SymLinkObjHandle, + IN HANDLE LinkHandle, OUT PUNICODE_STRING LinkTarget, - OUT PULONG DataWritten OPTIONAL + OUT PULONG ResultLength OPTIONAL ); NTSTATUS STDCALL ZwQuerySymbolicLinkObject( - IN HANDLE SymLinkObjHandle, - OUT PUNICODE_STRING LinkName, - OUT PULONG DataWritten OPTIONAL + IN HANDLE LinkHandle, + OUT PUNICODE_STRING LinkTarget, + OUT PULONG ResultLength OPTIONAL ); @@ -3500,12 +3500,12 @@ ZwReadVirtualMemory( NTSTATUS STDCALL NtRegisterThreadTerminatePort( - HANDLE TerminationPort + HANDLE PortHandle ); NTSTATUS STDCALL ZwRegisterThreadTerminatePort( - HANDLE TerminationPort + HANDLE PortHandle ); /* @@ -3706,13 +3706,13 @@ NTSTATUS STDCALL NtResumeThread( IN HANDLE ThreadHandle, - OUT PULONG SuspendCount + OUT PULONG SuspendCount OPTIONAL ); NTSTATUS STDCALL ZwResumeThread( IN HANDLE ThreadHandle, - OUT PULONG SuspendCount + OUT PULONG SuspendCount OPTIONAL ); /* * FUNCTION: Writes the content of a registry key to ascii file @@ -3786,7 +3786,7 @@ ZwSetBootOptions( * FUNCTION: Sets the context of a specified thread. * ARGUMENTS: * ThreadHandle = Handle to the thread - * Context = The processor context. + * ThreadContext = The processor context. * RETURNS: Status */ @@ -3794,13 +3794,13 @@ NTSTATUS STDCALL NtSetContextThread( IN HANDLE ThreadHandle, - IN PCONTEXT Context + IN PCONTEXT ThreadContext ); NTSTATUS STDCALL ZwSetContextThread( IN HANDLE ThreadHandle, - IN PCONTEXT Context + IN PCONTEXT ThreadContext ); /* @@ -4501,13 +4501,13 @@ ZwStopProfile( NTSTATUS STDCALL NtTerminateProcess( - IN HANDLE ProcessHandle, + IN HANDLE ProcessHandle OPTIONAL, IN NTSTATUS ExitStatus ); NTSTATUS STDCALL ZwTerminateProcess( - IN HANDLE ProcessHandle, + IN HANDLE ProcessHandle OPTIONAL, IN NTSTATUS ExitStatus ); @@ -4870,14 +4870,14 @@ NTSTATUS STDCALL NtSuspendThread( IN HANDLE ThreadHandle, - IN PULONG PreviousSuspendCount + OUT PULONG PreviousSuspendCount OPTIONAL ); NTSTATUS STDCALL ZwSuspendThread( IN HANDLE ThreadHandle, - IN PULONG PreviousSuspendCount + OUT PULONG PreviousSuspendCount OPTIONAL ); /* @@ -5226,7 +5226,7 @@ NtCreateThread( IN HANDLE ProcessHandle, OUT PCLIENT_ID ClientId, IN PCONTEXT ThreadContext, - IN PUSER_STACK UserStack, + IN PINITIAL_TEB InitialTeb, IN BOOLEAN CreateSuspended ); @@ -5827,7 +5827,7 @@ ZwCreateThread( IN HANDLE ProcessHandle, OUT PCLIENT_ID ClientId, IN PCONTEXT ThreadContext, - IN PUSER_STACK UserStack, + IN PINITIAL_TEB InitialTeb, IN BOOLEAN CreateSuspended ); @@ -6098,20 +6098,20 @@ NTSTATUS STDCALL NtQueryInformationProcess( IN HANDLE ProcessHandle, - IN CINT ProcessInformationClass, + IN PROCESSINFOCLASS ProcessInformationClass, OUT PVOID ProcessInformation, IN ULONG ProcessInformationLength, - OUT PULONG ReturnLength + OUT PULONG ReturnLength OPTIONAL ); NTSTATUS STDCALL ZwQueryInformationProcess( IN HANDLE ProcessHandle, - IN CINT ProcessInformationClass, + IN PROCESSINFOCLASS ProcessInformationClass, OUT PVOID ProcessInformation, IN ULONG ProcessInformationLength, - OUT PULONG ReturnLength + OUT PULONG ReturnLength OPTIONAL ); /* @@ -6152,7 +6152,7 @@ ZwQueryObject( IN OBJECT_INFORMATION_CLASS ObjectInformationClass, OUT PVOID ObjectInformation, IN ULONG Length, - OUT PULONG ResultLength OPTIONAL + OUT PULONG ResultLength OPTIONAL ); NTSTATUS @@ -6295,7 +6295,7 @@ NTSTATUS STDCALL NtSetInformationProcess( IN HANDLE ProcessHandle, - IN CINT ProcessInformationClass, + IN PROCESSINFOCLASS ProcessInformationClass, IN PVOID ProcessInformation, IN ULONG ProcessInformationLength ); @@ -6304,7 +6304,7 @@ NTSTATUS STDCALL ZwSetInformationProcess( IN HANDLE ProcessHandle, - IN CINT ProcessInformationClass, + IN PROCESSINFOCLASS ProcessInformationClass, IN PVOID ProcessInformation, IN ULONG ProcessInformationLength ); @@ -6553,7 +6553,7 @@ NtQueryObject( IN OBJECT_INFORMATION_CLASS ObjectInformationClass, OUT PVOID ObjectInformation, IN ULONG Length, - OUT PULONG ResultLength OPTIONAL + OUT PULONG ResultLength OPTIONAL ); /* BEGIN REACTOS ONLY */ diff --git a/reactos/include/rosrtl/thread.h b/reactos/include/rosrtl/thread.h index 9ea15c372c3..a0968b18f1e 100644 --- a/reactos/include/rosrtl/thread.h +++ b/reactos/include/rosrtl/thread.h @@ -1,4 +1,4 @@ -/* $Id: thread.h,v 1.4 2003/12/30 05:10:31 hyperion Exp $ +/* $Id: thread.h,v 1.5 2004/10/24 20:37:26 weiden Exp $ */ #ifdef __cplusplus @@ -44,17 +44,17 @@ __declspec(noreturn) VOID NTAPI RtlRosExitUserThread NTSTATUS NTAPI RtlRosInitializeContext ( IN HANDLE ProcessHandle, - OUT PCONTEXT Context, - IN PVOID StartAddress, - IN PUSER_STACK UserStack, + OUT PCONTEXT ThreadContext, + IN PVOID ThreadStartAddress, + IN PINITIAL_TEB InitialTeb, IN ULONG ParameterCount, - IN ULONG_PTR * Parameters + IN ULONG_PTR *Parameters ); NTSTATUS NTAPI RtlRosCreateStack ( IN HANDLE ProcessHandle, - OUT PUSER_STACK UserStack, + OUT PINITIAL_TEB InitialTeb, IN LONG StackZeroBits, IN OUT PULONG StackReserve OPTIONAL, IN OUT PULONG StackCommit OPTIONAL @@ -63,7 +63,7 @@ NTSTATUS NTAPI RtlRosCreateStack NTSTATUS NTAPI RtlRosDeleteStack ( IN HANDLE ProcessHandle, - IN PUSER_STACK UserStack + IN PINITIAL_TEB InitialTeb ); NTSTATUS NTAPI RtlRosFreeUserThreadStack @@ -83,7 +83,7 @@ NTSTATUS NTAPI RtlRosSwitchStackForExit /* Private functions - for ROSRTL internal use only */ NTSTATUS NTAPI RtlpRosGetStackLimits ( - IN PUSER_STACK UserStack, + IN PINITIAL_TEB InitialTeb, OUT PVOID * StackBase, OUT PVOID * StackLimit ); diff --git a/reactos/lib/kernel32/thread/fiber.c b/reactos/lib/kernel32/thread/fiber.c index 00d22281d9c..8cc090b967a 100644 --- a/reactos/lib/kernel32/thread/fiber.c +++ b/reactos/lib/kernel32/thread/fiber.c @@ -1,4 +1,4 @@ -/* $Id: fiber.c,v 1.11 2004/06/13 20:04:56 navaraf Exp $ +/* $Id: fiber.c,v 1.12 2004/10/24 20:37:26 weiden Exp $ * * FILE: lib/kernel32/thread/fiber.c * @@ -146,7 +146,7 @@ LPVOID WINAPI CreateFiberEx NTSTATUS nErrCode; PSIZE_T pnStackReserve = NULL; PSIZE_T pnStackCommit = NULL; - USER_STACK usFiberStack; + INITIAL_TEB usFiberInitialTeb; CONTEXT ctxFiberContext; PTEB pTeb = NtCurrentTeb(); @@ -168,7 +168,7 @@ LPVOID WINAPI CreateFiberEx nErrCode = RtlRosCreateStack ( NtCurrentProcess(), - &usFiberStack, + &usFiberInitialTeb, 0, pnStackReserve, pnStackCommit @@ -183,7 +183,7 @@ LPVOID WINAPI CreateFiberEx NtCurrentProcess(), &ctxFiberContext, FiberStartup, - &usFiberStack, + &usFiberInitialTeb, 1, (ULONG_PTR *)&lpStartAddress ); @@ -194,23 +194,23 @@ LPVOID WINAPI CreateFiberEx /* copy the data into the fiber */ /* fixed-size stack */ - if(usFiberStack.FixedStackBase && usFiberStack.FixedStackLimit) + if(usFiberInitialTeb.StackBase && usFiberInitialTeb.StackLimit) { - pfCurFiber->StackBase = usFiberStack.FixedStackBase; - pfCurFiber->StackLimit = usFiberStack.FixedStackLimit; - pfCurFiber->DeallocationStack = usFiberStack.FixedStackLimit; + pfCurFiber->StackBase = usFiberInitialTeb.StackBase; + pfCurFiber->StackLimit = usFiberInitialTeb.StackLimit; + pfCurFiber->DeallocationStack = usFiberInitialTeb.StackLimit; } /* expandable stack */ else if ( - usFiberStack.ExpandableStackBase && - usFiberStack.ExpandableStackLimit && - usFiberStack.ExpandableStackBottom + usFiberInitialTeb.StackCommit && + usFiberInitialTeb.StackCommitMax && + usFiberInitialTeb.StackReserved ) { - pfCurFiber->StackBase = usFiberStack.ExpandableStackBase; - pfCurFiber->StackLimit = usFiberStack.ExpandableStackLimit; - pfCurFiber->DeallocationStack = usFiberStack.ExpandableStackBottom; + pfCurFiber->StackBase = usFiberInitialTeb.StackCommit; + pfCurFiber->StackLimit = usFiberInitialTeb.StackCommitMax; + pfCurFiber->DeallocationStack = usFiberInitialTeb.StackReserved; } /* bad initial stack */ else goto l_CleanupStack; @@ -239,7 +239,7 @@ LPVOID WINAPI CreateFiberEx l_CleanupStack: /* free the stack */ - RtlRosDeleteStack(NtCurrentProcess(), &usFiberStack); + RtlRosDeleteStack(NtCurrentProcess(), &usFiberInitialTeb); l_CleanupFiber: /* free the fiber */ diff --git a/reactos/lib/ntdll/rtl/thread.c b/reactos/lib/ntdll/rtl/thread.c index fd266fe7c1a..f92aacaab83 100644 --- a/reactos/lib/ntdll/rtl/thread.c +++ b/reactos/lib/ntdll/rtl/thread.c @@ -73,23 +73,22 @@ NTSTATUS STDCALL RtlCreateUserThread /* @implemented */ -NTSTATUS STDCALL RtlInitializeContext -( - HANDLE ProcessHandle, - PCONTEXT Context, - PVOID Parameter, - PTHREAD_START_ROUTINE StartAddress, - PUSER_STACK UserStack -) +NTSTATUS STDCALL +RtlInitializeContext( + IN HANDLE ProcessHandle, + OUT PCONTEXT ThreadContext, + IN PVOID ThreadStartParam OPTIONAL, + IN PTHREAD_START_ROUTINE ThreadStartAddress, + IN PINITIAL_TEB InitialTeb) { return RtlRosInitializeContext ( ProcessHandle, - Context, - StartAddress, - UserStack, + ThreadContext, + ThreadStartAddress, + InitialTeb, 1, - (ULONG_PTR *)&Parameter + (ULONG_PTR *)&ThreadStartParam ); } diff --git a/reactos/lib/rosrtl/thread/create.c b/reactos/lib/rosrtl/thread/create.c index 04a357f9c77..8738076851b 100644 --- a/reactos/lib/rosrtl/thread/create.c +++ b/reactos/lib/rosrtl/thread/create.c @@ -1,4 +1,4 @@ -/* $Id: create.c,v 1.6 2004/03/02 17:16:04 navaraf Exp $ +/* $Id: create.c,v 1.7 2004/10/24 20:37:26 weiden Exp $ */ /* */ @@ -28,7 +28,7 @@ RtlRosCreateUserThread IN ULONG_PTR * Parameters ) { - USER_STACK usUserStack; + INITIAL_TEB usUserInitialTeb; CONTEXT ctxInitialContext; NTSTATUS nErrCode; HANDLE hThread; @@ -41,7 +41,7 @@ RtlRosCreateUserThread nErrCode = RtlRosCreateStack ( ProcessHandle, - &usUserStack, + &usUserInitialTeb, StackZeroBits, StackReserve, StackCommit @@ -56,7 +56,7 @@ RtlRosCreateUserThread ProcessHandle, &ctxInitialContext, StartAddress, - &usUserStack, + &usUserInitialTeb, ParameterCount, Parameters ); @@ -73,7 +73,7 @@ RtlRosCreateUserThread ProcessHandle, ClientId, &ctxInitialContext, - &usUserStack, + &usUserInitialTeb, CreateSuspended ); @@ -88,7 +88,7 @@ l_Fail: ASSERT(!NT_SUCCESS(nErrCode)); /* deallocate the stack */ - RtlRosDeleteStack(ProcessHandle, &usUserStack); + RtlRosDeleteStack(ProcessHandle, &usUserInitialTeb); return nErrCode; } diff --git a/reactos/lib/rosrtl/thread/i386/context.c b/reactos/lib/rosrtl/thread/i386/context.c index 6552645499b..6ec91f7a622 100644 --- a/reactos/lib/rosrtl/thread/i386/context.c +++ b/reactos/lib/rosrtl/thread/i386/context.c @@ -1,4 +1,4 @@ -/* $Id: context.c,v 1.2 2003/08/07 03:35:06 royce Exp $ +/* $Id: context.c,v 1.3 2004/10/24 20:37:26 weiden Exp $ */ /* */ @@ -19,7 +19,7 @@ RtlRosInitializeContext IN HANDLE ProcessHandle, OUT PCONTEXT Context, IN PVOID StartAddress, - IN PUSER_STACK UserStack, + IN PINITIAL_TEB InitialTeb, IN ULONG ParameterCount, IN ULONG_PTR * Parameters ) @@ -34,7 +34,7 @@ RtlRosInitializeContext /* Intel x86: linear top-down stack, all parameters passed on the stack */ /* get the stack base and limit */ - nErrCode = RtlpRosGetStackLimits(UserStack, &pStackBase, &pStackLimit); + nErrCode = RtlpRosGetStackLimits(InitialTeb, &pStackBase, &pStackLimit); /* failure */ if(!NT_SUCCESS(nErrCode)) return nErrCode; diff --git a/reactos/lib/rosrtl/thread/stack.c b/reactos/lib/rosrtl/thread/stack.c index 76f1aedd3af..f560c5006b8 100644 --- a/reactos/lib/rosrtl/thread/stack.c +++ b/reactos/lib/rosrtl/thread/stack.c @@ -1,4 +1,4 @@ -/* $Id: stack.c,v 1.6 2004/03/02 17:16:04 navaraf Exp $ +/* $Id: stack.c,v 1.7 2004/10/24 20:37:26 weiden Exp $ */ /* */ @@ -14,7 +14,7 @@ NTSTATUS NTAPI RtlRosCreateStack ( IN HANDLE ProcessHandle, - OUT PUSER_STACK UserStack, + OUT PINITIAL_TEB InitialTeb, IN LONG StackZeroBits, IN OUT PULONG StackReserve OPTIONAL, IN OUT PULONG StackCommit OPTIONAL @@ -44,17 +44,17 @@ NTSTATUS NTAPI RtlRosCreateStack /* fixed stack */ if(*StackCommit == *StackReserve) { - UserStack->ExpandableStackBase = NULL; - UserStack->ExpandableStackLimit = NULL; - UserStack->ExpandableStackBottom = NULL; + InitialTeb->StackCommit = NULL; + InitialTeb->StackCommitMax = NULL; + InitialTeb->StackReserved = NULL; - UserStack->FixedStackLimit = NULL; + InitialTeb->StackLimit = NULL; /* allocate the stack */ nErrCode = NtAllocateVirtualMemory ( ProcessHandle, - &(UserStack->FixedStackLimit), + &(InitialTeb->StackLimit), StackZeroBits, StackReserve, MEM_RESERVE | MEM_COMMIT, @@ -65,8 +65,8 @@ NTSTATUS NTAPI RtlRosCreateStack if(!NT_SUCCESS(nErrCode)) goto l_Fail; /* store the highest (first) address of the stack */ - UserStack->FixedStackBase = - (PUCHAR)(UserStack->FixedStackLimit) + *StackReserve; + InitialTeb->StackBase = + (PUCHAR)(InitialTeb->StackLimit) + *StackReserve; *StackCommit = *StackReserve; } @@ -78,16 +78,16 @@ NTSTATUS NTAPI RtlRosCreateStack DPRINT("Expandable stack\n"); - UserStack->FixedStackBase = NULL; - UserStack->FixedStackLimit = NULL; + InitialTeb->StackBase = NULL; + InitialTeb->StackLimit = NULL; - UserStack->ExpandableStackBottom = NULL; + InitialTeb->StackReserved = NULL; /* reserve the stack */ nErrCode = NtAllocateVirtualMemory ( ProcessHandle, - &(UserStack->ExpandableStackBottom), + &(InitialTeb->StackReserved), StackZeroBits, StackReserve, MEM_RESERVE, @@ -100,22 +100,22 @@ NTSTATUS NTAPI RtlRosCreateStack DPRINT("Reserved %08X bytes\n", *StackReserve); /* expandable stack base - the highest address of the stack */ - UserStack->ExpandableStackBase = - (PUCHAR)(UserStack->ExpandableStackBottom) + *StackReserve; + InitialTeb->StackCommit = + (PUCHAR)(InitialTeb->StackReserved) + *StackReserve; /* expandable stack limit - the lowest committed address of the stack */ - UserStack->ExpandableStackLimit = - (PUCHAR)(UserStack->ExpandableStackBase) - *StackCommit; + InitialTeb->StackCommitMax = + (PUCHAR)(InitialTeb->StackCommit) - *StackCommit; - DPRINT("Stack base %p\n", UserStack->ExpandableStackBase); - DPRINT("Stack limit %p\n", UserStack->ExpandableStackLimit); - DPRINT("Stack bottom %p\n", UserStack->ExpandableStackBottom); + DPRINT("Stack commit %p\n", InitialTeb->StackCommit); + DPRINT("Stack commit max %p\n", InitialTeb->StackCommitMax); + DPRINT("Stack reserved %p\n", InitialTeb->StackReserved); /* commit as much stack as requested */ nErrCode = NtAllocateVirtualMemory ( ProcessHandle, - &(UserStack->ExpandableStackLimit), + &(InitialTeb->StackCommitMax), 0, StackCommit, MEM_COMMIT, @@ -128,9 +128,9 @@ NTSTATUS NTAPI RtlRosCreateStack ASSERT((*StackReserve - *StackCommit) >= PAGE_SIZE); ASSERT((*StackReserve - *StackCommit) % PAGE_SIZE == 0); - pGuardBase = (PUCHAR)(UserStack->ExpandableStackLimit) - PAGE_SIZE; + pGuardBase = (PUCHAR)(InitialTeb->StackCommitMax) - PAGE_SIZE; - DPRINT("Guard base %p\n", UserStack->ExpandableStackBase); + DPRINT("Guard base %p\n", InitialTeb->StackCommit); /* set up the guard page */ nErrCode = NtAllocateVirtualMemory @@ -146,7 +146,7 @@ NTSTATUS NTAPI RtlRosCreateStack /* failure */ if(!NT_SUCCESS(nErrCode)) goto l_Cleanup; - DPRINT("Guard base %p\n", UserStack->ExpandableStackBase); + DPRINT("Guard base %p\n", InitialTeb->StackCommit); } @@ -155,7 +155,7 @@ NTSTATUS NTAPI RtlRosCreateStack /* deallocate the stack */ l_Cleanup: - RtlRosDeleteStack(ProcessHandle, UserStack); + RtlRosDeleteStack(ProcessHandle, InitialTeb); /* failure */ l_Fail: @@ -166,16 +166,16 @@ l_Fail: NTSTATUS NTAPI RtlRosDeleteStack ( IN HANDLE ProcessHandle, - IN PUSER_STACK UserStack + IN PINITIAL_TEB InitialTeb ) { PVOID pStackLowest = NULL; ULONG_PTR nSize; - if(UserStack->FixedStackLimit) - pStackLowest = UserStack->FixedStackLimit; - else if(UserStack->ExpandableStackBottom) - pStackLowest = UserStack->ExpandableStackBottom; + if(InitialTeb->StackLimit) + pStackLowest = InitialTeb->StackLimit; + else if(InitialTeb->StackReserved) + pStackLowest = InitialTeb->StackReserved; /* free the stack, if it was allocated */ if(pStackLowest != NULL) @@ -238,22 +238,22 @@ NTSTATUS NTAPI RtlRosFreeUserThreadStack NTSTATUS NTAPI RtlpRosGetStackLimits ( - IN PUSER_STACK UserStack, + IN PINITIAL_TEB InitialTeb, OUT PVOID * StackBase, OUT PVOID * StackLimit ) { /* fixed-size stack */ - if(UserStack->FixedStackBase && UserStack->FixedStackLimit) + if(InitialTeb->StackBase && InitialTeb->StackLimit) { - *StackBase = UserStack->FixedStackBase; - *StackLimit = UserStack->FixedStackLimit; + *StackBase = InitialTeb->StackBase; + *StackLimit = InitialTeb->StackLimit; } /* expandable stack */ - else if(UserStack->ExpandableStackBase && UserStack->ExpandableStackLimit) + else if(InitialTeb->StackCommit && InitialTeb->StackCommitMax) { - *StackBase = UserStack->ExpandableStackBase; - *StackLimit = UserStack->ExpandableStackLimit; + *StackBase = InitialTeb->StackCommit; + *StackLimit = InitialTeb->StackCommitMax; } /* can't determine the type of stack: failure */ else diff --git a/reactos/ntoskrnl/ldr/init.c b/reactos/ntoskrnl/ldr/init.c index 8871ff19936..ea78db6dd72 100644 --- a/reactos/ntoskrnl/ldr/init.c +++ b/reactos/ntoskrnl/ldr/init.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: init.c,v 1.47 2004/09/25 06:41:16 arty Exp $ +/* $Id: init.c,v 1.48 2004/10/24 20:37:26 weiden Exp $ * * PROJECT: ReactOS kernel * FILE: ntoskrnl/ldr/init.c @@ -230,7 +230,7 @@ LdrpCreateProcessEnvironment(HANDLE ProcessHandle, static NTSTATUS LdrpCreateStack ( HANDLE ProcessHandle, - PUSER_STACK UserStack, + PINITIAL_TEB InitialTeb, PULONG_PTR StackReserve, PULONG_PTR StackCommit ) @@ -245,11 +245,11 @@ static NTSTATUS LdrpCreateStack /* FIXME: no SEH, no guard pages */ *StackCommit = *StackReserve; - UserStack->FixedStackBase = NULL; - UserStack->FixedStackLimit = NULL; - UserStack->ExpandableStackBase = NULL; - UserStack->ExpandableStackLimit = NULL; - UserStack->ExpandableStackBottom = NULL; + InitialTeb->StackBase = NULL; + InitialTeb->StackLimit = NULL; + InitialTeb->StackCommit = NULL; + InitialTeb->StackCommitMax = NULL; + InitialTeb->StackReserved = NULL; /* FIXME: this code assumes a stack growing downwards */ /* fixed stack */ @@ -257,13 +257,13 @@ static NTSTATUS LdrpCreateStack { DPRINT("Fixed stack\n"); - UserStack->FixedStackLimit = NULL; + InitialTeb->StackLimit = NULL; /* allocate the stack */ nErrCode = NtAllocateVirtualMemory ( ProcessHandle, - &(UserStack->FixedStackLimit), + &(InitialTeb->StackLimit), 0, StackReserve, MEM_RESERVE | MEM_COMMIT, @@ -274,8 +274,8 @@ static NTSTATUS LdrpCreateStack if(!NT_SUCCESS(nErrCode)) return nErrCode; /* store the highest (first) address of the stack */ - UserStack->FixedStackBase = - (PUCHAR)(UserStack->FixedStackLimit) + *StackReserve; + InitialTeb->StackBase = + (PUCHAR)(InitialTeb->StackLimit) + *StackReserve; } /* expandable stack */ else @@ -285,15 +285,15 @@ static NTSTATUS LdrpCreateStack DPRINT("Expandable stack\n"); - UserStack->FixedStackLimit = NULL; - UserStack->FixedStackBase = NULL; - UserStack->ExpandableStackBottom = NULL; + InitialTeb->StackLimit = NULL; + InitialTeb->StackBase = NULL; + InitialTeb->StackReserved = NULL; /* reserve the stack */ nErrCode = NtAllocateVirtualMemory ( ProcessHandle, - &(UserStack->ExpandableStackBottom), + &(InitialTeb->StackReserved), 0, StackReserve, MEM_RESERVE, @@ -306,21 +306,21 @@ static NTSTATUS LdrpCreateStack DPRINT("Reserved %08X bytes\n", *StackReserve); /* expandable stack base - the highest address of the stack */ - UserStack->ExpandableStackBase = - (PUCHAR)(UserStack->ExpandableStackBottom) + *StackReserve; + InitialTeb->StackCommit = + (PUCHAR)(InitialTeb->StackReserved) + *StackReserve; /* expandable stack limit - the lowest committed address of the stack */ - UserStack->ExpandableStackLimit = - (PUCHAR)(UserStack->ExpandableStackBase) - *StackCommit; + InitialTeb->StackCommitMax = + (PUCHAR)(InitialTeb->StackCommit) - *StackCommit; - DPRINT("Stack base %p\n", UserStack->ExpandableStackBase); - DPRINT("Stack limit %p\n", UserStack->ExpandableStackLimit); + DPRINT("Stack commit %p\n", InitialTeb->StackCommit); + DPRINT("Stack commit max %p\n", InitialTeb->StackCommitMax); /* commit as much stack as requested */ nErrCode = NtAllocateVirtualMemory ( ProcessHandle, - &(UserStack->ExpandableStackLimit), + &(InitialTeb->StackCommitMax), 0, StackCommit, MEM_COMMIT, @@ -330,11 +330,11 @@ static NTSTATUS LdrpCreateStack /* failure */ if(!NT_SUCCESS(nErrCode)) goto l_Cleanup; - DPRINT("Stack limit %p\n", UserStack->ExpandableStackLimit); + DPRINT("Stack commit max %p\n", InitialTeb->StackCommitMax); - pGuardBase = (PUCHAR)(UserStack->ExpandableStackLimit) - PAGE_SIZE; + pGuardBase = (PUCHAR)(InitialTeb->StackCommitMax) - PAGE_SIZE; - DPRINT("Guard base %p\n", UserStack->ExpandableStackBase); + DPRINT("Guard base %p\n", InitialTeb->StackCommit); /* set up the guard page */ nErrCode = NtAllocateVirtualMemory @@ -350,17 +350,17 @@ static NTSTATUS LdrpCreateStack /* failure */ if(!NT_SUCCESS(nErrCode)) goto l_Cleanup; - DPRINT("Guard base %p\n", UserStack->ExpandableStackBase); + DPRINT("Guard base %p\n", InitialTeb->StackCommit); } return STATUS_SUCCESS; /* cleanup in case of failure */ l_Cleanup: - if(UserStack->FixedStackLimit) - pStackLowest = UserStack->FixedStackLimit; - else if(UserStack->ExpandableStackBottom) - pStackLowest = UserStack->ExpandableStackBottom; + if(InitialTeb->StackLimit) + pStackLowest = InitialTeb->StackLimit; + else if(InitialTeb->StackReserved) + pStackLowest = InitialTeb->StackReserved; /* free the stack, if it was allocated */ if(pStackLowest != NULL) @@ -378,7 +378,7 @@ LdrLoadInitialProcess(PHANDLE ProcessHandle, UNICODE_STRING ImagePath; HANDLE SectionHandle; CONTEXT Context; - USER_STACK UserStack; + INITIAL_TEB InitialTeb; ULONG_PTR nStackReserve = 0; ULONG_PTR nStackCommit = 0; PVOID pStackLowest; @@ -468,7 +468,7 @@ LdrLoadInitialProcess(PHANDLE ProcessHandle, Status = LdrpCreateStack ( *ProcessHandle, - &UserStack, + &InitialTeb, &nStackReserve, &nStackCommit ); @@ -480,15 +480,15 @@ LdrLoadInitialProcess(PHANDLE ProcessHandle, return(Status); } - if(UserStack.FixedStackBase && UserStack.FixedStackLimit) + if(InitialTeb.StackBase && InitialTeb.StackLimit) { - pStackBase = UserStack.FixedStackBase; - pStackLowest = UserStack.FixedStackLimit; + pStackBase = InitialTeb.StackBase; + pStackLowest = InitialTeb.StackLimit; } else { - pStackBase = UserStack.ExpandableStackBase; - pStackLowest = UserStack.ExpandableStackBottom; + pStackBase = InitialTeb.StackCommit; + pStackLowest = InitialTeb.StackReserved; } DPRINT("pStackBase = %p\n", pStackBase); @@ -549,7 +549,7 @@ LdrLoadInitialProcess(PHANDLE ProcessHandle, *ProcessHandle, NULL, &Context, - &UserStack, + &InitialTeb, FALSE); if (!NT_SUCCESS(Status)) { diff --git a/reactos/ntoskrnl/ob/ntobj.c b/reactos/ntoskrnl/ob/ntobj.c index f6d787708af..52a7d745354 100644 --- a/reactos/ntoskrnl/ob/ntobj.c +++ b/reactos/ntoskrnl/ob/ntobj.c @@ -1,4 +1,4 @@ -/* $Id: ntobj.c,v 1.23 2004/08/15 16:39:10 chorns Exp $ +/* $Id: ntobj.c,v 1.24 2004/10/24 20:37:26 weiden Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -82,7 +82,7 @@ NtQueryObject (IN HANDLE ObjectHandle, IN OBJECT_INFORMATION_CLASS ObjectInformationClass, OUT PVOID ObjectInformation, IN ULONG Length, - OUT PULONG ReturnLength OPTIONAL) + OUT PULONG ResultLength OPTIONAL) { OBJECT_HANDLE_INFORMATION HandleInfo; POBJECT_HEADER ObjectHeader; @@ -199,8 +199,8 @@ NtQueryObject (IN HANDLE ObjectHandle, ObDereferenceObject (Object); - if (ReturnLength != NULL) - *ReturnLength = InfoLength; + if (ResultLength != NULL) + *ResultLength = InfoLength; return Status; } @@ -243,13 +243,13 @@ ObMakeTemporaryObject(IN PVOID ObjectBody) * REVISIONS */ NTSTATUS STDCALL -NtMakeTemporaryObject(IN HANDLE Handle) +NtMakeTemporaryObject(IN HANDLE ObjectHandle) { POBJECT_HEADER ObjectHeader; PVOID Object; NTSTATUS Status; - Status = ObReferenceObjectByHandle(Handle, + Status = ObReferenceObjectByHandle(ObjectHandle, 0, NULL, (KPROCESSOR_MODE)KeGetPreviousMode(), @@ -284,13 +284,13 @@ NtMakeTemporaryObject(IN HANDLE Handle) * @implemented */ NTSTATUS STDCALL -NtMakePermanentObject(IN HANDLE Handle) +NtMakePermanentObject(IN HANDLE ObjectHandle) { POBJECT_HEADER ObjectHeader; PVOID Object; NTSTATUS Status; - Status = ObReferenceObjectByHandle(Handle, + Status = ObReferenceObjectByHandle(ObjectHandle, 0, NULL, (KPROCESSOR_MODE)KeGetPreviousMode(), diff --git a/reactos/ntoskrnl/ob/symlink.c b/reactos/ntoskrnl/ob/symlink.c index e72cbbaeb18..76f1adbed2e 100644 --- a/reactos/ntoskrnl/ob/symlink.c +++ b/reactos/ntoskrnl/ob/symlink.c @@ -1,4 +1,4 @@ -/* $Id: symlink.c,v 1.10 2004/10/22 20:43:58 ekohl Exp $ +/* $Id: symlink.c,v 1.11 2004/10/24 20:37:26 weiden Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -202,10 +202,10 @@ ObInitSymbolicLinkImplementation (VOID) * */ NTSTATUS STDCALL -NtCreateSymbolicLinkObject(OUT PHANDLE SymbolicLinkHandle, +NtCreateSymbolicLinkObject(OUT PHANDLE LinkHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, - IN PUNICODE_STRING DeviceName) + IN PUNICODE_STRING LinkTarget) { PSYMLINK_OBJECT SymbolicLink; NTSTATUS Status; @@ -237,7 +237,7 @@ NtCreateSymbolicLinkObject(OUT PHANDLE SymbolicLinkHandle, DesiredAccess, 0, NULL, - SymbolicLinkHandle); + LinkHandle); if (!NT_SUCCESS(Status)) { ObDereferenceObject (SymbolicLink); @@ -246,13 +246,13 @@ NtCreateSymbolicLinkObject(OUT PHANDLE SymbolicLinkHandle, SymbolicLink->TargetName.Length = 0; SymbolicLink->TargetName.MaximumLength = - ((wcslen(DeviceName->Buffer) + 1) * sizeof(WCHAR)); + ((wcslen(LinkTarget->Buffer) + 1) * sizeof(WCHAR)); SymbolicLink->TargetName.Buffer = ExAllocatePoolWithTag(NonPagedPool, SymbolicLink->TargetName.MaximumLength, TAG_SYMLINK_TARGET); RtlCopyUnicodeString(&SymbolicLink->TargetName, - DeviceName); + LinkTarget); DPRINT("DeviceName %S\n", SymbolicLink->TargetName.Buffer); @@ -311,8 +311,8 @@ NtOpenSymbolicLinkObject(OUT PHANDLE LinkHandle, */ NTSTATUS STDCALL NtQuerySymbolicLinkObject(IN HANDLE LinkHandle, - IN OUT PUNICODE_STRING LinkTarget, - OUT PULONG ReturnedLength OPTIONAL) + OUT PUNICODE_STRING LinkTarget, + OUT PULONG ResultLength OPTIONAL) { PSYMLINK_OBJECT SymlinkObject; NTSTATUS Status; @@ -328,9 +328,9 @@ NtQuerySymbolicLinkObject(IN HANDLE LinkHandle, return Status; } - if (ReturnedLength != NULL) + if (ResultLength != NULL) { - *ReturnedLength = (ULONG)SymlinkObject->TargetName.Length + sizeof(WCHAR); + *ResultLength = (ULONG)SymlinkObject->TargetName.Length + sizeof(WCHAR); } if (LinkTarget->MaximumLength >= SymlinkObject->TargetName.Length + sizeof(WCHAR)) diff --git a/reactos/ntoskrnl/po/power.c b/reactos/ntoskrnl/po/power.c index 4a9450f39d3..04e3583805d 100644 --- a/reactos/ntoskrnl/po/power.c +++ b/reactos/ntoskrnl/po/power.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: power.c,v 1.11 2004/08/15 16:39:10 chorns Exp $ +/* $Id: power.c,v 1.12 2004/10/24 20:37:26 weiden Exp $ * PROJECT: ReactOS kernel * FILE: ntoskrnl/po/power.c * PURPOSE: Power Manager @@ -223,10 +223,10 @@ PoInit(VOID) NTSTATUS STDCALL NtInitiatePowerAction ( - POWER_ACTION SystemAction, - SYSTEM_POWER_STATE MinSystemState, - ULONG Flags, - BOOLEAN Asynchronous) + IN POWER_ACTION SystemAction, + IN SYSTEM_POWER_STATE MinSystemState, + IN ULONG Flags, + IN BOOLEAN Asynchronous) { UNIMPLEMENTED; return STATUS_NOT_IMPLEMENTED; @@ -238,17 +238,15 @@ NtInitiatePowerAction ( NTSTATUS STDCALL NtPowerInformation( - POWER_INFORMATION_LEVEL PowerInformationLevel, - PVOID InputBuffer, - ULONG InputBufferLength, - PVOID OutputBuffer, - ULONG OutputBufferLength + IN POWER_INFORMATION_LEVEL PowerInformationLevel, + IN PVOID InputBuffer OPTIONAL, + IN ULONG InputBufferLength, + OUT PVOID OutputBuffer OPTIONAL, + IN ULONG OutputBufferLength ) { UNIMPLEMENTED; return STATUS_NOT_IMPLEMENTED; } - - /* EOF */ diff --git a/reactos/ntoskrnl/ps/create.c b/reactos/ntoskrnl/ps/create.c index 6e4975f02e7..fbed9ab4ae1 100644 --- a/reactos/ntoskrnl/ps/create.c +++ b/reactos/ntoskrnl/ps/create.c @@ -1,4 +1,4 @@ -/* $Id: create.c,v 1.83 2004/10/22 20:45:46 ekohl Exp $ +/* $Id: create.c,v 1.84 2004/10/24 20:37:27 weiden Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -502,7 +502,7 @@ static NTSTATUS PsCreateTeb(HANDLE ProcessHandle, PTEB *TebPtr, PETHREAD Thread, - PUSER_STACK UserStack) + PINITIAL_TEB InitialTeb) { PEPROCESS Process; NTSTATUS Status; @@ -584,22 +584,22 @@ PsCreateTeb(HANDLE ProcessHandle, } DPRINT("Teb.Peb %x\n", Teb.Peb); - /* store stack information from UserStack */ - if(UserStack != NULL) + /* store stack information from InitialTeb */ + if(InitialTeb != NULL) { /* fixed-size stack */ - if(UserStack->FixedStackBase && UserStack->FixedStackLimit) + if(InitialTeb->StackBase && InitialTeb->StackLimit) { - Teb.Tib.StackBase = UserStack->FixedStackBase; - Teb.Tib.StackLimit = UserStack->FixedStackLimit; - Teb.DeallocationStack = UserStack->FixedStackLimit; + Teb.Tib.StackBase = InitialTeb->StackBase; + Teb.Tib.StackLimit = InitialTeb->StackLimit; + Teb.DeallocationStack = InitialTeb->StackLimit; } /* expandable stack */ else { - Teb.Tib.StackBase = UserStack->ExpandableStackBase; - Teb.Tib.StackLimit = UserStack->ExpandableStackLimit; - Teb.DeallocationStack = UserStack->ExpandableStackBottom; + Teb.Tib.StackBase = InitialTeb->StackCommit; + Teb.Tib.StackLimit = InitialTeb->StackCommitMax; + Teb.DeallocationStack = InitialTeb->StackReserved; } } @@ -664,14 +664,14 @@ LdrInitApcKernelRoutine(PKAPC Apc, NTSTATUS STDCALL -NtCreateThread(PHANDLE ThreadHandle, - ACCESS_MASK DesiredAccess, - POBJECT_ATTRIBUTES ObjectAttributes, - HANDLE ProcessHandle, - PCLIENT_ID Client, - PCONTEXT ThreadContext, - PUSER_STACK UserStack, - BOOLEAN CreateSuspended) +NtCreateThread(OUT PHANDLE ThreadHandle, + IN ACCESS_MASK DesiredAccess, + IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, + IN HANDLE ProcessHandle, + OUT PCLIENT_ID Client, + IN PCONTEXT ThreadContext, + IN PINITIAL_TEB InitialTeb, + IN BOOLEAN CreateSuspended) { PEPROCESS Process; PETHREAD Thread; @@ -716,7 +716,7 @@ NtCreateThread(PHANDLE ThreadHandle, Status = PsCreateTeb(ProcessHandle, &TebBase, Thread, - UserStack); + InitialTeb); if (!NT_SUCCESS(Status)) { return(Status); diff --git a/reactos/ntoskrnl/ps/debug.c b/reactos/ntoskrnl/ps/debug.c index 54c46247933..1e55349ca0f 100644 --- a/reactos/ntoskrnl/ps/debug.c +++ b/reactos/ntoskrnl/ps/debug.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: debug.c,v 1.13 2004/08/15 16:39:10 chorns Exp $ +/* $Id: debug.c,v 1.14 2004/10/24 20:37:27 weiden Exp $ * * PROJECT: ReactOS kernel * FILE: ntoskrnl/ps/debug.c @@ -185,7 +185,7 @@ KeGetContextKernelRoutine(PKAPC Apc, NTSTATUS STDCALL NtGetContextThread(IN HANDLE ThreadHandle, - OUT PCONTEXT UnsafeContext) + OUT PCONTEXT ThreadContext) { PETHREAD Thread; NTSTATUS Status; @@ -194,7 +194,7 @@ NtGetContextThread(IN HANDLE ThreadHandle, KEVENT Event; NTSTATUS AStatus; - Status = MmCopyFromCaller(&Context, UnsafeContext, sizeof(CONTEXT)); + Status = MmCopyFromCaller(&Context, ThreadContext, sizeof(CONTEXT)); if (! NT_SUCCESS(Status)) { return Status; @@ -256,7 +256,7 @@ NtGetContextThread(IN HANDLE ThreadHandle, } if (NT_SUCCESS(Status)) { - Status = MmCopyToCaller(UnsafeContext, &Context, sizeof(Context)); + Status = MmCopyToCaller(ThreadContext, &Context, sizeof(Context)); } ObDereferenceObject(Thread); @@ -290,7 +290,7 @@ KeSetContextKernelRoutine(PKAPC Apc, NTSTATUS STDCALL NtSetContextThread(IN HANDLE ThreadHandle, - IN PCONTEXT UnsafeContext) + IN PCONTEXT ThreadContext) { PETHREAD Thread; NTSTATUS Status; @@ -299,7 +299,7 @@ NtSetContextThread(IN HANDLE ThreadHandle, NTSTATUS AStatus; CONTEXT Context; - Status = MmCopyFromCaller(&Context, UnsafeContext, sizeof(CONTEXT)); + Status = MmCopyFromCaller(&Context, ThreadContext, sizeof(CONTEXT)); if (! NT_SUCCESS(Status)) { return Status; diff --git a/reactos/ntoskrnl/ps/kill.c b/reactos/ntoskrnl/ps/kill.c index f1559fad042..d8781a5503f 100644 --- a/reactos/ntoskrnl/ps/kill.c +++ b/reactos/ntoskrnl/ps/kill.c @@ -1,4 +1,4 @@ -/* $Id: kill.c,v 1.79 2004/10/03 21:03:03 gvg Exp $ +/* $Id: kill.c,v 1.80 2004/10/24 20:37:27 weiden Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -305,7 +305,7 @@ PiTerminateProcess(PEPROCESS Process, } NTSTATUS STDCALL -NtTerminateProcess(IN HANDLE ProcessHandle, +NtTerminateProcess(IN HANDLE ProcessHandle OPTIONAL, IN NTSTATUS ExitStatus) { NTSTATUS Status; @@ -417,7 +417,7 @@ NtCallTerminatePorts(PETHREAD Thread) } NTSTATUS STDCALL -NtRegisterThreadTerminatePort(HANDLE TerminationPortHandle) +NtRegisterThreadTerminatePort(HANDLE PortHandle) { NTSTATUS Status; PEPORT_TERMINATION_REQUEST Request; @@ -425,7 +425,7 @@ NtRegisterThreadTerminatePort(HANDLE TerminationPortHandle) KIRQL oldIrql; PETHREAD Thread; - Status = ObReferenceObjectByHandle(TerminationPortHandle, + Status = ObReferenceObjectByHandle(PortHandle, PORT_ALL_ACCESS, ExPortType, KeGetCurrentThread()->PreviousMode, diff --git a/reactos/ntoskrnl/ps/locale.c b/reactos/ntoskrnl/ps/locale.c index f770f121f56..93366d072ed 100644 --- a/reactos/ntoskrnl/ps/locale.c +++ b/reactos/ntoskrnl/ps/locale.c @@ -1,4 +1,4 @@ -/* $Id: locale.c,v 1.11 2004/09/16 11:45:06 ekohl Exp $ +/* $Id: locale.c,v 1.12 2004/10/24 20:37:27 weiden Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -198,22 +198,22 @@ PiInitThreadLocale(VOID) * FUNCTION: * Returns the default locale. * ARGUMENTS: - * ThreadOrSystem = If TRUE then the locale for this thread is returned, - * otherwise the locale for the system is returned. + * UserProfile = If TRUE then the locale for this thread is returned, + * otherwise the locale for the system is returned. * DefaultLocaleId = Points to a variable that receives the locale id. * Returns: * Status. */ NTSTATUS STDCALL -NtQueryDefaultLocale(IN BOOLEAN ThreadOrSystem, +NtQueryDefaultLocale(IN BOOLEAN UserProfile, OUT PLCID DefaultLocaleId) { if (DefaultLocaleId == NULL) return STATUS_UNSUCCESSFUL; - if (ThreadOrSystem == TRUE) + if (UserProfile) { - if (PsDefaultThreadLocaleInitialized == FALSE) + if (!PsDefaultThreadLocaleInitialized) { PiInitThreadLocale(); } @@ -242,7 +242,7 @@ NtQueryDefaultLocale(IN BOOLEAN ThreadOrSystem, * Status. */ NTSTATUS STDCALL -NtSetDefaultLocale(IN BOOLEAN ThreadOrSystem, +NtSetDefaultLocale(IN BOOLEAN UserProfile, IN LCID DefaultLocaleId) { OBJECT_ATTRIBUTES ObjectAttributes; @@ -254,7 +254,7 @@ NtSetDefaultLocale(IN BOOLEAN ThreadOrSystem, HANDLE UserKey = NULL; NTSTATUS Status; - if (ThreadOrSystem == TRUE) + if (UserProfile) { /* thread locale */ Status = RtlOpenCurrentUser(KEY_WRITE, @@ -315,7 +315,7 @@ NtSetDefaultLocale(IN BOOLEAN ThreadOrSystem, return(Status); } - if (ThreadOrSystem == TRUE) + if (UserProfile) { /* set thread locale */ DPRINT("Thread locale: %08lu\n", DefaultLocaleId); diff --git a/reactos/ntoskrnl/ps/process.c b/reactos/ntoskrnl/ps/process.c index 9135b299330..a3e831a01aa 100644 --- a/reactos/ntoskrnl/ps/process.c +++ b/reactos/ntoskrnl/ps/process.c @@ -1,4 +1,4 @@ -/* $Id: process.c,v 1.145 2004/10/22 20:45:46 ekohl Exp $ +/* $Id: process.c,v 1.146 2004/10/24 20:37:27 weiden Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -114,14 +114,18 @@ PsGetNextProcess(PEPROCESS OldProcess) } +/* + * @implemented + */ NTSTATUS STDCALL -_NtOpenProcessToken(IN HANDLE ProcessHandle, +NtOpenProcessToken(IN HANDLE ProcessHandle, IN ACCESS_MASK DesiredAccess, OUT PHANDLE TokenHandle) { PACCESS_TOKEN Token; + HANDLE hToken; NTSTATUS Status; - + Status = PsOpenTokenOfProcess(ProcessHandle, &Token); if (!NT_SUCCESS(Status)) @@ -132,23 +136,17 @@ _NtOpenProcessToken(IN HANDLE ProcessHandle, Token, DesiredAccess, FALSE, - TokenHandle); + &hToken); ObDereferenceObject(Token); + + if(NT_SUCCESS(Status)) + { + Status = MmCopyToCaller(TokenHandle, &hToken, sizeof(HANDLE)); + } return(Status); } -/* - * @implemented - */ -NTSTATUS STDCALL -NtOpenProcessToken(IN HANDLE ProcessHandle, - IN ACCESS_MASK DesiredAccess, - OUT PHANDLE TokenHandle) -{ - return _NtOpenProcessToken(ProcessHandle, DesiredAccess, TokenHandle); -} - /* * @unimplemented */ @@ -166,7 +164,6 @@ NtOpenProcessTokenEx( } - /* * @implemented */ @@ -577,12 +574,12 @@ PsCreateSystemProcess(PHANDLE ProcessHandle, NTSTATUS STDCALL NtCreateProcess(OUT PHANDLE ProcessHandle, IN ACCESS_MASK DesiredAccess, - IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, - IN HANDLE ParentProcessHandle, + IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, + IN HANDLE ParentProcess, IN BOOLEAN InheritObjectTable, - IN HANDLE SectionHandle OPTIONAL, - IN HANDLE DebugPortHandle OPTIONAL, - IN HANDLE ExceptionPortHandle OPTIONAL) + IN HANDLE SectionHandle OPTIONAL, + IN HANDLE DebugPort OPTIONAL, + IN HANDLE ExceptionPort OPTIONAL) /* * FUNCTION: Creates a process. * ARGUMENTS: @@ -606,14 +603,14 @@ NtCreateProcess(OUT PHANDLE ProcessHandle, */ { PEPROCESS Process; - PEPROCESS ParentProcess; + PEPROCESS pParentProcess; PKPROCESS KProcess; NTSTATUS Status; KIRQL oldIrql; PVOID LdrStartupAddr; PVOID ImageBase; - PEPORT DebugPort; - PEPORT ExceptionPort; + PEPORT pDebugPort; + PEPORT pExceptionPort; PVOID BaseAddress; PMEMORY_AREA MemoryArea; PHYSICAL_ADDRESS BoundaryAddressMultiple; @@ -622,11 +619,11 @@ NtCreateProcess(OUT PHANDLE ProcessHandle, BoundaryAddressMultiple.QuadPart = 0; - Status = ObReferenceObjectByHandle(ParentProcessHandle, + Status = ObReferenceObjectByHandle(ParentProcess, PROCESS_CREATE_PROCESS, PsProcessType, ExGetPreviousMode(), - (PVOID*)&ParentProcess, + (PVOID*)&pParentProcess, NULL); if (!NT_SUCCESS(Status)) { @@ -645,7 +642,7 @@ NtCreateProcess(OUT PHANDLE ProcessHandle, (PVOID*)&Process); if (!NT_SUCCESS(Status)) { - ObDereferenceObject(ParentProcess); + ObDereferenceObject(pParentProcess); DPRINT("ObCreateObject() = %x\n",Status); return(Status); } @@ -659,7 +656,7 @@ NtCreateProcess(OUT PHANDLE ProcessHandle, if (!NT_SUCCESS(Status)) { ObDereferenceObject (Process); - ObDereferenceObject (ParentProcess); + ObDereferenceObject (pParentProcess); DPRINT("ObInsertObject() = %x\n",Status); return Status; } @@ -670,7 +667,7 @@ NtCreateProcess(OUT PHANDLE ProcessHandle, FALSE); KProcess = &Process->Pcb; /* Inherit parent process's affinity. */ - KProcess->Affinity = ParentProcess->Pcb.Affinity; + KProcess->Affinity = pParentProcess->Pcb.Affinity; KProcess->BasePriority = PROCESS_PRIO_NORMAL; KProcess->IopmOffset = 0xffff; KProcess->LdtDescriptor[0] = 0; @@ -680,18 +677,18 @@ NtCreateProcess(OUT PHANDLE ProcessHandle, &Process->AddressSpace); Process->UniqueProcessId = InterlockedIncrement((LONG *)&PiNextProcessUniqueId); /* TODO */ Process->InheritedFromUniqueProcessId = - (HANDLE)ParentProcess->UniqueProcessId; - ObCreateHandleTable(ParentProcess, + (HANDLE)pParentProcess->UniqueProcessId; + ObCreateHandleTable(pParentProcess, InheritObjectTable, Process); - MmCopyMmInfo(ParentProcess, Process); - if (ParentProcess->Win32WindowStation != (HANDLE)0) + MmCopyMmInfo(pParentProcess, Process); + if (pParentProcess->Win32WindowStation != (HANDLE)0) { /* Always duplicate the process window station. */ Process->Win32WindowStation = 0; - Status = ObDuplicateObject(ParentProcess, + Status = ObDuplicateObject(pParentProcess, Process, - ParentProcess->Win32WindowStation, + pParentProcess->Win32WindowStation, &Process->Win32WindowStation, 0, FALSE, @@ -705,13 +702,13 @@ NtCreateProcess(OUT PHANDLE ProcessHandle, { Process->Win32WindowStation = (HANDLE)0; } - if (ParentProcess->Win32Desktop != (HANDLE)0) + if (pParentProcess->Win32Desktop != (HANDLE)0) { /* Always duplicate the process window station. */ Process->Win32Desktop = 0; - Status = ObDuplicateObject(ParentProcess, + Status = ObDuplicateObject(pParentProcess, Process, - ParentProcess->Win32Desktop, + pParentProcess->Win32Desktop, &Process->Win32Desktop, 0, FALSE, @@ -737,45 +734,45 @@ NtCreateProcess(OUT PHANDLE ProcessHandle, /* * Add the debug port */ - if (DebugPortHandle != NULL) + if (DebugPort != NULL) { - Status = ObReferenceObjectByHandle(DebugPortHandle, + Status = ObReferenceObjectByHandle(DebugPort, PORT_ALL_ACCESS, ExPortType, UserMode, - (PVOID*)&DebugPort, + (PVOID*)&pDebugPort, NULL); if (!NT_SUCCESS(Status)) { ObDereferenceObject(Process); - ObDereferenceObject(ParentProcess); + ObDereferenceObject(pParentProcess); ZwClose(*ProcessHandle); *ProcessHandle = NULL; return(Status); } - Process->DebugPort = DebugPort; + Process->DebugPort = pDebugPort; } /* * Add the exception port */ - if (ExceptionPortHandle != NULL) + if (ExceptionPort != NULL) { - Status = ObReferenceObjectByHandle(ExceptionPortHandle, + Status = ObReferenceObjectByHandle(ExceptionPort, PORT_ALL_ACCESS, ExPortType, UserMode, - (PVOID*)&ExceptionPort, + (PVOID*)&pExceptionPort, NULL); if (!NT_SUCCESS(Status)) { ObDereferenceObject(Process); - ObDereferenceObject(ParentProcess); + ObDereferenceObject(pParentProcess); ZwClose(*ProcessHandle); *ProcessHandle = NULL; return(Status); } - Process->ExceptionPort = ExceptionPort; + Process->ExceptionPort = pExceptionPort; } /* @@ -871,7 +868,7 @@ NtCreateProcess(OUT PHANDLE ProcessHandle, { DbgPrint("LdrpMapSystemDll failed (Status %x)\n", Status); ObDereferenceObject(Process); - ObDereferenceObject(ParentProcess); + ObDereferenceObject(pParentProcess); return(Status); } @@ -888,7 +885,7 @@ NtCreateProcess(OUT PHANDLE ProcessHandle, { DbgPrint("LdrpMapImage failed (Status %x)\n", Status); ObDereferenceObject(Process); - ObDereferenceObject(ParentProcess); + ObDereferenceObject(pParentProcess); return(Status); } } @@ -900,12 +897,12 @@ NtCreateProcess(OUT PHANDLE ProcessHandle, /* * Duplicate the token */ - Status = SepInitializeNewProcess(Process, ParentProcess); + Status = SepInitializeNewProcess(Process, pParentProcess); if (!NT_SUCCESS(Status)) { DbgPrint("SepInitializeNewProcess failed (Status %x)\n", Status); ObDereferenceObject(Process); - ObDereferenceObject(ParentProcess); + ObDereferenceObject(pParentProcess); return(Status); } @@ -920,7 +917,7 @@ NtCreateProcess(OUT PHANDLE ProcessHandle, { DbgPrint("NtCreateProcess() Peb creation failed: Status %x\n",Status); ObDereferenceObject(Process); - ObDereferenceObject(ParentProcess); + ObDereferenceObject(pParentProcess); ZwClose(*ProcessHandle); *ProcessHandle = NULL; return(Status); @@ -930,7 +927,7 @@ NtCreateProcess(OUT PHANDLE ProcessHandle, * Maybe send a message to the creator process's debugger */ #if 0 - if (ParentProcess->DebugPort != NULL) + if (pParentProcess->DebugPort != NULL) { LPC_DBG_MESSAGE Message; HANDLE FileHandle; @@ -949,7 +946,7 @@ NtCreateProcess(OUT PHANDLE ProcessHandle, Message.Data.CreateProcess.Base = ImageBase; Message.Data.CreateProcess.EntryPoint = NULL; // - Status = LpcSendDebugMessagePort(ParentProcess->DebugPort, + Status = LpcSendDebugMessagePort(pParentProcess->DebugPort, &Message); } #endif @@ -957,7 +954,7 @@ NtCreateProcess(OUT PHANDLE ProcessHandle, PspRunCreateProcessNotifyRoutines(Process, TRUE); ObDereferenceObject(Process); - ObDereferenceObject(ParentProcess); + ObDereferenceObject(pParentProcess); return(STATUS_SUCCESS); } @@ -1063,10 +1060,10 @@ NtOpenProcess(OUT PHANDLE ProcessHandle, */ NTSTATUS STDCALL NtQueryInformationProcess(IN HANDLE ProcessHandle, - IN CINT ProcessInformationClass, + IN PROCESSINFOCLASS ProcessInformationClass, OUT PVOID ProcessInformation, IN ULONG ProcessInformationLength, - OUT PULONG ReturnLength OPTIONAL) + OUT PULONG ReturnLength OPTIONAL) { PEPROCESS Process; NTSTATUS Status; @@ -1311,7 +1308,7 @@ PspAssignPrimaryToken(PEPROCESS Process, */ NTSTATUS STDCALL NtSetInformationProcess(IN HANDLE ProcessHandle, - IN CINT ProcessInformationClass, + IN PROCESSINFOCLASS ProcessInformationClass, IN PVOID ProcessInformation, IN ULONG ProcessInformationLength) { diff --git a/reactos/ntoskrnl/ps/suspend.c b/reactos/ntoskrnl/ps/suspend.c index c0da826a6a5..3ce3cf12eb7 100644 --- a/reactos/ntoskrnl/ps/suspend.c +++ b/reactos/ntoskrnl/ps/suspend.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: suspend.c,v 1.15 2004/08/15 16:39:10 chorns Exp $ +/* $Id: suspend.c,v 1.16 2004/10/24 20:37:27 weiden Exp $ * * PROJECT: ReactOS kernel * FILE: ntoskrnl/ps/suspend.c @@ -135,7 +135,7 @@ PsSuspendThread(PETHREAD Thread, PULONG PreviousSuspendCount) NTSTATUS STDCALL NtResumeThread(IN HANDLE ThreadHandle, - IN PULONG SuspendCount) + IN PULONG SuspendCount OPTIONAL) /* * FUNCTION: Decrements a thread's resume count * ARGUMENTS: @@ -182,7 +182,7 @@ NtResumeThread(IN HANDLE ThreadHandle, NTSTATUS STDCALL NtSuspendThread(IN HANDLE ThreadHandle, - IN PULONG PreviousSuspendCount) + IN PULONG PreviousSuspendCount OPTIONAL) /* * FUNCTION: Increments a thread's suspend count * ARGUMENTS: diff --git a/reactos/ntoskrnl/ps/tinfo.c b/reactos/ntoskrnl/ps/tinfo.c index 4317d9600d6..c095b20c160 100644 --- a/reactos/ntoskrnl/ps/tinfo.c +++ b/reactos/ntoskrnl/ps/tinfo.c @@ -1,4 +1,4 @@ -/* $Id: tinfo.c,v 1.29 2004/09/28 15:02:29 weiden Exp $ +/* $Id: tinfo.c,v 1.30 2004/10/24 20:37:27 weiden Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -222,7 +222,7 @@ NtQueryInformationThread (IN HANDLE ThreadHandle, IN THREADINFOCLASS ThreadInformationClass, OUT PVOID ThreadInformation, IN ULONG ThreadInformationLength, - OUT PULONG ReturnLength) + OUT PULONG ReturnLength OPTIONAL) { PETHREAD Thread; NTSTATUS Status; diff --git a/reactos/w32api/include/ddk/ntapi.h b/reactos/w32api/include/ddk/ntapi.h index 33a7de07f2f..a92a149bc26 100644 --- a/reactos/w32api/include/ddk/ntapi.h +++ b/reactos/w32api/include/ddk/ntapi.h @@ -1163,26 +1163,27 @@ ZwAreMappedFilesTheSame( /* Threads */ -typedef struct _USER_STACK { - PVOID FixedStackBase; - PVOID FixedStackLimit; - PVOID ExpandableStackBase; - PVOID ExpandableStackLimit; - PVOID ExpandableStackBottom; -} USER_STACK, *PUSER_STACK; +typedef struct _INITIAL_TEB +{ + PVOID StackBase; + PVOID StackLimit; + PVOID StackCommit; + PVOID StackCommitMax; + PVOID StackReserved; +} INITIAL_TEB, *PINITIAL_TEB; NTOSAPI NTSTATUS NTAPI ZwCreateThread( - OUT PHANDLE ThreadHandle, - IN ACCESS_MASK DesiredAccess, - IN POBJECT_ATTRIBUTES ObjectAttributes, - IN HANDLE ProcessHandle, - OUT PCLIENT_ID ClientId, - IN PCONTEXT ThreadContext, - IN PUSER_STACK UserStack, - IN BOOLEAN CreateSuspended); + OUT PHANDLE ThreadHandle, + IN ACCESS_MASK DesiredAccess, + IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, + IN HANDLE ProcessHandle, + OUT PCLIENT_ID ClientId, + IN PCONTEXT ThreadContext, + IN PINITIAL_TEB InitialTeb, + IN BOOLEAN CreateSuspended); NTOSAPI NTSTATUS