This implements GetClassInfo

It also implements GetClassInfoEx
It also implements RealGetWindowClass as best as I can do it right now (i.e. I dont know exactly what makes it different from GetClassName so it just calls GetClassName)
And it finishes GetClassName

svn path=/trunk/; revision=5474
This commit is contained in:
James Tabor 2003-08-09 07:09:57 +00:00
parent e658713c2c
commit 000755de9d
6 changed files with 161 additions and 56 deletions

View file

@ -575,11 +575,11 @@ NtUserGetCaretPos(
DWORD Unknown0); DWORD Unknown0);
DWORD STDCALL DWORD STDCALL
NtUserGetClassInfo(IN LPWSTR ClassName, NtUserGetClassInfo(HINSTANCE hInst,
IN ULONG InfoClass, LPCWSTR str,
OUT PVOID Info, LPWNDCLASSEXW wcex,
IN ULONG InfoLength, BOOL Ansi,
OUT PULONG ReturnedLength); DWORD unknown3);
DWORD DWORD
STDCALL STDCALL

View file

@ -1,4 +1,4 @@
/* $Id: class.c,v 1.27 2003/08/08 02:57:54 royce Exp $ /* $Id: class.c,v 1.28 2003/08/09 07:09:57 jimtabor 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
@ -17,22 +17,7 @@
#include <strpool.h> #include <strpool.h>
/* /*
* @unimplemented * @implemented
*/
WINBOOL
STDCALL
GetClassInfoA(
HINSTANCE hInstance,
LPCSTR lpClassName,
LPWNDCLASSA lpWndClass)
{
UNIMPLEMENTED;
return FALSE;
}
/*
* @unimplemented
*/ */
WINBOOL WINBOOL
STDCALL STDCALL
@ -41,13 +26,35 @@ GetClassInfoExA(
LPCSTR lpszClass, LPCSTR lpszClass,
LPWNDCLASSEXA lpwcx) LPWNDCLASSEXA lpwcx)
{ {
UNIMPLEMENTED; LPWSTR str;
return FALSE; PUNICODE_STRING str2;
WNDCLASSEXW w;
BOOL retval;
NTSTATUS Status;
Status = HEAP_strdupAtoW (&str, lpszClass, NULL);
if ( !NT_SUCCESS (Status) )
{
SetLastError (RtlNtStatusToDosError(Status));
return 0;
}
retval = (BOOL)NtUserGetClassInfo(hinst,str,&w,TRUE,0);
if (str)
{
HEAP_free(str);
}
RtlCopyMemory (&w,lpwcx,sizeof(WNDCLASSEXW));
if (!IS_INTRESOURCE(w.lpszMenuName))
{
str = (LPWSTR)w.lpszMenuName;
str2 = (PUNICODE_STRING)str;
lpwcx->lpszMenuName = heap_string_poolA (str2->Buffer, str2->Length);
}
return retval;
} }
/* /*
* @unimplemented * @implemented
*/ */
WINBOOL WINBOOL
STDCALL STDCALL
@ -56,13 +63,46 @@ GetClassInfoExW(
LPCWSTR lpszClass, LPCWSTR lpszClass,
LPWNDCLASSEXW lpwcx) LPWNDCLASSEXW lpwcx)
{ {
UNIMPLEMENTED; LPWSTR str;
return FALSE; PUNICODE_STRING str2;
WNDCLASSEXW w;
WINBOOL retval;
str = HEAP_strdupW (lpszClass, wcslen(lpszClass) );
retval = (BOOL)NtUserGetClassInfo(hinst,lpszClass,&w,FALSE,0);
if (str)
{
HEAP_free(str);
}
RtlCopyMemory (&w,lpwcx,sizeof(WNDCLASSEXW));
if (!IS_INTRESOURCE(w.lpszMenuName) )
{
str = (LPWSTR)w.lpszMenuName;
str2 = (PUNICODE_STRING)str;
lpwcx->lpszMenuName = heap_string_poolW (str2->Buffer, str2->Length);
}
return retval;
} }
/* /*
* @unimplemented * @implemented
*/
WINBOOL
STDCALL
GetClassInfoA(
HINSTANCE hInstance,
LPCSTR lpClassName,
LPWNDCLASSA lpWndClass)
{
WNDCLASSEXA w;
WINBOOL retval;
retval = GetClassInfoExA(hInstance,lpClassName,&w);
RtlCopyMemory (lpWndClass,&w.style,sizeof(WNDCLASSA));
return retval;
}
/*
* @implemented
*/ */
WINBOOL WINBOOL
STDCALL STDCALL
@ -71,8 +111,11 @@ GetClassInfoW(
LPCWSTR lpClassName, LPCWSTR lpClassName,
LPWNDCLASSW lpWndClass) LPWNDCLASSW lpWndClass)
{ {
UNIMPLEMENTED; WNDCLASSEXW w;
return FALSE; WINBOOL retval;
retval = GetClassInfoExW(hInstance,lpClassName,&w);
RtlCopyMemory (lpWndClass,&w.style,sizeof(WNDCLASSW));
return retval;
} }
@ -224,22 +267,22 @@ GetWindowWord(HWND hWnd, int nIndex)
} }
/* /*
* @unimplemented * @implemented
*/ */
UINT UINT
STDCALL STDCALL
RealGetWindowClassW( RealGetWindowClassW(
HWND hwnd, HWND hwnd,
LPSTR pszType, LPWSTR pszType,
UINT cchType) UINT cchType)
{ {
UNIMPLEMENTED; /* FIXME: Implement correct functionality of RealGetWindowClass */
return 0; return GetClassNameW(hwnd,pszType,cchType);
} }
/* /*
* @unimplemented * @implemented
*/ */
UINT UINT
STDCALL STDCALL
@ -248,8 +291,8 @@ RealGetWindowClassA(
LPSTR pszType, LPSTR pszType,
UINT cchType) UINT cchType)
{ {
UNIMPLEMENTED; /* FIXME: Implement correct functionality of RealGetWindowClass */
return 0; return GetClassNameA(hwnd,pszType,cchType);
} }
/* /*

View file

@ -1,4 +1,4 @@
/* $Id: window.c,v 1.53 2003/08/08 02:57:54 royce Exp $ /* $Id: window.c,v 1.54 2003/08/09 07:09:57 jimtabor 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
@ -1318,7 +1318,7 @@ IsWindow(HWND hWnd)
/* /*
* @unimplemented * @implemented
*/ */
WINBOOL STDCALL WINBOOL STDCALL
IsWindowUnicode(HWND hWnd) IsWindowUnicode(HWND hWnd)

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: class.c,v 1.25 2003/08/08 02:57:54 royce Exp $ /* $Id: class.c,v 1.26 2003/08/09 07:09:57 jimtabor Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -151,14 +151,44 @@ ClassReferenceClassByNameOrAtom(PWNDCLASS_OBJECT *Class,
} }
DWORD STDCALL DWORD STDCALL
NtUserGetClassInfo(IN LPWSTR ClassName, NtUserGetClassInfo(HINSTANCE hInst,
IN ULONG InfoClass, LPCWSTR str,
OUT PVOID Info, LPWNDCLASSEXW wcex,
IN ULONG InfoLength, BOOL Ansi,
OUT PULONG ReturnedLength) DWORD unknown3)
{ {
UNIMPLEMENTED; PWNDCLASS_OBJECT Class;
return(0); NTSTATUS Status;
Status = ClassReferenceClassByNameOrAtom(&Class,(LPWSTR)str);
if (!NT_SUCCESS(Status))
{
SetLastNtError(Status);
return 0;
}
if (Class->hInstance != hInst)
{
return 0;
}
wcex->cbSize = sizeof(LPWNDCLASSEXW);
wcex->style = Class->style;
if (Ansi)
{
wcex->lpfnWndProc = Class->lpfnWndProcA;
}
else
{
wcex->lpfnWndProc = Class->lpfnWndProcW;
}
wcex->cbClsExtra = Class->cbClsExtra;
wcex->cbWndExtra = Class->cbWndExtra;
wcex->hInstance = Class->hInstance;
wcex->hIcon = Class->hIcon;
wcex->hCursor = Class->hCursor;
wcex->hbrBackground = Class->hbrBackground;
wcex->lpszMenuName = (LPCWSTR)Class->lpszMenuName;
wcex->lpszClassName = (LPCWSTR)Class->lpszClassName;
wcex->hIconSm = Class->hIconSm;
return 1;
} }
ULONG FASTCALL ULONG FASTCALL
@ -166,18 +196,43 @@ W32kGetClassName(struct _WINDOW_OBJECT *WindowObject,
LPWSTR lpClassName, LPWSTR lpClassName,
int nMaxCount) int nMaxCount)
{ {
int length; ULONG length;
LPCWSTR name; LPWSTR name;
BOOL free;
PWINSTATION_OBJECT WinStaObject;
NTSTATUS Status;
if (IS_ATOM(WindowObject->Class->lpszClassName)) if (IS_ATOM(WindowObject->Class->lpszClassName))
{ {
/* FIXME find the string from the atom */ DPRINT("About to open window station handle (0x%X)\n",
name = L"\0"; PROCESS_WINDOW_STATION());
length = wcslen(name); Status = ValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
KernelMode,
0,
&WinStaObject);
if (!NT_SUCCESS(Status))
{
DPRINT("Validation of window station handle (0x%X) failed\n",
PROCESS_WINDOW_STATION());
return((RTL_ATOM)0);
}
length = 0;
Status = RtlQueryAtomInAtomTable(WinStaObject->AtomTable,(RTL_ATOM)WindowObject->Class->lpszClassName,NULL,NULL,name,&length);
name = ExAllocatePool(PagedPool,length+1);
free = TRUE;
Status = RtlQueryAtomInAtomTable(WinStaObject->AtomTable,(RTL_ATOM)WindowObject->Class->lpszClassName,NULL,NULL,name,&length);
if (!NT_SUCCESS(Status))
{
DPRINT("Validation of window station handle (0x%X) failed\n",
PROCESS_WINDOW_STATION());
return((RTL_ATOM)0);
}
ObDereferenceObject(WinStaObject);
} }
else else
{ {
name = WindowObject->Class->lpszClassName->Buffer; name = WindowObject->Class->lpszClassName->Buffer;
length = WindowObject->Class->lpszClassName->Length / sizeof(WCHAR); length = WindowObject->Class->lpszClassName->Length / sizeof(WCHAR);
free = FALSE;
} }
if (length > nMaxCount) if (length > nMaxCount)
{ {
@ -185,6 +240,10 @@ W32kGetClassName(struct _WINDOW_OBJECT *WindowObject,
} }
*(lpClassName+length) = 0; *(lpClassName+length) = 0;
wcsncpy(lpClassName,name,length); wcsncpy(lpClassName,name,length);
if (free)
{
ExFreePool(name);
}
return length; return length;
} }
@ -445,10 +504,12 @@ W32kSetClassLong(PWINDOW_OBJECT WindowObject, ULONG Offset, LONG dwNewLong, BOOL
if (Ansi) if (Ansi)
{ {
WindowObject->Class->lpfnWndProcA = (WNDPROC)dwNewLong; WindowObject->Class->lpfnWndProcA = (WNDPROC)dwNewLong;
WindowObject->Class->lpfnWndProcW = (WNDPROC)0xCCCCCCCC;
} }
else else
{ {
WindowObject->Class->lpfnWndProcW = (WNDPROC)dwNewLong; WindowObject->Class->lpfnWndProcW = (WNDPROC)dwNewLong;
WindowObject->Class->lpfnWndProcA = (WNDPROC)0xCCCCCCCC;
} }
break; break;
} }

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: window.c,v 1.81 2003/08/08 02:57:54 royce Exp $ /* $Id: window.c,v 1.82 2003/08/09 07:09:57 jimtabor Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -1828,11 +1828,13 @@ NtUserSetWindowLong(HWND hWnd, DWORD Index, LONG NewValue, BOOL Ansi)
{ {
OldValue = (LONG) WindowObject->WndProcA; OldValue = (LONG) WindowObject->WndProcA;
WindowObject->WndProcA = (WNDPROC) NewValue; WindowObject->WndProcA = (WNDPROC) NewValue;
WindowObject->WndProcW = (WNDPROC)0xCCCCCCCC;
} }
else else
{ {
OldValue = (LONG) WindowObject->WndProcW; OldValue = (LONG) WindowObject->WndProcW;
WindowObject->WndProcW = (WNDPROC) NewValue; WindowObject->WndProcW = (WNDPROC) NewValue;
WindowObject->WndProcA = (WNDPROC)0xCCCCCCCC;
} }
break; break;

View file

@ -7,9 +7,8 @@ DEP_FILES := $(join $(dir $(DEP_FILTERED)), $(addprefix ., $(notdir $(DEP_FILTER
# I (Andrew Greenwood) had to add this to compile under MinGW: # I (Andrew Greenwood) had to add this to compile under MinGW:
# SEP = / SEP = /
ifneq ($(MAKECMDGOALS),clean) ifneq ($(MAKECMDGOALS),clean)
-include $(DEP_FILES) -include $(DEP_FILES)
endif endif