mirror of
https://github.com/reactos/reactos.git
synced 2025-01-05 22:12:46 +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 IconLocation;
|
||||||
UNICODE_STRING WorkingDirectory;
|
UNICODE_STRING WorkingDirectory;
|
||||||
BOOL bResult;
|
BOOL bResult;
|
||||||
NTSTATUS Status;
|
|
||||||
|
|
||||||
Status = RtlCreateUnicodeStringFromAsciiz(&ItemName,
|
if (!RtlCreateUnicodeStringFromAsciiz(&ItemName,
|
||||||
(LPSTR)lpItemName);
|
(LPSTR)lpItemName))
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
{
|
||||||
SetLastError (RtlNtStatusToDosError (Status));
|
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = RtlCreateUnicodeStringFromAsciiz(&Arguments,
|
if (!RtlCreateUnicodeStringFromAsciiz(&Arguments,
|
||||||
(LPSTR)lpArguments);
|
(LPSTR)lpArguments))
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
{
|
||||||
RtlFreeUnicodeString(&ItemName);
|
RtlFreeUnicodeString(&ItemName);
|
||||||
SetLastError (RtlNtStatusToDosError (Status));
|
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = RtlCreateUnicodeStringFromAsciiz(&IconLocation,
|
if (!RtlCreateUnicodeStringFromAsciiz(&IconLocation,
|
||||||
(LPSTR)lpIconLocation);
|
(LPSTR)lpIconLocation))
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
{
|
||||||
RtlFreeUnicodeString(&Arguments);
|
RtlFreeUnicodeString(&Arguments);
|
||||||
RtlFreeUnicodeString(&ItemName);
|
RtlFreeUnicodeString(&ItemName);
|
||||||
SetLastError (RtlNtStatusToDosError (Status));
|
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lpWorkingDirectory != NULL)
|
if (lpWorkingDirectory != NULL)
|
||||||
{
|
{
|
||||||
Status = RtlCreateUnicodeStringFromAsciiz(&WorkingDirectory,
|
if (!RtlCreateUnicodeStringFromAsciiz(&WorkingDirectory,
|
||||||
(LPSTR)lpWorkingDirectory);
|
(LPSTR)lpWorkingDirectory))
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
{
|
||||||
RtlFreeUnicodeString(&IconLocation);
|
RtlFreeUnicodeString(&IconLocation);
|
||||||
RtlFreeUnicodeString(&Arguments);
|
RtlFreeUnicodeString(&Arguments);
|
||||||
RtlFreeUnicodeString(&ItemName);
|
RtlFreeUnicodeString(&ItemName);
|
||||||
SetLastError (RtlNtStatusToDosError (Status));
|
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -389,13 +384,11 @@ DeleteDesktopItemA (BOOL bCommonItem,
|
||||||
{
|
{
|
||||||
UNICODE_STRING ItemName;
|
UNICODE_STRING ItemName;
|
||||||
BOOL bResult;
|
BOOL bResult;
|
||||||
NTSTATUS Status;
|
|
||||||
|
|
||||||
Status = RtlCreateUnicodeStringFromAsciiz(&ItemName,
|
if (!RtlCreateUnicodeStringFromAsciiz(&ItemName,
|
||||||
(LPSTR)lpItemName);
|
(LPSTR)lpItemName))
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
{
|
||||||
SetLastError (RtlNtStatusToDosError (Status));
|
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -437,13 +430,11 @@ CreateGroupA (LPCSTR lpGroupName,
|
||||||
{
|
{
|
||||||
UNICODE_STRING GroupName;
|
UNICODE_STRING GroupName;
|
||||||
BOOL bResult;
|
BOOL bResult;
|
||||||
NTSTATUS Status;
|
|
||||||
|
|
||||||
Status = RtlCreateUnicodeStringFromAsciiz(&GroupName,
|
if (!RtlCreateUnicodeStringFromAsciiz(&GroupName,
|
||||||
(LPSTR)lpGroupName);
|
(LPSTR)lpGroupName))
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
{
|
||||||
SetLastError (RtlNtStatusToDosError (Status));
|
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -495,13 +486,11 @@ DeleteGroupA (LPCSTR lpGroupName,
|
||||||
{
|
{
|
||||||
UNICODE_STRING GroupName;
|
UNICODE_STRING GroupName;
|
||||||
BOOL bResult;
|
BOOL bResult;
|
||||||
NTSTATUS Status;
|
|
||||||
|
|
||||||
Status = RtlCreateUnicodeStringFromAsciiz(&GroupName,
|
if (!RtlCreateUnicodeStringFromAsciiz(&GroupName,
|
||||||
(LPSTR)lpGroupName);
|
(LPSTR)lpGroupName))
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
{
|
||||||
SetLastError (RtlNtStatusToDosError (Status));
|
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -564,54 +553,48 @@ AddItemA (LPCSTR lpGroupName, /* Optional */
|
||||||
UNICODE_STRING IconLocation;
|
UNICODE_STRING IconLocation;
|
||||||
UNICODE_STRING WorkingDirectory;
|
UNICODE_STRING WorkingDirectory;
|
||||||
BOOL bResult;
|
BOOL bResult;
|
||||||
NTSTATUS Status;
|
|
||||||
|
|
||||||
Status = RtlCreateUnicodeStringFromAsciiz(&ItemName,
|
if (!RtlCreateUnicodeStringFromAsciiz(&ItemName,
|
||||||
(LPSTR)lpItemName);
|
(LPSTR)lpItemName))
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
{
|
||||||
SetLastError (RtlNtStatusToDosError (Status));
|
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = RtlCreateUnicodeStringFromAsciiz(&Arguments,
|
if (!RtlCreateUnicodeStringFromAsciiz(&Arguments,
|
||||||
(LPSTR)lpArguments);
|
(LPSTR)lpArguments))
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
{
|
||||||
RtlFreeUnicodeString(&ItemName);
|
RtlFreeUnicodeString(&ItemName);
|
||||||
SetLastError (RtlNtStatusToDosError (Status));
|
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = RtlCreateUnicodeStringFromAsciiz(&IconLocation,
|
if (!RtlCreateUnicodeStringFromAsciiz(&IconLocation,
|
||||||
(LPSTR)lpIconLocation);
|
(LPSTR)lpIconLocation))
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
{
|
||||||
RtlFreeUnicodeString(&Arguments);
|
RtlFreeUnicodeString(&Arguments);
|
||||||
RtlFreeUnicodeString(&ItemName);
|
RtlFreeUnicodeString(&ItemName);
|
||||||
SetLastError (RtlNtStatusToDosError (Status));
|
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lpGroupName != NULL)
|
if (lpGroupName != NULL)
|
||||||
{
|
{
|
||||||
Status = RtlCreateUnicodeStringFromAsciiz(&GroupName,
|
if (!RtlCreateUnicodeStringFromAsciiz(&GroupName,
|
||||||
(LPSTR)lpGroupName);
|
(LPSTR)lpGroupName))
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
{
|
||||||
RtlFreeUnicodeString(&IconLocation);
|
RtlFreeUnicodeString(&IconLocation);
|
||||||
RtlFreeUnicodeString(&Arguments);
|
RtlFreeUnicodeString(&Arguments);
|
||||||
RtlFreeUnicodeString(&ItemName);
|
RtlFreeUnicodeString(&ItemName);
|
||||||
SetLastError (RtlNtStatusToDosError (Status));
|
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lpWorkingDirectory != NULL)
|
if (lpWorkingDirectory != NULL)
|
||||||
{
|
{
|
||||||
Status = RtlCreateUnicodeStringFromAsciiz(&WorkingDirectory,
|
if (!RtlCreateUnicodeStringFromAsciiz(&WorkingDirectory,
|
||||||
(LPSTR)lpWorkingDirectory);
|
(LPSTR)lpWorkingDirectory))
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
{
|
||||||
if (lpGroupName != NULL)
|
if (lpGroupName != NULL)
|
||||||
{
|
{
|
||||||
|
@ -620,7 +603,7 @@ AddItemA (LPCSTR lpGroupName, /* Optional */
|
||||||
RtlFreeUnicodeString(&IconLocation);
|
RtlFreeUnicodeString(&IconLocation);
|
||||||
RtlFreeUnicodeString(&Arguments);
|
RtlFreeUnicodeString(&Arguments);
|
||||||
RtlFreeUnicodeString(&ItemName);
|
RtlFreeUnicodeString(&ItemName);
|
||||||
SetLastError (RtlNtStatusToDosError (Status));
|
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -821,29 +804,26 @@ DeleteItemA (LPCSTR lpGroupName, /* Optional */
|
||||||
UNICODE_STRING GroupName;
|
UNICODE_STRING GroupName;
|
||||||
UNICODE_STRING ItemName;
|
UNICODE_STRING ItemName;
|
||||||
BOOL bResult;
|
BOOL bResult;
|
||||||
NTSTATUS Status;
|
|
||||||
|
|
||||||
if (lpGroupName != NULL)
|
if (lpGroupName != NULL)
|
||||||
{
|
{
|
||||||
Status = RtlCreateUnicodeStringFromAsciiz(&GroupName,
|
if (!RtlCreateUnicodeStringFromAsciiz(&GroupName,
|
||||||
(LPSTR)lpGroupName);
|
(LPSTR)lpGroupName))
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
{
|
||||||
SetLastError (RtlNtStatusToDosError (Status));
|
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = RtlCreateUnicodeStringFromAsciiz(&ItemName,
|
if (!RtlCreateUnicodeStringFromAsciiz(&ItemName,
|
||||||
(LPSTR)lpItemName);
|
(LPSTR)lpItemName))
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
{
|
||||||
if (lpGroupName != NULL)
|
if (lpGroupName != NULL)
|
||||||
{
|
{
|
||||||
RtlFreeUnicodeString(&GroupName);
|
RtlFreeUnicodeString(&GroupName);
|
||||||
}
|
}
|
||||||
|
|
||||||
SetLastError (RtlNtStatusToDosError (Status));
|
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,23 +39,20 @@ CopyProfileDirectoryA(LPCSTR lpSourcePath,
|
||||||
{
|
{
|
||||||
UNICODE_STRING SrcPath;
|
UNICODE_STRING SrcPath;
|
||||||
UNICODE_STRING DstPath;
|
UNICODE_STRING DstPath;
|
||||||
NTSTATUS Status;
|
|
||||||
BOOL bResult;
|
BOOL bResult;
|
||||||
|
|
||||||
Status = RtlCreateUnicodeStringFromAsciiz(&SrcPath,
|
if (!RtlCreateUnicodeStringFromAsciiz(&SrcPath,
|
||||||
(LPSTR)lpSourcePath);
|
(LPSTR)lpSourcePath))
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
{
|
||||||
SetLastError (RtlNtStatusToDosError (Status));
|
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = RtlCreateUnicodeStringFromAsciiz(&DstPath,
|
if (!RtlCreateUnicodeStringFromAsciiz(&DstPath,
|
||||||
(LPSTR)lpDestinationPath);
|
(LPSTR)lpDestinationPath))
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
{
|
||||||
RtlFreeUnicodeString(&SrcPath);
|
RtlFreeUnicodeString(&SrcPath);
|
||||||
SetLastError (RtlNtStatusToDosError (Status));
|
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5047,7 +5047,6 @@ SetMenuItemInfoA(
|
||||||
{
|
{
|
||||||
MENUITEMINFOW MenuItemInfoW;
|
MENUITEMINFOW MenuItemInfoW;
|
||||||
UNICODE_STRING UnicodeString;
|
UNICODE_STRING UnicodeString;
|
||||||
NTSTATUS Status;
|
|
||||||
ULONG Result = FALSE;
|
ULONG Result = FALSE;
|
||||||
|
|
||||||
RtlCopyMemory(&MenuItemInfoW, lpmii, min(lpmii->cbSize, sizeof(MENUITEMINFOW)));
|
RtlCopyMemory(&MenuItemInfoW, lpmii, min(lpmii->cbSize, sizeof(MENUITEMINFOW)));
|
||||||
|
@ -5069,12 +5068,11 @@ SetMenuItemInfoA(
|
||||||
&& MenuItemInfoW.dwTypeData != NULL)
|
&& MenuItemInfoW.dwTypeData != NULL)
|
||||||
{
|
{
|
||||||
/* cch is ignored when the content of a menu item is set by calling SetMenuItemInfo. */
|
/* cch is ignored when the content of a menu item is set by calling SetMenuItemInfo. */
|
||||||
Status = RtlCreateUnicodeStringFromAsciiz(&UnicodeString,
|
if (!RtlCreateUnicodeStringFromAsciiz(&UnicodeString,
|
||||||
(LPSTR)MenuItemInfoW.dwTypeData);
|
(LPSTR)MenuItemInfoW.dwTypeData))
|
||||||
if (!NT_SUCCESS (Status))
|
|
||||||
{
|
{
|
||||||
SetLastError (RtlNtStatusToDosError(Status));
|
SetLastError (ERROR_NOT_ENOUGH_MEMORY);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
MenuItemInfoW.dwTypeData = UnicodeString.Buffer;
|
MenuItemInfoW.dwTypeData = UnicodeString.Buffer;
|
||||||
MenuItemInfoW.cch = UnicodeString.Length / sizeof(WCHAR);
|
MenuItemInfoW.cch = UnicodeString.Length / sizeof(WCHAR);
|
||||||
|
|
|
@ -2675,11 +2675,9 @@ UINT WINAPI
|
||||||
RegisterWindowMessageA(LPCSTR lpString)
|
RegisterWindowMessageA(LPCSTR lpString)
|
||||||
{
|
{
|
||||||
UNICODE_STRING String;
|
UNICODE_STRING String;
|
||||||
BOOLEAN Result;
|
|
||||||
UINT Atom;
|
UINT Atom;
|
||||||
|
|
||||||
Result = RtlCreateUnicodeStringFromAsciiz(&String, (PCSZ)lpString);
|
if (!RtlCreateUnicodeStringFromAsciiz(&String, (PCSZ)lpString))
|
||||||
if (!Result)
|
|
||||||
{
|
{
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue