Author: hbelusca
Date: Tue Sep 10 21:26:37 2013
New Revision: 60014
URL:
http://svn.reactos.org/svn/reactos?rev=60014&view=rev
Log:
[USERENV][USER32]
Use a correct return variable for RtlCreateUnicodeStringFromAsciiz. Advice: read the
documentation before using functions...
Modified:
trunk/reactos/dll/win32/userenv/desktop.c
trunk/reactos/dll/win32/userenv/directory.c
trunk/reactos/win32ss/user/user32/windows/menu.c
trunk/reactos/win32ss/user/user32/windows/message.c
Modified: trunk/reactos/dll/win32/userenv/desktop.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/userenv/desktop.…
==============================================================================
--- trunk/reactos/dll/win32/userenv/desktop.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/userenv/desktop.c [iso-8859-1] Tue Sep 10 21:26:37 2013
@@ -164,45 +164,40 @@
UNICODE_STRING IconLocation;
UNICODE_STRING WorkingDirectory;
BOOL bResult;
- NTSTATUS Status;
-
- Status = RtlCreateUnicodeStringFromAsciiz(&ItemName,
- (LPSTR)lpItemName);
- if (!NT_SUCCESS(Status))
- {
- SetLastError (RtlNtStatusToDosError (Status));
- return FALSE;
- }
-
- Status = RtlCreateUnicodeStringFromAsciiz(&Arguments,
- (LPSTR)lpArguments);
- if (!NT_SUCCESS(Status))
+
+ if (!RtlCreateUnicodeStringFromAsciiz(&ItemName,
+ (LPSTR)lpItemName))
+ {
+ SetLastError(ERROR_NOT_ENOUGH_MEMORY);
+ return FALSE;
+ }
+
+ if (!RtlCreateUnicodeStringFromAsciiz(&Arguments,
+ (LPSTR)lpArguments))
{
RtlFreeUnicodeString(&ItemName);
- SetLastError (RtlNtStatusToDosError (Status));
- return FALSE;
- }
-
- Status = RtlCreateUnicodeStringFromAsciiz(&IconLocation,
- (LPSTR)lpIconLocation);
- if (!NT_SUCCESS(Status))
+ SetLastError(ERROR_NOT_ENOUGH_MEMORY);
+ return FALSE;
+ }
+
+ 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 @@
{
UNICODE_STRING ItemName;
BOOL bResult;
- NTSTATUS Status;
-
- Status = RtlCreateUnicodeStringFromAsciiz(&ItemName,
- (LPSTR)lpItemName);
- if (!NT_SUCCESS(Status))
- {
- SetLastError (RtlNtStatusToDosError (Status));
+
+ if (!RtlCreateUnicodeStringFromAsciiz(&ItemName,
+ (LPSTR)lpItemName))
+ {
+ SetLastError(ERROR_NOT_ENOUGH_MEMORY);
return FALSE;
}
@@ -437,13 +430,11 @@
{
UNICODE_STRING GroupName;
BOOL bResult;
- NTSTATUS Status;
-
- Status = RtlCreateUnicodeStringFromAsciiz(&GroupName,
- (LPSTR)lpGroupName);
- if (!NT_SUCCESS(Status))
- {
- SetLastError (RtlNtStatusToDosError (Status));
+
+ if (!RtlCreateUnicodeStringFromAsciiz(&GroupName,
+ (LPSTR)lpGroupName))
+ {
+ SetLastError(ERROR_NOT_ENOUGH_MEMORY);
return FALSE;
}
@@ -495,13 +486,11 @@
{
UNICODE_STRING GroupName;
BOOL bResult;
- NTSTATUS Status;
-
- Status = RtlCreateUnicodeStringFromAsciiz(&GroupName,
- (LPSTR)lpGroupName);
- if (!NT_SUCCESS(Status))
- {
- SetLastError (RtlNtStatusToDosError (Status));
+
+ if (!RtlCreateUnicodeStringFromAsciiz(&GroupName,
+ (LPSTR)lpGroupName))
+ {
+ SetLastError(ERROR_NOT_ENOUGH_MEMORY);
return FALSE;
}
@@ -564,54 +553,48 @@
UNICODE_STRING IconLocation;
UNICODE_STRING WorkingDirectory;
BOOL bResult;
- NTSTATUS Status;
-
- Status = RtlCreateUnicodeStringFromAsciiz(&ItemName,
- (LPSTR)lpItemName);
- if (!NT_SUCCESS(Status))
- {
- SetLastError (RtlNtStatusToDosError (Status));
- return FALSE;
- }
-
- Status = RtlCreateUnicodeStringFromAsciiz(&Arguments,
- (LPSTR)lpArguments);
- if (!NT_SUCCESS(Status))
+
+ if (!RtlCreateUnicodeStringFromAsciiz(&ItemName,
+ (LPSTR)lpItemName))
+ {
+ SetLastError(ERROR_NOT_ENOUGH_MEMORY);
+ return FALSE;
+ }
+
+ if (!RtlCreateUnicodeStringFromAsciiz(&Arguments,
+ (LPSTR)lpArguments))
{
RtlFreeUnicodeString(&ItemName);
- SetLastError (RtlNtStatusToDosError (Status));
- return FALSE;
- }
-
- Status = RtlCreateUnicodeStringFromAsciiz(&IconLocation,
- (LPSTR)lpIconLocation);
- if (!NT_SUCCESS(Status))
+ SetLastError(ERROR_NOT_ENOUGH_MEMORY);
+ return FALSE;
+ }
+
+ 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 @@
RtlFreeUnicodeString(&IconLocation);
RtlFreeUnicodeString(&Arguments);
RtlFreeUnicodeString(&ItemName);
- SetLastError (RtlNtStatusToDosError (Status));
+ SetLastError(ERROR_NOT_ENOUGH_MEMORY);
return FALSE;
}
}
@@ -821,29 +804,26 @@
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;
}
Modified: trunk/reactos/dll/win32/userenv/directory.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/userenv/director…
==============================================================================
--- trunk/reactos/dll/win32/userenv/directory.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/userenv/directory.c [iso-8859-1] Tue Sep 10 21:26:37 2013
@@ -39,23 +39,20 @@
{
UNICODE_STRING SrcPath;
UNICODE_STRING DstPath;
- NTSTATUS Status;
BOOL bResult;
- Status = RtlCreateUnicodeStringFromAsciiz(&SrcPath,
- (LPSTR)lpSourcePath);
- if (!NT_SUCCESS(Status))
- {
- SetLastError (RtlNtStatusToDosError (Status));
- return FALSE;
- }
-
- Status = RtlCreateUnicodeStringFromAsciiz(&DstPath,
- (LPSTR)lpDestinationPath);
- if (!NT_SUCCESS(Status))
+ if (!RtlCreateUnicodeStringFromAsciiz(&SrcPath,
+ (LPSTR)lpSourcePath))
+ {
+ SetLastError(ERROR_NOT_ENOUGH_MEMORY);
+ return FALSE;
+ }
+
+ if (!RtlCreateUnicodeStringFromAsciiz(&DstPath,
+ (LPSTR)lpDestinationPath))
{
RtlFreeUnicodeString(&SrcPath);
- SetLastError (RtlNtStatusToDosError (Status));
+ SetLastError(ERROR_NOT_ENOUGH_MEMORY);
return FALSE;
}
Modified: trunk/reactos/win32ss/user/user32/windows/menu.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/user32/window…
==============================================================================
--- trunk/reactos/win32ss/user/user32/windows/menu.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/user32/windows/menu.c [iso-8859-1] Tue Sep 10 21:26:37
2013
@@ -5047,7 +5047,6 @@
{
MENUITEMINFOW MenuItemInfoW;
UNICODE_STRING UnicodeString;
- NTSTATUS Status;
ULONG Result = FALSE;
RtlCopyMemory(&MenuItemInfoW, lpmii, min(lpmii->cbSize,
sizeof(MENUITEMINFOW)));
@@ -5069,12 +5068,11 @@
&& 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))
- {
- SetLastError (RtlNtStatusToDosError(Status));
- return FALSE;
+ if (!RtlCreateUnicodeStringFromAsciiz(&UnicodeString,
+ (LPSTR)MenuItemInfoW.dwTypeData))
+ {
+ SetLastError (ERROR_NOT_ENOUGH_MEMORY);
+ return FALSE;
}
MenuItemInfoW.dwTypeData = UnicodeString.Buffer;
MenuItemInfoW.cch = UnicodeString.Length / sizeof(WCHAR);
Modified: trunk/reactos/win32ss/user/user32/windows/message.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/user32/window…
==============================================================================
--- trunk/reactos/win32ss/user/user32/windows/message.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/user32/windows/message.c [iso-8859-1] Tue Sep 10 21:26:37
2013
@@ -2675,11 +2675,9 @@
RegisterWindowMessageA(LPCSTR lpString)
{
UNICODE_STRING String;
- BOOLEAN Result;
UINT Atom;
- Result = RtlCreateUnicodeStringFromAsciiz(&String, (PCSZ)lpString);
- if (!Result)
+ if (!RtlCreateUnicodeStringFromAsciiz(&String, (PCSZ)lpString))
{
return(0);
}