From 1b151936282684289053cc0a79078d61c6b7b795 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Sun, 7 Aug 2016 19:02:07 +0000 Subject: [PATCH] [ADVAPI32]: Don't directly redirect IsTextUnicode to RtlIsTextUnicode, but use a helper function, so that the return value is correctly set to TRUE or FALSE. Indeed the former function returns a BOOL (long) while the latter returns a BOOLEAN (byte), and the high bytes in the return value could not be correctly set otherwise. Adapted from a patch by 'andy-123'. CORE-11803 #resolve #comment Fixesd, thanks! svn path=/trunk/; revision=72151 --- reactos/dll/win32/advapi32/CMakeLists.txt | 1 + reactos/dll/win32/advapi32/advapi32.spec | 2 +- reactos/dll/win32/advapi32/misc/unicode.c | 36 +++++++++++++++++++++++ 3 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 reactos/dll/win32/advapi32/misc/unicode.c diff --git a/reactos/dll/win32/advapi32/CMakeLists.txt b/reactos/dll/win32/advapi32/CMakeLists.txt index ed51d188355..08b08ca083b 100644 --- a/reactos/dll/win32/advapi32/CMakeLists.txt +++ b/reactos/dll/win32/advapi32/CMakeLists.txt @@ -25,6 +25,7 @@ list(APPEND SOURCE misc/msi.c misc/shutdown.c misc/sysfunc.c + misc/unicode.c reg/hkcr.c reg/reg.c sec/ac.c diff --git a/reactos/dll/win32/advapi32/advapi32.spec b/reactos/dll/win32/advapi32/advapi32.spec index 45556be721a..957381b6d0e 100644 --- a/reactos/dll/win32/advapi32/advapi32.spec +++ b/reactos/dll/win32/advapi32/advapi32.spec @@ -313,7 +313,7 @@ 313 stdcall InitiateSystemShutdownExW(wstr wstr long long long long) 314 stdcall InitiateSystemShutdownW(str str long long long) 315 stub InstallApplication -316 stdcall IsTextUnicode(ptr long ptr) ntdll.RtlIsTextUnicode +316 stdcall IsTextUnicode(ptr long ptr) 317 stdcall IsTokenRestricted(long) 318 stub IsTokenUntrusted 319 stdcall IsValidAcl(ptr) diff --git a/reactos/dll/win32/advapi32/misc/unicode.c b/reactos/dll/win32/advapi32/misc/unicode.c new file mode 100644 index 00000000000..54201bfafa3 --- /dev/null +++ b/reactos/dll/win32/advapi32/misc/unicode.c @@ -0,0 +1,36 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS system libraries + * FILE: dll/win32/advapi32/misc/unicode.c + * PURPOSE: Unicode helper. Needed because RtlIsTextUnicode returns a + * BOOLEAN (byte) while IsTextUnicode returns a BOOL (long). + * The high bytes of the return value should be correctly set, + * hence a direct redirection cannot be done. + */ + +#include + +WINE_DEFAULT_DEBUG_CHANNEL(advapi); + +/************************************************************************** + * IsTextUnicode (ADVAPI32.@) + * + * Attempt to guess whether a text buffer is Unicode. + * + * PARAMS + * lpv [I] Text buffer to test + * iSize [I] Length of lpv + * lpiResult [O] Destination for test results + * + * RETURNS + * TRUE if the buffer is likely Unicode, FALSE otherwise. + */ +BOOL WINAPI +IsTextUnicode(IN CONST VOID* lpv, + IN INT iSize, + IN OUT LPINT lpiResult OPTIONAL) +{ + return (RtlIsTextUnicode(lpv, iSize, lpiResult) == TRUE); +} + +/* EOF */