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

@ -4847,10 +4847,7 @@ RegSetValueExA(HKEY hKey,
/* Convert SubKey name to Unicode */
if (lpValueName != NULL && lpValueName[0] != '\0')
{
BOOL bConverted;
bConverted = RtlCreateUnicodeStringFromAsciiz(&ValueName,
(PSTR)lpValueName);
if(!bConverted)
if (!RtlCreateUnicodeStringFromAsciiz(&ValueName, (PSTR)lpValueName))
return ERROR_NOT_ENOUGH_MEMORY;
}
else

View file

@ -934,9 +934,9 @@ UDFCheckAccessRights(
)
{
NTSTATUS RC;
BOOLEAN SecurityCheck = TRUE;
BOOLEAN ROCheck = FALSE;
#ifdef UDF_ENABLE_SECURITY
BOOLEAN SecurityCheck;
PSECURITY_DESCRIPTOR SecDesc;
SECURITY_SUBJECT_CONTEXT SubjectContext;
ACCESS_MASK LocalAccessMask;
@ -1011,8 +1011,7 @@ treat_as_ro:
} else
#endif //UDF_ENABLE_SECURITY
if(DesiredAccess & ACCESS_SYSTEM_SECURITY) {
SecurityCheck = SeSinglePrivilegeCheck(SeExports->SeSecurityPrivilege, UserMode);
if(!SecurityCheck)
if (!SeSinglePrivilegeCheck(SeExports->SeSecurityPrivilege, UserMode))
return STATUS_ACCESS_DENIED;
Ccb->PreviouslyGrantedAccess |= ACCESS_SYSTEM_SECURITY;
}

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