mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 09:34:43 +00:00
Fixed some bugs in CreateProcessA which was introduced by r16730.
svn path=/trunk/; revision=16881
This commit is contained in:
parent
7559937efb
commit
ade86ba7d7
3 changed files with 41 additions and 11 deletions
|
@ -134,7 +134,7 @@ BasepCheckRealTimePrivilege(VOID);
|
|||
VOID
|
||||
STDCALL
|
||||
BasepAnsiStringToHeapUnicodeString(IN LPCSTR AnsiString,
|
||||
IN PVOID UnicodeString);
|
||||
OUT LPWSTR* UnicodeString);
|
||||
|
||||
PUNICODE_STRING
|
||||
STDCALL
|
||||
|
@ -145,11 +145,16 @@ STDCALL
|
|||
Basep8BitStringToLiveUnicodeString(OUT PUNICODE_STRING UnicodeString,
|
||||
IN LPCSTR String);
|
||||
|
||||
NTSTATUS
|
||||
STDCALL
|
||||
Basep8BitStringToHeapUnicodeString(OUT PUNICODE_STRING UnicodeString,
|
||||
IN LPCSTR String);
|
||||
|
||||
typedef NTSTATUS (STDCALL *PRTL_CONVERT_STRING)(IN PUNICODE_STRING UnicodeString,
|
||||
IN PANSI_STRING AnsiString,
|
||||
IN BOOLEAN AllocateMemory);
|
||||
|
||||
PRTL_CONVERT_STRING Basep8BitStringToUnicodeString;
|
||||
extern PRTL_CONVERT_STRING Basep8BitStringToUnicodeString;
|
||||
|
||||
NTSTATUS
|
||||
STDCALL
|
||||
|
|
|
@ -73,13 +73,38 @@ Basep8BitStringToCachedUnicodeString(IN LPCSTR String)
|
|||
return StaticString;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
STDCALL
|
||||
Basep8BitStringToHeapUnicodeString(OUT PUNICODE_STRING UnicodeString,
|
||||
IN LPCSTR String)
|
||||
{
|
||||
ANSI_STRING AnsiString;
|
||||
NTSTATUS Status;
|
||||
|
||||
DPRINT("Basep8BitStringToCachedUnicodeString\n");
|
||||
|
||||
/* Initialize an ANSI String */
|
||||
RtlInitAnsiString(&AnsiString, String);
|
||||
|
||||
/* Convert it */
|
||||
Status = Basep8BitStringToUnicodeString(UnicodeString, &AnsiString, TRUE);
|
||||
|
||||
/* Handle failure */
|
||||
/* Return Status */
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
SetLastErrorByStatus(Status);
|
||||
}
|
||||
return Status;
|
||||
}
|
||||
|
||||
/*
|
||||
* Allocates space from the Heap and converts an Ansi String into it
|
||||
*/
|
||||
VOID
|
||||
STDCALL
|
||||
BasepAnsiStringToHeapUnicodeString(IN LPCSTR AnsiString,
|
||||
IN PVOID UnicodeString)
|
||||
IN LPWSTR* UnicodeString)
|
||||
{
|
||||
ANSI_STRING AnsiTemp;
|
||||
UNICODE_STRING UnicodeTemp;
|
||||
|
@ -93,12 +118,12 @@ BasepAnsiStringToHeapUnicodeString(IN LPCSTR AnsiString,
|
|||
UnicodeTemp.MaximumLength = RtlAnsiStringToUnicodeSize(&AnsiTemp);
|
||||
|
||||
/* Allocate space from the Heap for the string */
|
||||
UnicodeString = RtlAllocateHeap(GetProcessHeap(),
|
||||
*UnicodeString = RtlAllocateHeap(GetProcessHeap(),
|
||||
0,
|
||||
UnicodeTemp.MaximumLength);
|
||||
|
||||
/* Save the buffer and convert */
|
||||
UnicodeTemp.Buffer = UnicodeString;
|
||||
UnicodeTemp.Buffer = *UnicodeString;
|
||||
RtlAnsiStringToUnicodeString(&UnicodeTemp, &AnsiTemp, FALSE);
|
||||
}
|
||||
|
||||
|
|
|
@ -639,7 +639,7 @@ CreateProcessA(LPCSTR lpApplicationName,
|
|||
else
|
||||
{
|
||||
/* Use a dynamic version */
|
||||
Basep8BitStringToLiveUnicodeString(&LiveCommandLine,
|
||||
Basep8BitStringToHeapUnicodeString(&LiveCommandLine,
|
||||
lpCommandLine);
|
||||
}
|
||||
}
|
||||
|
@ -652,12 +652,12 @@ CreateProcessA(LPCSTR lpApplicationName,
|
|||
/* Convert the Name and Directory */
|
||||
if (lpApplicationName)
|
||||
{
|
||||
Basep8BitStringToLiveUnicodeString(&ApplicationName,
|
||||
Basep8BitStringToHeapUnicodeString(&ApplicationName,
|
||||
lpApplicationName);
|
||||
}
|
||||
if (lpCurrentDirectory)
|
||||
{
|
||||
Basep8BitStringToLiveUnicodeString(&CurrentDirectory,
|
||||
Basep8BitStringToHeapUnicodeString(&CurrentDirectory,
|
||||
lpCurrentDirectory);
|
||||
}
|
||||
|
||||
|
@ -741,11 +741,11 @@ CreateProcessW(LPCWSTR lpApplicationName,
|
|||
PWCHAR Extension;
|
||||
LPWSTR QuotedCmdLine = NULL;
|
||||
LPWSTR ScanString;
|
||||
LPWSTR NullBuffer;
|
||||
LPWSTR NullBuffer = NULL;
|
||||
LPWSTR NameBuffer = NULL;
|
||||
WCHAR SaveChar;
|
||||
WCHAR SaveChar = 0;
|
||||
ULONG RetVal;
|
||||
UINT Error;
|
||||
UINT Error = 0;
|
||||
BOOLEAN SearchDone = FALSE;
|
||||
CLIENT_ID ClientId;
|
||||
PPEB OurPeb = NtCurrentPeb();
|
||||
|
|
Loading…
Reference in a new issue