mirror of
https://github.com/reactos/reactos.git
synced 2025-01-03 21:09:19 +00:00
[USERENV][USER32]
Use a correct return variable for RtlCreateUnicodeStringFromAsciiz. Advice: read the documentation before using functions... svn path=/trunk/; revision=60014
This commit is contained in:
parent
13abedbf7a
commit
e7603b96f7
4 changed files with 53 additions and 80 deletions
|
@ -164,45 +164,40 @@ AddDesktopItemA (BOOL bCommonItem,
|
|||
UNICODE_STRING IconLocation;
|
||||
UNICODE_STRING WorkingDirectory;
|
||||
BOOL bResult;
|
||||
NTSTATUS Status;
|
||||
|
||||
Status = RtlCreateUnicodeStringFromAsciiz(&ItemName,
|
||||
(LPSTR)lpItemName);
|
||||
if (!NT_SUCCESS(Status))
|
||||
if (!RtlCreateUnicodeStringFromAsciiz(&ItemName,
|
||||
(LPSTR)lpItemName))
|
||||
{
|
||||
SetLastError (RtlNtStatusToDosError (Status));
|
||||
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Status = RtlCreateUnicodeStringFromAsciiz(&Arguments,
|
||||
(LPSTR)lpArguments);
|
||||
if (!NT_SUCCESS(Status))
|
||||
if (!RtlCreateUnicodeStringFromAsciiz(&Arguments,
|
||||
(LPSTR)lpArguments))
|
||||
{
|
||||
RtlFreeUnicodeString(&ItemName);
|
||||
SetLastError (RtlNtStatusToDosError (Status));
|
||||
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Status = RtlCreateUnicodeStringFromAsciiz(&IconLocation,
|
||||
(LPSTR)lpIconLocation);
|
||||
if (!NT_SUCCESS(Status))
|
||||
if (!RtlCreateUnicodeStringFromAsciiz(&IconLocation,
|
||||
(LPSTR)lpIconLocation))
|
||||
{
|
||||
RtlFreeUnicodeString(&Arguments);
|
||||
RtlFreeUnicodeString(&ItemName);
|
||||
SetLastError (RtlNtStatusToDosError (Status));
|
||||
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (lpWorkingDirectory != NULL)
|
||||
{
|
||||
Status = RtlCreateUnicodeStringFromAsciiz(&WorkingDirectory,
|
||||
(LPSTR)lpWorkingDirectory);
|
||||
if (!NT_SUCCESS(Status))
|
||||
if (!RtlCreateUnicodeStringFromAsciiz(&WorkingDirectory,
|
||||
(LPSTR)lpWorkingDirectory))
|
||||
{
|
||||
RtlFreeUnicodeString(&IconLocation);
|
||||
RtlFreeUnicodeString(&Arguments);
|
||||
RtlFreeUnicodeString(&ItemName);
|
||||
SetLastError (RtlNtStatusToDosError (Status));
|
||||
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
@ -389,13 +384,11 @@ DeleteDesktopItemA (BOOL bCommonItem,
|
|||
{
|
||||
UNICODE_STRING ItemName;
|
||||
BOOL bResult;
|
||||
NTSTATUS Status;
|
||||
|
||||
Status = RtlCreateUnicodeStringFromAsciiz(&ItemName,
|
||||
(LPSTR)lpItemName);
|
||||
if (!NT_SUCCESS(Status))
|
||||
if (!RtlCreateUnicodeStringFromAsciiz(&ItemName,
|
||||
(LPSTR)lpItemName))
|
||||
{
|
||||
SetLastError (RtlNtStatusToDosError (Status));
|
||||
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -437,13 +430,11 @@ CreateGroupA (LPCSTR lpGroupName,
|
|||
{
|
||||
UNICODE_STRING GroupName;
|
||||
BOOL bResult;
|
||||
NTSTATUS Status;
|
||||
|
||||
Status = RtlCreateUnicodeStringFromAsciiz(&GroupName,
|
||||
(LPSTR)lpGroupName);
|
||||
if (!NT_SUCCESS(Status))
|
||||
if (!RtlCreateUnicodeStringFromAsciiz(&GroupName,
|
||||
(LPSTR)lpGroupName))
|
||||
{
|
||||
SetLastError (RtlNtStatusToDosError (Status));
|
||||
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -495,13 +486,11 @@ DeleteGroupA (LPCSTR lpGroupName,
|
|||
{
|
||||
UNICODE_STRING GroupName;
|
||||
BOOL bResult;
|
||||
NTSTATUS Status;
|
||||
|
||||
Status = RtlCreateUnicodeStringFromAsciiz(&GroupName,
|
||||
(LPSTR)lpGroupName);
|
||||
if (!NT_SUCCESS(Status))
|
||||
if (!RtlCreateUnicodeStringFromAsciiz(&GroupName,
|
||||
(LPSTR)lpGroupName))
|
||||
{
|
||||
SetLastError (RtlNtStatusToDosError (Status));
|
||||
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -564,54 +553,48 @@ AddItemA (LPCSTR lpGroupName, /* Optional */
|
|||
UNICODE_STRING IconLocation;
|
||||
UNICODE_STRING WorkingDirectory;
|
||||
BOOL bResult;
|
||||
NTSTATUS Status;
|
||||
|
||||
Status = RtlCreateUnicodeStringFromAsciiz(&ItemName,
|
||||
(LPSTR)lpItemName);
|
||||
if (!NT_SUCCESS(Status))
|
||||
if (!RtlCreateUnicodeStringFromAsciiz(&ItemName,
|
||||
(LPSTR)lpItemName))
|
||||
{
|
||||
SetLastError (RtlNtStatusToDosError (Status));
|
||||
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Status = RtlCreateUnicodeStringFromAsciiz(&Arguments,
|
||||
(LPSTR)lpArguments);
|
||||
if (!NT_SUCCESS(Status))
|
||||
if (!RtlCreateUnicodeStringFromAsciiz(&Arguments,
|
||||
(LPSTR)lpArguments))
|
||||
{
|
||||
RtlFreeUnicodeString(&ItemName);
|
||||
SetLastError (RtlNtStatusToDosError (Status));
|
||||
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Status = RtlCreateUnicodeStringFromAsciiz(&IconLocation,
|
||||
(LPSTR)lpIconLocation);
|
||||
if (!NT_SUCCESS(Status))
|
||||
if (!RtlCreateUnicodeStringFromAsciiz(&IconLocation,
|
||||
(LPSTR)lpIconLocation))
|
||||
{
|
||||
RtlFreeUnicodeString(&Arguments);
|
||||
RtlFreeUnicodeString(&ItemName);
|
||||
SetLastError (RtlNtStatusToDosError (Status));
|
||||
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (lpGroupName != NULL)
|
||||
{
|
||||
Status = RtlCreateUnicodeStringFromAsciiz(&GroupName,
|
||||
(LPSTR)lpGroupName);
|
||||
if (!NT_SUCCESS(Status))
|
||||
if (!RtlCreateUnicodeStringFromAsciiz(&GroupName,
|
||||
(LPSTR)lpGroupName))
|
||||
{
|
||||
RtlFreeUnicodeString(&IconLocation);
|
||||
RtlFreeUnicodeString(&Arguments);
|
||||
RtlFreeUnicodeString(&ItemName);
|
||||
SetLastError (RtlNtStatusToDosError (Status));
|
||||
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (lpWorkingDirectory != NULL)
|
||||
{
|
||||
Status = RtlCreateUnicodeStringFromAsciiz(&WorkingDirectory,
|
||||
(LPSTR)lpWorkingDirectory);
|
||||
if (!NT_SUCCESS(Status))
|
||||
if (!RtlCreateUnicodeStringFromAsciiz(&WorkingDirectory,
|
||||
(LPSTR)lpWorkingDirectory))
|
||||
{
|
||||
if (lpGroupName != NULL)
|
||||
{
|
||||
|
@ -620,7 +603,7 @@ AddItemA (LPCSTR lpGroupName, /* Optional */
|
|||
RtlFreeUnicodeString(&IconLocation);
|
||||
RtlFreeUnicodeString(&Arguments);
|
||||
RtlFreeUnicodeString(&ItemName);
|
||||
SetLastError (RtlNtStatusToDosError (Status));
|
||||
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
@ -821,29 +804,26 @@ DeleteItemA (LPCSTR lpGroupName, /* Optional */
|
|||
UNICODE_STRING GroupName;
|
||||
UNICODE_STRING ItemName;
|
||||
BOOL bResult;
|
||||
NTSTATUS Status;
|
||||
|
||||
if (lpGroupName != NULL)
|
||||
{
|
||||
Status = RtlCreateUnicodeStringFromAsciiz(&GroupName,
|
||||
(LPSTR)lpGroupName);
|
||||
if (!NT_SUCCESS(Status))
|
||||
if (!RtlCreateUnicodeStringFromAsciiz(&GroupName,
|
||||
(LPSTR)lpGroupName))
|
||||
{
|
||||
SetLastError (RtlNtStatusToDosError (Status));
|
||||
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
Status = RtlCreateUnicodeStringFromAsciiz(&ItemName,
|
||||
(LPSTR)lpItemName);
|
||||
if (!NT_SUCCESS(Status))
|
||||
if (!RtlCreateUnicodeStringFromAsciiz(&ItemName,
|
||||
(LPSTR)lpItemName))
|
||||
{
|
||||
if (lpGroupName != NULL)
|
||||
{
|
||||
RtlFreeUnicodeString(&GroupName);
|
||||
}
|
||||
|
||||
SetLastError (RtlNtStatusToDosError (Status));
|
||||
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
|
@ -39,23 +39,20 @@ CopyProfileDirectoryA(LPCSTR lpSourcePath,
|
|||
{
|
||||
UNICODE_STRING SrcPath;
|
||||
UNICODE_STRING DstPath;
|
||||
NTSTATUS Status;
|
||||
BOOL bResult;
|
||||
|
||||
Status = RtlCreateUnicodeStringFromAsciiz(&SrcPath,
|
||||
(LPSTR)lpSourcePath);
|
||||
if (!NT_SUCCESS(Status))
|
||||
if (!RtlCreateUnicodeStringFromAsciiz(&SrcPath,
|
||||
(LPSTR)lpSourcePath))
|
||||
{
|
||||
SetLastError (RtlNtStatusToDosError (Status));
|
||||
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Status = RtlCreateUnicodeStringFromAsciiz(&DstPath,
|
||||
(LPSTR)lpDestinationPath);
|
||||
if (!NT_SUCCESS(Status))
|
||||
if (!RtlCreateUnicodeStringFromAsciiz(&DstPath,
|
||||
(LPSTR)lpDestinationPath))
|
||||
{
|
||||
RtlFreeUnicodeString(&SrcPath);
|
||||
SetLastError (RtlNtStatusToDosError (Status));
|
||||
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
|
@ -5047,7 +5047,6 @@ SetMenuItemInfoA(
|
|||
{
|
||||
MENUITEMINFOW MenuItemInfoW;
|
||||
UNICODE_STRING UnicodeString;
|
||||
NTSTATUS Status;
|
||||
ULONG Result = FALSE;
|
||||
|
||||
RtlCopyMemory(&MenuItemInfoW, lpmii, min(lpmii->cbSize, sizeof(MENUITEMINFOW)));
|
||||
|
@ -5069,12 +5068,11 @@ SetMenuItemInfoA(
|
|||
&& MenuItemInfoW.dwTypeData != NULL)
|
||||
{
|
||||
/* cch is ignored when the content of a menu item is set by calling SetMenuItemInfo. */
|
||||
Status = RtlCreateUnicodeStringFromAsciiz(&UnicodeString,
|
||||
(LPSTR)MenuItemInfoW.dwTypeData);
|
||||
if (!NT_SUCCESS (Status))
|
||||
if (!RtlCreateUnicodeStringFromAsciiz(&UnicodeString,
|
||||
(LPSTR)MenuItemInfoW.dwTypeData))
|
||||
{
|
||||
SetLastError (RtlNtStatusToDosError(Status));
|
||||
return FALSE;
|
||||
SetLastError (ERROR_NOT_ENOUGH_MEMORY);
|
||||
return FALSE;
|
||||
}
|
||||
MenuItemInfoW.dwTypeData = UnicodeString.Buffer;
|
||||
MenuItemInfoW.cch = UnicodeString.Length / sizeof(WCHAR);
|
||||
|
|
|
@ -2675,11 +2675,9 @@ UINT WINAPI
|
|||
RegisterWindowMessageA(LPCSTR lpString)
|
||||
{
|
||||
UNICODE_STRING String;
|
||||
BOOLEAN Result;
|
||||
UINT Atom;
|
||||
|
||||
Result = RtlCreateUnicodeStringFromAsciiz(&String, (PCSZ)lpString);
|
||||
if (!Result)
|
||||
if (!RtlCreateUnicodeStringFromAsciiz(&String, (PCSZ)lpString))
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue