https://git.reactos.org/?p=reactos.git;a=commitdiff;h=c5db5399dc0864b51d3b7…
commit c5db5399dc0864b51d3b761eaadd9d8bb640e181
Author: Giannis Adamopoulos <gadamopoulos(a)reactos.org>
AuthorDate: Mon Dec 25 00:12:45 2017 +0200
[USER32] Implement the index -1 for GetWindowLong which returns a pointer to WW
We don't have this struct but WND already contains the same fields in the right
order so we can just return the pointer to the first one.
The meaning of the -1 index was found here:
http://www.geoffchappell.com/studies/windows/win32/user32/structs/wnd/index…
---
win32ss/include/ntuser.h | 6 ++++++
win32ss/user/user32/windows/class.c | 9 +++++++++
2 files changed, 15 insertions(+)
diff --git a/win32ss/include/ntuser.h b/win32ss/include/ntuser.h
index 5482ac690f..0195b08d8d 100644
--- a/win32ss/include/ntuser.h
+++ b/win32ss/include/ntuser.h
@@ -657,6 +657,11 @@ typedef struct _SBINFOEX
typedef struct _WND
{
THRDESKHEAD head;
+#if 0
+ WW ww;
+#else
+ /* These fields should be moved in the WW at some point. */
+ /* Plese do not change them to keep the same layout with WW. */
DWORD state;
DWORD state2;
/* Extended style. */
@@ -666,6 +671,7 @@ typedef struct _WND
/* Handle of the module that created the window. */
HINSTANCE hModule;
DWORD fnid;
+#endif
struct _WND *spwndNext;
struct _WND *spwndPrev;
struct _WND *spwndParent;
diff --git a/win32ss/user/user32/windows/class.c b/win32ss/user/user32/windows/class.c
index c0ad6a65d3..f12788fd22 100644
--- a/win32ss/user/user32/windows/class.c
+++ b/win32ss/user/user32/windows/class.c
@@ -1116,6 +1116,15 @@ LONG_PTR IntGetWindowLong( HWND hwnd, INT offset, UINT size, BOOL
unicode )
case GWL_EXSTYLE: retvalue = wndPtr->ExStyle; break;
case GWLP_ID: retvalue = wndPtr->IDMenu; break;
case GWLP_HINSTANCE: retvalue = (ULONG_PTR)wndPtr->hModule; break;
+#if 0
+ /* -1 is an undocumented case which returns WW* */
+ /* source:
http://www.geoffchappell.com/studies/windows/win32/user32/structs/wnd/index…
+ case -1: retvalue = (ULONG_PTR)&wndPtr->ww; break;
+#else
+ /* We don't have a WW but WND already contains the same fields in the right
order, */
+ /* so we can return a pointer to its first field */
+ case -1: retvalue = (ULONG_PTR)&wndPtr->state; break;
+#endif
case GWLP_WNDPROC:
{
if (!TestWindowProcess(wndPtr))