* Fixed the searching for the file extension in CreateProcessW.

svn path=/trunk/; revision=3709
This commit is contained in:
Hartmut Birr 2002-11-05 20:54:10 +00:00
parent 811a27af00
commit cb7fd6d214

View file

@ -1,4 +1,4 @@
/* $Id: create.c,v 1.56 2002/10/25 22:59:55 chorns Exp $
/* $Id: create.c,v 1.57 2002/11/05 20:54:10 hbirr Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
@ -167,20 +167,22 @@ CreateProcessA (LPCSTR lpApplicationName,
return Result;
}
struct _CONTEXT;
struct __EXCEPTION_RECORD;
static
EXCEPTION_DISPOSITION
__cdecl
_except_handler(
struct _EXCEPTION_RECORD *ExceptionRecord,
void * EstablisherFrame,
struct _CONTEXT *ContextRecord,
void * DispatcherContext )
{
DPRINT("Process terminated abnormally...\n");
if (/* FIXME: */ TRUE) /* Not a service */
{
static
EXCEPTION_DISPOSITION
__cdecl
_except_handler(
struct _EXCEPTION_RECORD *ExceptionRecord,
void * EstablisherFrame,
struct _CONTEXT *ContextRecord,
void * DispatcherContext )
{
DPRINT("Process terminated abnormally...\n");
if (/* FIXME: */ TRUE) /* Not a service */
{
ExitProcess(0);
}
else
@ -190,17 +192,17 @@ _except_handler(
/* We should not get to here */
return ExceptionContinueSearch;
}
}
VOID STDCALL
BaseProcessStart(LPTHREAD_START_ROUTINE lpStartAddress,
DWORD lpParameter)
DWORD lpParameter)
{
UINT uExitCode = 0;
__try1(_except_handler)
{
uExitCode = (lpStartAddress)(lpParameter);
uExitCode = (lpStartAddress)((PVOID)lpParameter);
} __except1
{
}
@ -520,7 +522,7 @@ KlInitPeb (HANDLE ProcessHandle,
/* create the PPB */
PpbBase = NULL;
PpbSize = Ppb->AllocationSize;
PpbSize = Ppb->AllocationSize;
Status = NtAllocateVirtualMemory(ProcessHandle,
&PpbBase,
0,
@ -536,7 +538,7 @@ KlInitPeb (HANDLE ProcessHandle,
NtWriteVirtualMemory(ProcessHandle,
PpbBase,
Ppb,
Ppb->AllocationSize,
Ppb->AllocationSize,
&BytesWritten);
/* write pointer to environment */
@ -658,7 +660,7 @@ CreateProcessW(LPCWSTR lpApplicationName,
{
s = TempApplicationNameW;
}
s = wcsrchr(TempApplicationNameW, L'.');
s = wcsrchr(s, L'.');
if (s == NULL)
wcscat(TempApplicationNameW, L".exe");
}
@ -798,23 +800,23 @@ CreateProcessW(LPCWSTR lpApplicationName,
/*
* Translate some handles for the new process
*/
if (Ppb->CurrentDirectoryHandle)
if (Ppb->CurrentDirectoryHandle)
{
Status = NtDuplicateObject (NtCurrentProcess(),
Ppb->CurrentDirectoryHandle,
Ppb->CurrentDirectoryHandle,
hProcess,
&Ppb->CurrentDirectoryHandle,
&Ppb->CurrentDirectoryHandle,
0,
TRUE,
DUPLICATE_SAME_ACCESS);
}
if (Ppb->hConsole)
if (Ppb->hConsole)
{
Status = NtDuplicateObject (NtCurrentProcess(),
Ppb->hConsole,
Ppb->hConsole,
hProcess,
&Ppb->hConsole,
&Ppb->hConsole,
0,
TRUE,
DUPLICATE_SAME_ACCESS);
@ -862,31 +864,31 @@ CreateProcessW(LPCWSTR lpApplicationName,
}
// Set the child console handles
Ppb->hStdInput = NtCurrentPeb()->ProcessParameters->hStdInput;
Ppb->hStdOutput = NtCurrentPeb()->ProcessParameters->hStdOutput;
Ppb->hStdError = NtCurrentPeb()->ProcessParameters->hStdError;
Ppb->hStdInput = NtCurrentPeb()->ProcessParameters->hStdInput;
Ppb->hStdOutput = NtCurrentPeb()->ProcessParameters->hStdOutput;
Ppb->hStdError = NtCurrentPeb()->ProcessParameters->hStdError;
if (lpStartupInfo && (lpStartupInfo->dwFlags & STARTF_USESTDHANDLES))
{
if (lpStartupInfo->hStdInput)
Ppb->hStdInput = lpStartupInfo->hStdInput;
Ppb->hStdInput = lpStartupInfo->hStdInput;
if (lpStartupInfo->hStdOutput)
Ppb->hStdOutput = lpStartupInfo->hStdOutput;
Ppb->hStdOutput = lpStartupInfo->hStdOutput;
if (lpStartupInfo->hStdError)
Ppb->hStdError = lpStartupInfo->hStdError;
Ppb->hStdError = lpStartupInfo->hStdError;
}
if (IsConsoleHandle(Ppb->hStdInput))
if (IsConsoleHandle(Ppb->hStdInput))
{
Ppb->hStdInput = CsrReply.Data.CreateProcessReply.InputHandle;
Ppb->hStdInput = CsrReply.Data.CreateProcessReply.InputHandle;
}
else
{
DPRINT("Duplicate input handle\n");
Status = NtDuplicateObject (NtCurrentProcess(),
Ppb->hStdInput,
Ppb->hStdInput,
hProcess,
&Ppb->hStdInput,
&Ppb->hStdInput,
0,
TRUE,
DUPLICATE_SAME_ACCESS);
@ -896,17 +898,17 @@ CreateProcessW(LPCWSTR lpApplicationName,
}
}
if (IsConsoleHandle(Ppb->hStdOutput))
if (IsConsoleHandle(Ppb->hStdOutput))
{
Ppb->hStdOutput = CsrReply.Data.CreateProcessReply.OutputHandle;
Ppb->hStdOutput = CsrReply.Data.CreateProcessReply.OutputHandle;
}
else
{
DPRINT("Duplicate output handle\n");
Status = NtDuplicateObject (NtCurrentProcess(),
Ppb->hStdOutput,
Ppb->hStdOutput,
hProcess,
&Ppb->hStdOutput,
&Ppb->hStdOutput,
0,
TRUE,
DUPLICATE_SAME_ACCESS);
@ -915,17 +917,17 @@ CreateProcessW(LPCWSTR lpApplicationName,
DPRINT("NtDuplicateObject failed, status %x\n", Status);
}
}
if (IsConsoleHandle(Ppb->hStdError))
if (IsConsoleHandle(Ppb->hStdError))
{
Ppb->hStdError = CsrReply.Data.CreateProcessReply.OutputHandle;
Ppb->hStdError = CsrReply.Data.CreateProcessReply.OutputHandle;
}
else
{
DPRINT("Duplicate error handle\n");
Status = NtDuplicateObject (NtCurrentProcess(),
Ppb->hStdError,
Ppb->hStdError,
hProcess,
&Ppb->hStdError,
&Ppb->hStdError,
0,
TRUE,
DUPLICATE_SAME_ACCESS);
@ -940,20 +942,20 @@ CreateProcessW(LPCWSTR lpApplicationName,
*/
if (lpStartupInfo)
{
Ppb->dwFlags = lpStartupInfo->dwFlags;
if (Ppb->dwFlags & STARTF_USESHOWWINDOW)
Ppb->dwFlags = lpStartupInfo->dwFlags;
if (Ppb->dwFlags & STARTF_USESHOWWINDOW)
{
Ppb->wShowWindow = lpStartupInfo->wShowWindow;
Ppb->wShowWindow = lpStartupInfo->wShowWindow;
}
else
{
Ppb->wShowWindow = SW_SHOWDEFAULT;
Ppb->wShowWindow = SW_SHOWDEFAULT;
}
Ppb->dwX = lpStartupInfo->dwX;
Ppb->dwY = lpStartupInfo->dwY;
Ppb->dwXSize = lpStartupInfo->dwXSize;
Ppb->dwYSize = lpStartupInfo->dwYSize;
Ppb->dwFillAttribute = lpStartupInfo->dwFillAttribute;
Ppb->dwX = lpStartupInfo->dwX;
Ppb->dwY = lpStartupInfo->dwY;
Ppb->dwXSize = lpStartupInfo->dwXSize;
Ppb->dwYSize = lpStartupInfo->dwYSize;
Ppb->dwFillAttribute = lpStartupInfo->dwFillAttribute;
}
else
{