[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
This commit is contained in:
Giannis Adamopoulos 2017-12-25 00:12:45 +02:00
parent c5e707ec1f
commit c5db5399dc
2 changed files with 15 additions and 0 deletions

View file

@ -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;

View file

@ -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))