mirror of
https://github.com/reactos/reactos.git
synced 2025-08-04 16:35:49 +00:00
[KERNEL32]: Reimplement BasePushProcessParameters for future extensibility, also cleanup some code paths and fix a few bugs.
[KERNEL32]: Add some more SXS and CSRSS structures. svn path=/trunk/; revision=54986
This commit is contained in:
parent
e7f2a28453
commit
3b7a2e8b40
4 changed files with 278 additions and 119 deletions
|
@ -774,57 +774,33 @@ BasepDuplicateAndWriteHandle(IN HANDLE ProcessHandle,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
BOOLEAN
|
||||||
WINAPI
|
WINAPI
|
||||||
BasepCopyHandles(IN PRTL_USER_PROCESS_PARAMETERS Params,
|
BasePushProcessParameters(IN ULONG ParameterFlags,
|
||||||
IN PRTL_USER_PROCESS_PARAMETERS PebParams,
|
IN HANDLE ProcessHandle,
|
||||||
IN BOOL InheritHandles)
|
IN PPEB RemotePeb,
|
||||||
{
|
IN LPCWSTR ApplicationPathName,
|
||||||
DPRINT("BasepCopyHandles %p %p, %d\n", Params, PebParams, InheritHandles);
|
|
||||||
|
|
||||||
/* Copy the handle if we are inheriting or if it's a console handle */
|
|
||||||
if ((InheritHandles) || (IsConsoleHandle(PebParams->StandardInput)))
|
|
||||||
{
|
|
||||||
Params->StandardInput = PebParams->StandardInput;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((InheritHandles) || (IsConsoleHandle(PebParams->StandardOutput)))
|
|
||||||
{
|
|
||||||
Params->StandardOutput = PebParams->StandardOutput;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((InheritHandles) || (IsConsoleHandle(PebParams->StandardError)))
|
|
||||||
{
|
|
||||||
Params->StandardError = PebParams->StandardError;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
NTSTATUS
|
|
||||||
WINAPI
|
|
||||||
BasePushProcessParameters(IN HANDLE ProcessHandle,
|
|
||||||
IN PPEB Peb,
|
|
||||||
IN LPWSTR ApplicationPathName,
|
|
||||||
IN LPWSTR lpCurrentDirectory,
|
IN LPWSTR lpCurrentDirectory,
|
||||||
IN LPWSTR lpCommandLine,
|
IN LPWSTR lpCommandLine,
|
||||||
IN LPVOID lpEnvironment,
|
IN LPVOID lpEnvironment,
|
||||||
IN SIZE_T EnvSize,
|
|
||||||
IN LPSTARTUPINFOW StartupInfo,
|
IN LPSTARTUPINFOW StartupInfo,
|
||||||
IN DWORD CreationFlags,
|
IN DWORD CreationFlags,
|
||||||
IN BOOL InheritHandles)
|
IN BOOL InheritHandles,
|
||||||
|
IN ULONG ImageSubsystem,
|
||||||
|
IN PVOID AppCompatData,
|
||||||
|
IN ULONG AppCompatDataSize)
|
||||||
{
|
{
|
||||||
WCHAR FullPath[MAX_PATH + 5];
|
WCHAR FullPath[MAX_PATH + 5];
|
||||||
LPWSTR Remaining;
|
PWCHAR Remaining, DllPathString, ScanChar;
|
||||||
LPWSTR DllPathString;
|
PRTL_USER_PROCESS_PARAMETERS ProcessParameters, RemoteParameters;
|
||||||
PRTL_USER_PROCESS_PARAMETERS ProcessParameters;
|
PVOID RemoteAppCompatData;
|
||||||
PRTL_USER_PROCESS_PARAMETERS RemoteParameters = NULL;
|
|
||||||
UNICODE_STRING DllPath, ImageName, CommandLine, CurrentDirectory;
|
UNICODE_STRING DllPath, ImageName, CommandLine, CurrentDirectory;
|
||||||
|
UNICODE_STRING Desktop, Shell, Runtime, Title;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PWCHAR ScanChar;
|
|
||||||
ULONG EnviroSize;
|
ULONG EnviroSize;
|
||||||
SIZE_T Size;
|
SIZE_T Size;
|
||||||
UNICODE_STRING Desktop, Shell, Runtime, Title;
|
BOOLEAN HavePebLock = FALSE, Result;
|
||||||
PPEB OurPeb = NtCurrentPeb();
|
PPEB Peb = NtCurrentPeb();
|
||||||
LPVOID Environment = lpEnvironment;
|
|
||||||
DPRINT("BasePushProcessParameters\n");
|
DPRINT("BasePushProcessParameters\n");
|
||||||
|
|
||||||
/* Get the full path name */
|
/* Get the full path name */
|
||||||
|
@ -835,9 +811,14 @@ BasePushProcessParameters(IN HANDLE ProcessHandle,
|
||||||
if ((Size) && (Size <= (MAX_PATH + 4)))
|
if ((Size) && (Size <= (MAX_PATH + 4)))
|
||||||
{
|
{
|
||||||
/* Get the DLL Path */
|
/* Get the DLL Path */
|
||||||
DllPathString = BaseComputeProcessDllPath(ApplicationPathName,
|
DllPathString = BaseComputeProcessDllPath((LPWSTR)ApplicationPathName,
|
||||||
Environment);
|
lpEnvironment);
|
||||||
if (!DllPathString) return STATUS_NO_MEMORY;
|
if (!DllPathString)
|
||||||
|
{
|
||||||
|
/* Fail */
|
||||||
|
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
/* Initialize Strings */
|
/* Initialize Strings */
|
||||||
RtlInitUnicodeString(&DllPath, DllPathString);
|
RtlInitUnicodeString(&DllPath, DllPathString);
|
||||||
|
@ -846,14 +827,18 @@ BasePushProcessParameters(IN HANDLE ProcessHandle,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Get the DLL Path */
|
/* Get the DLL Path */
|
||||||
DllPathString = BaseComputeProcessDllPath(FullPath, Environment);
|
DllPathString = BaseComputeProcessDllPath(FullPath, lpEnvironment);
|
||||||
if (!DllPathString) return STATUS_NO_MEMORY;
|
if (!DllPathString)
|
||||||
|
{
|
||||||
|
/* Fail */
|
||||||
|
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
/* Initialize Strings */
|
/* Initialize Strings */
|
||||||
RtlInitUnicodeString(&DllPath, DllPathString);
|
RtlInitUnicodeString(&DllPath, DllPathString);
|
||||||
RtlInitUnicodeString(&ImageName, FullPath);
|
RtlInitUnicodeString(&ImageName, FullPath);
|
||||||
}
|
}
|
||||||
DPRINT("DllPath: %wZ, ImageName: %wZ\n", DllPath, ImageName);
|
|
||||||
|
|
||||||
/* Initialize Strings */
|
/* Initialize Strings */
|
||||||
RtlInitUnicodeString(&CommandLine, lpCommandLine);
|
RtlInitUnicodeString(&CommandLine, lpCommandLine);
|
||||||
|
@ -889,38 +874,50 @@ BasePushProcessParameters(IN HANDLE ProcessHandle,
|
||||||
Runtime.Buffer = (LPWSTR)StartupInfo->lpReserved2;
|
Runtime.Buffer = (LPWSTR)StartupInfo->lpReserved2;
|
||||||
Runtime.MaximumLength = Runtime.Length = StartupInfo->cbReserved2;
|
Runtime.MaximumLength = Runtime.Length = StartupInfo->cbReserved2;
|
||||||
|
|
||||||
|
/* Enforce no app compat data if the pointer was NULL */
|
||||||
|
if (!AppCompatData) AppCompatDataSize = 0;
|
||||||
|
|
||||||
/* Create the Parameter Block */
|
/* Create the Parameter Block */
|
||||||
DPRINT("Creating Process Parameters: %wZ %wZ %wZ %wZ %wZ %wZ %wZ\n",
|
ProcessParameters = NULL;
|
||||||
&ImageName, &DllPath, &CommandLine, &Desktop, &Title, &Shell,
|
|
||||||
&Runtime);
|
|
||||||
Status = RtlCreateProcessParameters(&ProcessParameters,
|
Status = RtlCreateProcessParameters(&ProcessParameters,
|
||||||
&ImageName,
|
&ImageName,
|
||||||
&DllPath,
|
&DllPath,
|
||||||
lpCurrentDirectory ?
|
lpCurrentDirectory ?
|
||||||
&CurrentDirectory : NULL,
|
&CurrentDirectory : NULL,
|
||||||
&CommandLine,
|
&CommandLine,
|
||||||
Environment,
|
lpEnvironment,
|
||||||
&Title,
|
&Title,
|
||||||
&Desktop,
|
&Desktop,
|
||||||
&Shell,
|
&Shell,
|
||||||
&Runtime);
|
&Runtime);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status)) goto FailPath;
|
||||||
{
|
|
||||||
DPRINT1("Failed to create process parameters!\n");
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Clear the current directory handle if not inheriting */
|
/* Clear the current directory handle if not inheriting */
|
||||||
if (!InheritHandles) ProcessParameters->CurrentDirectory.Handle = NULL;
|
if (!InheritHandles) ProcessParameters->CurrentDirectory.Handle = NULL;
|
||||||
|
|
||||||
|
/* Check if the user passed in an environment */
|
||||||
|
if (lpEnvironment)
|
||||||
|
{
|
||||||
|
/* We should've made it part of the parameters block, enforce this */
|
||||||
|
ASSERT(ProcessParameters->Environment == lpEnvironment);
|
||||||
|
lpEnvironment = ProcessParameters->Environment;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* The user did not, so use the one from the current PEB */
|
||||||
|
HavePebLock = TRUE;
|
||||||
|
RtlAcquirePebLock();
|
||||||
|
lpEnvironment = Peb->ProcessParameters->Environment;
|
||||||
|
}
|
||||||
|
|
||||||
/* Save pointer and start lookup */
|
/* Save pointer and start lookup */
|
||||||
Environment = ScanChar = ProcessParameters->Environment;
|
ScanChar = lpEnvironment;
|
||||||
if (Environment)
|
if (lpEnvironment)
|
||||||
{
|
{
|
||||||
/* Find the environment size */
|
/* Find the environment size */
|
||||||
while (*ScanChar) ScanChar += wcslen(ScanChar) + 1;
|
while ((ScanChar[0]) || (ScanChar[1])) ++ScanChar;
|
||||||
EnviroSize = (ULONG_PTR)ScanChar - (ULONG_PTR)Environment;
|
ScanChar += (2 * sizeof(UNICODE_NULL));
|
||||||
DPRINT("EnvironmentSize %ld\n", EnviroSize);
|
EnviroSize = (ULONG_PTR)ScanChar - (ULONG_PTR)lpEnvironment;
|
||||||
|
|
||||||
/* Allocate and Initialize new Environment Block */
|
/* Allocate and Initialize new Environment Block */
|
||||||
Size = EnviroSize;
|
Size = EnviroSize;
|
||||||
|
@ -931,23 +928,25 @@ BasePushProcessParameters(IN HANDLE ProcessHandle,
|
||||||
&Size,
|
&Size,
|
||||||
MEM_COMMIT,
|
MEM_COMMIT,
|
||||||
PAGE_READWRITE);
|
PAGE_READWRITE);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status)) goto FailPath;
|
||||||
{
|
|
||||||
DPRINT1("Failed to allocate Environment Block\n");
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Write the Environment Block */
|
/* Write the Environment Block */
|
||||||
Status = ZwWriteVirtualMemory(ProcessHandle,
|
Status = ZwWriteVirtualMemory(ProcessHandle,
|
||||||
ProcessParameters->Environment,
|
ProcessParameters->Environment,
|
||||||
Environment,
|
lpEnvironment,
|
||||||
EnviroSize,
|
EnviroSize,
|
||||||
NULL);
|
NULL);
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
|
/* No longer need the PEB lock anymore */
|
||||||
|
if (HavePebLock)
|
||||||
{
|
{
|
||||||
DPRINT1("Failed to write Environment Block\n");
|
/* Release it */
|
||||||
return Status;
|
RtlReleasePebLock();
|
||||||
|
HavePebLock = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Check if the write failed */
|
||||||
|
if (!NT_SUCCESS(Status)) goto FailPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Write new parameters */
|
/* Write new parameters */
|
||||||
|
@ -965,7 +964,6 @@ BasePushProcessParameters(IN HANDLE ProcessHandle,
|
||||||
if (StartupInfo->dwFlags &
|
if (StartupInfo->dwFlags &
|
||||||
(STARTF_USESTDHANDLES | STARTF_USEHOTKEY | STARTF_SHELLPRIVATE))
|
(STARTF_USESTDHANDLES | STARTF_USEHOTKEY | STARTF_SHELLPRIVATE))
|
||||||
{
|
{
|
||||||
DPRINT("Using Standard Handles\n");
|
|
||||||
ProcessParameters->StandardInput = StartupInfo->hStdInput;
|
ProcessParameters->StandardInput = StartupInfo->hStdInput;
|
||||||
ProcessParameters->StandardOutput = StartupInfo->hStdOutput;
|
ProcessParameters->StandardOutput = StartupInfo->hStdOutput;
|
||||||
ProcessParameters->StandardError = StartupInfo->hStdError;
|
ProcessParameters->StandardError = StartupInfo->hStdError;
|
||||||
|
@ -987,17 +985,28 @@ BasePushProcessParameters(IN HANDLE ProcessHandle,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Inherit our Console Handle */
|
/* Inherit our Console Handle */
|
||||||
ProcessParameters->ConsoleHandle = OurPeb->ProcessParameters->ConsoleHandle;
|
ProcessParameters->ConsoleHandle = Peb->ProcessParameters->ConsoleHandle;
|
||||||
|
|
||||||
/* Is the shell trampling on our Handles? */
|
/* Make sure that the shell isn't trampling on our handles first */
|
||||||
if (!(StartupInfo->dwFlags &
|
if (!(StartupInfo->dwFlags &
|
||||||
(STARTF_USESTDHANDLES | STARTF_USEHOTKEY | STARTF_SHELLPRIVATE)))
|
(STARTF_USESTDHANDLES | STARTF_USEHOTKEY | STARTF_SHELLPRIVATE)))
|
||||||
{
|
{
|
||||||
/* Use handles from PEB, if inheriting or they are console */
|
/* Copy the handle if we are inheriting or if it's a console handle */
|
||||||
DPRINT("Copying handles from parent\n");
|
if ((InheritHandles) ||
|
||||||
BasepCopyHandles(ProcessParameters,
|
(IsConsoleHandle(Peb->ProcessParameters->StandardInput)))
|
||||||
OurPeb->ProcessParameters,
|
{
|
||||||
InheritHandles);
|
ProcessParameters->StandardInput = Peb->ProcessParameters->StandardInput;
|
||||||
|
}
|
||||||
|
if ((InheritHandles) ||
|
||||||
|
(IsConsoleHandle(Peb->ProcessParameters->StandardOutput)))
|
||||||
|
{
|
||||||
|
ProcessParameters->StandardOutput = Peb->ProcessParameters->StandardOutput;
|
||||||
|
}
|
||||||
|
if ((InheritHandles) ||
|
||||||
|
(IsConsoleHandle(Peb->ProcessParameters->StandardError)))
|
||||||
|
{
|
||||||
|
ProcessParameters->StandardError = Peb->ProcessParameters->StandardError;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1009,30 +1018,27 @@ BasePushProcessParameters(IN HANDLE ProcessHandle,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* See if the first 1MB should be reserved */
|
/* See if the first 1MB should be reserved */
|
||||||
if ((ULONG_PTR)ApplicationPathName & 1)
|
if (ParameterFlags & 1)
|
||||||
{
|
{
|
||||||
ProcessParameters->Flags |= RTL_USER_PROCESS_PARAMETERS_RESERVE_1MB;
|
ProcessParameters->Flags |= RTL_USER_PROCESS_PARAMETERS_RESERVE_1MB;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* See if the first 16MB should be reserved */
|
/* See if the first 16MB should be reserved */
|
||||||
if ((ULONG_PTR)ApplicationPathName & 2)
|
if (ParameterFlags & 2)
|
||||||
{
|
{
|
||||||
ProcessParameters->Flags |= RTL_USER_PROCESS_PARAMETERS_RESERVE_16MB;
|
ProcessParameters->Flags |= RTL_USER_PROCESS_PARAMETERS_RESERVE_16MB;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate memory for the parameter block */
|
/* Allocate memory for the parameter block */
|
||||||
Size = ProcessParameters->Length;
|
Size = ProcessParameters->Length;
|
||||||
|
RemoteParameters = NULL;
|
||||||
Status = NtAllocateVirtualMemory(ProcessHandle,
|
Status = NtAllocateVirtualMemory(ProcessHandle,
|
||||||
(PVOID*)&RemoteParameters,
|
(PVOID*)&RemoteParameters,
|
||||||
0,
|
0,
|
||||||
&Size,
|
&Size,
|
||||||
MEM_COMMIT,
|
MEM_COMMIT,
|
||||||
PAGE_READWRITE);
|
PAGE_READWRITE);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status)) goto FailPath;
|
||||||
{
|
|
||||||
DPRINT1("Failed to allocate Parameters Block\n");
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Set the allocated size */
|
/* Set the allocated size */
|
||||||
ProcessParameters->MaximumLength = Size;
|
ProcessParameters->MaximumLength = Size;
|
||||||
|
@ -1053,33 +1059,71 @@ BasePushProcessParameters(IN HANDLE ProcessHandle,
|
||||||
ProcessParameters,
|
ProcessParameters,
|
||||||
ProcessParameters->Length,
|
ProcessParameters->Length,
|
||||||
NULL);
|
NULL);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status)) goto FailPath;
|
||||||
{
|
|
||||||
DPRINT1("Failed to write Parameters Block\n");
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Write the PEB Pointer */
|
/* Write the PEB Pointer */
|
||||||
Status = NtWriteVirtualMemory(ProcessHandle,
|
Status = NtWriteVirtualMemory(ProcessHandle,
|
||||||
&Peb->ProcessParameters,
|
&RemotePeb->ProcessParameters,
|
||||||
&RemoteParameters,
|
&RemoteParameters,
|
||||||
sizeof(PVOID),
|
sizeof(PVOID),
|
||||||
NULL);
|
NULL);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status)) goto FailPath;
|
||||||
|
|
||||||
|
/* Check if there's any app compat data to write */
|
||||||
|
RemoteAppCompatData = NULL;
|
||||||
|
if (AppCompatData)
|
||||||
{
|
{
|
||||||
DPRINT1("Failed to write Parameters Block\n");
|
/* Allocate some space for the application compatibility data */
|
||||||
return Status;
|
Size = AppCompatDataSize;
|
||||||
|
Status = NtAllocateVirtualMemory(ProcessHandle,
|
||||||
|
&RemoteAppCompatData,
|
||||||
|
0,
|
||||||
|
&Size,
|
||||||
|
MEM_COMMIT,
|
||||||
|
PAGE_READWRITE);
|
||||||
|
if (!NT_SUCCESS(Status)) goto FailPath;
|
||||||
|
|
||||||
|
/* Write the application compatibility data */
|
||||||
|
Status = NtWriteVirtualMemory(ProcessHandle,
|
||||||
|
RemoteAppCompatData,
|
||||||
|
AppCompatData,
|
||||||
|
AppCompatDataSize,
|
||||||
|
NULL);
|
||||||
|
if (!NT_SUCCESS(Status)) goto FailPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME: Write Peb->ImageSubSystem */
|
/* Write the PEB Pointer to the app compat data (might be NULL) */
|
||||||
|
Status = NtWriteVirtualMemory(ProcessHandle,
|
||||||
|
&RemotePeb->pShimData,
|
||||||
|
&RemoteAppCompatData,
|
||||||
|
sizeof(PVOID),
|
||||||
|
NULL);
|
||||||
|
if (!NT_SUCCESS(Status)) goto FailPath;
|
||||||
|
|
||||||
|
/* Now write Peb->ImageSubSystem */
|
||||||
|
if (ImageSubsystem)
|
||||||
|
{
|
||||||
|
NtWriteVirtualMemory(ProcessHandle,
|
||||||
|
&RemotePeb->ImageSubsystem,
|
||||||
|
&ImageSubsystem,
|
||||||
|
sizeof(ImageSubsystem),
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Success path */
|
||||||
|
Result = TRUE;
|
||||||
|
|
||||||
|
Quickie:
|
||||||
/* Cleanup */
|
/* Cleanup */
|
||||||
|
if (HavePebLock) RtlReleasePebLock();
|
||||||
RtlFreeHeap(RtlGetProcessHeap(), 0, DllPath.Buffer);
|
RtlFreeHeap(RtlGetProcessHeap(), 0, DllPath.Buffer);
|
||||||
RtlDestroyProcessParameters(ProcessParameters);
|
if (ProcessParameters) RtlDestroyProcessParameters(ProcessParameters);
|
||||||
|
return Result;
|
||||||
DPRINT("Completed\n");
|
FailPath:
|
||||||
return STATUS_SUCCESS;
|
DPRINT1("Failure to create proecss parameters: %lx\n", Status);
|
||||||
|
BaseSetLastNTError(Status);
|
||||||
|
Result = FALSE;
|
||||||
|
goto Quickie;
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
|
@ -3058,17 +3102,21 @@ GetAppName:
|
||||||
|
|
||||||
/* Create Process Environment */
|
/* Create Process Environment */
|
||||||
RemotePeb = ProcessBasicInfo.PebBaseAddress;
|
RemotePeb = ProcessBasicInfo.PebBaseAddress;
|
||||||
Status = BasePushProcessParameters(hProcess,
|
Ret = BasePushProcessParameters(0,
|
||||||
RemotePeb,
|
hProcess,
|
||||||
(LPWSTR)lpApplicationName,
|
RemotePeb,
|
||||||
CurrentDirectory,
|
(LPWSTR)lpApplicationName,
|
||||||
(QuotesNeeded || CmdLineIsAppName || Escape) ?
|
CurrentDirectory,
|
||||||
QuotedCmdLine : lpCommandLine,
|
(QuotesNeeded || CmdLineIsAppName || Escape) ?
|
||||||
lpEnvironment,
|
QuotedCmdLine : lpCommandLine,
|
||||||
EnvSize,
|
lpEnvironment,
|
||||||
&StartupInfo,
|
&StartupInfo,
|
||||||
dwCreationFlags,
|
dwCreationFlags,
|
||||||
bInheritHandles);
|
bInheritHandles,
|
||||||
|
0,
|
||||||
|
NULL,
|
||||||
|
0);
|
||||||
|
if (!Ret) goto Cleanup;
|
||||||
|
|
||||||
/* Cleanup Environment */
|
/* Cleanup Environment */
|
||||||
if (lpEnvironment && !(dwCreationFlags & CREATE_UNICODE_ENVIRONMENT))
|
if (lpEnvironment && !(dwCreationFlags & CREATE_UNICODE_ENVIRONMENT))
|
||||||
|
@ -3076,13 +3124,6 @@ GetAppName:
|
||||||
RtlDestroyEnvironment(lpEnvironment);
|
RtlDestroyEnvironment(lpEnvironment);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
DPRINT1("Could not initialize Process Environment\n");
|
|
||||||
BaseSetLastNTError(Status);
|
|
||||||
goto Cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Close the section */
|
/* Close the section */
|
||||||
NtClose(hSection);
|
NtClose(hSection);
|
||||||
hSection = NULL;
|
hSection = NULL;
|
||||||
|
|
|
@ -450,6 +450,19 @@ typedef struct _BASE_MSG_SXS_HANDLES
|
||||||
LARGE_INTEGER ViewBase;
|
LARGE_INTEGER ViewBase;
|
||||||
} BASE_MSG_SXS_HANDLES, *PBASE_MSG_SXS_HANDLES;
|
} BASE_MSG_SXS_HANDLES, *PBASE_MSG_SXS_HANDLES;
|
||||||
|
|
||||||
|
typedef struct _SXS_WIN32_NT_PATH_PAIR
|
||||||
|
{
|
||||||
|
PUNICODE_STRING Win32;
|
||||||
|
PUNICODE_STRING Nt;
|
||||||
|
} SXS_WIN32_NT_PATH_PAIR, *PSXS_WIN32_NT_PATH_PAIR;
|
||||||
|
|
||||||
|
typedef struct _SXS_OVERRIDE_MANIFEST
|
||||||
|
{
|
||||||
|
PCWCH Name;
|
||||||
|
PVOID Address;
|
||||||
|
ULONG Size;
|
||||||
|
} SXS_OVERRIDE_MANIFEST, *PSXS_OVERRIDE_MANIFEST;
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
BasepConfigureAppCertDlls(
|
BasepConfigureAppCertDlls(
|
||||||
|
@ -464,6 +477,15 @@ BasepConfigureAppCertDlls(
|
||||||
extern LIST_ENTRY BasepAppCertDllsList;
|
extern LIST_ENTRY BasepAppCertDllsList;
|
||||||
extern RTL_CRITICAL_SECTION gcsAppCert;
|
extern RTL_CRITICAL_SECTION gcsAppCert;
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
WINAPI
|
||||||
|
BaseUpdateVDMEntry(
|
||||||
|
IN ULONG UpdateIndex,
|
||||||
|
IN OUT PHANDLE WaitHandle,
|
||||||
|
IN ULONG IndexInfo,
|
||||||
|
IN ULONG BinaryType
|
||||||
|
);
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
WINAPI
|
WINAPI
|
||||||
BaseMarkFileForDelete(
|
BaseMarkFileForDelete(
|
||||||
|
@ -471,3 +493,10 @@ BaseMarkFileForDelete(
|
||||||
IN ULONG FileAttributes
|
IN ULONG FileAttributes
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/* FIXME: This is EXPORTED! It should go in an external kernel32.h header */
|
||||||
|
VOID
|
||||||
|
WINAPI
|
||||||
|
BasepFreeAppCompatData(
|
||||||
|
IN PVOID AppCompatData,
|
||||||
|
IN PVOID AppCompatSxsData
|
||||||
|
);
|
||||||
|
|
|
@ -1380,6 +1380,26 @@ typedef struct _RTL_TRACE_BLOCK
|
||||||
PVOID *Trace;
|
PVOID *Trace;
|
||||||
} RTL_TRACE_BLOCK, *PRTL_TRACE_BLOCK;
|
} RTL_TRACE_BLOCK, *PRTL_TRACE_BLOCK;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Auto-Managed Rtl* String Buffer
|
||||||
|
//
|
||||||
|
typedef struct _RTL_BUFFER
|
||||||
|
{
|
||||||
|
PUCHAR Buffer;
|
||||||
|
PUCHAR StaticBuffer;
|
||||||
|
SIZE_T Size;
|
||||||
|
SIZE_T StaticSize;
|
||||||
|
SIZE_T ReservedForAllocatedSize;
|
||||||
|
PVOID ReservedForIMalloc;
|
||||||
|
} RTL_BUFFER, *PRTL_BUFFER;
|
||||||
|
|
||||||
|
typedef struct _RTL_UNICODE_STRING_BUFFER
|
||||||
|
{
|
||||||
|
UNICODE_STRING String;
|
||||||
|
RTL_BUFFER ByteBuffer;
|
||||||
|
WCHAR MinimumStaticBufferForTerminalNul;
|
||||||
|
} RTL_UNICODE_STRING_BUFFER, *PRTL_UNICODE_STRING_BUFFER;
|
||||||
|
|
||||||
#ifndef NTOS_MODE_USER
|
#ifndef NTOS_MODE_USER
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -31,11 +31,46 @@ typedef struct
|
||||||
ULONG Dummy;
|
ULONG Dummy;
|
||||||
} CSRSS_CONNECT_PROCESS, *PCSRSS_CONNECT_PROCESS;
|
} CSRSS_CONNECT_PROCESS, *PCSRSS_CONNECT_PROCESS;
|
||||||
|
|
||||||
|
typedef struct _BASE_SXS_CREATEPROCESS_MSG
|
||||||
|
{
|
||||||
|
ULONG Flags;
|
||||||
|
ULONG ProcessParameterFlags;
|
||||||
|
HANDLE FileHandle;
|
||||||
|
UNICODE_STRING SxsWin32ExePath;
|
||||||
|
UNICODE_STRING SxsNtExePath;
|
||||||
|
SIZE_T OverrideManifestOffset;
|
||||||
|
ULONG OverrideManifestSize;
|
||||||
|
SIZE_T OverridePolicyOffset;
|
||||||
|
ULONG OverridePolicySize;
|
||||||
|
PVOID PEManifestAddress;
|
||||||
|
ULONG PEManifestSize;
|
||||||
|
UNICODE_STRING CultureFallbacks;
|
||||||
|
ULONG Unknown[7];
|
||||||
|
UNICODE_STRING AssemblyName;
|
||||||
|
} BASE_SXS_CREATEPROCESS_MSG, *PBASE_SXS_CREATEPROCESS_MSG;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
HANDLE NewProcessId;
|
//
|
||||||
ULONG Flags;
|
// NT-type structure (BASE_CREATEPROCESS_MSG)
|
||||||
BOOL bInheritHandles;
|
//
|
||||||
|
HANDLE ProcessHandle;
|
||||||
|
HANDLE ThreadHandle;
|
||||||
|
CLIENT_ID ClientId;
|
||||||
|
ULONG CreationFlags;
|
||||||
|
ULONG VdmBinaryType;
|
||||||
|
ULONG VdmTask;
|
||||||
|
HANDLE hVDM;
|
||||||
|
BASE_SXS_CREATEPROCESS_MSG Sxs;
|
||||||
|
PVOID PebAddressNative;
|
||||||
|
ULONG PebAddressWow64;
|
||||||
|
USHORT ProcessorArchitecture;
|
||||||
|
//
|
||||||
|
// ReactOS Data
|
||||||
|
//
|
||||||
|
HANDLE NewProcessId;
|
||||||
|
ULONG Flags;
|
||||||
|
BOOL bInheritHandles;
|
||||||
} CSRSS_CREATE_PROCESS, *PCSRSS_CREATE_PROCESS;
|
} CSRSS_CREATE_PROCESS, *PCSRSS_CREATE_PROCESS;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
|
@ -548,6 +583,38 @@ typedef struct
|
||||||
ULONG ExitCode;
|
ULONG ExitCode;
|
||||||
} CSRSS_GET_VDM_EXIT_CODE, *PCSRSS_GET_VDM_EXIT_CODE;
|
} CSRSS_GET_VDM_EXIT_CODE, *PCSRSS_GET_VDM_EXIT_CODE;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
ULONG iTask;
|
||||||
|
HANDLE ConsoleHandle;
|
||||||
|
ULONG BinaryType;
|
||||||
|
HANDLE WaitObjectForParent;
|
||||||
|
HANDLE StdIn;
|
||||||
|
HANDLE StdOut;
|
||||||
|
HANDLE StdErr;
|
||||||
|
ULONG CodePage;
|
||||||
|
ULONG dwCreationFlags;
|
||||||
|
PCHAR CmdLine;
|
||||||
|
PCHAR appName;
|
||||||
|
PCHAR PifFile;
|
||||||
|
PCHAR CurDirectory;
|
||||||
|
PCHAR Env;
|
||||||
|
ULONG EnvLen;
|
||||||
|
PVOID StartupInfo;
|
||||||
|
PCHAR Desktop;
|
||||||
|
ULONG DesktopLen;
|
||||||
|
PCHAR Title;
|
||||||
|
ULONG TitleLen;
|
||||||
|
PCHAR Reserved;
|
||||||
|
ULONG ReservedLen;
|
||||||
|
USHORT CmdLen;
|
||||||
|
USHORT AppLen;
|
||||||
|
USHORT PifLen;
|
||||||
|
USHORT CurDirectoryLen;
|
||||||
|
USHORT CurDrive;
|
||||||
|
USHORT VDMState;
|
||||||
|
} CSRSS_CHECK_VDM, *PCSRSS_CHECK_VDM;
|
||||||
|
|
||||||
#define CSR_API_MESSAGE_HEADER_SIZE(Type) (FIELD_OFFSET(CSR_API_MESSAGE, Data) + sizeof(Type))
|
#define CSR_API_MESSAGE_HEADER_SIZE(Type) (FIELD_OFFSET(CSR_API_MESSAGE, Data) + sizeof(Type))
|
||||||
#define CSRSS_MAX_WRITE_CONSOLE (LPC_MAX_DATA_LENGTH - CSR_API_MESSAGE_HEADER_SIZE(CSRSS_WRITE_CONSOLE))
|
#define CSRSS_MAX_WRITE_CONSOLE (LPC_MAX_DATA_LENGTH - CSR_API_MESSAGE_HEADER_SIZE(CSRSS_WRITE_CONSOLE))
|
||||||
#define CSRSS_MAX_WRITE_CONSOLE_OUTPUT_CHAR (LPC_MAX_DATA_LENGTH - CSR_API_MESSAGE_HEADER_SIZE(CSRSS_WRITE_CONSOLE_OUTPUT_CHAR))
|
#define CSRSS_MAX_WRITE_CONSOLE_OUTPUT_CHAR (LPC_MAX_DATA_LENGTH - CSR_API_MESSAGE_HEADER_SIZE(CSRSS_WRITE_CONSOLE_OUTPUT_CHAR))
|
||||||
|
@ -632,6 +699,7 @@ typedef struct
|
||||||
#define SOUND_SENTRY (0x50)
|
#define SOUND_SENTRY (0x50)
|
||||||
#define UPDATE_VDM_ENTRY (0x51)
|
#define UPDATE_VDM_ENTRY (0x51)
|
||||||
#define GET_VDM_EXIT_CODE (0x52)
|
#define GET_VDM_EXIT_CODE (0x52)
|
||||||
|
#define CHECK_VDM (0x53)
|
||||||
|
|
||||||
/* Keep in sync with definition below. */
|
/* Keep in sync with definition below. */
|
||||||
#define CSRSS_HEADER_SIZE (sizeof(PORT_MESSAGE) + sizeof(ULONG) + sizeof(NTSTATUS))
|
#define CSRSS_HEADER_SIZE (sizeof(PORT_MESSAGE) + sizeof(ULONG) + sizeof(NTSTATUS))
|
||||||
|
@ -718,6 +786,7 @@ typedef struct _CSR_API_MESSAGE
|
||||||
CSRSS_SOUND_SENTRY SoundSentryRequest;
|
CSRSS_SOUND_SENTRY SoundSentryRequest;
|
||||||
CSRSS_UPDATE_VDM_ENTRY UpdateVdmEntry;
|
CSRSS_UPDATE_VDM_ENTRY UpdateVdmEntry;
|
||||||
CSRSS_GET_VDM_EXIT_CODE GetVdmExitCode;
|
CSRSS_GET_VDM_EXIT_CODE GetVdmExitCode;
|
||||||
|
CSRSS_CHECK_VDM CheckVdm;
|
||||||
} Data;
|
} Data;
|
||||||
} CSR_API_MESSAGE, *PCSR_API_MESSAGE;
|
} CSR_API_MESSAGE, *PCSR_API_MESSAGE;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue