mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +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/message.o \
|
||||||
rtl/misc.o \
|
rtl/misc.o \
|
||||||
rtl/path.o \
|
rtl/path.o \
|
||||||
rtl/ppb.o \
|
|
||||||
rtl/process.o \
|
rtl/process.o \
|
||||||
rtl/propvar.o \
|
rtl/propvar.o \
|
||||||
rtl/rangelist.o \
|
rtl/rangelist.o \
|
||||||
|
|
|
@ -9,7 +9,30 @@
|
||||||
#include <ddk/ntddk.h>
|
#include <ddk/ntddk.h>
|
||||||
#include <napi/teb.h>
|
#include <napi/teb.h>
|
||||||
|
|
||||||
|
|
||||||
PTEB STDCALL
|
PTEB STDCALL
|
||||||
_NtCurrentTeb() { return NtCurrentTeb(); }
|
_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 */
|
/* EOF */
|
||||||
|
|
|
@ -18,6 +18,7 @@ endif
|
||||||
|
|
||||||
TARGET_OBJECTS = \
|
TARGET_OBJECTS = \
|
||||||
acl.o \
|
acl.o \
|
||||||
|
ppb.o \
|
||||||
bit.o \
|
bit.o \
|
||||||
bitmap.o \
|
bitmap.o \
|
||||||
bootdata.o \
|
bootdata.o \
|
||||||
|
|
|
@ -28,28 +28,12 @@
|
||||||
#define ALIGN(x,align) (((ULONG)(x)+(align)-1UL)&(~((align)-1UL)))
|
#define ALIGN(x,align) (((ULONG)(x)+(align)-1UL)&(~((align)-1UL)))
|
||||||
|
|
||||||
|
|
||||||
|
KPROCESSOR_MODE
|
||||||
|
RtlpGetMode();
|
||||||
|
|
||||||
|
|
||||||
/* FUNCTIONS ****************************************************************/
|
/* 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
|
static inline VOID
|
||||||
RtlpCopyParameterString(PWCHAR *Ptr,
|
RtlpCopyParameterString(PWCHAR *Ptr,
|
||||||
|
@ -100,7 +84,7 @@ RtlCreateProcessParameters(PRTL_USER_PROCESS_PARAMETERS *ProcessParameters,
|
||||||
EmptyString.MaximumLength = sizeof(WCHAR);
|
EmptyString.MaximumLength = sizeof(WCHAR);
|
||||||
EmptyString.Buffer = L"";
|
EmptyString.Buffer = L"";
|
||||||
|
|
||||||
if (NtCurrentPeb()->ProcessParameters)
|
if (RtlpGetMode() == UserMode)
|
||||||
{
|
{
|
||||||
if (DllPath == NULL)
|
if (DllPath == NULL)
|
||||||
DllPath = &NtCurrentPeb()->ProcessParameters->DllPath;
|
DllPath = &NtCurrentPeb()->ProcessParameters->DllPath;
|
||||||
|
@ -152,7 +136,7 @@ RtlCreateProcessParameters(PRTL_USER_PROCESS_PARAMETERS *ProcessParameters,
|
||||||
/* Calculate the required block size */
|
/* Calculate the required block size */
|
||||||
RegionSize = ROUNDUP(Length, PAGE_SIZE);
|
RegionSize = ROUNDUP(Length, PAGE_SIZE);
|
||||||
|
|
||||||
Status = NtAllocateVirtualMemory(NtCurrentProcess(),
|
Status = ZwAllocateVirtualMemory(NtCurrentProcess(),
|
||||||
(PVOID*)&Param,
|
(PVOID*)&Param,
|
||||||
0,
|
0,
|
||||||
&RegionSize,
|
&RegionSize,
|
||||||
|
@ -253,7 +237,7 @@ RtlDestroyProcessParameters(PRTL_USER_PROCESS_PARAMETERS ProcessParameters)
|
||||||
{
|
{
|
||||||
ULONG RegionSize = 0;
|
ULONG RegionSize = 0;
|
||||||
|
|
||||||
return NtFreeVirtualMemory (NtCurrentProcess (),
|
return ZwFreeVirtualMemory (NtCurrentProcess (),
|
||||||
(PVOID)ProcessParameters,
|
(PVOID)ProcessParameters,
|
||||||
&RegionSize,
|
&RegionSize,
|
||||||
MEM_RELEASE);
|
MEM_RELEASE);
|
|
@ -20,6 +20,13 @@
|
||||||
|
|
||||||
/* FUNCTIONS *****************************************************************/
|
/* FUNCTIONS *****************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
KPROCESSOR_MODE
|
||||||
|
RtlpGetMode()
|
||||||
|
{
|
||||||
|
return KernelMode;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
|
@ -38,11 +45,12 @@ RtlReleasePebLock(VOID)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PPEB
|
PPEB
|
||||||
STDCALL
|
STDCALL
|
||||||
RtlpCurrentPeb(VOID)
|
RtlpCurrentPeb(VOID)
|
||||||
{
|
{
|
||||||
return ((PEPROCESS)(KeGetCurrentThread()->ApcState.Process))->Peb;
|
return ((PEPROCESS)(KeGetCurrentThread()->ApcState.Process))->Peb;
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
|
|
|
@ -81,6 +81,9 @@ SmCreateUserProcess (LPWSTR ImagePath,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
pProcessInfo);
|
pProcessInfo);
|
||||||
|
|
||||||
|
RtlDestroyProcessParameters (ProcessParameters);
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1("SM: %s: Running \"%S\" failed (Status=0x%08lx)\n",
|
DPRINT1("SM: %s: Running \"%S\" failed (Status=0x%08lx)\n",
|
||||||
|
@ -88,7 +91,8 @@ SmCreateUserProcess (LPWSTR ImagePath,
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
RtlDestroyProcessParameters (ProcessParameters);
|
NtResumeThread(pProcessInfo->ThreadHandle, NULL);
|
||||||
|
|
||||||
|
|
||||||
/* Wait for process termination */
|
/* Wait for process termination */
|
||||||
if(WaitForIt)
|
if(WaitForIt)
|
||||||
|
|
Loading…
Reference in a new issue