mirror of
https://github.com/reactos/reactos.git
synced 2025-04-22 13:10:39 +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;
|
UNICODE_STRING NameU;
|
||||||
|
|
||||||
/* Convert the name to Unicode */
|
/* Convert the name to Unicode */
|
||||||
Basep8BitStringToHeapUnicodeString(&NameU, lpNamedPipeName);
|
Basep8BitStringToDynamicUnicodeString(&NameU, lpNamedPipeName);
|
||||||
|
|
||||||
/* Call the Unicode API */
|
/* Call the Unicode API */
|
||||||
r = WaitNamedPipeW(NameU.Buffer, nTimeOut);
|
r = WaitNamedPipeW(NameU.Buffer, nTimeOut);
|
||||||
|
|
|
@ -192,15 +192,12 @@ PUNICODE_STRING
|
||||||
WINAPI
|
WINAPI
|
||||||
Basep8BitStringToStaticUnicodeString(IN LPCSTR AnsiString);
|
Basep8BitStringToStaticUnicodeString(IN LPCSTR AnsiString);
|
||||||
|
|
||||||
NTSTATUS
|
BOOLEAN
|
||||||
WINAPI
|
WINAPI
|
||||||
Basep8BitStringToLiveUnicodeString(OUT PUNICODE_STRING UnicodeString,
|
Basep8BitStringToDynamicUnicodeString(OUT PUNICODE_STRING UnicodeString,
|
||||||
IN LPCSTR String);
|
IN LPCSTR String);
|
||||||
|
|
||||||
NTSTATUS
|
#define BasepUnicodeStringTo8BitString RtlUnicodeStringToAnsiString
|
||||||
WINAPI
|
|
||||||
Basep8BitStringToHeapUnicodeString(OUT PUNICODE_STRING UnicodeString,
|
|
||||||
IN LPCSTR String);
|
|
||||||
|
|
||||||
typedef NTSTATUS (NTAPI *PRTL_CONVERT_STRING)(IN PUNICODE_STRING UnicodeString,
|
typedef NTSTATUS (NTAPI *PRTL_CONVERT_STRING)(IN PUNICODE_STRING UnicodeString,
|
||||||
IN PANSI_STRING AnsiString,
|
IN PANSI_STRING AnsiString,
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
* FILE: lib/kernel32/misc/utils.c
|
* FILE: lib/kernel32/misc/utils.c
|
||||||
* PURPOSE: Utility and Support Functions
|
* PURPOSE: Utility and Support Functions
|
||||||
* PROGRAMMER: Alex Ionescu (alex@relsoft.net)
|
* PROGRAMMER: Alex Ionescu (alex@relsoft.net)
|
||||||
|
* Pierre Schweitzer (pierre.schweitzer@reactos.org)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* INCLUDES ****************************************************************/
|
/* INCLUDES ****************************************************************/
|
||||||
|
@ -24,33 +25,6 @@ PRTL_CONVERT_STRING Basep8BitStringToUnicodeString;
|
||||||
|
|
||||||
/* FUNCTIONS ****************************************************************/
|
/* 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
|
* Converts an ANSI or OEM String to the TEB StaticUnicodeString
|
||||||
|
@ -81,18 +55,25 @@ Basep8BitStringToStaticUnicodeString(IN LPCSTR String)
|
||||||
return StaticString;
|
return StaticString;
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS
|
/*
|
||||||
|
* Allocates space from the Heap and converts an Unicode String into it
|
||||||
|
*/
|
||||||
|
BOOLEAN
|
||||||
WINAPI
|
WINAPI
|
||||||
Basep8BitStringToHeapUnicodeString(OUT PUNICODE_STRING UnicodeString,
|
Basep8BitStringToDynamicUnicodeString(OUT PUNICODE_STRING UnicodeString,
|
||||||
IN LPCSTR String)
|
IN LPCSTR String)
|
||||||
{
|
{
|
||||||
ANSI_STRING AnsiString;
|
ANSI_STRING AnsiString;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
DPRINT("Basep8BitStringToCachedUnicodeString\n");
|
DPRINT("Basep8BitStringToDynamicUnicodeString\n");
|
||||||
|
|
||||||
/* Initialize an ANSI String */
|
/* Initialize an ANSI String */
|
||||||
RtlInitAnsiString(&AnsiString, String);
|
if (!NT_SUCCESS(RtlInitAnsiStringEx(&AnsiString, String)))
|
||||||
|
{
|
||||||
|
SetLastError(ERROR_BUFFER_OVERFLOW);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
/* Convert it */
|
/* Convert it */
|
||||||
Status = Basep8BitStringToUnicodeString(UnicodeString, &AnsiString, TRUE);
|
Status = Basep8BitStringToUnicodeString(UnicodeString, &AnsiString, TRUE);
|
||||||
|
@ -101,9 +82,11 @@ Basep8BitStringToHeapUnicodeString(OUT PUNICODE_STRING UnicodeString,
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
SetLastErrorByStatus(Status);
|
SetLastErrorByStatus(Status);
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return Status */
|
/* Return Status */
|
||||||
return Status;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -1563,7 +1563,7 @@ CreateProcessInternalA(HANDLE hToken,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Use a dynamic version */
|
/* Use a dynamic version */
|
||||||
Basep8BitStringToHeapUnicodeString(&LiveCommandLine,
|
Basep8BitStringToDynamicUnicodeString(&LiveCommandLine,
|
||||||
lpCommandLine);
|
lpCommandLine);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1576,12 +1576,12 @@ CreateProcessInternalA(HANDLE hToken,
|
||||||
/* Convert the Name and Directory */
|
/* Convert the Name and Directory */
|
||||||
if (lpApplicationName)
|
if (lpApplicationName)
|
||||||
{
|
{
|
||||||
Basep8BitStringToHeapUnicodeString(&ApplicationName,
|
Basep8BitStringToDynamicUnicodeString(&ApplicationName,
|
||||||
lpApplicationName);
|
lpApplicationName);
|
||||||
}
|
}
|
||||||
if (lpCurrentDirectory)
|
if (lpCurrentDirectory)
|
||||||
{
|
{
|
||||||
Basep8BitStringToHeapUnicodeString(&CurrentDirectory,
|
Basep8BitStringToDynamicUnicodeString(&CurrentDirectory,
|
||||||
lpCurrentDirectory);
|
lpCurrentDirectory);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue