mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
Fixed process parameters
Simplified current directory code Added %C and %S formats to printf() Changed %w to %S Fixed compiler warnings svn path=/trunk/; revision=929
This commit is contained in:
parent
fb7f4582cd
commit
6cc53dd4b3
18 changed files with 460 additions and 460 deletions
|
@ -46,40 +46,55 @@ typedef struct linux_sigcontext {
|
|||
|
||||
typedef ULONG THREADINFOCLASS;
|
||||
|
||||
typedef struct _PPB
|
||||
typedef struct _CURDIR
|
||||
{
|
||||
ULONG TotalSize; // 00h
|
||||
ULONG DataSize; // 04h
|
||||
BOOLEAN Normalized; // 08h
|
||||
ULONG Unknown1; // 0Ch
|
||||
ULONG Unknown2; // 10h
|
||||
ULONG Unknown3; // 14h
|
||||
HANDLE InputHandle; // 18h
|
||||
HANDLE OutputHandle; // 1Ch
|
||||
HANDLE ErrorHandle; // 20h
|
||||
UNICODE_STRING CurrentDirectory; // 24h
|
||||
ULONG Unknown4; // 2Ch
|
||||
UNICODE_STRING LibraryPath; // 30h
|
||||
UNICODE_STRING CommandLine; // 38h
|
||||
UNICODE_STRING ImageName; // 40h
|
||||
UNICODE_STRING DosPath;
|
||||
HANDLE 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 _RTL_USER_PROCESS_PARAMETERS
|
||||
{
|
||||
ULONG MaximumLength; // 00h
|
||||
ULONG Length; // 04h
|
||||
ULONG Flags; // 08h
|
||||
ULONG DebugFlags; // 0Ch
|
||||
HANDLE ConsoleHandle; // 10h
|
||||
ULONG ConsoleFlags; // 14h
|
||||
HANDLE StandardInput; // 18h
|
||||
HANDLE StandardOutput; // 1Ch
|
||||
HANDLE StandardError; // 20h
|
||||
CURDIR CurrentDirectory; // 24h
|
||||
UNICODE_STRING DllPath; // 30h
|
||||
UNICODE_STRING ImagePathName; // 38h
|
||||
UNICODE_STRING CommandLine; // 40h
|
||||
PVOID Environment; // 48h
|
||||
DWORD X; // 4Ch
|
||||
DWORD Y; // 50h
|
||||
DWORD XSize; // 54h
|
||||
DWORD YSize; // 58h
|
||||
DWORD XCountChars; // 5Ch
|
||||
DWORD YCountChars; // 60h
|
||||
DWORD FillAttribute; // 64h
|
||||
DWORD Flags; // 68h
|
||||
DWORD ShowWindow; // 6Ch
|
||||
UNICODE_STRING Title; // 70h
|
||||
UNICODE_STRING Desktop; // 78h
|
||||
UNICODE_STRING Reserved; // 80h
|
||||
UNICODE_STRING Reserved2; // 88h
|
||||
} PPB, *PPPB;
|
||||
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 RuntimeData; // 88h
|
||||
RTL_DRIVE_LETTER_CURDIR DLCurrentDirectory[32]; // 90h
|
||||
} RTL_USER_PROCESS_PARAMETERS, *PRTL_USER_PROCESS_PARAMETERS;
|
||||
|
||||
|
||||
typedef struct _LDR {
|
||||
typedef struct _LDR
|
||||
{
|
||||
UCHAR Initialized;
|
||||
UCHAR InInitializationOrderModuleList;
|
||||
PVOID InLoadOrderModuleList;
|
||||
|
@ -95,7 +110,7 @@ typedef struct _PEB
|
|||
LONG ImageBaseAddress; // 03h
|
||||
LDR Ldr; // 07h
|
||||
|
||||
PPPB Ppb; // 10h
|
||||
PRTL_USER_PROCESS_PARAMETERS ProcessParameters; // 10h
|
||||
|
||||
WORD NumberOfProcessors; // 11h
|
||||
WORD NtGlobalFlag; // 13h
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: rtl.h,v 1.5 1999/12/06 00:16:33 ekohl Exp $
|
||||
/* $Id: rtl.h,v 1.6 2000/01/11 17:28:11 ekohl Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -119,7 +119,7 @@ STDCALL
|
|||
RtlCreateUserProcess (
|
||||
PUNICODE_STRING CommandLine,
|
||||
ULONG Unknown1,
|
||||
PPPB Ppb,
|
||||
PRTL_USER_PROCESS_PARAMETERS ProcessParameters,
|
||||
PSECURITY_DESCRIPTOR ProcessSd,
|
||||
PSECURITY_DESCRIPTOR ThreadSd,
|
||||
WINBOOL bInheritHandles,
|
||||
|
@ -132,7 +132,7 @@ RtlCreateUserProcess (
|
|||
NTSTATUS
|
||||
STDCALL
|
||||
RtlCreateProcessParameters (
|
||||
IN OUT PPPB *Ppb,
|
||||
IN OUT PRTL_USER_PROCESS_PARAMETERS *ProcessParameters,
|
||||
IN PUNICODE_STRING CommandLine,
|
||||
IN PUNICODE_STRING LibraryPath,
|
||||
IN PUNICODE_STRING CurrentDirectory,
|
||||
|
@ -147,19 +147,19 @@ RtlCreateProcessParameters (
|
|||
VOID
|
||||
STDCALL
|
||||
RtlDeNormalizeProcessParams (
|
||||
IN OUT PPPB Ppb
|
||||
IN OUT PRTL_USER_PROCESS_PARAMETERS ProcessParameters
|
||||
);
|
||||
|
||||
VOID
|
||||
STDCALL
|
||||
RtlDestroyProcessParameters (
|
||||
IN OUT PPPB Ppb
|
||||
IN OUT PRTL_USER_PROCESS_PARAMETERS ProcessParameters
|
||||
);
|
||||
|
||||
VOID
|
||||
STDCALL
|
||||
RtlNormalizeProcessParams (
|
||||
IN OUT PPPB Ppb
|
||||
IN OUT PRTL_USER_PROCESS_PARAMETERS ProcessParameters
|
||||
);
|
||||
|
||||
/* EOF */
|
|
@ -1,4 +1,5 @@
|
|||
/*
|
||||
/* $Id: create.c,v 1.15 2000/01/11 17:30:16 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/kernel32/file/create.c
|
||||
|
@ -20,9 +21,6 @@
|
|||
#define NDEBUG
|
||||
#include <kernel32/kernel32.h>
|
||||
|
||||
/* EXTERNS ******************************************************************/
|
||||
|
||||
DWORD STDCALL GetCurrentDriveW(DWORD nBufferLength, PWSTR lpBuffer);
|
||||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
|
@ -96,7 +94,7 @@ HANDLE STDCALL CreateFileW(LPCWSTR lpFileName,
|
|||
dwCreationDisposition = FILE_OVERWRITE;
|
||||
}
|
||||
|
||||
DPRINT("CreateFileW(lpFileName %w)\n",lpFileName);
|
||||
DPRINT("CreateFileW(lpFileName %S)\n",lpFileName);
|
||||
|
||||
if (dwDesiredAccess & GENERIC_READ)
|
||||
dwDesiredAccess |= FILE_GENERIC_READ;
|
||||
|
@ -123,7 +121,8 @@ HANDLE STDCALL CreateFileW(LPCWSTR lpFileName,
|
|||
}
|
||||
else if (lpFileName[0] == (WCHAR)'\\')
|
||||
{
|
||||
GetCurrentDriveW(MAX_PATH,PathNameW);
|
||||
GetCurrentDirectoryW(MAX_PATH,PathNameW);
|
||||
PathNameW[3] = 0;
|
||||
wcscat(PathNameW, lpFileName);
|
||||
}
|
||||
else
|
||||
|
@ -163,7 +162,7 @@ HANDLE STDCALL CreateFileW(LPCWSTR lpFileName,
|
|||
ObjectAttributes.SecurityDescriptor = NULL;
|
||||
ObjectAttributes.SecurityQualityOfService = NULL;
|
||||
|
||||
DPRINT("File Name %w\n",FileNameW);
|
||||
DPRINT("File Name %S\n",FileNameW);
|
||||
|
||||
Status = ZwCreateFile(&FileHandle,
|
||||
dwDesiredAccess,
|
||||
|
@ -184,3 +183,4 @@ HANDLE STDCALL CreateFileW(LPCWSTR lpFileName,
|
|||
return(FileHandle);
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/*
|
||||
/* $Id: curdir.c,v 1.19 2000/01/11 17:30:16 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/kernel32/file/curdir.c
|
||||
|
@ -20,12 +21,8 @@
|
|||
|
||||
/* GLOBALS *******************************************************************/
|
||||
|
||||
#define MAX_DOS_DRIVES 26
|
||||
|
||||
static HANDLE hCurrentDirectory = NULL;
|
||||
static ULONG CurrentDrive = 0;
|
||||
|
||||
static WCHAR DriveDirectoryW[MAX_DOS_DRIVES][MAX_PATH] = {{0}};
|
||||
static WCHAR CurrentDirectoryW[MAX_PATH];
|
||||
|
||||
static WCHAR SystemDirectoryW[MAX_PATH];
|
||||
static WCHAR WindowsDirectoryW[MAX_PATH];
|
||||
|
@ -34,15 +31,6 @@ WINBOOL STDCALL SetCurrentDirectoryW(LPCWSTR lpPathName);
|
|||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
DWORD STDCALL GetCurrentDriveW(DWORD nBufferLength, PWSTR lpBuffer)
|
||||
{
|
||||
lpBuffer[0] = 'A' + CurrentDrive;
|
||||
lpBuffer[1] = ':';
|
||||
lpBuffer[2] = '\\';
|
||||
lpBuffer[3] = 0;
|
||||
return(4);
|
||||
}
|
||||
|
||||
DWORD STDCALL GetCurrentDirectoryA(DWORD nBufferLength, LPSTR lpBuffer)
|
||||
{
|
||||
UINT uSize,i;
|
||||
|
@ -74,21 +62,23 @@ DWORD STDCALL GetCurrentDirectoryW(DWORD nBufferLength, LPWSTR lpBuffer)
|
|||
|
||||
if ( lpBuffer == NULL )
|
||||
return 0;
|
||||
uSize = lstrlenW(DriveDirectoryW[CurrentDrive]) + 2;
|
||||
|
||||
uSize = lstrlenW(CurrentDirectoryW);
|
||||
if (nBufferLength > uSize)
|
||||
{
|
||||
lpBuffer[0] = 'A' + CurrentDrive;
|
||||
lpBuffer[1] = ':';
|
||||
lpBuffer[2] = 0;
|
||||
lstrcpyW(&lpBuffer[2], DriveDirectoryW[CurrentDrive]);
|
||||
lstrcpyW(lpBuffer, CurrentDirectoryW);
|
||||
}
|
||||
if (uSize > 3 && lpBuffer[uSize - 1] == L'\\')
|
||||
{
|
||||
lpBuffer[uSize - 1] = 0;
|
||||
uSize--;
|
||||
}
|
||||
DPRINT("GetCurrentDirectoryW() = '%w'\n",lpBuffer);
|
||||
DPRINT("GetCurrentDirectoryW() = '%S'\n",lpBuffer);
|
||||
|
||||
return uSize;
|
||||
#if 0
|
||||
return (RtlGetCurrentDirectory_U (nBufferLength, lpBuffer) / sizeof (WCHAR));
|
||||
#endif
|
||||
}
|
||||
|
||||
WINBOOL STDCALL SetCurrentDirectoryA(LPCSTR lpPathName)
|
||||
|
@ -125,7 +115,7 @@ WINBOOL STDCALL SetCurrentDirectoryW(LPCWSTR lpPathName)
|
|||
WCHAR PathName[MAX_PATH];
|
||||
HANDLE hDir;
|
||||
|
||||
DPRINT("SetCurrentDirectoryW(lpPathName %w)\n",lpPathName);
|
||||
DPRINT("SetCurrentDirectoryW(lpPathName %S)\n",lpPathName);
|
||||
|
||||
if (lpPathName == NULL)
|
||||
{
|
||||
|
@ -146,7 +136,7 @@ WINBOOL STDCALL SetCurrentDirectoryW(LPCWSTR lpPathName)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
DPRINT("PathName %w\n",PathName);
|
||||
DPRINT("PathName %S\n",PathName);
|
||||
|
||||
hDir = CreateFileW(PathName,
|
||||
GENERIC_READ,
|
||||
|
@ -169,18 +159,25 @@ WINBOOL STDCALL SetCurrentDirectoryW(LPCWSTR lpPathName)
|
|||
|
||||
hCurrentDirectory = hDir;
|
||||
|
||||
DPRINT("PathName %w\n",PathName);
|
||||
DPRINT("PathName %S\n",PathName);
|
||||
|
||||
CurrentDrive = toupper((UCHAR)PathName[0]) - 'A';
|
||||
wcscpy(DriveDirectoryW[CurrentDrive],&PathName[2]);
|
||||
len = lstrlenW(DriveDirectoryW[CurrentDrive]);
|
||||
if (DriveDirectoryW[CurrentDrive][len-1] != '\\')
|
||||
wcscpy(CurrentDirectoryW,PathName);
|
||||
len = lstrlenW(CurrentDirectoryW);
|
||||
if (CurrentDirectoryW[len-1] != '\\')
|
||||
{
|
||||
DriveDirectoryW[CurrentDrive][len] = '\\';
|
||||
DriveDirectoryW[CurrentDrive][len+1] = 0;
|
||||
CurrentDirectoryW[len] = '\\';
|
||||
CurrentDirectoryW[len+1] = 0;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
#if 0
|
||||
UNICODE_STRING PathName_U;
|
||||
|
||||
RtlInitUnicodeString (&PathName_U,
|
||||
lpPathName);
|
||||
|
||||
return RtlSetCurrentDirectory_U (&PathName_U);
|
||||
#endif
|
||||
}
|
||||
|
||||
DWORD STDCALL GetTempPathA(DWORD nBufferLength, LPSTR lpBuffer)
|
||||
|
@ -285,3 +282,4 @@ GetWindowsDirectoryW(
|
|||
return uPathSize;
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/*
|
||||
/* $Id: delete.c,v 1.5 2000/01/11 17:30:16 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/kernel32/file/delete.c
|
||||
|
@ -18,9 +19,6 @@
|
|||
#define NDEBUG
|
||||
#include <kernel32/kernel32.h>
|
||||
|
||||
/* EXTERNS ******************************************************************/
|
||||
|
||||
DWORD STDCALL GetCurrentDriveW(DWORD nBufferLength, PWSTR lpBuffer);
|
||||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
|
@ -52,7 +50,7 @@ WINBOOL STDCALL DeleteFileW(LPCWSTR lpFileName)
|
|||
IO_STATUS_BLOCK IoStatusBlock;
|
||||
UINT Len;
|
||||
|
||||
DPRINT("DeleteFileW (lpFileName %w)\n",lpFileName);
|
||||
DPRINT("DeleteFileW (lpFileName %S)\n",lpFileName);
|
||||
|
||||
if (lpFileName[1] == (WCHAR)':')
|
||||
{
|
||||
|
@ -68,14 +66,15 @@ WINBOOL STDCALL DeleteFileW(LPCWSTR lpFileName)
|
|||
}
|
||||
else if (lpFileName[0] == (WCHAR)'\\')
|
||||
{
|
||||
GetCurrentDriveW(MAX_PATH,PathNameW);
|
||||
GetCurrentDirectoryW(MAX_PATH,PathNameW);
|
||||
PathNameW[3] = 0;
|
||||
wcscat(PathNameW, lpFileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
Len = GetCurrentDirectoryW(MAX_PATH,PathNameW);
|
||||
if ( Len == 0 )
|
||||
return NULL;
|
||||
return FALSE;
|
||||
if ( PathNameW[Len-1] != L'\\' ) {
|
||||
PathNameW[Len] = L'\\';
|
||||
PathNameW[Len+1] = 0;
|
||||
|
@ -93,10 +92,10 @@ WINBOOL STDCALL DeleteFileW(LPCWSTR lpFileName)
|
|||
FileNameString.Length = wcslen( FileNameW)*sizeof(WCHAR);
|
||||
|
||||
if ( FileNameString.Length == 0 )
|
||||
return NULL;
|
||||
return FALSE;
|
||||
|
||||
if ( FileNameString.Length > MAX_PATH*sizeof(WCHAR) )
|
||||
return NULL;
|
||||
return FALSE;
|
||||
|
||||
FileNameString.Buffer = (WCHAR *)FileNameW;
|
||||
FileNameString.MaximumLength = FileNameString.Length + sizeof(WCHAR);
|
||||
|
@ -108,7 +107,7 @@ WINBOOL STDCALL DeleteFileW(LPCWSTR lpFileName)
|
|||
ObjectAttributes.SecurityDescriptor = NULL;
|
||||
ObjectAttributes.SecurityQualityOfService = NULL;
|
||||
|
||||
DPRINT("FileName %w\n",FileNameW);
|
||||
DPRINT("FileName %S\n",FileNameW);
|
||||
|
||||
errCode = ZwCreateFile(&FileHandle,
|
||||
FILE_WRITE_ATTRIBUTES,
|
||||
|
@ -156,3 +155,5 @@ WINBOOL STDCALL DeleteFileW(LPCWSTR lpFileName)
|
|||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/*
|
||||
/* $Id: dir.c,v 1.22 2000/01/11 17:30:16 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/kernel32/file/dir.c
|
||||
|
@ -22,9 +23,6 @@
|
|||
#define NDEBUG
|
||||
#include <kernel32/kernel32.h>
|
||||
|
||||
/* EXTERNS ******************************************************************/
|
||||
|
||||
DWORD STDCALL GetCurrentDriveW(DWORD nBufferLength, PWSTR lpBuffer);
|
||||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
|
@ -96,7 +94,7 @@ WINBOOL STDCALL CreateDirectoryExW(LPCWSTR lpTemplateDirectory,
|
|||
WCHAR DirectoryNameW[MAX_PATH];
|
||||
UINT Len = 0;
|
||||
|
||||
DPRINT("lpTemplateDirectory %w lpNewDirectory %w lpSecurityAttributes %p\n",
|
||||
DPRINT("lpTemplateDirectory %S lpNewDirectory %S lpSecurityAttributes %p\n",
|
||||
lpTemplateDirectory, lpNewDirectory, lpSecurityAttributes);
|
||||
|
||||
if ( lpTemplateDirectory != NULL && *lpTemplateDirectory != 0 )
|
||||
|
@ -120,7 +118,8 @@ WINBOOL STDCALL CreateDirectoryExW(LPCWSTR lpTemplateDirectory,
|
|||
}
|
||||
else if (lpNewDirectory[0] == (WCHAR)'\\')
|
||||
{
|
||||
GetCurrentDriveW(MAX_PATH,PathNameW);
|
||||
GetCurrentDirectoryW(MAX_PATH,PathNameW);
|
||||
PathNameW[3] = 0;
|
||||
wcscat(PathNameW, lpNewDirectory);
|
||||
}
|
||||
else
|
||||
|
@ -160,7 +159,7 @@ WINBOOL STDCALL CreateDirectoryExW(LPCWSTR lpTemplateDirectory,
|
|||
ObjectAttributes.SecurityDescriptor = NULL;
|
||||
ObjectAttributes.SecurityQualityOfService = NULL;
|
||||
|
||||
errCode = ZwCreateFile(&DirectoryHandle,
|
||||
errCode = NtCreateFile(&DirectoryHandle,
|
||||
DIRECTORY_ALL_ACCESS,
|
||||
&ObjectAttributes,
|
||||
&IoStatusBlock,
|
||||
|
@ -211,7 +210,7 @@ WINBOOL STDCALL RemoveDirectoryW(LPCWSTR lpPathName)
|
|||
FILE_DISPOSITION_INFORMATION FileDispInfo;
|
||||
UINT Len = 0;
|
||||
|
||||
DPRINT("lpPathName %w\n",
|
||||
DPRINT("lpPathName %S\n",
|
||||
lpPathName);
|
||||
|
||||
if (lpPathName[1] == (WCHAR)':')
|
||||
|
@ -228,8 +227,8 @@ WINBOOL STDCALL RemoveDirectoryW(LPCWSTR lpPathName)
|
|||
}
|
||||
else if (lpPathName[0] == (WCHAR)'\\')
|
||||
{
|
||||
GetCurrentDriveW(MAX_PATH,PathNameW);
|
||||
wcscat(PathNameW, lpPathName);
|
||||
GetCurrentDirectoryW(MAX_PATH,PathNameW);
|
||||
wcscpy (&PathNameW[2], lpPathName);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -268,9 +267,9 @@ WINBOOL STDCALL RemoveDirectoryW(LPCWSTR lpPathName)
|
|||
ObjectAttributes.SecurityDescriptor = NULL;
|
||||
ObjectAttributes.SecurityQualityOfService = NULL;
|
||||
|
||||
DPRINT("DirectoryNameW '%w'\n", DirectoryNameW);
|
||||
DPRINT("DirectoryNameW '%S'\n", DirectoryNameW);
|
||||
|
||||
errCode = ZwCreateFile(&DirectoryHandle,
|
||||
errCode = NtCreateFile(&DirectoryHandle,
|
||||
FILE_WRITE_ATTRIBUTES, /* 0x110080 */
|
||||
&ObjectAttributes,
|
||||
&IoStatusBlock,
|
||||
|
@ -480,7 +479,7 @@ DWORD STDCALL GetFullPathNameW(LPCWSTR lpFileName,
|
|||
PWSTR p;
|
||||
PWSTR prev = NULL;
|
||||
|
||||
DPRINT("GetFullPathNameW(lpFileName %w, nBufferLength %d, lpBuffer %p, "
|
||||
DPRINT("GetFullPathNameW(lpFileName %S, nBufferLength %d, lpBuffer %p, "
|
||||
"lpFilePart %p)\n",lpFileName,nBufferLength,lpBuffer,lpFilePart);
|
||||
|
||||
if (!lpFileName || !lpBuffer)
|
||||
|
@ -524,7 +523,7 @@ DWORD STDCALL GetFullPathNameW(LPCWSTR lpFileName,
|
|||
lstrcatW(lpBuffer, lpFileName);
|
||||
}
|
||||
|
||||
DPRINT("lpBuffer %w\n",lpBuffer);
|
||||
DPRINT("lpBuffer %S\n",lpBuffer);
|
||||
|
||||
p = lpBuffer + 2;
|
||||
prev = p;
|
||||
|
@ -535,7 +534,7 @@ DWORD STDCALL GetFullPathNameW(LPCWSTR lpFileName,
|
|||
|
||||
dwDotLen = GetDotSequenceLengthW (p+1);
|
||||
DPRINT("DotSequenceLength %u\n", dwDotLen);
|
||||
DPRINT("prev %w p %w\n",prev,p);
|
||||
DPRINT("prev %S p %S\n",prev,p);
|
||||
|
||||
if (dwDotLen == 0)
|
||||
{
|
||||
|
@ -585,7 +584,7 @@ DWORD STDCALL GetFullPathNameW(LPCWSTR lpFileName,
|
|||
(*lpFilePart) = prev + 1;
|
||||
}
|
||||
|
||||
DPRINT("lpBuffer %w\n",lpBuffer);
|
||||
DPRINT("lpBuffer %S\n",lpBuffer);
|
||||
|
||||
return wcslen(lpBuffer);
|
||||
}
|
||||
|
@ -783,7 +782,6 @@ DWORD STDCALL SearchPathW(LPCWSTR lpPath,
|
|||
|
||||
DPRINT("SearchPath\n");
|
||||
|
||||
|
||||
if (lpPath == NULL)
|
||||
{
|
||||
// check the directory from which the application loaded
|
||||
|
@ -822,17 +820,11 @@ DWORD STDCALL SearchPathW(LPCWSTR lpPath,
|
|||
if ( EnvironmentBufferW[i] != 0 )
|
||||
retCode = SearchPathW(&EnvironmentBufferW[i],lpFileName, lpExtension, nBufferLength, lpBuffer, lpFilePart );
|
||||
i += lstrlenW(&EnvironmentBufferW[i]) + 1;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
HeapFree(GetProcessHeap(),0,EnvironmentBufferW);
|
||||
|
||||
|
||||
|
||||
return retCode;
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
|
@ -922,8 +914,6 @@ DWORD STDCALL SearchPathW(LPCWSTR lpPath,
|
|||
*lpFilePart = wcsrchr(lpBuffer,'\\')+1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
return lstrlenW(lpBuffer);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: find.c,v 1.22 1999/10/07 23:43:28 ekohl Exp $
|
||||
/* $Id: find.c,v 1.23 2000/01/11 17:30:16 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
|
@ -89,7 +89,7 @@ WINBOOL STDCALL InternalFindNextFile(HANDLE hFindFile,
|
|||
TRUE,
|
||||
&(IData->PatternStr),
|
||||
FALSE);
|
||||
DPRINT("Found %w\n",IData->FileInfo.FileName);
|
||||
DPRINT("Found %S\n",IData->FileInfo.FileName);
|
||||
if (Status != STATUS_SUCCESS)
|
||||
{
|
||||
return(FALSE);
|
||||
|
@ -112,7 +112,7 @@ HANDLE STDCALL InternalFindFirstFile(LPCWSTR lpFileName,
|
|||
UNICODE_STRING DirectoryNameStr;
|
||||
IO_STATUS_BLOCK IoStatusBlock;
|
||||
|
||||
DPRINT("FindFirstFileW(lpFileName %w, lpFindFileData %x)\n",
|
||||
DPRINT("FindFirstFileW(lpFileName %S, lpFindFileData %x)\n",
|
||||
lpFileName, lpFindFileData);
|
||||
|
||||
GetFullPathNameW(lpFileName, MAX_PATH, CurrentDirectory, NULL);
|
||||
|
@ -121,9 +121,9 @@ HANDLE STDCALL InternalFindFirstFile(LPCWSTR lpFileName,
|
|||
Directory[2] = '?';
|
||||
Directory[3] = '\\';
|
||||
Directory[4] = 0;
|
||||
DPRINT("Directory %w\n",Directory);
|
||||
DPRINT("Directory %S\n",Directory);
|
||||
wcscat(Directory, CurrentDirectory);
|
||||
DPRINT("Directory %w\n",Directory);
|
||||
DPRINT("Directory %S\n",Directory);
|
||||
End = wcsrchr(Directory, '\\');
|
||||
*End = 0;
|
||||
|
||||
|
@ -135,7 +135,7 @@ HANDLE STDCALL InternalFindFirstFile(LPCWSTR lpFileName,
|
|||
if (!wcscmp(Pattern, L"*.*"))
|
||||
Pattern[1] = 0;
|
||||
|
||||
DPRINT("Directory %w Pattern %w\n",Directory,Pattern);
|
||||
DPRINT("Directory %S Pattern %S\n",Directory,Pattern);
|
||||
|
||||
IData = HeapAlloc(GetProcessHeap(),
|
||||
HEAP_ZERO_MEMORY,
|
||||
|
@ -172,7 +172,7 @@ HANDLE STDCALL InternalFindFirstFile(LPCWSTR lpFileName,
|
|||
TRUE,
|
||||
&(IData->PatternStr),
|
||||
FALSE);
|
||||
DPRINT("Found %w\n",IData->FileInfo.FileName);
|
||||
DPRINT("Found %S\n",IData->FileInfo.FileName);
|
||||
|
||||
FileDataToWin32Data(lpFindFileData, IData);
|
||||
|
||||
|
@ -341,5 +341,4 @@ FindNextFileW (
|
|||
return(TRUE);
|
||||
}
|
||||
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: rw.c,v 1.7 1999/10/31 22:41:15 ea Exp $
|
||||
/* $Id: rw.c,v 1.8 2000/01/11 17:30:16 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
|
@ -19,11 +19,9 @@
|
|||
#define NDEBUG
|
||||
#include <kernel32/kernel32.h>
|
||||
|
||||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
WINBOOL STDCALL WriteFile(HANDLE hFile,
|
||||
LPCVOID lpBuffer,
|
||||
DWORD nNumberOfBytesToWrite,
|
||||
|
@ -168,8 +166,6 @@ WriteFileEx (
|
|||
IoStatusBlock = (PIO_STATUS_BLOCK)lpOverLapped;
|
||||
ptrOffset = &Offset;
|
||||
|
||||
|
||||
|
||||
errCode = NtWriteFile(hFile,
|
||||
NULL,
|
||||
ApcRoutine,
|
||||
|
@ -210,7 +206,6 @@ WINBOOL STDCALL ReadFileEx(HANDLE hFile,
|
|||
IoStatusBlock = (PIO_STATUS_BLOCK)lpOverLapped;
|
||||
ptrOffset = &Offset;
|
||||
|
||||
|
||||
errCode = NtReadFile(hFile,
|
||||
NULL,
|
||||
ApcRoutine,
|
||||
|
@ -221,7 +216,6 @@ WINBOOL STDCALL ReadFileEx(HANDLE hFile,
|
|||
ptrOffset,
|
||||
NULL);
|
||||
|
||||
|
||||
if (!NT_SUCCESS(errCode))
|
||||
{
|
||||
SetLastError(RtlNtStatusToDosError(errCode));
|
||||
|
@ -229,3 +223,5 @@ WINBOOL STDCALL ReadFileEx(HANDLE hFile,
|
|||
}
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: section.c,v 1.8 1999/12/30 01:51:37 dwelch Exp $
|
||||
/* $Id: section.c,v 1.9 2000/01/11 17:31:22 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -228,7 +228,7 @@ OpenFileMappingA (
|
|||
if ( bInheritHandle )
|
||||
Attributes = OBJ_INHERIT;
|
||||
|
||||
RtlInitAnsiString(&AnsiName, lpName);
|
||||
RtlInitAnsiString(&AnsiName, (LPSTR)lpName);
|
||||
RtlAnsiStringToUnicodeString(&UnicodeName, &AnsiName, TRUE);
|
||||
|
||||
|
||||
|
@ -294,14 +294,13 @@ FlushViewOfFile(
|
|||
DWORD dwNumberOfBytesToFlush
|
||||
)
|
||||
{
|
||||
|
||||
NTSTATUS Status;
|
||||
ULONG NumberOfBytesFlushed;
|
||||
|
||||
Status = NtFlushVirtualMemory (NtCurrentProcess (),
|
||||
lpBaseAddress, dwNumberOfBytesToFlush,
|
||||
&NumberOfBytesFlushed
|
||||
);
|
||||
(LPVOID)lpBaseAddress,
|
||||
dwNumberOfBytesToFlush,
|
||||
&NumberOfBytesFlushed);
|
||||
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: cmdline.c,v 1.9 1999/12/10 17:47:29 ekohl Exp $
|
||||
/* $Id: cmdline.c,v 1.10 2000/01/11 17:30:46 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
|
@ -11,7 +11,6 @@
|
|||
|
||||
/* INCLUDES ****************************************************************/
|
||||
|
||||
//#define UNICODE
|
||||
#include <ddk/ntddk.h>
|
||||
#include <windows.h>
|
||||
#include <kernel32/proc.h>
|
||||
|
@ -24,6 +23,7 @@
|
|||
#define NDEBUG
|
||||
#include <kernel32/kernel32.h>
|
||||
|
||||
|
||||
/* GLOBALS ******************************************************************/
|
||||
|
||||
static UNICODE_STRING CommandLineStringW;
|
||||
|
@ -40,7 +40,7 @@ static WINBOOL bCommandLineInitialized = FALSE;
|
|||
static VOID
|
||||
InitCommandLines (VOID)
|
||||
{
|
||||
PPPB Ppb;
|
||||
PRTL_USER_PROCESS_PARAMETERS Params;
|
||||
|
||||
// initialize command line buffers
|
||||
CommandLineW[0] = 0;
|
||||
|
@ -54,11 +54,11 @@ InitCommandLines (VOID)
|
|||
CommandLineStringA.MaximumLength = MAX_PATH;
|
||||
|
||||
// get command line
|
||||
Ppb = NtCurrentPeb()->Ppb;
|
||||
RtlNormalizeProcessParams (Ppb);
|
||||
Params = NtCurrentPeb()->ProcessParameters;
|
||||
RtlNormalizeProcessParams (Params);
|
||||
|
||||
RtlCopyUnicodeString (&CommandLineStringW,
|
||||
&(Ppb->CommandLine));
|
||||
&(Params->CommandLine));
|
||||
RtlUnicodeStringToAnsiString (&CommandLineStringA,
|
||||
&CommandLineStringW,
|
||||
FALSE);
|
||||
|
@ -86,7 +86,7 @@ LPWSTR STDCALL GetCommandLineW (VOID)
|
|||
InitCommandLines ();
|
||||
}
|
||||
|
||||
DPRINT ("CommandLine \'%w\'\n", CommandLineW);
|
||||
DPRINT ("CommandLine \'%S\'\n", CommandLineW);
|
||||
|
||||
return(CommandLineW);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: create.c,v 1.16 1999/12/10 17:47:29 ekohl Exp $
|
||||
/* $Id: create.c,v 1.17 2000/01/11 17:30:46 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
|
@ -236,19 +236,19 @@ HANDLE KERNEL32_MapFile(LPCWSTR lpApplicationName,
|
|||
TempApplicationName[3] = '\\';
|
||||
TempApplicationName[4] = 0;
|
||||
|
||||
DPRINT("TempApplicationName '%w'\n",TempApplicationName);
|
||||
DPRINT("TempApplicationName '%S'\n",TempApplicationName);
|
||||
|
||||
if (lpApplicationName != NULL)
|
||||
{
|
||||
wcscpy(TempFileName, lpApplicationName);
|
||||
|
||||
DPRINT("TempFileName '%w'\n",TempFileName);
|
||||
DPRINT("TempFileName '%S'\n",TempFileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
wcscpy(TempFileName, lpCommandLine);
|
||||
|
||||
DPRINT("TempFileName '%w'\n",TempFileName);
|
||||
DPRINT("TempFileName '%S'\n",TempFileName);
|
||||
|
||||
for (i=0; TempFileName[i]!=' ' && TempFileName[i] != 0; i++);
|
||||
TempFileName[i]=0;
|
||||
|
@ -268,7 +268,7 @@ HANDLE KERNEL32_MapFile(LPCWSTR lpApplicationName,
|
|||
|
||||
RtlInitUnicodeString(&ApplicationNameString, TempApplicationName);
|
||||
|
||||
DPRINT("ApplicationName %w\n",ApplicationNameString.Buffer);
|
||||
DPRINT("ApplicationName %S\n",ApplicationNameString.Buffer);
|
||||
|
||||
InitializeObjectAttributes(&ObjectAttributes,
|
||||
&ApplicationNameString,
|
||||
|
@ -349,7 +349,7 @@ static NTSTATUS
|
|||
CreatePeb (
|
||||
PPEB *PebPtr,
|
||||
HANDLE ProcessHandle,
|
||||
PPPB Ppb)
|
||||
PRTL_USER_PROCESS_PARAMETERS Ppb)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
PVOID PebBase;
|
||||
|
@ -361,7 +361,7 @@ CreatePeb (
|
|||
|
||||
/* create the PPB */
|
||||
PpbBase = (PVOID)PEB_STARTUPINFO;
|
||||
PpbSize = Ppb->TotalSize;
|
||||
PpbSize = Ppb->MaximumLength;
|
||||
Status = NtAllocateVirtualMemory(ProcessHandle,
|
||||
&PpbBase,
|
||||
0,
|
||||
|
@ -373,11 +373,11 @@ CreatePeb (
|
|||
return(Status);
|
||||
}
|
||||
|
||||
DPRINT("Ppb->TotalSize %x\n", Ppb->TotalSize);
|
||||
DPRINT("Ppb->MaximumLength %x\n", Ppb->MaximumLength);
|
||||
NtWriteVirtualMemory(ProcessHandle,
|
||||
PpbBase,
|
||||
Ppb,
|
||||
Ppb->TotalSize,
|
||||
Ppb->MaximumLength,
|
||||
&BytesWritten);
|
||||
|
||||
|
||||
|
@ -398,7 +398,7 @@ CreatePeb (
|
|||
|
||||
DPRINT("Peb created\n");
|
||||
|
||||
Peb.Ppb = (PPPB)PpbBase;
|
||||
Peb.ProcessParameters = (PRTL_USER_PROCESS_PARAMETERS)PpbBase;
|
||||
|
||||
NtWriteVirtualMemory(ProcessHandle,
|
||||
PebBase,
|
||||
|
@ -439,11 +439,11 @@ CreateProcessW (
|
|||
PROCESS_BASIC_INFORMATION ProcessBasicInfo;
|
||||
ULONG retlen;
|
||||
DWORD len = 0;
|
||||
PPPB Ppb;
|
||||
PRTL_USER_PROCESS_PARAMETERS ProcessParams;
|
||||
UNICODE_STRING CommandLine_U;
|
||||
PPEB Peb;
|
||||
|
||||
DPRINT("CreateProcessW(lpApplicationName '%w', lpCommandLine '%w')\n",
|
||||
DPRINT("CreateProcessW(lpApplicationName '%S', lpCommandLine '%S')\n",
|
||||
lpApplicationName,lpCommandLine);
|
||||
|
||||
if (lpApplicationName[1] != ':')
|
||||
|
@ -469,10 +469,10 @@ CreateProcessW (
|
|||
&CommandLine_U,
|
||||
TempCommandLine);
|
||||
|
||||
DPRINT("CommandLine_U %w\n", CommandLine_U.Buffer);
|
||||
DPRINT("CommandLine_U %S\n", CommandLine_U.Buffer);
|
||||
|
||||
RtlCreateProcessParameters (
|
||||
&Ppb,
|
||||
&ProcessParams,
|
||||
&CommandLine_U,
|
||||
NULL,
|
||||
NULL,
|
||||
|
@ -529,7 +529,7 @@ CreateProcessW (
|
|||
PAGE_READWRITE);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
RtlDestroyProcessParameters (Ppb);
|
||||
RtlDestroyProcessParameters (ProcessParams);
|
||||
SetLastError(RtlNtStatusToDosError(Status));
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -538,9 +538,9 @@ CreateProcessW (
|
|||
* Create Process Environment Block
|
||||
*/
|
||||
DPRINT("Creating peb\n");
|
||||
CreatePeb(&Peb, hProcess, Ppb);
|
||||
CreatePeb(&Peb, hProcess, ProcessParams);
|
||||
|
||||
RtlDestroyProcessParameters (Ppb);
|
||||
RtlDestroyProcessParameters (ProcessParams);
|
||||
|
||||
DPRINT("Creating thread for process\n");
|
||||
lpStartAddress = (LPTHREAD_START_ROUTINE)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: proc.c,v 1.25 1999/12/13 22:04:34 dwelch Exp $
|
||||
/* $Id: proc.c,v 1.26 2000/01/11 17:30:46 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
|
@ -23,30 +23,6 @@
|
|||
#define NDEBUG
|
||||
#include <kernel32/kernel32.h>
|
||||
|
||||
/* TYPES *********************************************************************/
|
||||
/*
|
||||
typedef struct _WSTARTUPINFO {
|
||||
DWORD cb;
|
||||
LPWSTR lpReserved;
|
||||
LPWSTR lpDesktop;
|
||||
LPWSTR lpTitle;
|
||||
DWORD dwX;
|
||||
DWORD dwY;
|
||||
DWORD dwXSize;
|
||||
DWORD dwYSize;
|
||||
DWORD dwXCountChars;
|
||||
DWORD dwYCountChars;
|
||||
DWORD dwFillAttribute;
|
||||
DWORD dwFlags;
|
||||
WORD wShowWindow;
|
||||
WORD cbReserved2;
|
||||
LPBYTE lpReserved2;
|
||||
HANDLE hStdInput;
|
||||
HANDLE hStdOutput;
|
||||
HANDLE hStdError;
|
||||
} WSTARTUPINFO, *LPWSTARTUPINFO;
|
||||
*/
|
||||
|
||||
/* GLOBALS *******************************************************************/
|
||||
|
||||
WaitForInputIdleType lpfnGlobalRegisterWaitForInputIdle;
|
||||
|
@ -320,7 +296,9 @@ GetStartupInfoW (
|
|||
LPSTARTUPINFOW lpStartupInfo
|
||||
)
|
||||
{
|
||||
PPEB pPeb = NtCurrentPeb();
|
||||
PRTL_USER_PROCESS_PARAMETERS Params;
|
||||
|
||||
Params = NtCurrentPeb()->ProcessParameters;
|
||||
|
||||
if (lpStartupInfo == NULL)
|
||||
{
|
||||
|
@ -329,24 +307,24 @@ GetStartupInfoW (
|
|||
}
|
||||
|
||||
lpStartupInfo->cb = sizeof(STARTUPINFOW);
|
||||
// lstrcpyW(lpStartupInfo->lpDesktop, pPeb->Ppb->Desktop);
|
||||
// lstrcpyW(lpStartupInfo->lpTitle, pPeb->Ppb->Title);
|
||||
lpStartupInfo->dwX = pPeb->Ppb->X;
|
||||
lpStartupInfo->dwY = pPeb->Ppb->Y;
|
||||
lpStartupInfo->dwXSize = pPeb->Ppb->XSize;
|
||||
lpStartupInfo->dwYSize = pPeb->Ppb->YSize;
|
||||
lpStartupInfo->dwXCountChars = pPeb->Ppb->XCountChars;
|
||||
lpStartupInfo->dwYCountChars = pPeb->Ppb->YCountChars;
|
||||
lpStartupInfo->dwFillAttribute = pPeb->Ppb->FillAttribute;
|
||||
lpStartupInfo->dwFlags = pPeb->Ppb->Flags;
|
||||
lpStartupInfo->wShowWindow = pPeb->Ppb->ShowWindow;
|
||||
// lpStartupInfo->lpReserved = pPeb->Ppb->lpReserved1;
|
||||
// lpStartupInfo->cbReserved2 = pPeb->Ppb->cbReserved;
|
||||
// lpStartupInfo->lpReserved2 = pPeb->Ppb->lpReserved2;
|
||||
wcscpy (lpStartupInfo->lpDesktop, Params->DesktopInfo.Buffer);
|
||||
wcscpy (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->WindowFlags;
|
||||
lpStartupInfo->wShowWindow = Params->ShowWindowFlags;
|
||||
wcscpy (lpStartupInfo->lpReserved, Params->ShellInfo.Buffer);
|
||||
// lpStartupInfo->cbReserved2 = Params->cbReserved;
|
||||
// lpStartupInfo->lpReserved2 = Params->lpReserved2;
|
||||
|
||||
lpStartupInfo->hStdInput = pPeb->Ppb->InputHandle;
|
||||
lpStartupInfo->hStdOutput = pPeb->Ppb->OutputHandle;
|
||||
lpStartupInfo->hStdError = pPeb->Ppb->ErrorHandle;
|
||||
lpStartupInfo->hStdInput = Params->StandardInput;
|
||||
lpStartupInfo->hStdOutput = Params->StandardOutput;
|
||||
lpStartupInfo->hStdError = Params->StandardError;
|
||||
}
|
||||
|
||||
|
||||
|
@ -356,9 +334,11 @@ GetStartupInfoA (
|
|||
LPSTARTUPINFOA lpStartupInfo
|
||||
)
|
||||
{
|
||||
PPEB pPeb = NtCurrentPeb();
|
||||
PRTL_USER_PROCESS_PARAMETERS Params;
|
||||
ULONG i = 0;
|
||||
|
||||
Params = NtCurrentPeb()->ProcessParameters;
|
||||
|
||||
if (lpStartupInfo == NULL)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
|
@ -384,22 +364,22 @@ GetStartupInfoA (
|
|||
}
|
||||
lpStartupInfo->lpTitle[i] = 0;
|
||||
#endif
|
||||
lpStartupInfo->dwX = pPeb->Ppb->X;
|
||||
lpStartupInfo->dwY = pPeb->Ppb->Y;
|
||||
lpStartupInfo->dwXSize = pPeb->Ppb->XSize;
|
||||
lpStartupInfo->dwYSize = pPeb->Ppb->YSize;
|
||||
lpStartupInfo->dwXCountChars = pPeb->Ppb->XCountChars;
|
||||
lpStartupInfo->dwYCountChars = pPeb->Ppb->YCountChars;
|
||||
lpStartupInfo->dwFillAttribute = pPeb->Ppb->FillAttribute;
|
||||
lpStartupInfo->dwFlags = pPeb->Ppb->Flags;
|
||||
lpStartupInfo->wShowWindow = pPeb->Ppb->ShowWindow;
|
||||
// lpStartupInfo->cbReserved2 = pPeb->Ppb->cbReserved;
|
||||
// lpStartupInfo->lpReserved = pPeb->Ppb->lpReserved1;
|
||||
// lpStartupInfo->lpReserved2 = pPeb->Ppb->lpReserved2;
|
||||
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->WindowFlags;
|
||||
lpStartupInfo->wShowWindow = Params->ShowWindowFlags;
|
||||
// lpStartupInfo->cbReserved2 = Params->cbReserved;
|
||||
// lpStartupInfo->lpReserved = Params->lpReserved1;
|
||||
// lpStartupInfo->lpReserved2 = Params->lpReserved2;
|
||||
|
||||
lpStartupInfo->hStdInput = pPeb->Ppb->InputHandle;
|
||||
lpStartupInfo->hStdOutput = pPeb->Ppb->OutputHandle;
|
||||
lpStartupInfo->hStdError = pPeb->Ppb->ErrorHandle;
|
||||
lpStartupInfo->hStdInput = Params->StandardInput;
|
||||
lpStartupInfo->hStdOutput = Params->StandardOutput;
|
||||
lpStartupInfo->hStdError = Params->StandardError;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: env.c,v 1.3 1999/12/06 00:22:43 ekohl Exp $
|
||||
/* $Id: env.c,v 1.4 2000/01/11 17:28:57 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
|
@ -16,7 +16,7 @@
|
|||
#include <internal/teb.h>
|
||||
#include <string.h>
|
||||
|
||||
//#define NDEBUG
|
||||
#define NDEBUG
|
||||
#include <ntdll/ntdll.h>
|
||||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
@ -121,8 +121,8 @@ RtlSetCurrentEnvironment (
|
|||
|
||||
RtlAcquirePebLock ();
|
||||
|
||||
EnvPtr = NtCurrentPeb()->Ppb->Environment;
|
||||
NtCurrentPeb()->Ppb->Environment = NewEnvironment;
|
||||
EnvPtr = NtCurrentPeb()->ProcessParameters->Environment;
|
||||
NtCurrentPeb()->ProcessParameters->Environment = NewEnvironment;
|
||||
|
||||
if (OldEnvironment != NULL)
|
||||
*OldEnvironment = EnvPtr;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: process.c,v 1.7 1999/12/10 17:48:34 ekohl Exp $
|
||||
/* $Id: process.c,v 1.8 2000/01/11 17:28:57 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
|
@ -161,7 +161,7 @@ RtlpMapFile(PUNICODE_STRING ApplicationName,
|
|||
*Section = NULL;
|
||||
|
||||
|
||||
DPRINT("ApplicationName %w\n", ApplicationName->Buffer);
|
||||
DPRINT("ApplicationName %S\n", ApplicationName->Buffer);
|
||||
|
||||
InitializeObjectAttributes(&ObjectAttributes,
|
||||
ApplicationName,
|
||||
|
@ -229,7 +229,7 @@ static NTSTATUS
|
|||
RtlpCreatePpbAndPeb (
|
||||
PPEB *PebPtr,
|
||||
HANDLE ProcessHandle,
|
||||
PPPB Ppb)
|
||||
PRTL_USER_PROCESS_PARAMETERS ProcessParameters)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
ULONG BytesWritten;
|
||||
|
@ -239,9 +239,9 @@ RtlpCreatePpbAndPeb (
|
|||
PVOID PpbBase;
|
||||
ULONG PpbSize;
|
||||
|
||||
/* create the PPB */
|
||||
/* create the process parameter block */
|
||||
PpbBase = (PVOID)PEB_STARTUPINFO;
|
||||
PpbSize = Ppb->TotalSize;
|
||||
PpbSize = ProcessParameters->MaximumLength;
|
||||
Status = NtAllocateVirtualMemory (
|
||||
ProcessHandle,
|
||||
&PpbBase,
|
||||
|
@ -257,8 +257,8 @@ RtlpCreatePpbAndPeb (
|
|||
NtWriteVirtualMemory (
|
||||
ProcessHandle,
|
||||
PpbBase,
|
||||
Ppb,
|
||||
Ppb->TotalSize,
|
||||
ProcessParameters,
|
||||
ProcessParameters->MaximumLength,
|
||||
&BytesWritten);
|
||||
|
||||
/* create the PEB */
|
||||
|
@ -273,7 +273,7 @@ RtlpCreatePpbAndPeb (
|
|||
PAGE_READWRITE);
|
||||
|
||||
memset (&Peb, 0, sizeof(PEB));
|
||||
Peb.Ppb = (PPPB)PpbBase;
|
||||
Peb.ProcessParameters = (PRTL_USER_PROCESS_PARAMETERS)PpbBase;
|
||||
|
||||
NtWriteVirtualMemory (
|
||||
ProcessHandle,
|
||||
|
@ -293,7 +293,7 @@ STDCALL
|
|||
RtlCreateUserProcess (
|
||||
PUNICODE_STRING CommandLine,
|
||||
ULONG Unknown1,
|
||||
PPPB Ppb,
|
||||
PRTL_USER_PROCESS_PARAMETERS Params,
|
||||
PSECURITY_DESCRIPTOR ProcessSd,
|
||||
PSECURITY_DESCRIPTOR ThreadSd,
|
||||
WINBOOL bInheritHandles,
|
||||
|
@ -316,7 +316,7 @@ RtlCreateUserProcess (
|
|||
ULONG retlen;
|
||||
PPEB Peb;
|
||||
|
||||
DPRINT ("RtlCreateUserProcess(CommandLine '%w')\n",
|
||||
DPRINT ("RtlCreateUserProcess(CommandLine '%S')\n",
|
||||
CommandLine->Buffer);
|
||||
|
||||
Status = RtlpMapFile(CommandLine,
|
||||
|
@ -340,7 +340,7 @@ RtlCreateUserProcess (
|
|||
&retlen);
|
||||
DPRINT("ProcessBasicInfo.UniqueProcessId %d\n",
|
||||
ProcessBasicInfo.UniqueProcessId);
|
||||
LocalClientId.UniqueProcess = ProcessBasicInfo.UniqueProcessId;
|
||||
LocalClientId.UniqueProcess = (HANDLE)ProcessBasicInfo.UniqueProcessId;
|
||||
|
||||
/*
|
||||
* Map NT DLL into the process
|
||||
|
@ -370,7 +370,7 @@ RtlCreateUserProcess (
|
|||
*
|
||||
*/
|
||||
DPRINT("Creating PPB and PEB\n");
|
||||
RtlpCreatePpbAndPeb (&Peb, hProcess, Ppb);
|
||||
RtlpCreatePpbAndPeb (&Peb, hProcess, Params);
|
||||
|
||||
DPRINT("Creating thread for process\n");
|
||||
lpStartAddress = (LPTHREAD_START_ROUTINE)
|
||||
|
@ -384,7 +384,7 @@ RtlCreateUserProcess (
|
|||
lpStartAddress,
|
||||
Peb,
|
||||
dwCreationFlags,
|
||||
&LocalClientId.UniqueThread,
|
||||
(LPDWORD)&LocalClientId.UniqueThread,
|
||||
NTDllSection,
|
||||
hSection,
|
||||
(PVOID)Headers.OptionalHeader.ImageBase);
|
||||
|
@ -407,7 +407,6 @@ RtlCreateUserProcess (
|
|||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
STDCALL
|
||||
RtlAcquirePebLock (VOID)
|
||||
|
@ -415,7 +414,6 @@ RtlAcquirePebLock (VOID)
|
|||
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
STDCALL
|
||||
RtlReleasePebLock (VOID)
|
||||
|
@ -426,20 +424,20 @@ RtlReleasePebLock (VOID)
|
|||
NTSTATUS
|
||||
STDCALL
|
||||
RtlCreateProcessParameters (
|
||||
PPPB *Ppb,
|
||||
PRTL_USER_PROCESS_PARAMETERS *ProcessParameters,
|
||||
PUNICODE_STRING CommandLine,
|
||||
PUNICODE_STRING LibraryPath,
|
||||
PUNICODE_STRING DllPath,
|
||||
PUNICODE_STRING CurrentDirectory,
|
||||
PUNICODE_STRING ImageName,
|
||||
PUNICODE_STRING ImagePathName,
|
||||
PVOID Environment,
|
||||
PUNICODE_STRING Title,
|
||||
PUNICODE_STRING Desktop,
|
||||
PUNICODE_STRING Reserved,
|
||||
PUNICODE_STRING WindowTitle,
|
||||
PUNICODE_STRING DesktopInfo,
|
||||
PUNICODE_STRING ShellInfo,
|
||||
PVOID Reserved2
|
||||
)
|
||||
{
|
||||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
PPPB Param = NULL;
|
||||
PRTL_USER_PROCESS_PARAMETERS Params = NULL;
|
||||
ULONG RegionSize = 0;
|
||||
ULONG DataSize = 0;
|
||||
PWCHAR Dest;
|
||||
|
@ -449,39 +447,36 @@ RtlCreateProcessParameters (
|
|||
RtlAcquirePebLock ();
|
||||
|
||||
/* size of process parameter block */
|
||||
DataSize = sizeof (PPB);
|
||||
|
||||
/* size of (reserved) buffer */
|
||||
DataSize += (256 * sizeof(WCHAR));
|
||||
DataSize = sizeof (RTL_USER_PROCESS_PARAMETERS);
|
||||
|
||||
/* size of current directory buffer */
|
||||
DataSize += (MAX_PATH * sizeof(WCHAR));
|
||||
|
||||
/* add string lengths */
|
||||
if (LibraryPath != NULL)
|
||||
DataSize += (LibraryPath->Length + sizeof(WCHAR));
|
||||
if (DllPath != NULL)
|
||||
DataSize += (DllPath->Length + sizeof(WCHAR));
|
||||
|
||||
if (ImagePathName != NULL)
|
||||
DataSize += (ImagePathName->Length + sizeof(WCHAR));
|
||||
|
||||
if (CommandLine != NULL)
|
||||
DataSize += (CommandLine->Length + sizeof(WCHAR));
|
||||
|
||||
if (ImageName != NULL)
|
||||
DataSize += (ImageName->Length + sizeof(WCHAR));
|
||||
if (WindowTitle != NULL)
|
||||
DataSize += (WindowTitle->Length + sizeof(WCHAR));
|
||||
|
||||
if (Title != NULL)
|
||||
DataSize += (Title->Length + sizeof(WCHAR));
|
||||
if (DesktopInfo != NULL)
|
||||
DataSize += (DesktopInfo->Length + sizeof(WCHAR));
|
||||
|
||||
if (Desktop != NULL)
|
||||
DataSize += (Desktop->Length + sizeof(WCHAR));
|
||||
|
||||
if (Reserved != NULL)
|
||||
DataSize += (Reserved->Length + sizeof(WCHAR));
|
||||
if (ShellInfo != NULL)
|
||||
DataSize += (ShellInfo->Length + sizeof(WCHAR));
|
||||
|
||||
/* Calculate the required block size */
|
||||
RegionSize = ROUNDUP(DataSize, PAGESIZE);
|
||||
|
||||
Status = NtAllocateVirtualMemory (
|
||||
NtCurrentProcess (),
|
||||
(PVOID*)&Param,
|
||||
(PVOID*)&Params,
|
||||
0,
|
||||
&RegionSize,
|
||||
MEM_COMMIT,
|
||||
|
@ -492,25 +487,28 @@ RtlCreateProcessParameters (
|
|||
return Status;
|
||||
}
|
||||
|
||||
DPRINT ("Ppb allocated\n");
|
||||
DPRINT ("Process parameter block allocated\n");
|
||||
|
||||
Param->TotalSize = RegionSize;
|
||||
Param->DataSize = DataSize;
|
||||
Param->Normalized = TRUE;
|
||||
Param->Environment = Environment;
|
||||
// Param->Unknown1 =
|
||||
// Param->Unknown2 =
|
||||
// Param->Unknown3 =
|
||||
// Param->Unknown4 =
|
||||
Params->MaximumLength = RegionSize;
|
||||
Params->Length = DataSize;
|
||||
Params->Flags = TRUE;
|
||||
Params->Environment = Environment;
|
||||
// Params->Unknown1 =
|
||||
// Params->Unknown2 =
|
||||
// Params->Unknown3 =
|
||||
// Params->Unknown4 =
|
||||
|
||||
/* copy current directory */
|
||||
Dest = (PWCHAR)(((PBYTE)Param) + sizeof(PPB) + (256 * sizeof(WCHAR)));
|
||||
Dest = (PWCHAR)(((PBYTE)Params) +
|
||||
sizeof(RTL_USER_PROCESS_PARAMETERS));
|
||||
|
||||
Param->CurrentDirectory.Buffer = Dest;
|
||||
Params->CurrentDirectory.DosPath.Buffer = Dest;
|
||||
if (CurrentDirectory != NULL)
|
||||
{
|
||||
Param->CurrentDirectory.Length = CurrentDirectory->Length;
|
||||
Param->CurrentDirectory.MaximumLength = CurrentDirectory->Length + sizeof(WCHAR);
|
||||
Params->CurrentDirectory.DosPath.Length =
|
||||
CurrentDirectory->Length;
|
||||
Params->CurrentDirectory.DosPath.MaximumLength =
|
||||
CurrentDirectory->Length + sizeof(WCHAR);
|
||||
memcpy (Dest,
|
||||
CurrentDirectory->Buffer,
|
||||
CurrentDirectory->Length);
|
||||
|
@ -518,100 +516,107 @@ RtlCreateProcessParameters (
|
|||
}
|
||||
*Dest = 0;
|
||||
|
||||
Dest = (PWCHAR)(((PBYTE)Param) + sizeof(PPB) +
|
||||
(256 * sizeof(WCHAR)) + (MAX_PATH * sizeof(WCHAR)));
|
||||
Dest = (PWCHAR)(((PBYTE)Params) +
|
||||
sizeof(RTL_USER_PROCESS_PARAMETERS) +
|
||||
(MAX_PATH * sizeof(WCHAR)));
|
||||
|
||||
/* copy library path */
|
||||
Param->LibraryPath.Buffer = Dest;
|
||||
if (LibraryPath != NULL)
|
||||
/* copy dll path */
|
||||
Params->DllPath.Buffer = Dest;
|
||||
if (DllPath != NULL)
|
||||
{
|
||||
Param->LibraryPath.Length = LibraryPath->Length;
|
||||
Params->DllPath.Length = DllPath->Length;
|
||||
memcpy (Dest,
|
||||
LibraryPath->Buffer,
|
||||
LibraryPath->Length);
|
||||
Dest = (PWCHAR)(((PBYTE)Dest) + LibraryPath->Length);
|
||||
DllPath->Buffer,
|
||||
DllPath->Length);
|
||||
Dest = (PWCHAR)(((PBYTE)Dest) + DllPath->Length);
|
||||
}
|
||||
Param->LibraryPath.MaximumLength = Param->LibraryPath.Length + sizeof(WCHAR);
|
||||
Params->DllPath.MaximumLength =
|
||||
Params->DllPath.Length + sizeof(WCHAR);
|
||||
*Dest = 0;
|
||||
Dest++;
|
||||
|
||||
/* copy image path name */
|
||||
Params->ImagePathName.Buffer = Dest;
|
||||
if (ImagePathName != NULL)
|
||||
{
|
||||
Params->ImagePathName.Length = ImagePathName->Length;
|
||||
memcpy (Dest,
|
||||
ImagePathName->Buffer,
|
||||
ImagePathName->Length);
|
||||
Dest = (PWCHAR)(((PBYTE)Dest) + ImagePathName->Length);
|
||||
}
|
||||
Params->ImagePathName.MaximumLength =
|
||||
Params->ImagePathName.Length + sizeof(WCHAR);
|
||||
*Dest = 0;
|
||||
Dest++;
|
||||
|
||||
/* copy command line */
|
||||
Param->CommandLine.Buffer = Dest;
|
||||
Params->CommandLine.Buffer = Dest;
|
||||
if (CommandLine != NULL)
|
||||
{
|
||||
Param->CommandLine.Length = CommandLine->Length;
|
||||
Params->CommandLine.Length = CommandLine->Length;
|
||||
memcpy (Dest,
|
||||
CommandLine->Buffer,
|
||||
CommandLine->Length);
|
||||
Dest = (PWCHAR)(((PBYTE)Dest) + CommandLine->Length);
|
||||
}
|
||||
Param->CommandLine.MaximumLength = Param->CommandLine.Length + sizeof(WCHAR);
|
||||
Params->CommandLine.MaximumLength =
|
||||
Params->CommandLine.Length + sizeof(WCHAR);
|
||||
*Dest = 0;
|
||||
Dest++;
|
||||
|
||||
/* copy image name */
|
||||
Param->ImageName.Buffer = Dest;
|
||||
if (ImageName != NULL)
|
||||
/* copy window title */
|
||||
Params->WindowTitle.Buffer = Dest;
|
||||
if (WindowTitle != NULL)
|
||||
{
|
||||
Param->ImageName.Length = ImageName->Length;
|
||||
Params->WindowTitle.Length = WindowTitle->Length;
|
||||
memcpy (Dest,
|
||||
ImageName->Buffer,
|
||||
ImageName->Length);
|
||||
Dest = (PWCHAR)(((PBYTE)Dest) + ImageName->Length);
|
||||
WindowTitle->Buffer,
|
||||
WindowTitle->Length);
|
||||
Dest = (PWCHAR)(((PBYTE)Dest) + WindowTitle->Length);
|
||||
}
|
||||
Param->ImageName.MaximumLength = Param->ImageName.Length + sizeof(WCHAR);
|
||||
Params->WindowTitle.MaximumLength =
|
||||
Params->WindowTitle.Length + sizeof(WCHAR);
|
||||
*Dest = 0;
|
||||
Dest++;
|
||||
|
||||
/* copy title */
|
||||
Param->Title.Buffer = Dest;
|
||||
if (Title != NULL)
|
||||
/* copy desktop info */
|
||||
Params->DesktopInfo.Buffer = Dest;
|
||||
if (DesktopInfo != NULL)
|
||||
{
|
||||
Param->Title.Length = Title->Length;
|
||||
Params->DesktopInfo.Length = DesktopInfo->Length;
|
||||
memcpy (Dest,
|
||||
Title->Buffer,
|
||||
Title->Length);
|
||||
Dest = (PWCHAR)(((PBYTE)Dest) + Title->Length);
|
||||
DesktopInfo->Buffer,
|
||||
DesktopInfo->Length);
|
||||
Dest = (PWCHAR)(((PBYTE)Dest) + DesktopInfo->Length);
|
||||
}
|
||||
Param->Title.MaximumLength = Param->Title.Length + sizeof(WCHAR);
|
||||
Params->DesktopInfo.MaximumLength =
|
||||
Params->DesktopInfo.Length + sizeof(WCHAR);
|
||||
*Dest = 0;
|
||||
Dest++;
|
||||
|
||||
/* copy desktop */
|
||||
Param->Desktop.Buffer = Dest;
|
||||
if (Desktop != NULL)
|
||||
/* copy shell info */
|
||||
Params->ShellInfo.Buffer = Dest;
|
||||
if (ShellInfo != NULL)
|
||||
{
|
||||
Param->Desktop.Length = Desktop->Length;
|
||||
Params->ShellInfo.Length = ShellInfo->Length;
|
||||
memcpy (Dest,
|
||||
Desktop->Buffer,
|
||||
Desktop->Length);
|
||||
Dest = (PWCHAR)(((PBYTE)Dest) + Desktop->Length);
|
||||
ShellInfo->Buffer,
|
||||
ShellInfo->Length);
|
||||
Dest = (PWCHAR)(((PBYTE)Dest) + ShellInfo->Length);
|
||||
}
|
||||
Param->Desktop.MaximumLength = Param->Desktop.Length + sizeof(WCHAR);
|
||||
Params->ShellInfo.MaximumLength =
|
||||
Params->ShellInfo.Length + sizeof(WCHAR);
|
||||
*Dest = 0;
|
||||
Dest++;
|
||||
|
||||
/* copy reserved */
|
||||
Param->Reserved.Buffer = Dest;
|
||||
if (Reserved != NULL)
|
||||
{
|
||||
Param->Reserved.Length = Reserved->Length;
|
||||
memcpy (Dest,
|
||||
Reserved->Buffer,
|
||||
Reserved->Length);
|
||||
Dest = (PWCHAR)(((PBYTE)Dest) + Reserved->Length);
|
||||
}
|
||||
Param->Reserved.MaximumLength = Param->Reserved.Length + sizeof(WCHAR);
|
||||
*Dest = 0;
|
||||
Dest++;
|
||||
/* set runtime data */
|
||||
Params->RuntimeData.Length = 0;
|
||||
Params->RuntimeData.MaximumLength = 0;
|
||||
Params->RuntimeData.Buffer = NULL;
|
||||
|
||||
/* set reserved2 */
|
||||
Param->Reserved2.Length = 0;
|
||||
Param->Reserved2.MaximumLength = 0;
|
||||
Param->Reserved2.Buffer = NULL;
|
||||
|
||||
RtlDeNormalizeProcessParams (Param);
|
||||
*Ppb = Param;
|
||||
RtlDeNormalizeProcessParams (Params);
|
||||
*ProcessParameters = Params;
|
||||
RtlReleasePebLock ();
|
||||
|
||||
return Status;
|
||||
|
@ -620,13 +625,13 @@ RtlCreateProcessParameters (
|
|||
VOID
|
||||
STDCALL
|
||||
RtlDestroyProcessParameters (
|
||||
PPPB Ppb
|
||||
PRTL_USER_PROCESS_PARAMETERS ProcessParameters
|
||||
)
|
||||
{
|
||||
ULONG RegionSize = 0;
|
||||
|
||||
NtFreeVirtualMemory (NtCurrentProcess (),
|
||||
(PVOID)Ppb,
|
||||
(PVOID)ProcessParameters,
|
||||
&RegionSize,
|
||||
MEM_RELEASE);
|
||||
}
|
||||
|
@ -637,65 +642,65 @@ RtlDestroyProcessParameters (
|
|||
VOID
|
||||
STDCALL
|
||||
RtlDeNormalizeProcessParams (
|
||||
PPPB Ppb
|
||||
PRTL_USER_PROCESS_PARAMETERS Params
|
||||
)
|
||||
{
|
||||
if (Ppb == NULL)
|
||||
if (Params == NULL)
|
||||
return;
|
||||
|
||||
if (Ppb->Normalized == FALSE)
|
||||
if (Params->Flags == FALSE)
|
||||
return;
|
||||
|
||||
if (Ppb->CurrentDirectory.Buffer != NULL)
|
||||
if (Params->CurrentDirectory.DosPath.Buffer != NULL)
|
||||
{
|
||||
Ppb->CurrentDirectory.Buffer =
|
||||
(PWSTR)((ULONG)Ppb->CurrentDirectory.Buffer -
|
||||
(ULONG)Ppb);
|
||||
Params->CurrentDirectory.DosPath.Buffer =
|
||||
(PWSTR)((ULONG)Params->CurrentDirectory.DosPath.Buffer -
|
||||
(ULONG)Params);
|
||||
}
|
||||
|
||||
if (Ppb->LibraryPath.Buffer != NULL)
|
||||
if (Params->DllPath.Buffer != NULL)
|
||||
{
|
||||
Ppb->LibraryPath.Buffer =
|
||||
(PWSTR)((ULONG)Ppb->LibraryPath.Buffer -
|
||||
(ULONG)Ppb);
|
||||
Params->DllPath.Buffer =
|
||||
(PWSTR)((ULONG)Params->DllPath.Buffer -
|
||||
(ULONG)Params);
|
||||
}
|
||||
|
||||
if (Ppb->CommandLine.Buffer != NULL)
|
||||
if (Params->ImagePathName.Buffer != NULL)
|
||||
{
|
||||
Ppb->CommandLine.Buffer =
|
||||
(PWSTR)((ULONG)Ppb->CommandLine.Buffer -
|
||||
(ULONG)Ppb);
|
||||
Params->ImagePathName.Buffer =
|
||||
(PWSTR)((ULONG)Params->ImagePathName.Buffer -
|
||||
(ULONG)Params);
|
||||
}
|
||||
|
||||
if (Ppb->ImageName.Buffer != NULL)
|
||||
if (Params->CommandLine.Buffer != NULL)
|
||||
{
|
||||
Ppb->ImageName.Buffer =
|
||||
(PWSTR)((ULONG)Ppb->ImageName.Buffer -
|
||||
(ULONG)Ppb);
|
||||
Params->CommandLine.Buffer =
|
||||
(PWSTR)((ULONG)Params->CommandLine.Buffer -
|
||||
(ULONG)Params);
|
||||
}
|
||||
|
||||
if (Ppb->Title.Buffer != NULL)
|
||||
if (Params->WindowTitle.Buffer != NULL)
|
||||
{
|
||||
Ppb->Title.Buffer =
|
||||
(PWSTR)((ULONG)Ppb->Title.Buffer -
|
||||
(ULONG)Ppb);
|
||||
Params->WindowTitle.Buffer =
|
||||
(PWSTR)((ULONG)Params->WindowTitle.Buffer -
|
||||
(ULONG)Params);
|
||||
}
|
||||
|
||||
if (Ppb->Desktop.Buffer != NULL)
|
||||
if (Params->DesktopInfo.Buffer != NULL)
|
||||
{
|
||||
Ppb->Desktop.Buffer =
|
||||
(PWSTR)((ULONG)Ppb->Desktop.Buffer -
|
||||
(ULONG)Ppb);
|
||||
Params->DesktopInfo.Buffer =
|
||||
(PWSTR)((ULONG)Params->DesktopInfo.Buffer -
|
||||
(ULONG)Params);
|
||||
}
|
||||
|
||||
if (Ppb->Reserved.Buffer != NULL)
|
||||
if (Params->ShellInfo.Buffer != NULL)
|
||||
{
|
||||
Ppb->Reserved.Buffer =
|
||||
(PWSTR)((ULONG)Ppb->Reserved.Buffer -
|
||||
(ULONG)Ppb);
|
||||
Params->ShellInfo.Buffer =
|
||||
(PWSTR)((ULONG)Params->ShellInfo.Buffer -
|
||||
(ULONG)Params);
|
||||
}
|
||||
|
||||
Ppb->Normalized = FALSE;
|
||||
Params->Flags = FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -704,65 +709,65 @@ RtlDeNormalizeProcessParams (
|
|||
VOID
|
||||
STDCALL
|
||||
RtlNormalizeProcessParams (
|
||||
PPPB Ppb
|
||||
PRTL_USER_PROCESS_PARAMETERS Params
|
||||
)
|
||||
{
|
||||
if (Ppb == NULL)
|
||||
if (Params == NULL)
|
||||
return;
|
||||
|
||||
if (Ppb->Normalized == TRUE)
|
||||
if (Params->Flags == TRUE) // & PPF_NORMALIZED
|
||||
return;
|
||||
|
||||
if (Ppb->CurrentDirectory.Buffer != NULL)
|
||||
if (Params->CurrentDirectory.DosPath.Buffer != NULL)
|
||||
{
|
||||
Ppb->CurrentDirectory.Buffer =
|
||||
(PWSTR)((ULONG)Ppb->CurrentDirectory.Buffer +
|
||||
(ULONG)Ppb);
|
||||
Params->CurrentDirectory.DosPath.Buffer =
|
||||
(PWSTR)((ULONG)Params->CurrentDirectory.DosPath.Buffer +
|
||||
(ULONG)Params);
|
||||
}
|
||||
|
||||
if (Ppb->LibraryPath.Buffer != NULL)
|
||||
if (Params->DllPath.Buffer != NULL)
|
||||
{
|
||||
Ppb->LibraryPath.Buffer =
|
||||
(PWSTR)((ULONG)Ppb->LibraryPath.Buffer +
|
||||
(ULONG)Ppb);
|
||||
Params->DllPath.Buffer =
|
||||
(PWSTR)((ULONG)Params->DllPath.Buffer +
|
||||
(ULONG)Params);
|
||||
}
|
||||
|
||||
if (Ppb->CommandLine.Buffer != NULL)
|
||||
if (Params->ImagePathName.Buffer != NULL)
|
||||
{
|
||||
Ppb->CommandLine.Buffer =
|
||||
(PWSTR)((ULONG)Ppb->CommandLine.Buffer +
|
||||
(ULONG)Ppb);
|
||||
Params->ImagePathName.Buffer =
|
||||
(PWSTR)((ULONG)Params->ImagePathName.Buffer +
|
||||
(ULONG)Params);
|
||||
}
|
||||
|
||||
if (Ppb->ImageName.Buffer != NULL)
|
||||
if (Params->CommandLine.Buffer != NULL)
|
||||
{
|
||||
Ppb->ImageName.Buffer =
|
||||
(PWSTR)((ULONG)Ppb->ImageName.Buffer +
|
||||
(ULONG)Ppb);
|
||||
Params->CommandLine.Buffer =
|
||||
(PWSTR)((ULONG)Params->CommandLine.Buffer +
|
||||
(ULONG)Params);
|
||||
}
|
||||
|
||||
if (Ppb->Title.Buffer != NULL)
|
||||
if (Params->WindowTitle.Buffer != NULL)
|
||||
{
|
||||
Ppb->Title.Buffer =
|
||||
(PWSTR)((ULONG)Ppb->Title.Buffer +
|
||||
(ULONG)Ppb);
|
||||
Params->WindowTitle.Buffer =
|
||||
(PWSTR)((ULONG)Params->WindowTitle.Buffer +
|
||||
(ULONG)Params);
|
||||
}
|
||||
|
||||
if (Ppb->Desktop.Buffer != NULL)
|
||||
if (Params->DesktopInfo.Buffer != NULL)
|
||||
{
|
||||
Ppb->Desktop.Buffer =
|
||||
(PWSTR)((ULONG)Ppb->Desktop.Buffer +
|
||||
(ULONG)Ppb);
|
||||
Params->DesktopInfo.Buffer =
|
||||
(PWSTR)((ULONG)Params->DesktopInfo.Buffer +
|
||||
(ULONG)Params);
|
||||
}
|
||||
|
||||
if (Ppb->Reserved.Buffer != NULL)
|
||||
if (Params->ShellInfo.Buffer != NULL)
|
||||
{
|
||||
Ppb->Reserved.Buffer =
|
||||
(PWSTR)((ULONG)Ppb->Reserved.Buffer +
|
||||
(ULONG)Ppb);
|
||||
Params->ShellInfo.Buffer =
|
||||
(PWSTR)((ULONG)Params->ShellInfo.Buffer +
|
||||
(ULONG)Params);
|
||||
}
|
||||
|
||||
Ppb->Normalized = TRUE;
|
||||
Params->Flags = TRUE; // |= PPF_NORMALIZED;
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: swprintf.c,v 1.1 2000/01/10 20:33:06 ekohl Exp $
|
||||
/* $Id: swprintf.c,v 1.2 2000/01/11 17:29:17 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -153,7 +153,7 @@ int _vsnwprintf(wchar_t *buf, size_t cnt, const wchar_t *fmt, va_list args)
|
|||
int i, base;
|
||||
wchar_t * str;
|
||||
const wchar_t *s;
|
||||
// const short int* sw; /* needed for '%w' only */
|
||||
// const short int* sw; /* needed for '%S' only */
|
||||
|
||||
int flags; /* flags to number() */
|
||||
|
||||
|
@ -224,7 +224,7 @@ int _vsnwprintf(wchar_t *buf, size_t cnt, const wchar_t *fmt, va_list args)
|
|||
if (!(flags & LEFT))
|
||||
while (--field_width > 0)
|
||||
*str++ = L' ';
|
||||
*str++ = (wchar_t) va_arg(args, int);
|
||||
*str++ = (wchar_t) va_arg(args, wchar_t);
|
||||
while (--field_width > 0)
|
||||
*str++ = L' ';
|
||||
continue;
|
||||
|
|
|
@ -1,3 +1,18 @@
|
|||
/* $Id: vsprintf.c,v 1.6 2000/01/11 17:29:17 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: lib/ntdll/stdio/vsprintf.c
|
||||
* PURPOSE: Single byte printf functions
|
||||
* PROGRAMMERS: David Welch
|
||||
* Eric Kohl
|
||||
*
|
||||
* TODO:
|
||||
* - Implement maximum length (cnt) in _vsnprintf().
|
||||
* - Add MS specific types 'C', 'S', 'Z'...
|
||||
* - Add MS specific qualifier 'I64'.
|
||||
*/
|
||||
|
||||
/*
|
||||
* linux/lib/vsprintf.c
|
||||
*
|
||||
|
@ -9,17 +24,6 @@
|
|||
* Wirzenius wrote this portably, Torvalds fucked it up :-)
|
||||
*/
|
||||
|
||||
/*
|
||||
* Appropiated for the reactos kernel, March 1998 -- David Welch
|
||||
*
|
||||
* TODO:
|
||||
* - Implement maximum length (cnt) in _vsnprintf().
|
||||
* - Add MS specific types 'C', 'S', 'Z'...
|
||||
* - Add long long support ('ll' qualifier).
|
||||
* - Add MS specific qualifier 'I64'.
|
||||
* Eric Kohl
|
||||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
|
@ -193,7 +197,8 @@ int _vsnprintf(char *buf, size_t cnt, const char *fmt, va_list args)
|
|||
|
||||
/* get the conversion qualifier */
|
||||
qualifier = -1;
|
||||
if (*fmt == 'h' || *fmt == 'l' || *fmt == 'L') {
|
||||
if (*fmt == 'h' || *fmt == 'l' || *fmt == 'L' /*|| *fmt == 'w'*/ ||
|
||||
(*fmt == 'I' && *(fmt+1) == '6' && *(fmt+2) == '4')) {
|
||||
qualifier = *fmt;
|
||||
++fmt;
|
||||
}
|
||||
|
@ -206,6 +211,9 @@ int _vsnprintf(char *buf, size_t cnt, const char *fmt, va_list args)
|
|||
if (!(flags & LEFT))
|
||||
while (--field_width > 0)
|
||||
*str++ = ' ';
|
||||
if (qualifier == 'l' /*|| qualifier == 'w'*/)
|
||||
*str++ = (unsigned char) va_arg(args, wchar_t);
|
||||
else
|
||||
*str++ = (unsigned char) va_arg(args, int);
|
||||
while (--field_width > 0)
|
||||
*str++ = ' ';
|
||||
|
@ -215,6 +223,9 @@ int _vsnprintf(char *buf, size_t cnt, const char *fmt, va_list args)
|
|||
if (!(flags & LEFT))
|
||||
while (--field_width > 0)
|
||||
*str++ = ' ';
|
||||
if (qualifier == 'h')
|
||||
*str++ = (unsigned char) va_arg(args, int);
|
||||
else
|
||||
*str++ = (unsigned char) va_arg(args, wchar_t);
|
||||
while (--field_width > 0)
|
||||
*str++ = ' ';
|
||||
|
@ -265,6 +276,12 @@ int _vsnprintf(char *buf, size_t cnt, const char *fmt, va_list args)
|
|||
}
|
||||
continue;
|
||||
|
||||
case 'Z':
|
||||
if (qualifier == 'w') {
|
||||
} else {
|
||||
}
|
||||
continue;
|
||||
|
||||
case 'p':
|
||||
if (field_width == -1) {
|
||||
field_width = 2 * sizeof(void *);
|
||||
|
|
|
@ -42,21 +42,21 @@
|
|||
|
||||
static NTSTATUS
|
||||
LdrCreatePpb (
|
||||
PPPB *PpbPtr,
|
||||
PRTL_USER_PROCESS_PARAMETERS *PpbPtr,
|
||||
HANDLE ProcessHandle
|
||||
)
|
||||
{
|
||||
RTL_USER_PROCESS_PARAMETERS Ppb;
|
||||
PVOID PpbBase;
|
||||
ULONG PpbSize;
|
||||
PPB Ppb;
|
||||
ULONG BytesWritten;
|
||||
NTSTATUS Status;
|
||||
|
||||
/* Create process parameters block (PPB)*/
|
||||
PpbBase = (PVOID)PEB_STARTUPINFO;
|
||||
PpbSize = sizeof (PPB);
|
||||
PpbSize = sizeof (RTL_USER_PROCESS_PARAMETERS);
|
||||
|
||||
Status = ZwAllocateVirtualMemory (
|
||||
Status = NtAllocateVirtualMemory (
|
||||
ProcessHandle,
|
||||
(PVOID*)&PpbBase,
|
||||
0,
|
||||
|
@ -66,19 +66,19 @@ LdrCreatePpb (
|
|||
);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DbgPrint ("Ppb allocation failed \n");
|
||||
DbgPrint ("Process Parameters allocation failed \n");
|
||||
DbgPrintErrorMessage (Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* initialize the ppb */
|
||||
memset (&Ppb, 0, sizeof(PPB));
|
||||
memset (&Ppb, 0, sizeof(RTL_USER_PROCESS_PARAMETERS));
|
||||
|
||||
ZwWriteVirtualMemory (
|
||||
NtWriteVirtualMemory (
|
||||
ProcessHandle,
|
||||
PpbBase,
|
||||
&Ppb,
|
||||
sizeof(PPB),
|
||||
sizeof(RTL_USER_PROCESS_PARAMETERS),
|
||||
&BytesWritten);
|
||||
|
||||
*PpbPtr = PpbBase;
|
||||
|
@ -91,7 +91,7 @@ static NTSTATUS
|
|||
LdrCreatePeb (
|
||||
PPEB *PebPtr,
|
||||
HANDLE ProcessHandle,
|
||||
PPPB Ppb
|
||||
PRTL_USER_PROCESS_PARAMETERS Ppb
|
||||
)
|
||||
{
|
||||
PPEB PebBase;
|
||||
|
@ -119,7 +119,7 @@ LdrCreatePeb (
|
|||
|
||||
/* initialize the peb */
|
||||
memset(&Peb, 0, sizeof Peb);
|
||||
Peb.Ppb = Ppb;
|
||||
Peb.ProcessParameters = Ppb;
|
||||
|
||||
ZwWriteVirtualMemory (
|
||||
ProcessHandle,
|
||||
|
@ -177,7 +177,7 @@ NTSTATUS LdrLoadImage(HANDLE ProcessHandle,
|
|||
|
||||
WCHAR TmpNameBuffer [MAX_PATH];
|
||||
|
||||
PPPB Ppb;
|
||||
PRTL_USER_PROCESS_PARAMETERS Ppb;
|
||||
PPEB Peb;
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: init.c,v 1.8 1999/12/30 01:51:42 dwelch Exp $
|
||||
/* $Id: init.c,v 1.9 2000/01/11 17:32:13 ekohl Exp $
|
||||
*
|
||||
* init.c - Session Manager initialization
|
||||
*
|
||||
|
@ -74,7 +74,7 @@ InitSessionManager (
|
|||
UNICODE_STRING UnicodeString;
|
||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
UNICODE_STRING CmdLineW;
|
||||
PPPB Ppb;
|
||||
PRTL_USER_PROCESS_PARAMETERS ProcessParameters;
|
||||
|
||||
|
||||
/* Create the "\SmApiPort" object (LPC) */
|
||||
|
@ -174,7 +174,7 @@ InitSessionManager (
|
|||
RtlInitUnicodeString (&UnicodeString,
|
||||
L"\\??\\C:\\reactos\\system32\\csrss.exe");
|
||||
|
||||
RtlCreateProcessParameters (&Ppb,
|
||||
RtlCreateProcessParameters (&ProcessParameters,
|
||||
&UnicodeString,
|
||||
NULL,
|
||||
NULL,
|
||||
|
@ -187,7 +187,7 @@ InitSessionManager (
|
|||
|
||||
Status = RtlCreateUserProcess (&UnicodeString,
|
||||
0,
|
||||
Ppb,
|
||||
ProcessParameters,
|
||||
NULL,
|
||||
NULL,
|
||||
FALSE,
|
||||
|
@ -202,7 +202,7 @@ InitSessionManager (
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
RtlDestroyProcessParameters (Ppb);
|
||||
RtlDestroyProcessParameters (ProcessParameters);
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -216,7 +216,7 @@ InitSessionManager (
|
|||
L"\\??\\C:\\reactos\\system32\\winlogon.exe");
|
||||
#endif
|
||||
|
||||
RtlCreateProcessParameters (&Ppb,
|
||||
RtlCreateProcessParameters (&ProcessParameters,
|
||||
&UnicodeString,
|
||||
NULL,
|
||||
NULL,
|
||||
|
@ -230,7 +230,7 @@ InitSessionManager (
|
|||
|
||||
Status = RtlCreateUserProcess (&UnicodeString,
|
||||
0,
|
||||
Ppb,
|
||||
ProcessParameters,
|
||||
NULL,
|
||||
NULL,
|
||||
FALSE,
|
||||
|
@ -239,7 +239,7 @@ InitSessionManager (
|
|||
&Children[CHILD_WINLOGON],
|
||||
NULL);
|
||||
|
||||
RtlDestroyProcessParameters (Ppb);
|
||||
RtlDestroyProcessParameters (ProcessParameters);
|
||||
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue