mirror of
https://github.com/reactos/reactos.git
synced 2024-09-09 20:30:04 +00:00
* Fixed the searching for the file extension in CreateProcessW.
svn path=/trunk/; revision=3709
This commit is contained in:
parent
811a27af00
commit
cb7fd6d214
|
@ -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
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS system libraries
|
* PROJECT: ReactOS system libraries
|
||||||
|
@ -167,20 +167,22 @@ CreateProcessA (LPCSTR lpApplicationName,
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct _CONTEXT;
|
||||||
|
struct __EXCEPTION_RECORD;
|
||||||
|
|
||||||
static
|
static
|
||||||
EXCEPTION_DISPOSITION
|
EXCEPTION_DISPOSITION
|
||||||
__cdecl
|
__cdecl
|
||||||
_except_handler(
|
_except_handler(
|
||||||
struct _EXCEPTION_RECORD *ExceptionRecord,
|
struct _EXCEPTION_RECORD *ExceptionRecord,
|
||||||
void * EstablisherFrame,
|
void * EstablisherFrame,
|
||||||
struct _CONTEXT *ContextRecord,
|
struct _CONTEXT *ContextRecord,
|
||||||
void * DispatcherContext )
|
void * DispatcherContext )
|
||||||
{
|
{
|
||||||
DPRINT("Process terminated abnormally...\n");
|
DPRINT("Process terminated abnormally...\n");
|
||||||
|
|
||||||
if (/* FIXME: */ TRUE) /* Not a service */
|
if (/* FIXME: */ TRUE) /* Not a service */
|
||||||
{
|
{
|
||||||
ExitProcess(0);
|
ExitProcess(0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -190,17 +192,17 @@ _except_handler(
|
||||||
|
|
||||||
/* We should not get to here */
|
/* We should not get to here */
|
||||||
return ExceptionContinueSearch;
|
return ExceptionContinueSearch;
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID STDCALL
|
VOID STDCALL
|
||||||
BaseProcessStart(LPTHREAD_START_ROUTINE lpStartAddress,
|
BaseProcessStart(LPTHREAD_START_ROUTINE lpStartAddress,
|
||||||
DWORD lpParameter)
|
DWORD lpParameter)
|
||||||
{
|
{
|
||||||
UINT uExitCode = 0;
|
UINT uExitCode = 0;
|
||||||
|
|
||||||
__try1(_except_handler)
|
__try1(_except_handler)
|
||||||
{
|
{
|
||||||
uExitCode = (lpStartAddress)(lpParameter);
|
uExitCode = (lpStartAddress)((PVOID)lpParameter);
|
||||||
} __except1
|
} __except1
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -520,7 +522,7 @@ KlInitPeb (HANDLE ProcessHandle,
|
||||||
|
|
||||||
/* create the PPB */
|
/* create the PPB */
|
||||||
PpbBase = NULL;
|
PpbBase = NULL;
|
||||||
PpbSize = Ppb->AllocationSize;
|
PpbSize = Ppb->AllocationSize;
|
||||||
Status = NtAllocateVirtualMemory(ProcessHandle,
|
Status = NtAllocateVirtualMemory(ProcessHandle,
|
||||||
&PpbBase,
|
&PpbBase,
|
||||||
0,
|
0,
|
||||||
|
@ -536,7 +538,7 @@ KlInitPeb (HANDLE ProcessHandle,
|
||||||
NtWriteVirtualMemory(ProcessHandle,
|
NtWriteVirtualMemory(ProcessHandle,
|
||||||
PpbBase,
|
PpbBase,
|
||||||
Ppb,
|
Ppb,
|
||||||
Ppb->AllocationSize,
|
Ppb->AllocationSize,
|
||||||
&BytesWritten);
|
&BytesWritten);
|
||||||
|
|
||||||
/* write pointer to environment */
|
/* write pointer to environment */
|
||||||
|
@ -658,7 +660,7 @@ CreateProcessW(LPCWSTR lpApplicationName,
|
||||||
{
|
{
|
||||||
s = TempApplicationNameW;
|
s = TempApplicationNameW;
|
||||||
}
|
}
|
||||||
s = wcsrchr(TempApplicationNameW, L'.');
|
s = wcsrchr(s, L'.');
|
||||||
if (s == NULL)
|
if (s == NULL)
|
||||||
wcscat(TempApplicationNameW, L".exe");
|
wcscat(TempApplicationNameW, L".exe");
|
||||||
}
|
}
|
||||||
|
@ -798,23 +800,23 @@ CreateProcessW(LPCWSTR lpApplicationName,
|
||||||
/*
|
/*
|
||||||
* Translate some handles for the new process
|
* Translate some handles for the new process
|
||||||
*/
|
*/
|
||||||
if (Ppb->CurrentDirectoryHandle)
|
if (Ppb->CurrentDirectoryHandle)
|
||||||
{
|
{
|
||||||
Status = NtDuplicateObject (NtCurrentProcess(),
|
Status = NtDuplicateObject (NtCurrentProcess(),
|
||||||
Ppb->CurrentDirectoryHandle,
|
Ppb->CurrentDirectoryHandle,
|
||||||
hProcess,
|
hProcess,
|
||||||
&Ppb->CurrentDirectoryHandle,
|
&Ppb->CurrentDirectoryHandle,
|
||||||
0,
|
0,
|
||||||
TRUE,
|
TRUE,
|
||||||
DUPLICATE_SAME_ACCESS);
|
DUPLICATE_SAME_ACCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Ppb->hConsole)
|
if (Ppb->hConsole)
|
||||||
{
|
{
|
||||||
Status = NtDuplicateObject (NtCurrentProcess(),
|
Status = NtDuplicateObject (NtCurrentProcess(),
|
||||||
Ppb->hConsole,
|
Ppb->hConsole,
|
||||||
hProcess,
|
hProcess,
|
||||||
&Ppb->hConsole,
|
&Ppb->hConsole,
|
||||||
0,
|
0,
|
||||||
TRUE,
|
TRUE,
|
||||||
DUPLICATE_SAME_ACCESS);
|
DUPLICATE_SAME_ACCESS);
|
||||||
|
@ -862,31 +864,31 @@ CreateProcessW(LPCWSTR lpApplicationName,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the child console handles
|
// Set the child console handles
|
||||||
Ppb->hStdInput = NtCurrentPeb()->ProcessParameters->hStdInput;
|
Ppb->hStdInput = NtCurrentPeb()->ProcessParameters->hStdInput;
|
||||||
Ppb->hStdOutput = NtCurrentPeb()->ProcessParameters->hStdOutput;
|
Ppb->hStdOutput = NtCurrentPeb()->ProcessParameters->hStdOutput;
|
||||||
Ppb->hStdError = NtCurrentPeb()->ProcessParameters->hStdError;
|
Ppb->hStdError = NtCurrentPeb()->ProcessParameters->hStdError;
|
||||||
|
|
||||||
if (lpStartupInfo && (lpStartupInfo->dwFlags & STARTF_USESTDHANDLES))
|
if (lpStartupInfo && (lpStartupInfo->dwFlags & STARTF_USESTDHANDLES))
|
||||||
{
|
{
|
||||||
if (lpStartupInfo->hStdInput)
|
if (lpStartupInfo->hStdInput)
|
||||||
Ppb->hStdInput = lpStartupInfo->hStdInput;
|
Ppb->hStdInput = lpStartupInfo->hStdInput;
|
||||||
if (lpStartupInfo->hStdOutput)
|
if (lpStartupInfo->hStdOutput)
|
||||||
Ppb->hStdOutput = lpStartupInfo->hStdOutput;
|
Ppb->hStdOutput = lpStartupInfo->hStdOutput;
|
||||||
if (lpStartupInfo->hStdError)
|
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
|
else
|
||||||
{
|
{
|
||||||
DPRINT("Duplicate input handle\n");
|
DPRINT("Duplicate input handle\n");
|
||||||
Status = NtDuplicateObject (NtCurrentProcess(),
|
Status = NtDuplicateObject (NtCurrentProcess(),
|
||||||
Ppb->hStdInput,
|
Ppb->hStdInput,
|
||||||
hProcess,
|
hProcess,
|
||||||
&Ppb->hStdInput,
|
&Ppb->hStdInput,
|
||||||
0,
|
0,
|
||||||
TRUE,
|
TRUE,
|
||||||
DUPLICATE_SAME_ACCESS);
|
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
|
else
|
||||||
{
|
{
|
||||||
DPRINT("Duplicate output handle\n");
|
DPRINT("Duplicate output handle\n");
|
||||||
Status = NtDuplicateObject (NtCurrentProcess(),
|
Status = NtDuplicateObject (NtCurrentProcess(),
|
||||||
Ppb->hStdOutput,
|
Ppb->hStdOutput,
|
||||||
hProcess,
|
hProcess,
|
||||||
&Ppb->hStdOutput,
|
&Ppb->hStdOutput,
|
||||||
0,
|
0,
|
||||||
TRUE,
|
TRUE,
|
||||||
DUPLICATE_SAME_ACCESS);
|
DUPLICATE_SAME_ACCESS);
|
||||||
|
@ -915,17 +917,17 @@ CreateProcessW(LPCWSTR lpApplicationName,
|
||||||
DPRINT("NtDuplicateObject failed, status %x\n", Status);
|
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
|
else
|
||||||
{
|
{
|
||||||
DPRINT("Duplicate error handle\n");
|
DPRINT("Duplicate error handle\n");
|
||||||
Status = NtDuplicateObject (NtCurrentProcess(),
|
Status = NtDuplicateObject (NtCurrentProcess(),
|
||||||
Ppb->hStdError,
|
Ppb->hStdError,
|
||||||
hProcess,
|
hProcess,
|
||||||
&Ppb->hStdError,
|
&Ppb->hStdError,
|
||||||
0,
|
0,
|
||||||
TRUE,
|
TRUE,
|
||||||
DUPLICATE_SAME_ACCESS);
|
DUPLICATE_SAME_ACCESS);
|
||||||
|
@ -940,20 +942,20 @@ CreateProcessW(LPCWSTR lpApplicationName,
|
||||||
*/
|
*/
|
||||||
if (lpStartupInfo)
|
if (lpStartupInfo)
|
||||||
{
|
{
|
||||||
Ppb->dwFlags = lpStartupInfo->dwFlags;
|
Ppb->dwFlags = lpStartupInfo->dwFlags;
|
||||||
if (Ppb->dwFlags & STARTF_USESHOWWINDOW)
|
if (Ppb->dwFlags & STARTF_USESHOWWINDOW)
|
||||||
{
|
{
|
||||||
Ppb->wShowWindow = lpStartupInfo->wShowWindow;
|
Ppb->wShowWindow = lpStartupInfo->wShowWindow;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Ppb->wShowWindow = SW_SHOWDEFAULT;
|
Ppb->wShowWindow = SW_SHOWDEFAULT;
|
||||||
}
|
}
|
||||||
Ppb->dwX = lpStartupInfo->dwX;
|
Ppb->dwX = lpStartupInfo->dwX;
|
||||||
Ppb->dwY = lpStartupInfo->dwY;
|
Ppb->dwY = lpStartupInfo->dwY;
|
||||||
Ppb->dwXSize = lpStartupInfo->dwXSize;
|
Ppb->dwXSize = lpStartupInfo->dwXSize;
|
||||||
Ppb->dwYSize = lpStartupInfo->dwYSize;
|
Ppb->dwYSize = lpStartupInfo->dwYSize;
|
||||||
Ppb->dwFillAttribute = lpStartupInfo->dwFillAttribute;
|
Ppb->dwFillAttribute = lpStartupInfo->dwFillAttribute;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue