Misc addendum to CORE-14271 (#1529)

* [ADVAPI32] Simplify RtlCreateUnicodeStringFromAsciiz() return value check

RtlCreateUnicodeStringFromAsciiz() returns a BOOLEAN, not a BOOL.

No functional change.

Addendum to
CORE-14271

* [USER32] Simplify RtlCreateUnicodeStringFromAsciiz() return value check

RtlCreateUnicodeStringFromAsciiz() returns a BOOLEAN, not a UINT.

Also, add a FIXME.

No functional change.

Addendum to
CORE-14271

* [USER32] Simplify RegisterClipboardFormatA/W() a bit

No functional change.

* [UDFS] Simplify SeSinglePrivilegeCheck() return value check

No functional change.

Addendum to
CORE-14271
This commit is contained in:
Serge Gautherie 2019-06-04 16:56:33 +02:00 committed by Hermès BÉLUSCA - MAÏTO
parent 77ac92d817
commit 38db074491
3 changed files with 15 additions and 21 deletions

View file

@ -71,7 +71,7 @@ GetClipboardFormatNameA(UINT format,
/* clear result string */
Length = 0;
}
lpszFormatName[Length] = '\0';
lpszFormatName[Length] = ANSI_NULL;
}
RtlFreeHeap(RtlGetProcessHeap(), 0, lpBuffer);
@ -97,7 +97,7 @@ UINT
WINAPI
RegisterClipboardFormatA(LPCSTR lpszFormat)
{
UINT ret = 0;
UINT ret;
UNICODE_STRING usFormat = {0};
if (lpszFormat == NULL)
@ -106,20 +106,22 @@ RegisterClipboardFormatA(LPCSTR lpszFormat)
return 0;
}
/* check for "" */
if (*lpszFormat == 0) //NULL
if (*lpszFormat == ANSI_NULL)
{
SetLastError(ERROR_INVALID_NAME);
return 0;
}
ret = RtlCreateUnicodeStringFromAsciiz(&usFormat, lpszFormat);
if (ret)
if (!RtlCreateUnicodeStringFromAsciiz(&usFormat, lpszFormat))
{
ret = NtUserRegisterWindowMessage(&usFormat); //(LPCWSTR)
RtlFreeUnicodeString(&usFormat);
// FIXME: Shouldn't we 'SetLastError(ERROR_NOT_ENOUGH_MEMORY);'?
return 0;
}
ret = NtUserRegisterWindowMessage(&usFormat); //(LPCWSTR)
RtlFreeUnicodeString(&usFormat);
return ret;
}
@ -130,7 +132,6 @@ UINT
WINAPI
RegisterClipboardFormatW(LPCWSTR lpszFormat)
{
UINT ret = 0;
UNICODE_STRING usFormat = {0};
if (lpszFormat == NULL)
@ -139,17 +140,14 @@ RegisterClipboardFormatW(LPCWSTR lpszFormat)
return 0;
}
/* check for "" */
if (*lpszFormat == 0) //NULL
if (*lpszFormat == UNICODE_NULL)
{
SetLastError(ERROR_INVALID_NAME);
return 0;
}
RtlInitUnicodeString(&usFormat, lpszFormat);
ret = NtUserRegisterWindowMessage(&usFormat);
return ret;
return NtUserRegisterWindowMessage(&usFormat);
}
static PVOID WINAPI