/* Allocate buffer for the output string */
Length = CommandLineString.MaximumLength + ApplicationNameString.MaximumLength + 32;
Buffer = RtlAllocateHeap(RtlGetProcessHeap(), 0, Length);
- RtlInitEmptyUnicodeString(SubsysCommandLine, Buffer, Length);
+ RtlInitEmptyUnicodeString(SubsysCommandLine, Buffer, (USHORT)Length);
if (!Buffer)
{
/* Fail, no memory */
BASE_API_MESSAGE ApiMessage;
PBASE_CREATE_THREAD CreateThreadRequest = &ApiMessage.Data.CreateThreadRequest;
- DPRINT("BasepNotifyCsrOfThread: Thread: %lx, Handle %lx\n",
+ DPRINT("BasepNotifyCsrOfThread: Thread: %p, Handle %p\n",
ClientId->UniqueThread, ThreadHandle);
/* Fill out the request */
/* Create the Parameter Block */
ProcessParameters = NULL;
- DPRINT1("ImageName: '%wZ'\n", &ImageName);
- DPRINT1("DllPath : '%wZ'\n", &DllPath);
- DPRINT1("CurDir : '%wZ'\n", &CurrentDirectory);
- DPRINT1("CmdLine : '%wZ'\n", &CommandLine);
- DPRINT1("Title : '%wZ'\n", &Title);
- DPRINT1("Desktop : '%wZ'\n", &Desktop);
- DPRINT1("Shell : '%wZ'\n", &Shell);
- DPRINT1("Runtime : '%wZ'\n", &Runtime);
+ DPRINT("ImageName: '%wZ'\n", &ImageName);
+ DPRINT("DllPath : '%wZ'\n", &DllPath);
+ DPRINT("CurDir : '%wZ'\n", &CurrentDirectory);
+ DPRINT("CmdLine : '%wZ'\n", &CommandLine);
+ DPRINT("Title : '%wZ'\n", &Title);
+ DPRINT("Desktop : '%wZ'\n", &Desktop);
+ DPRINT("Shell : '%wZ'\n", &Shell);
+ DPRINT("Runtime : '%wZ'\n", &Runtime);
Status = RtlCreateProcessParameters(&ProcessParameters,
&ImageName,
&DllPath,
if (lpEnvironment)
{
/* Find the environment size */
- while ((ScanChar[0]) || (ScanChar[1])) ++ScanChar;
- ScanChar += (2 * sizeof(UNICODE_NULL));
- EnviroSize = (ULONG_PTR)ScanChar - (ULONG_PTR)lpEnvironment;
+ while (*ScanChar++) while (*ScanChar++);
+ EnviroSize = (ULONG)((ULONG_PTR)ScanChar - (ULONG_PTR)lpEnvironment);
/* Allocate and Initialize new Environment Block */
Size = EnviroSize;
ProcessHandle = OpenProcess(PROCESS_VM_READ | PROCESS_QUERY_INFORMATION,
FALSE,
ProcessId);
- if (!ProcessHandle) return 0;
+ if (!ProcessHandle) _SEH2_YIELD(return 0);
/* Try to find out where its PEB lives */
Status = NtQueryInformationProcess(ProcessHandle,
SECTION_IMAGE_INFORMATION ImageInformation;
IO_STATUS_BLOCK IoStatusBlock;
CLIENT_ID ClientId;
- ULONG NoWindow, RegionSize, StackSize, ImageMachine, ErrorCode, Flags;
+ ULONG NoWindow, RegionSize, StackSize, ErrorCode, Flags;
+ USHORT ImageMachine;
ULONG ParameterFlags, PrivilegeValue, HardErrorMode, ErrorResponse;
ULONG_PTR ErrorParameters[2];
BOOLEAN InJob, SaferNeeded, UseLargePages, HavePrivilege;
ANSI_STRING VdmAnsiEnv;
UNICODE_STRING VdmString, VdmUnicodeEnv;
BOOLEAN IsWowApp;
- PBASE_CHECK_VDM VdmMsg;
+ PBASE_CHECK_VDM CheckVdmMsg;
/* Zero out the initial core variables and handles */
QuerySection = FALSE;
/* Set message structures */
CreateProcessMsg = &CsrMsg.Data.CreateProcessRequest;
- VdmMsg = &CsrMsg.Data.CheckVDMRequest;
+ CheckVdmMsg = &CsrMsg.Data.CheckVDMRequest;
/* Clear the more complex structures by zeroing out their entire memory */
RtlZeroMemory(&Context, sizeof(Context));
PolicyPathPair.Nt = &SxsNtPolicyPath.String;
#endif
- DPRINT1("CreateProcessInternalW: %S %S %lx\n", lpApplicationName, lpCommandLine, dwCreationFlags);
+ DPRINT("CreateProcessInternalW: %S %S %lx\n", lpApplicationName, lpCommandLine, dwCreationFlags);
/* Finally, set our TEB and PEB */
Teb = NtCurrentTeb();
}
/* Use the allocated size and convert */
- UnicodeEnv.MaximumLength = RegionSize;
+ UnicodeEnv.MaximumLength = (USHORT)RegionSize;
Status = RtlAnsiStringToUnicodeString(&UnicodeEnv, &AnsiEnv, FALSE);
if (!NT_SUCCESS(Status))
{
/* Now compute the final EXE path based on the name */
SearchPath = BaseComputeProcessExePath((LPWSTR)lpApplicationName);
- DPRINT1("Search Path: %S\n", SearchPath);
+ DPRINT("Search Path: %S\n", SearchPath);
if (!SearchPath)
{
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
}
}
- DPRINT1("Length: %lx Buffer: %S\n", Length, NameBuffer);
+ DPRINT("Length: %lu Buffer: %S\n", Length, NameBuffer);
/* Check if there was a failure in SearchPathW */
if ((Length) && (Length < MAX_PATH))
SxsWin32ExePath = PathBufferString;
PathBuffer = PathBufferString.Buffer;
PathBufferString.Buffer = NULL;
- DPRINT1("SxS Path: %S\n", PathBuffer);
+ DPRINT("SxS Path: %S\n", PathBuffer);
}
/* Also set the .EXE path based on the path name */
}
/* Now use the path name, and the root path, to try opening the app */
- DPRINT1("Path: %wZ. Dir: %lx\n", &PathName, SxsWin32RelativePath.ContainingDirectory);
+ DPRINT("Path: %wZ. Dir: %p\n", &PathName, SxsWin32RelativePath.ContainingDirectory);
InitializeObjectAttributes(&LocalObjectAttributes,
&PathName,
OBJ_CASE_INSENSITIVE,
PAGE_EXECUTE,
SEC_IMAGE,
FileHandle);
- DPRINT1("Section status: %lx\n", Status);
+ DPRINT("Section status: %lx\n", Status);
if (NT_SUCCESS(Status))
{
/* Are we running on Windows Embedded, Datacenter, Blade or Starter? */
lpCommandLine,
lpCurrentDirectory,
&VdmAnsiEnv,
- (PCSR_API_MESSAGE)VdmMsg,
+ &CsrMsg,
&VdmTask,
dwCreationFlags,
&StartupInfo,
}
/* Check which VDM state we're currently in */
- switch (VdmMsg->VDMState & (VDM_NOT_LOADED |
- VDM_NOT_READY |
- VDM_READY))
+ switch (CheckVdmMsg->VDMState & (VDM_NOT_LOADED |
+ VDM_NOT_READY |
+ VDM_READY))
{
case VDM_NOT_LOADED:
/* VDM is not fully loaded, so not that much to undo */
VdmUndoLevel = VDM_UNDO_REUSE;
/* Check if CSRSS wants us to wait on VDM */
- VdmWaitObject = VdmMsg->WaitObjectForParent;
+ VdmWaitObject = CheckVdmMsg->WaitObjectForParent;
break;
case VDM_NOT_READY:
lpCommandLine,
lpCurrentDirectory,
&VdmAnsiEnv,
- (PCSR_API_MESSAGE)VdmMsg,
+ &CsrMsg,
&VdmTask,
dwCreationFlags,
&StartupInfo,
};
/* Handle possible VDM states */
- switch (VdmMsg->VDMState & (VDM_NOT_LOADED |
- VDM_NOT_READY |
- VDM_READY))
+ switch (CheckVdmMsg->VDMState & (VDM_NOT_LOADED |
+ VDM_NOT_READY |
+ VDM_READY))
{
case VDM_NOT_LOADED:
/* If VDM is not loaded, we'll do a partial undo */
VdmUndoLevel = VDM_UNDO_REUSE;
/* Check if CSRSS wants us to wait on VDM */
- VdmWaitObject = VdmMsg->WaitObjectForParent;
+ VdmWaitObject = CheckVdmMsg->WaitObjectForParent;
break;
case VDM_NOT_READY:
((_wcsnicmp(ExtBuffer, L".bat", 4)) &&
(_wcsnicmp(ExtBuffer, L".cmd", 4))))
{
- DPRINT1("Invalid EXE, and not a batch or script file\n");
+ DPRINT1("'%wZ': Invalid EXE, and not a batch or script file\n", &PathName);
SetLastError(ERROR_BAD_EXE_FORMAT);
Result = FALSE;
goto Quickie;
if (!Result)
{
/* It was not, bail out */
- DPRINT1("Invalid subsystem version: %d.%d\n",
+ DPRINT1("Invalid subsystem version: %hu.%hu\n",
ImageInformation.SubSystemMajorVersion,
ImageInformation.SubSystemMinorVersion);
SetLastError(ERROR_BAD_EXE_FORMAT);
}
/* Account for the quotes and space between the two */
- n += ((sizeof('""') * 2) + sizeof(' '));
+ n += sizeof("\" \"") - sizeof(ANSI_NULL);
/* Convert to bytes, and make sure we don't overflow */
n *= sizeof(WCHAR);
/* Set the length */
RtlInitEmptyUnicodeString(&DebuggerString,
DebuggerString.Buffer,
- n);
+ (USHORT)n);
/* Now perform the command line creation */
ImageDbgStatus = RtlAppendUnicodeToString(&DebuggerString,
RealTimePrivilegeState = NULL;
/* Is realtime priority being requested? */
- if (PriorityClass.PriorityClass == REALTIME_PRIORITY_CLASS)
+ if (PriorityClass.PriorityClass == PROCESS_PRIORITY_CLASS_REALTIME)
{
/* Check if the caller has real-time access, and enable it if so */
RealTimePrivilegeState = BasepIsRealtimeAllowed(TRUE);
{
/* IA32, IA64 and AMD64 are supported in Server 2003 */
case IMAGE_FILE_MACHINE_I386:
- CreateProcessMsg->ProcessorArchitecture = PROCESSOR_ARCHITECTURE_INTEL;
+ CreateProcessMsg->ProcessorArchitecture = PROCESSOR_ARCHITECTURE_INTEL;
break;
case IMAGE_FILE_MACHINE_IA64:
CreateProcessMsg->ProcessorArchitecture = PROCESSOR_ARCHITECTURE_IA64;
BOOL bRetVal;
STARTUPINFOW StartupInfo;
- DPRINT("dwCreationFlags %x, lpEnvironment %x, lpCurrentDirectory %x, "
- "lpStartupInfo %x, lpProcessInformation %x\n",
+ DPRINT("dwCreationFlags %x, lpEnvironment %p, lpCurrentDirectory %p, "
+ "lpStartupInfo %p, lpProcessInformation %p\n",
dwCreationFlags, lpEnvironment, lpCurrentDirectory,
lpStartupInfo, lpProcessInformation);