2002-10-20 Casper S. Hornstrup <chorns@users.sourceforge.net>

* include/napi/teb.h (RTL_USER_PROCESS_PARAMETERS): Use field names
	as described in Windows NT/2000 Native API Reference.
	* lib/kernel32/file/file.c: Use new field names.
	* lib/kernel32/misc/console.c: Ditto.
	* lib/kernel32/process/create.c: Ditto.
	* lib/kernel32/process/proc.c: Ditto.
	* lib/ntdll/rtl/path.c: Ditto.
	* lib/ntdll/rtl/ppb.c: Ditto.
	* lib/ntdll/rtl/process.c: Ditto.

svn path=/trunk/; revision=3642
This commit is contained in:
Casper Hornstrup 2002-10-20 11:56:00 +00:00
parent bab254e373
commit aa9fe526e2
9 changed files with 344 additions and 333 deletions

View file

@ -1,3 +1,15 @@
2002-10-20 Casper S. Hornstrup <chorns@users.sourceforge.net>
* include/napi/teb.h (RTL_USER_PROCESS_PARAMETERS): Use field names
as described in Windows NT/2000 Native API Reference.
* lib/kernel32/file/file.c: Use new field names.
* lib/kernel32/misc/console.c: Ditto.
* lib/kernel32/process/create.c: Ditto.
* lib/kernel32/process/proc.c: Ditto.
* lib/ntdll/rtl/path.c: Ditto.
* lib/ntdll/rtl/ppb.c: Ditto.
* lib/ntdll/rtl/process.c: Ditto.
2002-10-19 Casper S. Hornstrup <chorns@users.sourceforge.net>
* include/ntos.h: Include relevant files.

View file

