mirror of
https://github.com/reactos/reactos.git
synced 2025-07-10 04:14:13 +00:00
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:
parent
e658713c2c
commit
000755de9d
6 changed files with 161 additions and 56 deletions
|
@ -575,11 +575,11 @@ NtUserGetCaretPos(
|
|||
DWORD Unknown0);
|
||||
|
||||
DWORD STDCALL
|
||||
NtUserGetClassInfo(IN LPWSTR ClassName,
|
||||
IN ULONG InfoClass,
|
||||
OUT PVOID Info,
|
||||
IN ULONG InfoLength,
|
||||
OUT PULONG ReturnedLength);
|
||||
NtUserGetClassInfo(HINSTANCE hInst,
|
||||
LPCWSTR str,
|
||||
LPWNDCLASSEXW wcex,
|
||||
BOOL Ansi,
|
||||
DWORD unknown3);
|
||||
|
||||
DWORD
|
||||
STDCALL
|
||||
|
|
|
@ -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
|
||||
* PROJECT: ReactOS user32.dll
|
||||
|
@ -17,22 +17,7 @@
|
|||
#include <strpool.h>
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
WINBOOL
|
||||
STDCALL
|
||||
GetClassInfoA(
|
||||
HINSTANCE hInstance,
|
||||
LPCSTR lpClassName,
|
||||
LPWNDCLASSA lpWndClass)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
* @implemented
|
||||
*/
|
||||
WINBOOL
|
||||
STDCALL
|
||||
|
@ -41,13 +26,35 @@ GetClassInfoExA(
|
|||
LPCSTR lpszClass,
|
||||
LPWNDCLASSEXA lpwcx)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
return FALSE;
|
||||
LPWSTR str;
|
||||
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
|
||||
STDCALL
|
||||
|
@ -56,13 +63,46 @@ GetClassInfoExW(
|
|||
LPCWSTR lpszClass,
|
||||
LPWNDCLASSEXW lpwcx)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
return FALSE;
|
||||
LPWSTR str;
|
||||
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
|
||||
STDCALL
|
||||
|
@ -71,8 +111,11 @@ GetClassInfoW(
|
|||
LPCWSTR lpClassName,
|
||||
LPWNDCLASSW lpWndClass)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
return FALSE;
|
||||
WNDCLASSEXW w;
|
||||
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
|
||||
STDCALL
|
||||
RealGetWindowClassW(
|
||||
HWND hwnd,
|
||||
LPSTR pszType,
|
||||
LPWSTR pszType,
|
||||
UINT cchType)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
return 0;
|
||||
/* FIXME: Implement correct functionality of RealGetWindowClass */
|
||||
return GetClassNameW(hwnd,pszType,cchType);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
* @implemented
|
||||
*/
|
||||
UINT
|
||||
STDCALL
|
||||
|
@ -248,8 +291,8 @@ RealGetWindowClassA(
|
|||
LPSTR pszType,
|
||||
UINT cchType)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
return 0;
|
||||
/* FIXME: Implement correct functionality of RealGetWindowClass */
|
||||
return GetClassNameA(hwnd,pszType,cchType);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -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
|
||||
* PROJECT: ReactOS user32.dll
|
||||
|
@ -1318,7 +1318,7 @@ IsWindow(HWND hWnd)
|
|||
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
* @implemented
|
||||
*/
|
||||
WINBOOL STDCALL
|
||||
IsWindowUnicode(HWND hWnd)
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* 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
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -151,14 +151,44 @@ ClassReferenceClassByNameOrAtom(PWNDCLASS_OBJECT *Class,
|
|||
}
|
||||
|
||||
DWORD STDCALL
|
||||
NtUserGetClassInfo(IN LPWSTR ClassName,
|
||||
IN ULONG InfoClass,
|
||||
OUT PVOID Info,
|
||||
IN ULONG InfoLength,
|
||||
OUT PULONG ReturnedLength)
|
||||
NtUserGetClassInfo(HINSTANCE hInst,
|
||||
LPCWSTR str,
|
||||
LPWNDCLASSEXW wcex,
|
||||
BOOL Ansi,
|
||||
DWORD unknown3)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
return(0);
|
||||
PWNDCLASS_OBJECT Class;
|
||||
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
|
||||
|
@ -166,18 +196,43 @@ W32kGetClassName(struct _WINDOW_OBJECT *WindowObject,
|
|||
LPWSTR lpClassName,
|
||||
int nMaxCount)
|
||||
{
|
||||
int length;
|
||||
LPCWSTR name;
|
||||
ULONG length;
|
||||
LPWSTR name;
|
||||
BOOL free;
|
||||
PWINSTATION_OBJECT WinStaObject;
|
||||
NTSTATUS Status;
|
||||
if (IS_ATOM(WindowObject->Class->lpszClassName))
|
||||
{
|
||||
/* FIXME find the string from the atom */
|
||||
name = L"\0";
|
||||
length = wcslen(name);
|
||||
DPRINT("About to open window station handle (0x%X)\n",
|
||||
PROCESS_WINDOW_STATION());
|
||||
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
|
||||
{
|
||||
name = WindowObject->Class->lpszClassName->Buffer;
|
||||
length = WindowObject->Class->lpszClassName->Length / sizeof(WCHAR);
|
||||
free = FALSE;
|
||||
}
|
||||
if (length > nMaxCount)
|
||||
{
|
||||
|
@ -185,6 +240,10 @@ W32kGetClassName(struct _WINDOW_OBJECT *WindowObject,
|
|||
}
|
||||
*(lpClassName+length) = 0;
|
||||
wcsncpy(lpClassName,name,length);
|
||||
if (free)
|
||||
{
|
||||
ExFreePool(name);
|
||||
}
|
||||
return length;
|
||||
}
|
||||
|
||||
|
@ -445,10 +504,12 @@ W32kSetClassLong(PWINDOW_OBJECT WindowObject, ULONG Offset, LONG dwNewLong, BOOL
|
|||
if (Ansi)
|
||||
{
|
||||
WindowObject->Class->lpfnWndProcA = (WNDPROC)dwNewLong;
|
||||
WindowObject->Class->lpfnWndProcW = (WNDPROC)0xCCCCCCCC;
|
||||
}
|
||||
else
|
||||
{
|
||||
WindowObject->Class->lpfnWndProcW = (WNDPROC)dwNewLong;
|
||||
WindowObject->Class->lpfnWndProcA = (WNDPROC)0xCCCCCCCC;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* 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
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -1828,11 +1828,13 @@ NtUserSetWindowLong(HWND hWnd, DWORD Index, LONG NewValue, BOOL Ansi)
|
|||
{
|
||||
OldValue = (LONG) WindowObject->WndProcA;
|
||||
WindowObject->WndProcA = (WNDPROC) NewValue;
|
||||
WindowObject->WndProcW = (WNDPROC)0xCCCCCCCC;
|
||||
}
|
||||
else
|
||||
{
|
||||
OldValue = (LONG) WindowObject->WndProcW;
|
||||
WindowObject->WndProcW = (WNDPROC) NewValue;
|
||||
WindowObject->WndProcA = (WNDPROC)0xCCCCCCCC;
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
@ -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:
|
||||
# SEP = /
|
||||
|
||||
|
||||
SEP = /
|
||||
|
||||
ifneq ($(MAKECMDGOALS),clean)
|
||||
-include $(DEP_FILES)
|
||||
endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue