-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:
Gunnar Dalsnes 2005-04-01 00:39:52 +00:00
parent 8a147bd7bb
commit 0b60acbc3c
6 changed files with 45 additions and 26 deletions

View file

@ -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 \

View file

@ -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 */

View file

@ -18,6 +18,7 @@ endif
TARGET_OBJECTS = \
acl.o \
ppb.o \
bit.o \
bitmap.o \
bootdata.o \

View file

@ -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);

View file

@ -20,6 +20,13 @@
/* FUNCTIONS *****************************************************************/
KPROCESSOR_MODE
RtlpGetMode()
{
return KernelMode;
}
/*
* @implemented
*/
@ -38,6 +45,7 @@ RtlReleasePebLock(VOID)
}
PPEB
STDCALL
RtlpCurrentPeb(VOID)

View file

@ -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)