@ -1,234 +1,233 @@
/* TEB/PEB parameters */
#ifndef __INCLUDE_INTERNAL_TEB
#define __INCLUDE_INTERNAL_TEB
#include <napi/types.h>
typedef struct _CLIENT_ID
{
HANDLE UniqueProcess;
HANDLE UniqueThread;
} CLIENT_ID, *PCLIENT_ID;
typedef struct _CURDIR
{
UNICODE_STRING DosPath;
PVOID Handle;
} CURDIR, *PCURDIR;
typedef struct RTL_DRIVE_LETTER_CURDIR
{
USHORT Flags;
USHORT Length;
ULONG TimeStamp;
UNICODE_STRING DosPath;
} RTL_DRIVE_LETTER_CURDIR, *PRTL_DRIVE_LETTER_CURDIR;
typedef struct _PEB_FREE_BLOCK
{
struct _PEB_FREE_BLOCK* Next;
ULONG Size;
} PEB_FREE_BLOCK, *PPEB_FREE_BLOCK;
/* RTL_USER_PROCESS_PARAMETERS.Flags */
#define PPF_NORMALIZED (1)
typedef struct _RTL_USER_PROCESS_PARAMETERS
{
ULONG MaximumLength; // 00h
ULONG Length; // 04h
ULONG Flags; // 08h
ULONG DebugFlags; // 0Ch
PVOID ConsoleHandle; // 10h
ULONG ConsoleFlags; // 14h
HANDLE InputHandle; // 18h
HANDLE OutputHandle; // 1Ch
HANDLE ErrorHandle; // 20h
CURDIR CurrentDirectory; // 24h
UNICODE_STRING DllPath; // 30h
UNICODE_STRING ImagePathName; // 38h
UNICODE_STRING CommandLine; // 40h
PWSTR Environment; // 48h
ULONG StartingX; // 4Ch
ULONG StartingY; // 50h
ULONG CountX; // 54h
ULONG CountY; // 58h
ULONG CountCharsX; // 5Ch
ULONG CountCharsY; // 60h
ULONG FillAttribute; // 64h
ULONG WindowFlags; // 68h
ULONG ShowWindowFlags; // 6Ch
UNICODE_STRING WindowTitle; // 70h
UNICODE_STRING DesktopInfo; // 78h
UNICODE_STRING ShellInfo; // 80h
UNICODE_STRING RuntimeInfo; // 88h
RTL_DRIVE_LETTER_CURDIR DLCurrentDirectory[0x20]; // 90h
} RTL_USER_PROCESS_PARAMETERS, *PRTL_USER_PROCESS_PARAMETERS;
#define PEB_BASE (0x7FFDF000)
typedef struct _PEB_LDR_DATA
{
ULONG Length;
BOOLEAN Initialized;
PVOID SsHandle;
LIST_ENTRY InLoadOrderModuleList;
LIST_ENTRY InMemoryOrderModuleList;
LIST_ENTRY InInitializationOrderModuleList;
} PEB_LDR_DATA, *PPEB_LDR_DATA;
typedef VOID STDCALL (*PPEBLOCKROUTINE)(PVOID);
typedef struct _PEB
{
UCHAR InheritedAddressSpace; // 00h
UCHAR ReadImageFileExecOptions; // 01h
UCHAR BeingDebugged; // 02h
UCHAR Spare; // 03h
PVOID Mutant; // 04h
PVOID ImageBaseAddress; // 08h
PPEB_LDR_DATA Ldr; // 0Ch
PRTL_USER_PROCESS_PARAMETERS ProcessParameters; // 10h
PVOID SubSystemData; // 14h
PVOID ProcessHeap; // 18h
PVOID FastPebLock; // 1Ch
PPEBLOCKROUTINE FastPebLockRoutine; // 20h
PPEBLOCKROUTINE FastPebUnlockRoutine; // 24h
ULONG EnvironmentUpdateCount; // 28h
PVOID* KernelCallbackTable; // 2Ch
PVOID EventLogSection; // 30h
PVOID EventLog; // 34h
PPEB_FREE_BLOCK FreeList; // 38h
ULONG TlsExpansionCounter; // 3Ch
PVOID TlsBitmap; // 40h
ULONG TlsBitmapBits[0x2]; // 44h
PVOID ReadOnlySharedMemoryBase; // 4Ch
PVOID ReadOnlySharedMemoryHeap; // 50h
PVOID* ReadOnlyStaticServerData; // 54h
PVOID AnsiCodePageData; // 58h
PVOID OemCodePageData; // 5Ch
PVOID UnicodeCaseTableData; // 60h
ULONG NumberOfProcessors; // 64h
ULONG NtGlobalFlag; // 68h
UCHAR Spare2[0x4]; // 6Ch
LARGE_INTEGER CriticalSectionTimeout; // 70h
ULONG HeapSegmentReserve; // 78h
ULONG HeapSegmentCommit; // 7Ch
ULONG HeapDeCommitTotalFreeThreshold; // 80h
ULONG HeapDeCommitFreeBlockThreshold; // 84h
ULONG NumberOfHeaps; // 88h
ULONG MaximumNumberOfHeaps; // 8Ch
PVOID** ProcessHeaps; // 90h
PVOID GdiSharedHandleTable; // 94h
PVOID ProcessStarterHelper; // 98h
PVOID GdiDCAttributeList; // 9Ch
PVOID LoaderLock; // A0h
ULONG OSMajorVersion; // A4h
ULONG OSMinorVersion; // A8h
ULONG OSBuildNumber; // ACh
ULONG OSPlatformId; // B0h
ULONG ImageSubSystem; // B4h
ULONG ImageSubSystemMajorVersion; // B8h
ULONG ImageSubSystemMinorVersion; // C0h
ULONG GdiHandleBuffer[0x22]; // C4h
} PEB, *PPEB;
typedef struct _NT_TIB {
struct _EXCEPTION_REGISTRATION_RECORD* ExceptionList; // 00h
PVOID StackBase; // 04h
PVOID StackLimit; // 08h
PVOID SubSystemTib; // 0Ch
union {
PVOID FiberData; // 10h
ULONG Version; // 10h
} Fib;
PVOID ArbitraryUserPointer; // 14h
struct _NT_TIB *Self; // 18h
} NT_TIB, *PNT_TIB;
typedef struct _GDI_TEB_BATCH
{
ULONG Offset;
ULONG HDC;
ULONG Buffer[0x136];
} GDI_TEB_BATCH, *PGDI_TEB_BATCH;
typedef struct _TEB
{
NT_TIB Tib; // 00h
PVOID EnvironmentPointer; // 1Ch
CLIENT_ID Cid; // 20h
PVOID ActiveRpcInfo; // 28h
PVOID ThreadLocalStoragePointer; // 2Ch
PPEB Peb; // 30h
ULONG LastErrorValue; // 34h
ULONG CountOfOwnedCriticalSections; // 38h
PVOID CsrClientThread; // 3Ch
struct _W32THREAD* Win32ThreadInfo; // 40h
ULONG Win32ClientInfo[0x1F]; // 44h
PVOID WOW32Reserved; // C0h
ULONG CurrentLocale; // C4h
ULONG FpSoftwareStatusRegister; // C8h
PVOID SystemReserved1[0x36]; // CCh
PVOID Spare1; // 1A4h
LONG ExceptionCode; // 1A8h
ULONG SpareBytes1[0x28]; // 1ACh
PVOID SystemReserved2[0xA]; // 1D4h
// GDI_TEB_BATCH GdiTebBatch; // 1FCh
ULONG gdiRgn; // 6DCh
ULONG gdiPen; // 6E0h
ULONG gdiBrush; // 6E4h
CLIENT_ID RealClientId; // 6E8h
PVOID GdiCachedProcessHandle; // 6F0h
ULONG GdiClientPID; // 6F4h
ULONG GdiClientTID; // 6F8h
PVOID GdiThreadLocaleInfo; // 6FCh
PVOID UserReserved[5]; // 700h
PVOID glDispatchTable[0x118]; // 714h
ULONG glReserved1[0x1A]; // B74h
PVOID glReserved2; // BDCh
PVOID glSectionInfo; // BE0h
PVOID glSection; // BE4h
PVOID glTable; // BE8h
PVOID glCurrentRC; // BECh
PVOID glContext; // BF0h
NTSTATUS LastStatusValue; // BF4h
UNICODE_STRING StaticUnicodeString; // BF8h
WCHAR StaticUnicodeBuffer[0x105]; // C00h
PVOID DeallocationStack; // E0Ch
PVOID TlsSlots[0x40]; // E10h
LIST_ENTRY TlsLinks; // F10h
PVOID Vdm; // F18h
PVOID ReservedForNtRpc; // F1Ch
PVOID DbgSsReserved[0x2]; // F20h
ULONG HardErrorDisabled; // F28h
PVOID Instrumentation[0x10]; // F2Ch
PVOID WinSockData; // F6Ch
ULONG GdiBatchCount; // F70h
ULONG Spare2; // F74h
ULONG Spare3; // F78h
ULONG Spare4; // F7Ch
PVOID ReservedForOle; // F80h
ULONG WaitingOnLoaderLock; // F84h
PVOID WineDebugInfo; // Needed for WINE DLL's
} TEB, *PTEB;
#define NtCurrentPeb() (NtCurrentTeb()->Peb)
static inline PTEB NtCurrentTeb(VOID)
{
int x;
__asm__ __volatile__("movl %%fs:0x18, %0\n\t"
: "=r" (x) /* can't have two memory operands */
: /* no inputs */
);
return((PTEB)x);
}
#endif /* __INCLUDE_INTERNAL_TEB */
/* TEB/PEB parameters */
#ifndef __INCLUDE_INTERNAL_TEB
#define __INCLUDE_INTERNAL_TEB
#include <napi/types.h>
typedef struct _CLIENT_ID
{
HANDLE UniqueProcess;
HANDLE UniqueThread;
} CLIENT_ID, *PCLIENT_ID;
typedef struct _CURDIR
{
UNICODE_STRING DosPath;
PVOID Handle;
} CURDIR, *PCURDIR;
typedef struct RTL_DRIVE_LETTER_CURDIR
{
USHORT Flags;
USHORT Length;
ULONG TimeStamp;
UNICODE_STRING DosPath;
} RTL_DRIVE_LETTER_CURDIR, *PRTL_DRIVE_LETTER_CURDIR;
typedef struct _PEB_FREE_BLOCK
{
struct _PEB_FREE_BLOCK* Next;
ULONG Size;
} PEB_FREE_BLOCK, *PPEB_FREE_BLOCK;
/* RTL_USER_PROCESS_PARAMETERS.Flags */
#define PPF_NORMALIZED (1)
typedef struct _RTL_USER_PROCESS_PARAMETERS {
ULONG AllocationSize;
ULONG Size;
ULONG Flags;
ULONG DebugFlags;
HANDLE hConsole;
ULONG ProcessGroup;
HANDLE hStdInput;
HANDLE hStdOutput;
HANDLE hStdError;
UNICODE_STRING CurrentDirectoryName;
HANDLE CurrentDirectoryHandle;
UNICODE_STRING DllPath;
UNICODE_STRING ImagePathName;
UNICODE_STRING CommandLine;
PWSTR Environment;
ULONG dwX;
ULONG dwY;
ULONG dwXSize;
ULONG dwYSize;
ULONG dwXCountChars;
ULONG dwYCountChars;
ULONG dwFillAttribute;
ULONG dwFlags;
ULONG wShowWindow;
UNICODE_STRING WindowTitle;
UNICODE_STRING DesktopInfo;
UNICODE_STRING ShellInfo;
UNICODE_STRING RuntimeInfo;
} RTL_USER_PROCESS_PARAMETERS, *PRTL_USER_PROCESS_PARAMETERS;
#define PEB_BASE (0x7FFDF000)
typedef struct _PEB_LDR_DATA
{
ULONG Length;
BOOLEAN Initialized;
PVOID SsHandle;
LIST_ENTRY InLoadOrderModuleList;
LIST_ENTRY InMemoryOrderModuleList;
LIST_ENTRY InInitializationOrderModuleList;
} PEB_LDR_DATA, *PPEB_LDR_DATA;
typedef VOID STDCALL (*PPEBLOCKROUTINE)(PVOID);
typedef struct _PEB
{
UCHAR InheritedAddressSpace; // 00h
UCHAR ReadImageFileExecOptions; // 01h
UCHAR BeingDebugged; // 02h
UCHAR Spare; // 03h
PVOID Mutant; // 04h
PVOID ImageBaseAddress; // 08h
PPEB_LDR_DATA Ldr; // 0Ch
PRTL_USER_PROCESS_PARAMETERS ProcessParameters; // 10h
PVOID SubSystemData; // 14h
PVOID ProcessHeap; // 18h
PVOID FastPebLock; // 1Ch
PPEBLOCKROUTINE FastPebLockRoutine; // 20h
PPEBLOCKROUTINE FastPebUnlockRoutine; // 24h
ULONG EnvironmentUpdateCount; // 28h
PVOID* KernelCallbackTable; // 2Ch
PVOID EventLogSection; // 30h
PVOID EventLog; // 34h
PPEB_FREE_BLOCK FreeList; // 38h
ULONG TlsExpansionCounter; // 3Ch
PVOID TlsBitmap; // 40h
ULONG TlsBitmapBits[0x2]; // 44h
PVOID ReadOnlySharedMemoryBase; // 4Ch
PVOID ReadOnlySharedMemoryHeap; // 50h
PVOID* ReadOnlyStaticServerData; // 54h
PVOID AnsiCodePageData; // 58h
PVOID OemCodePageData; // 5Ch
PVOID UnicodeCaseTableData; // 60h
ULONG NumberOfProcessors; // 64h
ULONG NtGlobalFlag; // 68h
UCHAR Spare2[0x4]; // 6Ch
LARGE_INTEGER CriticalSectionTimeout; // 70h
ULONG HeapSegmentReserve; // 78h
ULONG HeapSegmentCommit; // 7Ch
ULONG HeapDeCommitTotalFreeThreshold; // 80h
ULONG HeapDeCommitFreeBlockThreshold; // 84h
ULONG NumberOfHeaps; // 88h
ULONG MaximumNumberOfHeaps; // 8Ch
PVOID** ProcessHeaps; // 90h
PVOID GdiSharedHandleTable; // 94h
PVOID ProcessStarterHelper; // 98h
PVOID GdiDCAttributeList; // 9Ch
PVOID LoaderLock; // A0h
ULONG OSMajorVersion; // A4h
ULONG OSMinorVersion; // A8h
ULONG OSBuildNumber; // ACh
ULONG OSPlatformId; // B0h
ULONG ImageSubSystem; // B4h
ULONG ImageSubSystemMajorVersion; // B8h
ULONG ImageSubSystemMinorVersion; // C0h
ULONG GdiHandleBuffer[0x22]; // C4h
} PEB, *PPEB;
typedef struct _NT_TIB {
struct _EXCEPTION_REGISTRATION_RECORD* ExceptionList; // 00h
PVOID StackBase; // 04h
PVOID StackLimit; // 08h
PVOID SubSystemTib; // 0Ch
union {
PVOID FiberData; // 10h
ULONG Version; // 10h
} Fib;
PVOID ArbitraryUserPointer; // 14h
struct _NT_TIB *Self; // 18h
} NT_TIB, *PNT_TIB;
typedef struct _GDI_TEB_BATCH
{
ULONG Offset;
ULONG HDC;
ULONG Buffer[0x136];
} GDI_TEB_BATCH, *PGDI_TEB_BATCH;
typedef struct _TEB
{
NT_TIB Tib; // 00h
PVOID EnvironmentPointer; // 1Ch
CLIENT_ID Cid; // 20h
PVOID ActiveRpcInfo; // 28h
PVOID ThreadLocalStoragePointer; // 2Ch
PPEB Peb; // 30h
ULONG LastErrorValue; // 34h
ULONG CountOfOwnedCriticalSections; // 38h
PVOID CsrClientThread; // 3Ch
struct _W32THREAD* Win32ThreadInfo; // 40h
ULONG Win32ClientInfo[0x1F]; // 44h
PVOID WOW32Reserved; // C0h
ULONG CurrentLocale; // C4h
ULONG FpSoftwareStatusRegister; // C8h
PVOID SystemReserved1[0x36]; // CCh
PVOID Spare1; // 1A4h
LONG ExceptionCode; // 1A8h
ULONG SpareBytes1[0x28]; // 1ACh
PVOID SystemReserved2[0xA]; // 1D4h
// GDI_TEB_BATCH GdiTebBatch; // 1FCh
ULONG gdiRgn; // 6DCh
ULONG gdiPen; // 6E0h
ULONG gdiBrush; // 6E4h
CLIENT_ID RealClientId; // 6E8h
PVOID GdiCachedProcessHandle; // 6F0h
ULONG GdiClientPID; // 6F4h
ULONG GdiClientTID; // 6F8h
PVOID GdiThreadLocaleInfo; // 6FCh
PVOID UserReserved[5]; // 700h
PVOID glDispatchTable[0x118]; // 714h
ULONG glReserved1[0x1A]; // B74h
PVOID glReserved2; // BDCh
PVOID glSectionInfo; // BE0h
PVOID glSection; // BE4h
PVOID glTable; // BE8h
PVOID glCurrentRC; // BECh
PVOID glContext; // BF0h
NTSTATUS LastStatusValue; // BF4h
UNICODE_STRING StaticUnicodeString; // BF8h
WCHAR StaticUnicodeBuffer[0x105]; // C00h
PVOID DeallocationStack; // E0Ch
PVOID TlsSlots[0x40]; // E10h
LIST_ENTRY TlsLinks; // F10h
PVOID Vdm; // F18h
PVOID ReservedForNtRpc; // F1Ch
PVOID DbgSsReserved[0x2]; // F20h
ULONG HardErrorDisabled; // F28h
PVOID Instrumentation[0x10]; // F2Ch
PVOID WinSockData; // F6Ch
ULONG GdiBatchCount; // F70h
ULONG Spare2; // F74h
ULONG Spare3; // F78h
ULONG Spare4; // F7Ch
PVOID ReservedForOle; // F80h
ULONG WaitingOnLoaderLock; // F84h
PVOID WineDebugInfo; // Needed for WINE DLL's
} TEB, *PTEB;
#define NtCurrentPeb() (NtCurrentTeb()->Peb)
static inline PTEB NtCurrentTeb(VOID)
{
int x;
__asm__ __volatile__("movl %%fs:0x18, %0\n\t"
: "=r" (x) /* can't have two memory operands */
: /* no inputs */
);
return((PTEB)x);
}
#endif /* __INCLUDE_INTERNAL_TEB */

