mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
-move ppb from ntdll to rtl
smapiexec.c: free ppb on failure. resume thread (RtlCreateUserProcess is supposed to create the thread suspended) svn path=/trunk/; revision=14402
This commit is contained in:
parent
8a147bd7bb
commit
0b60acbc3c
6 changed files with 45 additions and 26 deletions
|
@ -76,7 +76,6 @@ RTL_OBJECTS = \
|
|||
rtl/message.o \
|
||||
rtl/misc.o \
|
||||
rtl/path.o \
|
||||
rtl/ppb.o \
|
||||
rtl/process.o \
|
||||
rtl/propvar.o \
|
||||
rtl/rangelist.o \
|
||||
|
|
|
@ -9,7 +9,30 @@
|
|||
#include <ddk/ntddk.h>
|
||||
#include <napi/teb.h>
|
||||
|
||||
|
||||
PTEB STDCALL
|
||||
_NtCurrentTeb() { return NtCurrentTeb(); }
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
VOID STDCALL
|
||||
RtlAcquirePebLock(VOID)
|
||||
{
|
||||
PPEB Peb = NtCurrentPeb ();
|
||||
Peb->FastPebLockRoutine (Peb->FastPebLock);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
VOID STDCALL
|
||||
RtlReleasePebLock(VOID)
|
||||
{
|
||||
PPEB Peb = NtCurrentPeb ();
|
||||
Peb->FastPebUnlockRoutine (Peb->FastPebLock);
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -18,6 +18,7 @@ endif
|
|||
|
||||
TARGET_OBJECTS = \
|
||||
acl.o \
|
||||
ppb.o \
|
||||
bit.o \
|
||||
bitmap.o \
|
||||
bootdata.o \
|
||||
|
|
|
@ -28,28 +28,12 @@
|
|||
#define ALIGN(x,align) (((ULONG)(x)+(align)-1UL)&(~((align)-1UL)))
|
||||
|
||||
|
||||
KPROCESSOR_MODE
|
||||
RtlpGetMode();
|
||||
|
||||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
VOID STDCALL
|
||||
RtlAcquirePebLock(VOID)
|
||||
{
|
||||
PPEB Peb = NtCurrentPeb ();
|
||||
Peb->FastPebLockRoutine (Peb->FastPebLock);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
VOID STDCALL
|
||||
RtlReleasePebLock(VOID)
|
||||
{
|
||||
PPEB Peb = NtCurrentPeb ();
|
||||
Peb->FastPebUnlockRoutine (Peb->FastPebLock);
|
||||
}
|
||||
|
||||
static inline VOID
|
||||
RtlpCopyParameterString(PWCHAR *Ptr,
|
||||
|
@ -100,7 +84,7 @@ RtlCreateProcessParameters(PRTL_USER_PROCESS_PARAMETERS *ProcessParameters,
|
|||
EmptyString.MaximumLength = sizeof(WCHAR);
|
||||
EmptyString.Buffer = L"";
|
||||
|
||||
if (NtCurrentPeb()->ProcessParameters)
|
||||
if (RtlpGetMode() == UserMode)
|
||||
{
|
||||
if (DllPath == NULL)
|
||||
DllPath = &NtCurrentPeb()->ProcessParameters->DllPath;
|
||||
|
@ -152,7 +136,7 @@ RtlCreateProcessParameters(PRTL_USER_PROCESS_PARAMETERS *ProcessParameters,
|
|||
/* Calculate the required block size */
|
||||
RegionSize = ROUNDUP(Length, PAGE_SIZE);
|
||||
|
||||
Status = NtAllocateVirtualMemory(NtCurrentProcess(),
|
||||
Status = ZwAllocateVirtualMemory(NtCurrentProcess(),
|
||||
(PVOID*)&Param,
|
||||
0,
|
||||
&RegionSize,
|
||||
|
@ -253,7 +237,7 @@ RtlDestroyProcessParameters(PRTL_USER_PROCESS_PARAMETERS ProcessParameters)
|
|||
{
|
||||
ULONG RegionSize = 0;
|
||||
|
||||
return NtFreeVirtualMemory (NtCurrentProcess (),
|
||||
return ZwFreeVirtualMemory (NtCurrentProcess (),
|
||||
(PVOID)ProcessParameters,
|
||||
&RegionSize,
|
||||
MEM_RELEASE);
|
|
@ -20,6 +20,13 @@
|
|||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
|
||||
KPROCESSOR_MODE
|
||||
RtlpGetMode()
|
||||
{
|
||||
return KernelMode;
|
||||
}
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
|
@ -38,11 +45,12 @@ RtlReleasePebLock(VOID)
|
|||
|
||||
}
|
||||
|
||||
|
||||
PPEB
|
||||
STDCALL
|
||||
RtlpCurrentPeb(VOID)
|
||||
{
|
||||
return ((PEPROCESS)(KeGetCurrentThread()->ApcState.Process))->Peb;
|
||||
return ((PEPROCESS)(KeGetCurrentThread()->ApcState.Process))->Peb;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
|
|
|
@ -81,6 +81,9 @@ SmCreateUserProcess (LPWSTR ImagePath,
|
|||
NULL,
|
||||
NULL,
|
||||
pProcessInfo);
|
||||
|
||||
RtlDestroyProcessParameters (ProcessParameters);
|
||||
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT1("SM: %s: Running \"%S\" failed (Status=0x%08lx)\n",
|
||||
|
@ -88,7 +91,8 @@ SmCreateUserProcess (LPWSTR ImagePath,
|
|||
return Status;
|
||||
}
|
||||
|
||||
RtlDestroyProcessParameters (ProcessParameters);
|
||||
NtResumeThread(pProcessInfo->ThreadHandle, NULL);
|
||||
|
||||
|
||||
/* Wait for process termination */
|
||||
if(WaitForIt)
|
||||
|
|
Loading…
Reference in a new issue