mirror of
https://github.com/reactos/reactos.git
synced 2025-04-20 12:29:56 +00:00
[KERNEL32]
- Get rid of old function Basep8BitStringToLiveUnicodeString() that doesn't exist under Windows, and that was even unused - Rename Basep8BitStringToHeapUnicodeString() to Basep8BitStringToDynamicUnicodeString() and fix its implementation (and all the calls) - Define BasepUnicodeStringTo8BitString() svn path=/trunk/; revision=50838
This commit is contained in:
parent
cbfa1e3dbb
commit
6b74e9a992
4 changed files with 32 additions and 52 deletions
|
@ -251,7 +251,7 @@ WaitNamedPipeA(LPCSTR lpNamedPipeName,
|
|||
UNICODE_STRING NameU;
|
||||
|
||||
/* Convert the name to Unicode */
|
||||
Basep8BitStringToHeapUnicodeString(&NameU, lpNamedPipeName);
|
||||
Basep8BitStringToDynamicUnicodeString(&NameU, lpNamedPipeName);
|
||||
|
||||
/* Call the Unicode API */
|
||||
r = WaitNamedPipeW(NameU.Buffer, nTimeOut);
|
||||
|
|
|
@ -192,15 +192,12 @@ PUNICODE_STRING
|
|||
WINAPI
|
||||
Basep8BitStringToStaticUnicodeString(IN LPCSTR AnsiString);
|
||||
|
||||
NTSTATUS
|
||||
BOOLEAN
|
||||
WINAPI
|
||||
Basep8BitStringToLiveUnicodeString(OUT PUNICODE_STRING UnicodeString,
|
||||
IN LPCSTR String);
|
||||
|
||||
NTSTATUS
|
||||
WINAPI
|
||||
Basep8BitStringToHeapUnicodeString(OUT PUNICODE_STRING UnicodeString,
|
||||
IN LPCSTR String);
|
||||
Basep8BitStringToDynamicUnicodeString(OUT PUNICODE_STRING UnicodeString,
|
||||
IN LPCSTR String);
|
||||
|
||||
#define BasepUnicodeStringTo8BitString RtlUnicodeStringToAnsiString
|
||||
|
||||
typedef NTSTATUS (NTAPI *PRTL_CONVERT_STRING)(IN PUNICODE_STRING UnicodeString,
|
||||
IN PANSI_STRING AnsiString,
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* FILE: lib/kernel32/misc/utils.c
|
||||
* PURPOSE: Utility and Support Functions
|
||||
* PROGRAMMER: Alex Ionescu (alex@relsoft.net)
|
||||
* Pierre Schweitzer (pierre.schweitzer@reactos.org)
|
||||
*/
|
||||
|
||||
/* INCLUDES ****************************************************************/
|
||||
|
@ -24,33 +25,6 @@ PRTL_CONVERT_STRING Basep8BitStringToUnicodeString;
|
|||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
/*
|
||||
* Converts an ANSI or OEM String to the specified Unicode String
|
||||
*/
|
||||
NTSTATUS
|
||||
WINAPI
|
||||
Basep8BitStringToLiveUnicodeString(OUT PUNICODE_STRING UnicodeString,
|
||||
IN LPCSTR String)
|
||||
{
|
||||
ANSI_STRING AnsiString;
|
||||
NTSTATUS Status;
|
||||
|
||||
DPRINT("Basep8BitStringToLiveUnicodeString\n");
|
||||
|
||||
/* Create the ANSI String */
|
||||
RtlInitAnsiString(&AnsiString, String);
|
||||
|
||||
/* Convert from OEM or ANSI */
|
||||
Status = Basep8BitStringToUnicodeString(UnicodeString, &AnsiString, FALSE);
|
||||
|
||||
/* Return Status */
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
SetLastErrorByStatus(Status);
|
||||
}
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Converts an ANSI or OEM String to the TEB StaticUnicodeString
|
||||
|
@ -81,29 +55,38 @@ Basep8BitStringToStaticUnicodeString(IN LPCSTR String)
|
|||
return StaticString;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
/*
|
||||
* Allocates space from the Heap and converts an Unicode String into it
|
||||
*/
|
||||
BOOLEAN
|
||||
WINAPI
|
||||
Basep8BitStringToHeapUnicodeString(OUT PUNICODE_STRING UnicodeString,
|
||||
IN LPCSTR String)
|
||||
Basep8BitStringToDynamicUnicodeString(OUT PUNICODE_STRING UnicodeString,
|
||||
IN LPCSTR String)
|
||||
{
|
||||
ANSI_STRING AnsiString;
|
||||
NTSTATUS Status;
|
||||
|
||||
DPRINT("Basep8BitStringToCachedUnicodeString\n");
|
||||
|
||||
DPRINT("Basep8BitStringToDynamicUnicodeString\n");
|
||||
|
||||
/* Initialize an ANSI String */
|
||||
RtlInitAnsiString(&AnsiString, String);
|
||||
|
||||
if (!NT_SUCCESS(RtlInitAnsiStringEx(&AnsiString, String)))
|
||||
{
|
||||
SetLastError(ERROR_BUFFER_OVERFLOW);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Convert it */
|
||||
Status = Basep8BitStringToUnicodeString(UnicodeString, &AnsiString, TRUE);
|
||||
|
||||
Status = Basep8BitStringToUnicodeString(UnicodeString, &AnsiString, TRUE);
|
||||
|
||||
/* Handle failure */
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
SetLastErrorByStatus(Status);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Return Status */
|
||||
return Status;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1563,8 +1563,8 @@ CreateProcessInternalA(HANDLE hToken,
|
|||
else
|
||||
{
|
||||
/* Use a dynamic version */
|
||||
Basep8BitStringToHeapUnicodeString(&LiveCommandLine,
|
||||
lpCommandLine);
|
||||
Basep8BitStringToDynamicUnicodeString(&LiveCommandLine,
|
||||
lpCommandLine);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1576,13 +1576,13 @@ CreateProcessInternalA(HANDLE hToken,
|
|||
/* Convert the Name and Directory */
|
||||
if (lpApplicationName)
|
||||
{
|
||||
Basep8BitStringToHeapUnicodeString(&ApplicationName,
|
||||
lpApplicationName);
|
||||
Basep8BitStringToDynamicUnicodeString(&ApplicationName,
|
||||
lpApplicationName);
|
||||
}
|
||||
if (lpCurrentDirectory)
|
||||
{
|
||||
Basep8BitStringToHeapUnicodeString(&CurrentDirectory,
|
||||
lpCurrentDirectory);
|
||||
Basep8BitStringToDynamicUnicodeString(&CurrentDirectory,
|
||||
lpCurrentDirectory);
|
||||
}
|
||||
|
||||
/* Now convert Startup Strings */
|
||||
|
|
Loading…
Reference in a new issue