View file

@ -1,4 +1,4 @@
/* $Id: file.c,v 1.36 2002/09/08 10:22:42 chorns Exp $
/* $Id: file.c,v 1.37 2002/10/20 11:55:59 chorns Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
@ -259,15 +259,15 @@ GetFileType(HANDLE hFile)
switch ((ULONG)hFile)
{
case STD_INPUT_HANDLE:
hFile = NtCurrentPeb()->ProcessParameters->InputHandle;
hFile = NtCurrentPeb()->ProcessParameters->hStdInput;
break;
case STD_OUTPUT_HANDLE:
hFile = NtCurrentPeb()->ProcessParameters->OutputHandle;
hFile = NtCurrentPeb()->ProcessParameters->hStdOutput;
break;
case STD_ERROR_HANDLE:
hFile = NtCurrentPeb()->ProcessParameters->ErrorHandle;
hFile = NtCurrentPeb()->ProcessParameters->hStdError;
break;
}

View file

@ -1,4 +1,4 @@
/* $Id: console.c,v 1.44 2002/10/20 00:34:39 mdill Exp $
/* $Id: console.c,v 1.45 2002/10/20 11:55:59 chorns Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
@ -579,9 +579,9 @@ GetStdHandle(DWORD nStdHandle)
Ppb = NtCurrentPeb()->ProcessParameters;
switch (nStdHandle)
{
case STD_INPUT_HANDLE: return Ppb->InputHandle;
case STD_OUTPUT_HANDLE: return Ppb->OutputHandle;
case STD_ERROR_HANDLE: return Ppb->ErrorHandle;
case STD_INPUT_HANDLE: return Ppb->hStdInput;
case STD_OUTPUT_HANDLE: return Ppb->hStdOutput;
case STD_ERROR_HANDLE: return Ppb->hStdError;
}
SetLastError (ERROR_INVALID_PARAMETER);
return INVALID_HANDLE_VALUE;
@ -614,13 +614,13 @@ SetStdHandle(DWORD nStdHandle,
switch (nStdHandle)
{
case STD_INPUT_HANDLE:
Ppb->InputHandle = hHandle;
Ppb->hStdInput = hHandle;
return TRUE;
case STD_OUTPUT_HANDLE:
Ppb->OutputHandle = hHandle;
Ppb->hStdOutput = hHandle;
return TRUE;
case STD_ERROR_HANDLE:
Ppb->ErrorHandle = hHandle;
Ppb->hStdError = hHandle;
return TRUE;
}
SetLastError (ERROR_INVALID_PARAMETER);

View file

@ -1,4 +1,4 @@
/* $Id: create.c,v 1.54 2002/10/01 19:27:19 chorns Exp $
/* $Id: create.c,v 1.55 2002/10/20 11:56:00 chorns Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
@ -477,7 +477,7 @@ KlInitPeb (HANDLE ProcessHandle,
/* create the PPB */
PpbBase = NULL;
PpbSize = Ppb->MaximumLength;
PpbSize = Ppb->AllocationSize;
Status = NtAllocateVirtualMemory(ProcessHandle,
&PpbBase,
0,
@ -493,7 +493,7 @@ KlInitPeb (HANDLE ProcessHandle,
NtWriteVirtualMemory(ProcessHandle,
PpbBase,
Ppb,
Ppb->MaximumLength,
Ppb->AllocationSize,
&BytesWritten);
/* write pointer to environment */
@ -755,23 +755,23 @@ CreateProcessW(LPCWSTR lpApplicationName,
/*
* Translate some handles for the new process
*/
if (Ppb->CurrentDirectory.Handle)
if (Ppb->CurrentDirectoryHandle)
{
Status = NtDuplicateObject (NtCurrentProcess(),
Ppb->CurrentDirectory.Handle,
Ppb->CurrentDirectoryHandle,
hProcess,
&Ppb->CurrentDirectory.Handle,
&Ppb->CurrentDirectoryHandle,
0,
TRUE,
DUPLICATE_SAME_ACCESS);
}
if (Ppb->ConsoleHandle)
if (Ppb->hConsole)
{
Status = NtDuplicateObject (NtCurrentProcess(),
Ppb->ConsoleHandle,
Ppb->hConsole,
hProcess,
&Ppb->ConsoleHandle,
&Ppb->hConsole,
0,
TRUE,
DUPLICATE_SAME_ACCESS);
@ -819,31 +819,31 @@ CreateProcessW(LPCWSTR lpApplicationName,
}
// Set the child console handles
Ppb->InputHandle = NtCurrentPeb()->ProcessParameters->InputHandle;
Ppb->OutputHandle = NtCurrentPeb()->ProcessParameters->OutputHandle;
Ppb->ErrorHandle = NtCurrentPeb()->ProcessParameters->ErrorHandle;
Ppb->hStdInput = NtCurrentPeb()->ProcessParameters->hStdInput;
Ppb->hStdOutput = NtCurrentPeb()->ProcessParameters->hStdOutput;
Ppb->hStdError = NtCurrentPeb()->ProcessParameters->hStdError;
if (lpStartupInfo && (lpStartupInfo->dwFlags & STARTF_USESTDHANDLES))
{
if (lpStartupInfo->hStdInput)
Ppb->InputHandle = lpStartupInfo->hStdInput;
Ppb->hStdInput = lpStartupInfo->hStdInput;
if (lpStartupInfo->hStdOutput)
Ppb->OutputHandle = lpStartupInfo->hStdOutput;
Ppb->hStdOutput = lpStartupInfo->hStdOutput;
if (lpStartupInfo->hStdError)
Ppb->ErrorHandle = lpStartupInfo->hStdError;
Ppb->hStdError = lpStartupInfo->hStdError;
}
if (IsConsoleHandle(Ppb->InputHandle))
if (IsConsoleHandle(Ppb->hStdInput))
{
Ppb->InputHandle = CsrReply.Data.CreateProcessReply.InputHandle;
Ppb->hStdInput = CsrReply.Data.CreateProcessReply.InputHandle;
}
else
{
DPRINT("Duplicate input handle\n");
Status = NtDuplicateObject (NtCurrentProcess(),
Ppb->InputHandle,
Ppb->hStdInput,
hProcess,
&Ppb->InputHandle,
&Ppb->hStdInput,
0,
TRUE,
DUPLICATE_SAME_ACCESS);
@ -853,17 +853,17 @@ CreateProcessW(LPCWSTR lpApplicationName,
}
}
if (IsConsoleHandle(Ppb->OutputHandle))
if (IsConsoleHandle(Ppb->hStdOutput))
{
Ppb->OutputHandle = CsrReply.Data.CreateProcessReply.OutputHandle;
Ppb->hStdOutput = CsrReply.Data.CreateProcessReply.OutputHandle;
}
else
{
DPRINT("Duplicate output handle\n");
Status = NtDuplicateObject (NtCurrentProcess(),
Ppb->OutputHandle,
Ppb->hStdOutput,
hProcess,
&Ppb->OutputHandle,
&Ppb->hStdOutput,
0,
TRUE,
DUPLICATE_SAME_ACCESS);
@ -872,17 +872,17 @@ CreateProcessW(LPCWSTR lpApplicationName,
DPRINT("NtDuplicateObject failed, status %x\n", Status);
}
}
if (IsConsoleHandle(Ppb->ErrorHandle))
if (IsConsoleHandle(Ppb->hStdError))
{
Ppb->ErrorHandle = CsrReply.Data.CreateProcessReply.OutputHandle;
Ppb->hStdError = CsrReply.Data.CreateProcessReply.OutputHandle;
}
else
{
DPRINT("Duplicate error handle\n");
Status = NtDuplicateObject (NtCurrentProcess(),
Ppb->ErrorHandle,
Ppb->hStdError,
hProcess,
&Ppb->ErrorHandle,
&Ppb->hStdError,
0,
TRUE,
DUPLICATE_SAME_ACCESS);
@ -897,20 +897,20 @@ CreateProcessW(LPCWSTR lpApplicationName,
*/
if (lpStartupInfo)
{
Ppb->WindowFlags = lpStartupInfo->dwFlags;
if (Ppb->WindowFlags & STARTF_USESHOWWINDOW)
Ppb->dwFlags = lpStartupInfo->dwFlags;
if (Ppb->dwFlags & STARTF_USESHOWWINDOW)
{
Ppb->ShowWindowFlags = lpStartupInfo->wShowWindow;
Ppb->wShowWindow = lpStartupInfo->wShowWindow;
}
else
{
Ppb->ShowWindowFlags = SW_SHOWDEFAULT;
Ppb->wShowWindow = SW_SHOWDEFAULT;
}
Ppb->StartingX = lpStartupInfo->dwX;
Ppb->StartingY = lpStartupInfo->dwY;
Ppb->CountX = lpStartupInfo->dwXSize;
Ppb->CountY = lpStartupInfo->dwYSize;
Ppb->FillAttribute = lpStartupInfo->dwFillAttribute;
Ppb->dwX = lpStartupInfo->dwX;
Ppb->dwY = lpStartupInfo->dwY;
Ppb->dwXSize = lpStartupInfo->dwXSize;
Ppb->dwYSize = lpStartupInfo->dwYSize;
Ppb->dwFillAttribute = lpStartupInfo->dwFillAttribute;
}
else
{

View file

@ -1,4 +1,4 @@
/* $Id: proc.c,v 1.46 2002/09/08 10:22:45 chorns Exp $
/* $Id: proc.c,v 1.47 2002/10/20 11:56:00 chorns Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
@ -389,22 +389,22 @@ GetStartupInfoW(LPSTARTUPINFOW lpStartupInfo)
lpStartupInfo->cb = sizeof(STARTUPINFOW);
lpStartupInfo->lpDesktop = Params->DesktopInfo.Buffer;
lpStartupInfo->lpTitle = Params->WindowTitle.Buffer;
lpStartupInfo->dwX = Params->StartingX;
lpStartupInfo->dwY = Params->StartingY;
lpStartupInfo->dwXSize = Params->CountX;
lpStartupInfo->dwYSize = Params->CountY;
lpStartupInfo->dwXCountChars = Params->CountCharsX;
lpStartupInfo->dwYCountChars = Params->CountCharsY;
lpStartupInfo->dwFillAttribute = Params->FillAttribute;
lpStartupInfo->dwFlags = Params->Flags;
lpStartupInfo->wShowWindow = Params->ShowWindowFlags;
lpStartupInfo->dwX = Params->dwX;
lpStartupInfo->dwY = Params->dwY;
lpStartupInfo->dwXSize = Params->dwXSize;
lpStartupInfo->dwYSize = Params->dwYSize;
lpStartupInfo->dwXCountChars = Params->dwXCountChars;
lpStartupInfo->dwYCountChars = Params->dwYCountChars;
lpStartupInfo->dwFillAttribute = Params->dwFillAttribute;
lpStartupInfo->dwFlags = Params->dwFlags;
lpStartupInfo->wShowWindow = Params->wShowWindow;
lpStartupInfo->lpReserved = Params->ShellInfo.Buffer;
lpStartupInfo->cbReserved2 = Params->RuntimeInfo.Length;
lpStartupInfo->lpReserved2 = (LPBYTE)Params->RuntimeInfo.Buffer;
lpStartupInfo->hStdInput = Params->InputHandle;
lpStartupInfo->hStdOutput = Params->OutputHandle;
lpStartupInfo->hStdError = Params->ErrorHandle;
lpStartupInfo->hStdInput = Params->hStdInput;
lpStartupInfo->hStdOutput = Params->hStdOutput;
lpStartupInfo->hStdError = Params->hStdError;
}
@ -451,21 +451,21 @@ GetStartupInfoA(LPSTARTUPINFOA lpStartupInfo)
TRUE);
lpLocalStartupInfo->lpReserved = AnsiString.Buffer;
lpLocalStartupInfo->dwX = Params->StartingX;
lpLocalStartupInfo->dwY = Params->StartingY;
lpLocalStartupInfo->dwXSize = Params->CountX;
lpLocalStartupInfo->dwYSize = Params->CountY;
lpLocalStartupInfo->dwXCountChars = Params->CountCharsX;
lpLocalStartupInfo->dwYCountChars = Params->CountCharsY;
lpLocalStartupInfo->dwFillAttribute = Params->FillAttribute;
lpLocalStartupInfo->dwFlags = Params->Flags;
lpLocalStartupInfo->wShowWindow = Params->ShowWindowFlags;
lpLocalStartupInfo->dwX = Params->dwX;
lpLocalStartupInfo->dwY = Params->dwY;
lpLocalStartupInfo->dwXSize = Params->dwXSize;
lpLocalStartupInfo->dwYSize = Params->dwYSize;
lpLocalStartupInfo->dwXCountChars = Params->dwXCountChars;
lpLocalStartupInfo->dwYCountChars = Params->dwYCountChars;
lpLocalStartupInfo->dwFillAttribute = Params->dwFillAttribute;
lpLocalStartupInfo->dwFlags = Params->dwFlags;
lpLocalStartupInfo->wShowWindow = Params->wShowWindow;
lpLocalStartupInfo->cbReserved2 = Params->RuntimeInfo.Length;
lpLocalStartupInfo->lpReserved2 = (LPBYTE)Params->RuntimeInfo.Buffer;
lpLocalStartupInfo->hStdInput = Params->InputHandle;
lpLocalStartupInfo->hStdOutput = Params->OutputHandle;
lpLocalStartupInfo->hStdError = Params->ErrorHandle;
lpLocalStartupInfo->hStdInput = Params->hStdInput;
lpLocalStartupInfo->hStdOutput = Params->hStdOutput;
lpLocalStartupInfo->hStdError = Params->hStdError;
}
RtlReleasePebLock ();

View file

@ -1,4 +1,4 @@
/* $Id: path.c,v 1.14 2002/09/08 10:23:06 chorns Exp $
/* $Id: path.c,v 1.15 2002/10/20 11:56:00 chorns Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
@ -252,7 +252,7 @@ RtlGetCurrentDirectory_U(ULONG MaximumLength,
DPRINT ("RtlGetCurrentDirectory %lu %p\n", MaximumLength, Buffer);
cd = &(NtCurrentPeb ()->ProcessParameters->CurrentDirectory);
cd = (PCURDIR)&(NtCurrentPeb ()->ProcessParameters->CurrentDirectoryName);
RtlAcquirePebLock();
Length = cd->DosPath.Length / sizeof(WCHAR);
@ -304,7 +304,7 @@ RtlSetCurrentDirectory_U(PUNICODE_STRING name)
DPRINT ("RtlSetCurrentDirectory %wZ\n", name);
RtlAcquirePebLock ();
cd = &NtCurrentPeb ()->ProcessParameters->CurrentDirectory;
cd = (PCURDIR)&NtCurrentPeb ()->ProcessParameters->CurrentDirectoryName;
size = cd->DosPath.MaximumLength;
buf = RtlAllocateHeap (RtlGetProcessHeap(),
@ -516,7 +516,7 @@ CHECKPOINT;
RtlAcquirePebLock();
cd = &(NtCurrentPeb ()->ProcessParameters->CurrentDirectory);
cd = (PCURDIR)&(NtCurrentPeb ()->ProcessParameters->CurrentDirectoryName);
DPRINT("type %ld\n", type);
switch (type)
{
@ -707,7 +707,7 @@ RtlDosPathNameToNtPathName_U(PWSTR dosname,
if (nah)
{
memset (nah, 0, sizeof(CURDIR));
cd = &(NtCurrentPeb ()->ProcessParameters->CurrentDirectory);
cd = (PCURDIR)&(NtCurrentPeb ()->ProcessParameters->CurrentDirectoryName);
if (Type == 5 && cd->Handle &&
!_wcsnicmp (cd->DosPath.Buffer, fullname, cd->DosPath.Length / 2))
{

View file

@ -1,4 +1,4 @@
/* $Id: ppb.c,v 1.15 2002/10/01 19:27:20 chorns Exp $
/* $Id: ppb.c,v 1.16 2002/10/20 11:56:00 chorns Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
@ -97,10 +97,10 @@ RtlCreateProcessParameters(PRTL_USER_PROCESS_PARAMETERS *ProcessParameters,
if (Environment == NULL)
Environment = NtCurrentPeb()->ProcessParameters->Environment;
if (CurrentDirectory == NULL)
CurrentDirectory = &NtCurrentPeb()->ProcessParameters->CurrentDirectory.DosPath;
CurrentDirectoryHandle = NtCurrentPeb()->ProcessParameters->CurrentDirectory.Handle;
ConsoleHandle = NtCurrentPeb()->ProcessParameters->ConsoleHandle;
ConsoleFlags = NtCurrentPeb()->ProcessParameters->ConsoleFlags;
CurrentDirectory = &NtCurrentPeb()->ProcessParameters->CurrentDirectoryName;
CurrentDirectoryHandle = NtCurrentPeb()->ProcessParameters->CurrentDirectoryHandle;
ConsoleHandle = NtCurrentPeb()->ProcessParameters->hConsole;
ConsoleFlags = NtCurrentPeb()->ProcessParameters->ProcessGroup;
}
else
{
@ -156,33 +156,33 @@ RtlCreateProcessParameters(PRTL_USER_PROCESS_PARAMETERS *ProcessParameters,
DPRINT ("Process parameters allocated\n");
Param->MaximumLength = RegionSize;
Param->Length = Length;
Param->AllocationSize = RegionSize;
Param->Size = Length;
Param->Flags = PPF_NORMALIZED;
Param->Environment = Environment;
Param->CurrentDirectory.Handle = CurrentDirectoryHandle;
Param->ConsoleHandle = ConsoleHandle;
Param->ConsoleFlags = ConsoleFlags;
Param->CurrentDirectoryHandle = CurrentDirectoryHandle;
Param->hConsole = ConsoleHandle;
Param->ProcessGroup = ConsoleFlags;
Dest = (PWCHAR)(((PBYTE)Param) + sizeof(RTL_USER_PROCESS_PARAMETERS));
/* copy current directory */
RtlpCopyParameterString(&Dest,
&Param->CurrentDirectory.DosPath,
&Param->CurrentDirectoryName,
CurrentDirectory,
MAX_PATH * sizeof(WCHAR));
/* make sure the current directory has a trailing backslash */
if (Param->CurrentDirectory.DosPath.Length > 0)
if (Param->CurrentDirectoryName.Length > 0)
{
ULONG Length;
Length = Param->CurrentDirectory.DosPath.Length / sizeof(WCHAR);
if (Param->CurrentDirectory.DosPath.Buffer[Length-1] != L'\\')
Length = Param->CurrentDirectoryName.Length / sizeof(WCHAR);
if (Param->CurrentDirectoryName.Buffer[Length-1] != L'\\')
{
Param->CurrentDirectory.DosPath.Buffer[Length] = L'\\';
Param->CurrentDirectory.DosPath.Buffer[Length + 1] = 0;
Param->CurrentDirectory.DosPath.Length += sizeof(WCHAR);
Param->CurrentDirectoryName.Buffer[Length] = L'\\';
Param->CurrentDirectoryName.Buffer[Length + 1] = 0;
Param->CurrentDirectoryName.Length += sizeof(WCHAR);
}
}
@ -254,7 +254,7 @@ RtlDeNormalizeProcessParams(PRTL_USER_PROCESS_PARAMETERS Params)
{
if (Params && (Params->Flags & PPF_NORMALIZED))
{
DENORMALIZE(Params->CurrentDirectory.DosPath.Buffer, Params);
DENORMALIZE(Params->CurrentDirectoryName.Buffer, Params);
DENORMALIZE(Params->DllPath.Buffer, Params);
DENORMALIZE(Params->ImagePathName.Buffer, Params);
DENORMALIZE(Params->CommandLine.Buffer, Params);
@ -277,7 +277,7 @@ RtlNormalizeProcessParams(PRTL_USER_PROCESS_PARAMETERS Params)
{
if (Params && !(Params->Flags & PPF_NORMALIZED))
{
NORMALIZE(Params->CurrentDirectory.DosPath.Buffer, Params);
NORMALIZE(Params->CurrentDirectoryName.Buffer, Params);
NORMALIZE(Params->DllPath.Buffer, Params);
NORMALIZE(Params->ImagePathName.Buffer, Params);
NORMALIZE(Params->CommandLine.Buffer, Params);

View file

@ -1,4 +1,4 @@
/* $Id: process.c,v 1.31 2002/10/01 19:27:20 chorns Exp $
/* $Id: process.c,v 1.32 2002/10/20 11:56:00 chorns Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
@ -323,7 +323,7 @@ static NTSTATUS KlInitPeb (HANDLE ProcessHandle,
/* create the PPB */
PpbBase = NULL;
PpbSize = Ppb->MaximumLength;
PpbSize = Ppb->AllocationSize;
Status = NtAllocateVirtualMemory(ProcessHandle,
&PpbBase,
0,
@ -342,7 +342,7 @@ static NTSTATUS KlInitPeb (HANDLE ProcessHandle,
NtWriteVirtualMemory(ProcessHandle,
PpbBase,
Ppb,
Ppb->MaximumLength,
Ppb->AllocationSize,
&BytesWritten);
RtlNormalizeProcessParams (Ppb);