GetClassInfoExA/W() checks for valid parameters now

svn path=/trunk/; revision=5661
This commit is contained in:
Thomas Bluemel 2003-08-19 00:49:42 +00:00
parent 37da5cd4d8
commit 01533e4a5d

View file

@ -1,4 +1,4 @@
/* $Id: class.c,v 1.31 2003/08/19 00:36:40 weiden Exp $ /* $Id: class.c,v 1.32 2003/08/19 00:49:42 weiden Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS user32.dll * PROJECT: ReactOS user32.dll
@ -31,6 +31,13 @@ GetClassInfoExA(
WNDCLASSEXW w; WNDCLASSEXW w;
BOOL retval; BOOL retval;
NTSTATUS Status; NTSTATUS Status;
if(!lpszClass || !lpwcx)
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
if(IS_ATOM(lpszClass)) if(IS_ATOM(lpszClass))
str = (LPWSTR)lpszClass; str = (LPWSTR)lpszClass;
else else
@ -38,7 +45,7 @@ GetClassInfoExA(
if ( !NT_SUCCESS (Status) ) if ( !NT_SUCCESS (Status) )
{ {
SetLastError (RtlNtStatusToDosError(Status)); SetLastError (RtlNtStatusToDosError(Status));
return 0; return FALSE;
} }
str2.Length = 0; str2.Length = 0;
@ -48,7 +55,7 @@ GetClassInfoExA(
if(!str2.Buffer) if(!str2.Buffer)
{ {
SetLastError (RtlNtStatusToDosError(STATUS_NO_MEMORY)); SetLastError (RtlNtStatusToDosError(STATUS_NO_MEMORY));
return 0; return FALSE;
} }
w.lpszMenuName = (LPCWSTR)&str2; w.lpszMenuName = (LPCWSTR)&str2;
@ -57,7 +64,7 @@ GetClassInfoExA(
HEAP_free(str); HEAP_free(str);
RtlCopyMemory ( lpwcx, &w, sizeof(WNDCLASSEXW) ); RtlCopyMemory ( lpwcx, &w, sizeof(WNDCLASSEXW) );
if (!IS_INTRESOURCE(w.lpszMenuName)) if (!IS_INTRESOURCE(w.lpszMenuName) && w.lpszMenuName)
{ {
lpwcx->lpszMenuName = heap_string_poolA (str2.Buffer, str2.Length); lpwcx->lpszMenuName = heap_string_poolA (str2.Buffer, str2.Length);
} }
@ -80,6 +87,13 @@ GetClassInfoExW(
UNICODE_STRING str2; UNICODE_STRING str2;
WNDCLASSEXW w; WNDCLASSEXW w;
WINBOOL retval; WINBOOL retval;
if(!lpszClass || !lpwcx)
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
if(IS_ATOM(lpszClass)) if(IS_ATOM(lpszClass))
str = (LPWSTR)lpszClass; str = (LPWSTR)lpszClass;
else else
@ -92,7 +106,7 @@ GetClassInfoExW(
if(!str2.Buffer) if(!str2.Buffer)
{ {
SetLastError (RtlNtStatusToDosError(STATUS_NO_MEMORY)); SetLastError (RtlNtStatusToDosError(STATUS_NO_MEMORY));
return 0; return FALSE;
} }
w.lpszMenuName = (LPCWSTR)&str2; w.lpszMenuName = (LPCWSTR)&str2;
@ -101,7 +115,7 @@ GetClassInfoExW(
HEAP_free(str); HEAP_free(str);
RtlCopyMemory ( lpwcx, &w, sizeof(WNDCLASSEXW) ); RtlCopyMemory ( lpwcx, &w, sizeof(WNDCLASSEXW) );
if (!IS_INTRESOURCE(w.lpszMenuName) ) if (!IS_INTRESOURCE(w.lpszMenuName) && w.lpszMenuName)
{ {
lpwcx->lpszMenuName = heap_string_poolW (str2.Buffer, str2.Length); lpwcx->lpszMenuName = heap_string_poolW (str2.Buffer, str2.Length);
} }