From c5db5399dc0864b51d3b761eaadd9d8bb640e181 Mon Sep 17 00:00:00 2001 From: Giannis Adamopoulos Date: Mon, 25 Dec 2017 00:12:45 +0200 Subject: [PATCH] [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.htm --- 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 5482ac690fe..0195b08d8d1 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 c0ad6a65d33..f12788fd220 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.htm*/ + 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))