-/* $Id$
+/* $Id: proc.c 57086 2012-08-16 15:39:40Z akhaldi $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
if ((Size) && (Size <= (MAX_PATH + 4)))
{
/* Get the DLL Path */
- DllPathString = BaseComputeProcessDllPath((LPWSTR)ApplicationPathName,
- lpEnvironment);
+ DllPathString = BaseComputeProcessDllPath(FullPath, lpEnvironment);
if (!DllPathString)
{
/* Fail */
/* Initialize Strings */
RtlInitUnicodeString(&DllPath, DllPathString);
- RtlInitUnicodeString(&ImageName, ApplicationPathName);
+ RtlInitUnicodeString(&ImageName, FullPath);
}
else
{
- /* Get the DLL Path */
- DllPathString = BaseComputeProcessDllPath(FullPath, lpEnvironment);
+ /* Couldn't get the path name. Just take the original path */
+ DllPathString = BaseComputeProcessDllPath((LPWSTR)ApplicationPathName,
+ lpEnvironment);
if (!DllPathString)
{
/* Fail */
/* Initialize Strings */
RtlInitUnicodeString(&DllPath, DllPathString);
- RtlInitUnicodeString(&ImageName, FullPath);
+ RtlInitUnicodeString(&ImageName, ApplicationPathName);
}
/* Initialize Strings */
/* Allocate and Initialize new Environment Block */
Size = EnviroSize;
ProcessParameters->Environment = NULL;
- Status = ZwAllocateVirtualMemory(ProcessHandle,
+ Status = NtAllocateVirtualMemory(ProcessHandle,
(PVOID*)&ProcessParameters->Environment,
0,
&Size,
if (!NT_SUCCESS(Status)) goto FailPath;
/* Write the Environment Block */
- Status = ZwWriteVirtualMemory(ProcessHandle,
+ Status = NtWriteVirtualMemory(ProcessHandle,
ProcessParameters->Environment,
lpEnvironment,
EnviroSize,
/* Someone beat us to it, use their data instead */
StartupInfo = BaseAnsiStartupInfo;
Status = STATUS_SUCCESS;
-
+
/* We're going to free our own stuff, but not raise */
RtlFreeAnsiString(&TitleString);
}
while (NULL != (ScanString = wcschr(ScanString, L'^')))
{
ScanString++;
- if (*ScanString == L'\"' || *ScanString == L'^' || *ScanString == L'\"')
+ if (*ScanString == L'\"' || *ScanString == L'^' || *ScanString == L'\\')
{
Escape = TRUE;
break;
/* FIXME: Allow CREATE_SEPARATE only for WOW Apps, once we have that. */
/* Get some information about the executable */
- Status = ZwQuerySection(hSection,
+ Status = NtQuerySection(hSection,
SectionImageInformation,
&SectionImageInfo,
sizeof(SectionImageInfo),
IMAGE_SUBSYSTEM_WINDOWS_CUI != SectionImageInfo.SubSystemType)
{
DPRINT1("Invalid subsystem %d\n", SectionImageInfo.SubSystemType);
- SetLastError(ERROR_BAD_EXE_FORMAT);
+ /*
+ * Despite the name of the error code suggests, it corresponds to the
+ * well-known "The %1 application cannot be run in Win32 mode" message.
+ */
+ SetLastError(ERROR_CHILD_NOT_COMPLETE);
goto Cleanup;
}
/* Check if only this process will be debugged */
if (dwCreationFlags & DEBUG_ONLY_THIS_PROCESS)
{
- /* FIXME: Set process flag */
+ /* Set process flag */
+ hDebug = (HANDLE)((ULONG_PTR)hDebug | 0x1);
}
}
if (hSection) NtClose(hSection);
if (hThread)
{
- /* We don't know any more details then this */
+ /* We don't know any more details than this */
NtTerminateProcess(hProcess, STATUS_UNSUCCESSFUL);
NtClose(hThread);
}