mirror of
https://github.com/reactos/reactos.git
synced 2025-08-04 03:05:40 +00:00
- Re-simplify CreateProcessW (like r40484)
svn path=/trunk/; revision=40575
This commit is contained in:
parent
9065a6dbcf
commit
c2f98d4d61
1 changed files with 2 additions and 24 deletions
|
@ -720,34 +720,12 @@ CreateProcessInternalW(HANDLE hToken,
|
||||||
|
|
||||||
if (lpCurrentDirectory)
|
if (lpCurrentDirectory)
|
||||||
{
|
{
|
||||||
LPWSTR FilePart, Buffer = NULL;
|
if ((GetFileAttributesW(lpCurrentDirectory) == INVALID_FILE_ATTRIBUTES) ||
|
||||||
|
!(GetFileAttributesW(lpCurrentDirectory) & FILE_ATTRIBUTE_DIRECTORY))
|
||||||
Buffer = RtlAllocateHeap(RtlGetProcessHeap(),
|
|
||||||
0,
|
|
||||||
(MAX_PATH + 1) * sizeof(WCHAR));
|
|
||||||
|
|
||||||
if (!Buffer)
|
|
||||||
{
|
{
|
||||||
SetLastErrorByStatus(STATUS_NO_MEMORY);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GetFullPathNameW(lpCurrentDirectory, MAX_PATH, Buffer, &FilePart) > MAX_PATH)
|
|
||||||
{
|
|
||||||
RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer);
|
|
||||||
SetLastError(ERROR_DIRECTORY);
|
SetLastError(ERROR_DIRECTORY);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((GetFileAttributesW(Buffer) == INVALID_FILE_ATTRIBUTES) ||
|
|
||||||
!(GetFileAttributesW(Buffer) & FILE_ATTRIBUTE_DIRECTORY))
|
|
||||||
{
|
|
||||||
RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer);
|
|
||||||
SetLastError(ERROR_DIRECTORY);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue