ReactOS  0.4.14-dev-337-gf981a68
window.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define HAS_DLGFRAME(Style, ExStyle)
 
#define HAS_THICKFRAME(Style, ExStyle)
 
#define HAS_THINFRAME(Style, ExStyle)   (((Style) & WS_BORDER) || (!((Style) & (WS_CHILD | WS_POPUP))))
 
#define HAS_CLIENTFRAME(Style, ExStyle)   (((ExStyle) & WS_EX_CLIENTEDGE) || (!((Style) & (WS_CHILD | WS_POPUP))))
 
#define HAS_MENU(pWnd, style)   ((((style) & (WS_CHILD | WS_POPUP)) != WS_CHILD) && (pWnd->IDMenu) && IntIsMenu(UlongToHandle(pWnd->IDMenu)))
 
#define IntIsDesktopWindow(WndObj)   (WndObj->spwndParent == NULL)
 
#define IntIsBroadcastHwnd(hWnd)   (hWnd == HWND_BROADCAST || hWnd == HWND_TOPMOST)
 
#define IntWndBelongsToThread(WndObj, W32Thread)   ((WndObj->head.pti) && (WndObj->head.pti == W32Thread))
 
#define IntGetWndThreadId(WndObj)   PsGetThreadId(WndObj->head.pti->pEThread)
 
#define IntGetWndProcessId(WndObj)   PsGetProcessId(WndObj->head.pti->ppi->peProcess)
 
#define WINVER_WIN2K   _WIN32_WINNT_WIN2K
 
#define WINVER_WINNT4   _WIN32_WINNT_NT4
 
#define WINVER_WIN31   0x30A
 

Functions

PWND FASTCALL ValidateHwndNoErr (HWND)
 
BOOL FASTCALL UserUpdateUiState (PWND Wnd, WPARAM wParam)
 
BOOL FASTCALL IntIsWindow (HWND hWnd)
 
HWND *FASTCALL IntWinListChildren (PWND Window)
 
HWND *FASTCALL IntWinListOwnedPopups (PWND Window)
 
VOID FASTCALL IntGetClientRect (PWND WindowObject, RECTL *Rect)
 
INT FASTCALL IntMapWindowPoints (PWND FromWnd, PWND ToWnd, LPPOINT lpPoints, UINT cPoints)
 
BOOL FASTCALL IntIsChildWindow (PWND Parent, PWND Child)
 
VOID FASTCALL IntUnlinkWindow (PWND Wnd)
 
VOID FASTCALL IntLinkHwnd (PWND Wnd, HWND hWndPrev)
 
PWND FASTCALL IntGetParent (PWND Wnd)
 
VOID FASTCALL IntGetWindowBorderMeasures (PWND WindowObject, UINT *cx, UINT *cy)
 
BOOL FASTCALL IntShowOwnedPopups (PWND owner, BOOL fShow)
 
LRESULT FASTCALL IntDefWindowProc (PWND Window, UINT Msg, WPARAM wParam, LPARAM lParam, BOOL Ansi)
 
VOID FASTCALL IntNotifyWinEvent (DWORD, PWND, LONG, LONG, DWORD)
 
PWND FASTCALL IntCreateWindow (CREATESTRUCTW *Cs, PLARGE_STRING WindowName, PCLS Class, PWND ParentWindow, PWND OwnerWindow, PVOID acbiBuffer, PDESKTOP pdeskCreated, DWORD dwVer)
 
PWND FASTCALL co_UserCreateWindowEx (CREATESTRUCTW *Cs, PUNICODE_STRING ClassName, PLARGE_STRING WindowName, PVOID acbiBuffer, DWORD dwVer)
 
BOOL FASTCALL IntEnableWindow (HWND, BOOL)
 
BOOL FASTCALL IntIsWindowVisible (PWND)
 
DWORD FASTCALL GetNCHitEx (PWND, POINT)
 
ULONG FASTCALL IntSetStyle (PWND, ULONG, ULONG)
 
PWND FASTCALL VerifyWnd (PWND)
 
PWND FASTCALL IntGetNonChildAncestor (PWND)
 
LONG FASTCALL co_UserSetWindowLong (HWND, DWORD, LONG, BOOL)
 
LONG_PTR FASTCALL co_UserSetWindowLongPtr (HWND, DWORD, LONG_PTR, BOOL)
 
HWND FASTCALL IntGetWindow (HWND, UINT)
 
LRESULT co_UserFreeWindow (PWND, PPROCESSINFO, PTHREADINFO, BOOLEAN)
 

Variables

ATOM AtomMessage
 
ATOM AtomWndObj
 
ATOM AtomLayer
 
ATOM AtomFlashWndState
 

Macro Definition Documentation

◆ HAS_CLIENTFRAME

#define HAS_CLIENTFRAME (   Style,
  ExStyle 
)    (((ExStyle) & WS_EX_CLIENTEDGE) || (!((Style) & (WS_CHILD | WS_POPUP))))

Definition at line 19 of file window.h.

◆ HAS_DLGFRAME

#define HAS_DLGFRAME (   Style,
  ExStyle 
)
Value:
(((Style) & WS_DLGFRAME) && (!((Style) & WS_THICKFRAME))))
#define WS_THICKFRAME
Definition: pedump.c:630
#define WS_DLGFRAME
Definition: pedump.c:626
#define WS_EX_DLGMODALFRAME
Definition: pedump.c:645
const DWORD Style
Definition: appswitch.c:71
const DWORD ExStyle
Definition: appswitch.c:72

Definition at line 8 of file window.h.

◆ HAS_MENU

#define HAS_MENU (   pWnd,
  style 
)    ((((style) & (WS_CHILD | WS_POPUP)) != WS_CHILD) && (pWnd->IDMenu) && IntIsMenu(UlongToHandle(pWnd->IDMenu)))

Definition at line 22 of file window.h.

◆ HAS_THICKFRAME

#define HAS_THICKFRAME (   Style,
  ExStyle 
)
Value:
(((Style) & WS_THICKFRAME) && \
#define WS_THICKFRAME
Definition: pedump.c:630
#define WS_DLGFRAME
Definition: pedump.c:626
const DWORD Style
Definition: appswitch.c:71
#define WS_BORDER
Definition: pedump.c:625

Definition at line 12 of file window.h.

◆ HAS_THINFRAME

#define HAS_THINFRAME (   Style,
  ExStyle 
)    (((Style) & WS_BORDER) || (!((Style) & (WS_CHILD | WS_POPUP))))

Definition at line 16 of file window.h.

◆ IntGetWndProcessId

#define IntGetWndProcessId (   WndObj)    PsGetProcessId(WndObj->head.pti->ppi->peProcess)

Definition at line 37 of file window.h.

◆ IntGetWndThreadId

#define IntGetWndThreadId (   WndObj)    PsGetThreadId(WndObj->head.pti->pEThread)

Definition at line 34 of file window.h.

◆ IntIsBroadcastHwnd

#define IntIsBroadcastHwnd (   hWnd)    (hWnd == HWND_BROADCAST || hWnd == HWND_TOPMOST)

Definition at line 27 of file window.h.

◆ IntIsDesktopWindow

#define IntIsDesktopWindow (   WndObj)    (WndObj->spwndParent == NULL)

Definition at line 24 of file window.h.

◆ IntWndBelongsToThread

#define IntWndBelongsToThread (   WndObj,
  W32Thread 
)    ((WndObj->head.pti) && (WndObj->head.pti == W32Thread))

Definition at line 31 of file window.h.

◆ WINVER_WIN2K

#define WINVER_WIN2K   _WIN32_WINNT_WIN2K

Definition at line 55 of file window.h.

◆ WINVER_WIN31

#define WINVER_WIN31   0x30A

Definition at line 57 of file window.h.

◆ WINVER_WINNT4

#define WINVER_WINNT4   _WIN32_WINNT_NT4

Definition at line 56 of file window.h.

Function Documentation

◆ co_UserCreateWindowEx()

PWND FASTCALL co_UserCreateWindowEx ( CREATESTRUCTW Cs,
PUNICODE_STRING  ClassName,
PLARGE_STRING  WindowName,
PVOID  acbiBuffer,
DWORD  dwVer 
)

Definition at line 1969 of file window.c.

1974 {
1975  ULONG style;
1976  PWND Window = NULL, ParentWindow = NULL, OwnerWindow;
1977  HWND hWnd, hWndParent, hWndOwner, hwndInsertAfter;
1978  PWINSTATION_OBJECT WinSta;
1979  PCLS Class = NULL;
1980  SIZE Size;
1981  POINT MaxSize, MaxPos, MinTrack, MaxTrack;
1982  CBT_CREATEWNDW * pCbtCreate;
1983  LRESULT Result;
1984  USER_REFERENCE_ENTRY ParentRef, Ref;
1985  PTHREADINFO pti;
1986  DWORD dwShowMode = SW_SHOW;
1987  CREATESTRUCTW *pCsw = NULL;
1988  PVOID pszClass = NULL, pszName = NULL;
1989  PWND ret = NULL;
1990 
1991  /* Get the current window station and reference it */
1992  pti = GetW32ThreadInfo();
1993  if (pti == NULL || pti->rpdesk == NULL)
1994  {
1995  ERR("Thread is not attached to a desktop! Cannot create window!\n");
1996  return NULL; // There is nothing to cleanup.
1997  }
1998  WinSta = pti->rpdesk->rpwinstaParent;
2000 
2001  pCsw = NULL;
2002  pCbtCreate = NULL;
2003 
2004  /* Get the class and reference it */
2005  Class = IntGetAndReferenceClass(ClassName, Cs->hInstance, FALSE);
2006  if(!Class)
2007  {
2009  ERR("Failed to find class %wZ\n", ClassName);
2010  goto cleanup;
2011  }
2012 
2013  /* Now find the parent and the owner window */
2014  hWndParent = pti->rpdesk->pDeskInfo->spwnd->head.h;
2015  hWndOwner = NULL;
2016 
2017  if (Cs->hwndParent == HWND_MESSAGE)
2018  {
2019  Cs->hwndParent = hWndParent = pti->rpdesk->spwndMessage->head.h;
2020  }
2021  else if (Cs->hwndParent)
2022  {
2023  if ((Cs->style & (WS_CHILD|WS_POPUP)) != WS_CHILD)
2024  hWndOwner = Cs->hwndParent;
2025  else
2026  hWndParent = Cs->hwndParent;
2027  }
2028  else if ((Cs->style & (WS_CHILD|WS_POPUP)) == WS_CHILD)
2029  {
2030  ERR("Cannot create a child window without a parent!\n");
2032  goto cleanup; /* WS_CHILD needs a parent, but WS_POPUP doesn't */
2033  }
2035  (IS_INTRESOURCE(Cs->lpszClass) ||
2036  Cs->lpszClass != (LPCWSTR)MAKEINTATOM(gpsi->atomSysClass[ICLS_HWNDMESSAGE]) ||
2037  _wcsicmp(Cs->lpszClass, L"Message") != 0))
2038  {
2039  if (pti->ppi->dwLayout & LAYOUT_RTL)
2040  {
2041  Cs->dwExStyle |= WS_EX_LAYOUTRTL;
2042  }
2043  }
2044 
2045  ParentWindow = hWndParent ? UserGetWindowObject(hWndParent): NULL;
2046  OwnerWindow = hWndOwner ? UserGetWindowObject(hWndOwner): NULL;
2047 
2048  if (hWndParent && !ParentWindow)
2049  {
2050  ERR("Got invalid parent window handle\n");
2051  goto cleanup;
2052  }
2053  else if (hWndOwner && !OwnerWindow)
2054  {
2055  ERR("Got invalid owner window handle\n");
2056  ParentWindow = NULL;
2057  goto cleanup;
2058  }
2059 
2060  if(OwnerWindow)
2061  {
2062  if (IntIsDesktopWindow(OwnerWindow)) OwnerWindow = NULL;
2063  else if (ParentWindow && !IntIsDesktopWindow(ParentWindow))
2064  {
2065  ERR("an owned window must be created as top-level\n");
2067  goto cleanup;
2068  }
2069  else /* owner must be a top-level window */
2070  {
2071  while ((OwnerWindow->style & (WS_POPUP|WS_CHILD)) == WS_CHILD && !IntIsDesktopWindow(OwnerWindow->spwndParent))
2072  OwnerWindow = OwnerWindow->spwndParent;
2073  }
2074  }
2075 
2076  /* Fix the position and the size of the window */
2077  if (ParentWindow)
2078  {
2079  UserRefObjectCo(ParentWindow, &ParentRef);
2080  IntFixWindowCoordinates(Cs, ParentWindow, &dwShowMode);
2081  }
2082 
2083  /* Allocate and initialize the new window */
2084  Window = IntCreateWindow(Cs,
2085  WindowName,
2086  Class,
2087  ParentWindow,
2088  OwnerWindow,
2089  acbiBuffer,
2090  NULL,
2091  dwVer );
2092  if(!Window)
2093  {
2094  ERR("IntCreateWindow failed!\n");
2095  goto cleanup;
2096  }
2097 
2099  hwndInsertAfter = HWND_TOP;
2100 
2101  UserRefObjectCo(Window, &Ref);
2103  ObDereferenceObject(WinSta);
2104 
2106  if ( ISITHOOKED(WH_CBT) || (pti->rpdesk->pDeskInfo->fsHooks & HOOKID_TO_FLAG(WH_CBT)) )
2107  {
2108  // Allocate the calling structures Justin Case this goes Global.
2111  if (!pCsw || !pCbtCreate)
2112  {
2113  ERR("UserHeapAlloc() failed!\n");
2114  goto cleanup;
2115  }
2116 
2117  /* Fill the new CREATESTRUCTW */
2118  RtlCopyMemory(pCsw, Cs, sizeof(CREATESTRUCTW));
2119  pCsw->style = Window->style; /* HCBT_CREATEWND needs the real window style */
2120 
2121  // Based on the assumption this is from "unicode source" user32, ReactOS, answer is yes.
2122  if (!IS_ATOM(ClassName->Buffer))
2123  {
2124  if (Window->state & WNDS_ANSICREATOR)
2125  {
2127  AnsiString.MaximumLength = (USHORT)RtlUnicodeStringToAnsiSize(ClassName)+sizeof(CHAR);
2128  pszClass = UserHeapAlloc(AnsiString.MaximumLength);
2129  if (!pszClass)
2130  {
2131  ERR("UserHeapAlloc() failed!\n");
2132  goto cleanup;
2133  }
2134  RtlZeroMemory(pszClass, AnsiString.MaximumLength);
2135  AnsiString.Buffer = (PCHAR)pszClass;
2137  }
2138  else
2139  {
2141  UnicodeString.MaximumLength = ClassName->Length + sizeof(UNICODE_NULL);
2142  pszClass = UserHeapAlloc(UnicodeString.MaximumLength);
2143  if (!pszClass)
2144  {
2145  ERR("UserHeapAlloc() failed!\n");
2146  goto cleanup;
2147  }
2148  RtlZeroMemory(pszClass, UnicodeString.MaximumLength);
2149  UnicodeString.Buffer = (PWSTR)pszClass;
2150  RtlCopyUnicodeString(&UnicodeString, ClassName);
2151  }
2152  pCsw->lpszClass = UserHeapAddressToUser(pszClass);
2153  }
2154  if (WindowName->Length)
2155  {
2157  Name.Buffer = WindowName->Buffer;
2158  Name.Length = (USHORT)min(WindowName->Length, MAXUSHORT); // FIXME: LARGE_STRING truncated
2159  Name.MaximumLength = (USHORT)min(WindowName->MaximumLength, MAXUSHORT);
2160 
2161  if (Window->state & WNDS_ANSICREATOR)
2162  {
2164  AnsiString.MaximumLength = (USHORT)RtlUnicodeStringToAnsiSize(&Name) + sizeof(CHAR);
2165  pszName = UserHeapAlloc(AnsiString.MaximumLength);
2166  if (!pszName)
2167  {
2168  ERR("UserHeapAlloc() failed!\n");
2169  goto cleanup;
2170  }
2171  RtlZeroMemory(pszName, AnsiString.MaximumLength);
2172  AnsiString.Buffer = (PCHAR)pszName;
2174  }
2175  else
2176  {
2178  UnicodeString.MaximumLength = Name.Length + sizeof(UNICODE_NULL);
2179  pszName = UserHeapAlloc(UnicodeString.MaximumLength);
2180  if (!pszName)
2181  {
2182  ERR("UserHeapAlloc() failed!\n");
2183  goto cleanup;
2184  }
2185  RtlZeroMemory(pszName, UnicodeString.MaximumLength);
2186  UnicodeString.Buffer = (PWSTR)pszName;
2188  }
2189  pCsw->lpszName = UserHeapAddressToUser(pszName);
2190  }
2191 
2192  pCbtCreate->lpcs = pCsw;
2193  pCbtCreate->hwndInsertAfter = hwndInsertAfter;
2194 
2197  if (Result != 0)
2198  {
2199  ERR("WH_CBT HCBT_CREATEWND hook failed! 0x%x\n", Result);
2200  goto cleanup;
2201  }
2202  // Write back changes.
2203  Cs->cx = pCsw->cx;
2204  Cs->cy = pCsw->cy;
2205  Cs->x = pCsw->x;
2206  Cs->y = pCsw->y;
2207  hwndInsertAfter = pCbtCreate->hwndInsertAfter;
2208  }
2209 
2210  /* NCCREATE and WM_NCCALCSIZE need the original values */
2211  Cs->lpszName = (LPCWSTR) WindowName;
2212  Cs->lpszClass = (LPCWSTR) ClassName;
2213 
2214  if ((Cs->style & (WS_CHILD|WS_POPUP)) == WS_CHILD)
2215  {
2216  if (ParentWindow != co_GetDesktopWindow(Window))
2217  {
2218  Cs->x += ParentWindow->rcClient.left;
2219  Cs->y += ParentWindow->rcClient.top;
2220  }
2221  }
2222 
2223  /* Send the WM_GETMINMAXINFO message */
2224  Size.cx = Cs->cx;
2225  Size.cy = Cs->cy;
2226 
2227  if ((Cs->style & WS_THICKFRAME) || !(Cs->style & (WS_POPUP | WS_CHILD)))
2228  {
2229  co_WinPosGetMinMaxInfo(Window, &MaxSize, &MaxPos, &MinTrack, &MaxTrack);
2230  if (Size.cx > MaxTrack.x) Size.cx = MaxTrack.x;
2231  if (Size.cy > MaxTrack.y) Size.cy = MaxTrack.y;
2232  if (Size.cx < MinTrack.x) Size.cx = MinTrack.x;
2233  if (Size.cy < MinTrack.y) Size.cy = MinTrack.y;
2234  }
2235 
2236  Window->rcWindow.left = Cs->x;
2237  Window->rcWindow.top = Cs->y;
2238  Window->rcWindow.right = Cs->x + Size.cx;
2239  Window->rcWindow.bottom = Cs->y + Size.cy;
2240  /*
2241  if (0 != (Window->style & WS_CHILD) && ParentWindow)
2242  {
2243  ERR("co_UserCreateWindowEx(): Offset rcWindow\n");
2244  RECTL_vOffsetRect(&Window->rcWindow,
2245  ParentWindow->rcClient.left,
2246  ParentWindow->rcClient.top);
2247  }
2248  */
2249  /* correct child window coordinates if mirroring on parent is enabled */
2250  if (ParentWindow != NULL)
2251  {
2252  if ( ((Cs->style & WS_CHILD) == WS_CHILD) &&
2253  ((ParentWindow->ExStyle & WS_EX_LAYOUTRTL) == WS_EX_LAYOUTRTL))
2254  {
2255  Window->rcWindow.right = ParentWindow->rcClient.right - (Window->rcWindow.left - ParentWindow->rcClient.left);
2256  Window->rcWindow.left = Window->rcWindow.right - Size.cx;
2257  }
2258  }
2259 
2260  Window->rcClient = Window->rcWindow;
2261 
2262  /* Link the window */
2263  if (NULL != ParentWindow)
2264  {
2265  /* Link the window into the siblings list */
2266  if ((Cs->style & (WS_CHILD|WS_MAXIMIZE)) == WS_CHILD)
2268  else
2269  IntLinkHwnd(Window, hwndInsertAfter);
2270  }
2271 
2272  if (!(Window->state2 & WNDS2_WIN31COMPAT))
2273  {
2274  if (Class->style & CS_PARENTDC && !(ParentWindow->style & WS_CLIPCHILDREN))
2275  Window->style &= ~(WS_CLIPSIBLINGS | WS_CLIPCHILDREN);
2276  }
2277 
2278  if ((Window->style & (WS_CHILD | WS_POPUP)) == WS_CHILD)
2279  {
2280  if ( !IntIsTopLevelWindow(Window) )
2281  {
2282  if (pti != Window->spwndParent->head.pti)
2283  {
2284  //ERR("CreateWindow Parent in.\n");
2285  UserAttachThreadInput(pti, Window->spwndParent->head.pti, TRUE);
2286  }
2287  }
2288  }
2289 
2290  /* Send the NCCREATE message */
2292  if (!Result)
2293  {
2294  ERR("co_UserCreateWindowEx(): NCCREATE message failed\n");
2295  goto cleanup;
2296  }
2297 
2298  /* Send the WM_NCCALCSIZE message */
2299  {
2300  // RECT rc;
2301  MaxPos.x = Window->rcWindow.left;
2302  MaxPos.y = Window->rcWindow.top;
2303 
2304  Result = co_WinPosGetNonClientSize(Window, &Window->rcWindow, &Window->rcClient);
2305  //rc = Window->rcWindow;
2306  //Result = co_IntSendMessageNoWait(Window->head.h, WM_NCCALCSIZE, FALSE, (LPARAM)&rc);
2307  //Window->rcClient = rc;
2308 
2309  RECTL_vOffsetRect(&Window->rcWindow, MaxPos.x - Window->rcWindow.left,
2310  MaxPos.y - Window->rcWindow.top);
2311  }
2312 
2313  /* Send the WM_CREATE message. */
2315  if (Result == (LRESULT)-1)
2316  {
2317  ERR("co_UserCreateWindowEx(): WM_CREATE message failed\n");
2318  goto cleanup;
2319  }
2320 
2321  /* Send the EVENT_OBJECT_CREATE event */
2322  IntNotifyWinEvent(EVENT_OBJECT_CREATE, Window, OBJID_WINDOW, CHILDID_SELF, 0);
2323 
2324  /* By setting the flag below it can be examined to determine if the window
2325  was created successfully and a valid pwnd was passed back to caller since
2326  from here the function has to succeed. */
2328 
2329  /* Send the WM_SIZE and WM_MOVE messages. */
2330  if (!(Window->state & WNDS_SENDSIZEMOVEMSGS))
2331  {
2333  }
2334 
2335  /* Show or maybe minimize or maximize the window. */
2336 
2338  if (style & (WS_MINIMIZE | WS_MAXIMIZE))
2339  {
2340  RECTL NewPos;
2341  UINT SwFlag = (style & WS_MINIMIZE) ? SW_MINIMIZE : SW_MAXIMIZE;
2342 
2343  SwFlag = co_WinPosMinMaximize(Window, SwFlag, &NewPos);
2344  SwFlag |= SWP_NOZORDER|SWP_FRAMECHANGED; /* Frame always gets changed */
2345  if (!(style & WS_VISIBLE) || (style & WS_CHILD) || UserGetActiveWindow()) SwFlag |= SWP_NOACTIVATE;
2346  co_WinPosSetWindowPos(Window, 0, NewPos.left, NewPos.top,
2347  NewPos.right, NewPos.bottom, SwFlag);
2348  }
2349 
2350  /* Send the WM_PARENTNOTIFY message */
2352 
2353  /* Notify the shell that a new window was created */
2354  if (UserIsDesktopWindow(Window->spwndParent) &&
2355  Window->spwndOwner == NULL &&
2356  (Window->style & WS_VISIBLE) &&
2357  (!(Window->ExStyle & WS_EX_TOOLWINDOW) ||
2358  (Window->ExStyle & WS_EX_APPWINDOW)))
2359  {
2361  }
2362 
2363  /* Initialize and show the window's scrollbars */
2364  if (Window->style & WS_VSCROLL)
2365  {
2367  }
2368  if (Window->style & WS_HSCROLL)
2369  {
2371  }
2372 
2373  /* Show the new window */
2374  if (Cs->style & WS_VISIBLE)
2375  {
2376  if (Window->style & WS_MAXIMIZE)
2377  dwShowMode = SW_SHOW;
2378  else if (Window->style & WS_MINIMIZE)
2379  dwShowMode = SW_SHOWMINIMIZED;
2380 
2381  co_WinPosShowWindow(Window, dwShowMode);
2382 
2383  if (Window->ExStyle & WS_EX_MDICHILD)
2384  {
2385  ASSERT(ParentWindow);
2386  if(!ParentWindow)
2387  goto cleanup;
2388  co_IntSendMessage(UserHMGetHandle(ParentWindow), WM_MDIREFRESHMENU, 0, 0);
2389  /* ShowWindow won't activate child windows */
2391  }
2392  }
2393 
2394  if (Class->atomClassName == gaGuiConsoleWndClass)
2395  {
2396  /* Count only console windows manually */
2398  }
2399 
2400  TRACE("co_UserCreateWindowEx(): Created window %p\n", hWnd);
2401  ret = Window;
2402 
2403 cleanup:
2404  if (!ret)
2405  {
2406  TRACE("co_UserCreateWindowEx(): Error Created window!\n");
2407  /* If the window was created, the class will be dereferenced by co_UserDestroyWindow */
2408  if (Window)
2410  else if (Class)
2411  IntDereferenceClass(Class, pti->pDeskInfo, pti->ppi);
2412  }
2413 
2414  if (pCsw) ExFreePoolWithTag(pCsw, TAG_HOOK);
2415  if (pCbtCreate) ExFreePoolWithTag(pCbtCreate, TAG_HOOK);
2416  if (pszName) UserHeapFree(pszName);
2417  if (pszClass) UserHeapFree(pszClass);
2418 
2419  if (Window)
2420  {
2422  }
2423  if (ParentWindow) UserDerefObjectCo(ParentWindow);
2424 
2425  // See CORE-13717, not setting error on success.
2426  if (ret)
2428 
2429  return ret;
2430 }
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
#define WS_THICKFRAME
Definition: pedump.c:630
#define HOOKID_TO_FLAG(HookId)
Definition: hook.h:5
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
NTSYSAPI DWORD WINAPI RtlUnicodeStringToAnsiSize(const UNICODE_STRING *)
#define HCBT_CREATEWND
Definition: winuser.h:58
POBJECT_TYPE ExWindowStationObjectType
Definition: win32k.c:25
*BytesInUnicodeString PWCH UnicodeString
Definition: rtlfuncs.h:1980
long y
Definition: polytest.cpp:48
#define LAYOUT_RTL
Definition: wingdi.h:1370
#define ERROR_SUCCESS
Definition: deptool.c:10
NTSTATUS FASTCALL UserAttachThreadInput(PTHREADINFO ptiFrom, PTHREADINFO ptiTo, BOOL fAttach)
Definition: input.c:479
#define TAG_HOOK
Definition: tags.h:5
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define UserIsDesktopWindow(pWnd)
Definition: desktop.h:220
long x
Definition: polytest.cpp:48
PVOID Buffer
Definition: ntuser.h:97
#define SB_VERT
Definition: winuser.h:553
HWND FASTCALL UserGetActiveWindow(VOID)
Definition: focus.c:1311
uint16_t * PWSTR
Definition: typedefs.h:54
LPCREATESTRUCTW lpcs
Definition: winuser.h:2949
#define SB_HORZ
Definition: winuser.h:552
VOID FASTCALL IntNotifyWinEvent(DWORD Event, PWND pWnd, LONG idObject, LONG idChild, DWORD flags)
Definition: event.c:179
BOOLEAN FASTCALL co_WinPosSetWindowPos(PWND Window, HWND WndInsertAfter, INT x, INT y, INT cx, INT cy, UINT flags)
Definition: winpos.c:1720
#define OBJID_WINDOW
Definition: winable.h:15
HWND hWnd
Definition: settings.c:17
#define ICLS_DESKTOP
Definition: ntuser.h:890
#define WS_EX_LAYOUTRTL
Definition: winuser.h:390
static __inline VOID UserRefObjectCo(PVOID obj, PUSER_REFERENCE_ENTRY UserReferenceEntry)
Definition: object.h:25
#define HSHELL_WINDOWCREATED
Definition: winuser.h:1240
long bottom
Definition: polytest.cpp:53
static __inline BOOL UserHeapFree(PVOID lpMem)
Definition: usrheap.h:42
DWORD FASTCALL co_UserShowScrollBar(PWND, int, BOOL, BOOL)
Definition: scrollbar.c:859
#define HWND_TOP
Definition: winuser.h:1193
BOOL FASTCALL UserDereferenceObject(PVOID Object)
Definition: object.c:610
VOID NTAPI ObDereferenceObject(IN PVOID Object)
Definition: obref.c:375
UINT_PTR WPARAM
Definition: windef.h:207
#define WNDS_SENDSIZEMOVEMSGS
Definition: ntuser.h:577
#define WS_CHILD
Definition: pedump.c:617
#define HWND_MESSAGE
Definition: winuser.h:1196
#define SWP_NOZORDER
Definition: winuser.h:1232
static __inline PVOID UserHeapAlloc(SIZE_T Bytes)
Definition: usrheap.h:34
#define SW_SHOWMINIMIZED
Definition: winuser.h:765
#define WS_CLIPCHILDREN
Definition: pedump.c:619
ATOM gaGuiConsoleWndClass
Definition: ntuser.c:27
#define WM_NCCREATE
Definition: winuser.h:1665
#define WS_EX_TOOLWINDOW
Definition: winuser.h:404
struct _DESKTOP * rpdesk
Definition: win32.h:91
PSERVERINFO gpsi
Definition: main.c:27
NTSYSAPI VOID NTAPI RtlCopyUnicodeString(PUNICODE_STRING DestinationString, PUNICODE_STRING SourceString)
DWORD dwLayout
Definition: win32.h:270
struct _THREADINFO * GetW32ThreadInfo(VOID)
Definition: misc.c:781
PPROCESSINFO ppi
Definition: win32.h:87
HWND hwndInsertAfter
Definition: winuser.h:2950
long right
Definition: polytest.cpp:53
Definition: window.c:29
#define WS_EX_MDICHILD
Definition: winuser.h:394
VOID FASTCALL IntLinkHwnd(PWND Wnd, HWND hWndPrev)
Definition: window.c:937
#define UNICODE_NULL
#define WS_MINIMIZE
Definition: pedump.c:622
static __inline VOID UserDerefObjectCo(PVOID obj)
Definition: object.h:38
long top
Definition: polytest.cpp:53
struct NameRec_ * Name
Definition: cdprocs.h:464
#define CHILDID_SELF
Definition: winable.h:14
Definition: object.h:3
smooth NULL
Definition: ftsmooth.c:416
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
Definition: ntuser.h:533
LONG_PTR LPARAM
Definition: windef.h:208
PWND FASTCALL co_GetDesktopWindow(PWND pWnd)
Definition: desktop.c:1330
#define WH_CBT
Definition: winuser.h:35
NTSTATUS NTAPI ObReferenceObjectByPointer(IN PVOID Object, IN ACCESS_MASK DesiredAccess, IN POBJECT_TYPE ObjectType, IN KPROCESSOR_MODE AccessMode)
Definition: obref.c:383
NTSYSAPI NTSTATUS NTAPI RtlUnicodeStringToAnsiString(PANSI_STRING DestinationString, PUNICODE_STRING SourceString, BOOLEAN AllocateDestinationString)
#define SW_SHOW
Definition: winuser.h:769
PWND FASTCALL IntCreateWindow(CREATESTRUCTW *Cs, PLARGE_STRING WindowName, PCLS Class, PWND ParentWindow, PWND OwnerWindow, PVOID acbiBuffer, PDESKTOP pdeskCreated, DWORD dwVer)
Definition: window.c:1612
long left
Definition: polytest.cpp:53
VOID FASTCALL co_IntUserManualGuiCheck(BOOL Create)
Definition: guicheck.c:77
#define PCHAR
Definition: match.c:90
UINT FASTCALL co_WinPosGetMinMaxInfo(PWND Window, POINT *MaxSize, POINT *MaxPos, POINT *MinTrack, POINT *MaxTrack)
Definition: winpos.c:931
BOOLEAN FASTCALL co_WinPosShowWindow(PWND Wnd, INT Cmd)
Definition: winpos.c:2464
BOOLEAN co_UserDestroyWindow(PVOID Object)
Definition: window.c:2644
HINSTANCE hInstance
Definition: winuser.h:2930
#define UserHMGetHandle(obj)
Definition: ntuser.h:208
#define ERROR_TLW_WITH_WSCHILD
Definition: winerror.h:887
#define HWND_BOTTOM
Definition: winuser.h:1191
#define TRACE(s)
Definition: solgame.cpp:4
#define IS_INTRESOURCE(i)
Definition: winuser.h:580
ULONG Length
Definition: ntuser.h:94
#define SWP_NOACTIVATE
Definition: winuser.h:1227
#define ISITHOOKED(HookId)
Definition: hook.h:6
PCLS IntGetAndReferenceClass(PUNICODE_STRING ClassName, HINSTANCE hInstance, BOOL bDesktopThread)
Definition: class.c:1407
void FASTCALL co_WinPosSendSizeMove(PWND Wnd)
Definition: winpos.c:2280
unsigned long DWORD
Definition: ntddk_ex.h:95
#define WNDS2_WMCREATEMSGPROCESSED
Definition: ntuser.h:638
#define STATUS_ACCESS_DENIED
Definition: udferr_usr.h:145
#define SW_MINIMIZE
Definition: winuser.h:770
int Window
Definition: x11stubs.h:26
#define WS_HSCROLL
Definition: pedump.c:628
BOOL FASTCALL IntIsTopLevelWindow(PWND pWnd)
Definition: window.c:331
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
LRESULT APIENTRY co_HOOK_CallHooks(INT HookId, INT Code, WPARAM wParam, LPARAM lParam)
Definition: hook.c:1103
int ret
static const WCHAR L[]
Definition: oid.c:1250
LRESULT FASTCALL co_IntSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1281
LPCWSTR lpszName
Definition: winuser.h:2938
#define SWP_FRAMECHANGED
Definition: winuser.h:1225
static __inline PVOID UserHeapAddressToUser(PVOID lpMem)
Definition: usrheap.h:92
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
#define SWP_NOSIZE
Definition: winuser.h:1230
#define ERR(fmt,...)
Definition: debug.h:109
Definition: ntuser.h:657
FORCEINLINE VOID RECTL_vOffsetRect(_Inout_ RECTL *prcl, _In_ INT cx, _In_ INT cy)
Definition: rect.h:31
#define IntIsDesktopWindow(WndObj)
Definition: window.h:24
#define WM_MDIREFRESHMENU
Definition: winuser.h:1808
unsigned short USHORT
Definition: pedump.c:61
#define WNDS2_WIN31COMPAT
Definition: ntuser.h:617
PWND FASTCALL UserGetWindowObject(HWND hWnd)
Definition: window.c:103
#define min(a, b)
Definition: monoChain.cc:55
#define WS_POPUP
Definition: pedump.c:616
unsigned int UINT
Definition: ndis.h:50
#define WS_VSCROLL
Definition: pedump.c:627
#define SWP_SHOWWINDOW
Definition: winuser.h:1233
VOID co_IntShellHookNotify(WPARAM Message, WPARAM wParam, LPARAM lParam)
Definition: desktop.c:1656
#define MAXUSHORT
Definition: typedefs.h:81
UINT FASTCALL co_WinPosMinMaximize(PWND Wnd, UINT ShowFlag, RECT *NewPos)
Definition: winpos.c:2314
VOID IntDereferenceClass(IN OUT PCLS Class, IN PDESKTOPINFO Desktop, IN PPROCESSINFO pi)
Definition: class.c:792
#define WM_CREATE
Definition: winuser.h:1590
LPCWSTR lpszClass
Definition: winuser.h:2939
ULONG FASTCALL IntSetStyle(PWND pwnd, ULONG set_bits, ULONG clear_bits)
Definition: window.c:124
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
char * cleanup(char *str)
Definition: wpickclick.c:99
#define SWP_NOMOVE
Definition: winuser.h:1229
#define IS_ATOM(x)
Definition: class.h:3
#define WS_EX_APPWINDOW
Definition: winuser.h:383
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
LONG_PTR LRESULT
Definition: windef.h:209
struct _DESKTOPINFO * pDeskInfo
Definition: win32.h:92
Arabic default style
Definition: afstyles.h:93
#define WS_VISIBLE
Definition: pedump.c:620
#define WNDS_ANSICREATOR
Definition: ntuser.h:602
#define SW_MAXIMIZE
Definition: winuser.h:766
#define CHAR(Char)
static void IntSendParentNotify(PWND pWindow, UINT msg)
Definition: window.c:1503
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27
void FASTCALL IntFixWindowCoordinates(CREATESTRUCTW *Cs, PWND ParentWindow, DWORD *dwShowMode)
Definition: window.c:1522
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
#define CS_PARENTDC
Definition: winuser.h:651
#define MAKEINTATOM(i)
Definition: winbase.h:1423
ULONG MaximumLength
Definition: ntuser.h:95
ATOM atomSysClass[ICLS_NOTUSED+1]
Definition: ntuser.h:1013
LRESULT FASTCALL co_WinPosGetNonClientSize(PWND Window, RECT *WindowRect, RECT *ClientRect)
Definition: winpos.c:2265
#define WS_MAXIMIZE
Definition: pedump.c:623
#define ERROR_CANNOT_FIND_WND_CLASS
Definition: winerror.h:888

Referenced by MENU_InitPopup(), and NtUserCreateWindowEx().

◆ co_UserFreeWindow()

LRESULT co_UserFreeWindow ( PWND  ,
PPROCESSINFO  ,
PTHREADINFO  ,
BOOLEAN   
)

Definition at line 546 of file window.c.

550 {
551  HWND *Children;
552  HWND *ChildHandle;
553  PWND Child;
554  PMENU Menu;
555  BOOLEAN BelongsToThreadData;
556 
557  ASSERT(Window);
558 
559  if(Window->state2 & WNDS2_INDESTROY)
560  {
561  TRACE("Tried to call co_UserFreeWindow() twice\n");
562  return 0;
563  }
564  Window->state2 |= WNDS2_INDESTROY;
565  Window->style &= ~WS_VISIBLE;
566  Window->head.pti->cVisWindows--;
567 
568 
569  /* remove the window already at this point from the thread window list so we
570  don't get into trouble when destroying the thread windows while we're still
571  in co_UserFreeWindow() */
572  RemoveEntryList(&Window->ThreadListEntry);
573 
574  BelongsToThreadData = IntWndBelongsToThread(Window, ThreadData);
575 
577 
578  /* free child windows */
579  Children = IntWinListChildren(Window);
580  if (Children)
581  {
582  for (ChildHandle = Children; *ChildHandle; ++ChildHandle)
583  {
584  if ((Child = IntGetWindowObject(*ChildHandle)))
585  {
587  {
588  /* send WM_DESTROY messages to windows not belonging to the same thread */
590  }
591  else
592  co_UserFreeWindow(Child, ProcessData, ThreadData, SendMessages);
593 
595  }
596  }
598  }
599 
600  if (SendMessages)
601  {
602  /*
603  * Clear the update region to make sure no WM_PAINT messages will be
604  * generated for this window while processing the WM_NCDESTROY.
605  */
609  if (BelongsToThreadData)
611  }
612 
614 
616 
617  /* Unregister hot keys */
619 
620  /* flush the message queue */
622 
623  /* from now on no messages can be sent to this window anymore */
624  Window->state |= WNDS_DESTROYED;
625  Window->fnid |= FNID_FREED;
626 
627  /* don't remove the WINDOWSTATUS_DESTROYING bit */
628 
629  /* reset shell window handles */
630  if (ThreadData->rpdesk)
631  {
632  if (Window->head.h == ThreadData->rpdesk->rpwinstaParent->ShellWindow)
633  ThreadData->rpdesk->rpwinstaParent->ShellWindow = NULL;
634 
635  if (Window->head.h == ThreadData->rpdesk->rpwinstaParent->ShellListView)
636  ThreadData->rpdesk->rpwinstaParent->ShellListView = NULL;
637  }
638 
639  /* Fixes dialog test_focus breakage due to r66237. */
640  if (ThreadData->MessageQueue->spwndFocus == Window)
641  ThreadData->MessageQueue->spwndFocus = NULL;
642 
643  if (ThreadData->MessageQueue->spwndActive == Window)
644  ThreadData->MessageQueue->spwndActive = NULL;
645 
646  if (ThreadData->MessageQueue->spwndCapture == Window)
647  {
649  }
650 
652  if ( Window->hrgnUpdate != NULL || Window->state & WNDS_INTERNALPAINT )
653  {
654  MsqDecPaintCountQueue(Window->head.pti);
655  if (Window->hrgnUpdate > HRGN_WINDOW && GreIsHandleValid(Window->hrgnUpdate))
656  {
658  GreDeleteObject(Window->hrgnUpdate);
659  }
660  Window->hrgnUpdate = NULL;
661  Window->state &= ~WNDS_INTERNALPAINT;
662  }
663 
665  {
667  }
668 
669  if ( ((Window->style & (WS_CHILD|WS_POPUP)) != WS_CHILD) &&
670  Window->IDMenu &&
671  (Menu = UserGetMenuObject((HMENU)Window->IDMenu)))
672  {
673  TRACE("UFW: IDMenu %p\n",Window->IDMenu);
674  IntDestroyMenuObject(Menu, TRUE);
675  Window->IDMenu = 0;
676  }
677 
678  if (Window->SystemMenu
679  && (Menu = UserGetMenuObject(Window->SystemMenu)))
680  {
681  IntDestroyMenuObject(Menu, TRUE);
682  Window->SystemMenu = (HMENU)0;
683  }
684 
685  DceFreeWindowDCE(Window); /* Always do this to catch orphaned DCs */
686 
688 
689  if (Window->PropListItems)
690  {
692  TRACE("Window->PropListItems %lu\n",Window->PropListItems);
693  ASSERT(Window->PropListItems==0);
694  }
695 
698 
700 
701  if (Window->pcls->atomClassName == gaGuiConsoleWndClass)
702  {
703  /* Count only console windows manually */
705  }
706 
707  /* dereference the class */
708  NT_ASSERT(Window->head.pti != NULL);
710  Window->head.pti->pDeskInfo,
711  Window->head.pti->ppi);
712  Window->pcls = NULL;
713 
714  if (Window->hrgnClip)
715  {
717  GreDeleteObject(Window->hrgnClip);
718  Window->hrgnClip = NULL;
719  }
720  Window->head.pti->cWindows--;
721 
722 // ASSERT(Window != NULL);
723  UserFreeWindowInfo(Window->head.pti, Window);
724 
727 
728  return 0;
729 }
#define RDW_NOINTERNALPAINT
Definition: winuser.h:1203
#define RDW_NOCHILDREN
Definition: winuser.h:1208
BOOL FASTCALL UserDeleteObject(HANDLE h, HANDLE_TYPE type)
Definition: object.c:683
BOOL NTAPI GreDeleteObject(HGDIOBJ hobj)
Definition: gdiobj.c:1155
#define TRUE
Definition: types.h:120
LRESULT co_UserFreeWindow(PWND Window, PPROCESSINFO ProcessData, PTHREADINFO ThreadData, BOOLEAN SendMessages)
Definition: window.c:546
BOOL NTAPI GreIsHandleValid(HGDIOBJ hobj)
Definition: gdiobj.c:1143
VOID FASTCALL IntUnlinkWindow(PWND Wnd)
Definition: window.c:1306
BOOL FASTCALL IntReleaseCapture(VOID)
Definition: focus.c:1412
#define IntWndBelongsToThread(WndObj, W32Thread)
Definition: window.h:31
#define WNDS_SENDNCPAINT
Definition: ntuser.h:584
BOOL FASTCALL IntDestroyMenuObject(PMENU Menu, BOOL bRecurse)
Definition: menu.c:317
BOOL FASTCALL UserDereferenceObject(PVOID Object)
Definition: object.c:610
#define WS_CHILD
Definition: pedump.c:617
ATOM gaGuiConsoleWndClass
Definition: ntuser.c:27
PWND FASTCALL IntGetWindowObject(HWND hWnd)
Definition: window.c:51
FORCEINLINE PMENU UserGetMenuObject(HMENU hMenu)
Definition: userfuncs.h:3
FORCEINLINE BOOLEAN RemoveEntryList(_In_ PLIST_ENTRY Entry)
Definition: rtlfuncs.h:105
BOOL FASTCALL DestroyTimersForWindow(PTHREADINFO pti, PWND Window)
Definition: timer.c:522
Definition: window.c:29
void FASTCALL DceFreeWindowDCE(PWND)
Definition: windc.c:685
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
#define HRGN_WINDOW
Definition: ntuser.h:329
VOID FASTCALL UserClipboardFreeWindow(PWND pWindow)
Definition: clipboard.c:411
VOID FASTCALL co_IntUserManualGuiCheck(BOOL Create)
Definition: guicheck.c:77
#define UserHMGetHandle(obj)
Definition: ntuser.h:208
#define TRACE(s)
Definition: solgame.cpp:4
BOOL IntDeRegisterShellHookWindow(HWND hWnd)
Definition: desktop.c:1748
VOID FASTCALL UserRemoveWindowProps(_In_ PWND Window)
Definition: prop.c:115
BOOL FASTCALL IntGdiSetRegionOwner(HRGN hRgn, DWORD OwnerMask)
Definition: region.c:2478
#define WM_NCDESTROY
Definition: winuser.h:1666
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
VOID FASTCALL MsqDecPaintCountQueue(PTHREADINFO pti)
Definition: msgqueue.c:508
#define FNID_FREED
Definition: ntuser.h:861
#define RDW_VALIDATE
Definition: winuser.h:1204
LRESULT FASTCALL co_IntSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1281
#define RDW_NOERASE
Definition: winuser.h:1201
HWND *FASTCALL IntWinListChildren(PWND Window)
Definition: window.c:255
#define GDI_OBJ_HMGR_POWNED
Definition: ntgdihdl.h:117
#define RDW_NOFRAME
Definition: winuser.h:1202
Definition: ntuser.h:657
BOOL FASTCALL co_UserRedrawWindow(PWND Window, const RECTL *UpdateRect, PREGION UpdateRgn, ULONG Flags)
Definition: painting.c:876
BOOL FASTCALL IntDestroyScrollBars(PWND)
Definition: scrollbar.c:806
#define WS_POPUP
Definition: pedump.c:616
#define WNDS_INTERNALPAINT
Definition: ntuser.h:585
#define WNDS_SENDERASEBACKGROUND
Definition: ntuser.h:582
VOID IntDereferenceClass(IN OUT PCLS Class, IN PDESKTOPINFO Desktop, IN PPROCESSINFO pi)
Definition: class.c:792
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn BOOLEAN Physical UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER void *Data ACPI_OBJECT_HANDLER void **Data ACPI_STRING ACPI_OBJECT_LIST ACPI_BUFFER *ReturnObjectBuffer ACPI_DEVICE_INFO **ReturnBuffer ACPI_HANDLE ACPI_HANDLE Child
Definition: acpixf.h:722
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
#define USERTAG_WINDOWLIST
Definition: tags.h:297
#define WS_VISIBLE
Definition: pedump.c:620
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
#define WNDS_DESTROYED
Definition: ntuser.h:604
VOID APIENTRY MsqRemoveWindowMessagesFromQueue(PWND Window)
Definition: msgqueue.c:798
#define WNDS2_INDESTROY
Definition: ntuser.h:616
VOID FASTCALL UnregisterWindowHotKeys(PWND pWnd)
Definition: hotkey.c:91
static VOID UserFreeWindowInfo(PTHREADINFO ti, PWND Wnd)
Definition: window.c:513
VOID FASTCALL UserReferenceObject(PVOID obj)
Definition: object.c:697
#define NT_ASSERT
Definition: rtlfuncs.h:3312
BOOL FASTCALL UserMarkObjectDestroy(PVOID Object)
Definition: object.c:587

Referenced by co_UserDestroyWindow(), co_UserFreeWindow(), and handle_internal_message().

◆ co_UserSetWindowLong()

LONG FASTCALL co_UserSetWindowLong ( HWND  ,
DWORD  ,
LONG  ,
BOOL   
)

Definition at line 3830 of file window.c.

3831 {
3832  return (LONG)co_IntSetWindowLongPtr(hWnd, Index, NewValue, Ansi, sizeof(LONG), FALSE);
3833 }
HWND hWnd
Definition: settings.c:17
static LONG_PTR co_IntSetWindowLongPtr(HWND hWnd, DWORD Index, LONG_PTR NewValue, BOOL Ansi, ULONG Size, BOOL bAlter)
Definition: window.c:3635
long LONG
Definition: pedump.c:60
static const UCHAR Index[8]
Definition: usbohci.c:18

Referenced by DesktopWindowProc(), and NtUserSetWindowWord().

◆ co_UserSetWindowLongPtr()

LONG_PTR FASTCALL co_UserSetWindowLongPtr ( HWND  ,
DWORD  ,
LONG_PTR  ,
BOOL   
)

Definition at line 3836 of file window.c.

3837 {
3838  return co_IntSetWindowLongPtr(hWnd, Index, NewValue, Ansi, sizeof(LONG_PTR), FALSE);
3839 }
HWND hWnd
Definition: settings.c:17
static LONG_PTR co_IntSetWindowLongPtr(HWND hWnd, DWORD Index, LONG_PTR NewValue, BOOL Ansi, ULONG Size, BOOL bAlter)
Definition: window.c:3635
static const UCHAR Index[8]
Definition: usbohci.c:18
__int3264 LONG_PTR
Definition: mstsclib_h.h:276

◆ GetNCHitEx()

DWORD FASTCALL GetNCHitEx ( PWND  ,
POINT   
)

Definition at line 1927 of file nonclient.c.

1928 {
1929  RECT rcWindow, rcClient;
1930  DWORD Style, ExStyle;
1931 
1932  if (!pWnd) return HTNOWHERE;
1933 
1934  if (UserIsDesktopWindow(pWnd))
1935  {
1936  rcClient.left = rcClient.top = rcWindow.left = rcWindow.top = 0;
1941  }
1942  else
1943  {
1944  rcClient = pWnd->rcClient;
1945  rcWindow = pWnd->rcWindow;
1946  }
1947 
1948  if (!RECTL_bPointInRect(&rcWindow, pt.x, pt.y)) return HTNOWHERE;
1949 
1950  Style = pWnd->style;
1951  ExStyle = pWnd->ExStyle;
1952 
1953  if (Style & WS_MINIMIZE) return HTCAPTION;
1954 
1955  if (RECTL_bPointInRect( &rcClient, pt.x, pt.y )) return HTCLIENT;
1956 
1957  /* Check borders */
1958  if (HAS_THICKFRAME( Style, ExStyle ))
1959  {
1961  if (!RECTL_bPointInRect(&rcWindow, pt.x, pt.y ))
1962  {
1963  /* Check top sizing border */
1964  if (pt.y < rcWindow.top)
1965  {
1966  if (pt.x < rcWindow.left+UserGetSystemMetrics(SM_CXSIZE)) return HTTOPLEFT;
1967  if (pt.x >= rcWindow.right-UserGetSystemMetrics(SM_CXSIZE)) return HTTOPRIGHT;
1968  return HTTOP;
1969  }
1970  /* Check bottom sizing border */
1971  if (pt.y >= rcWindow.bottom)
1972  {
1973  if (pt.x < rcWindow.left+UserGetSystemMetrics(SM_CXSIZE)) return HTBOTTOMLEFT;
1974  if (pt.x >= rcWindow.right-UserGetSystemMetrics(SM_CXSIZE)) return HTBOTTOMRIGHT;
1975  return HTBOTTOM;
1976  }
1977  /* Check left sizing border */
1978  if (pt.x < rcWindow.left)
1979  {
1980  if (pt.y < rcWindow.top+UserGetSystemMetrics(SM_CYSIZE)) return HTTOPLEFT;
1981  if (pt.y >= rcWindow.bottom-UserGetSystemMetrics(SM_CYSIZE)) return HTBOTTOMLEFT;
1982  return HTLEFT;
1983  }
1984  /* Check right sizing border */
1985  if (pt.x >= rcWindow.right)
1986  {
1987  if (pt.y < rcWindow.top+UserGetSystemMetrics(SM_CYSIZE)) return HTTOPRIGHT;
1988  if (pt.y >= rcWindow.bottom-UserGetSystemMetrics(SM_CYSIZE)) return HTBOTTOMRIGHT;
1989  return HTRIGHT;
1990  }
1991  }
1992  }
1993  else /* No thick frame */
1994  {
1995  if (HAS_DLGFRAME( Style, ExStyle ))
1997  else if (HAS_THINFRAME( Style, ExStyle ))
1999  else if (HAS_CLIENTFRAME( Style, ExStyle ))
2001  if (!RECTL_bPointInRect( &rcWindow, pt.x, pt.y )) return HTBORDER;
2002  }
2003 
2004  /* Check caption */
2005 
2006  if ((Style & WS_CAPTION) == WS_CAPTION)
2007  {
2008  if (ExStyle & WS_EX_TOOLWINDOW)
2009  rcWindow.top += UserGetSystemMetrics(SM_CYSMCAPTION) - 1;
2010  else
2011  rcWindow.top += UserGetSystemMetrics(SM_CYCAPTION) - 1;
2012  if (!RECTL_bPointInRect( &rcWindow, pt.x, pt.y ))
2013  {
2014  BOOL min_or_max_box = (Style & WS_SYSMENU) && (Style & (WS_MINIMIZEBOX|WS_MAXIMIZEBOX));
2015  if (ExStyle & WS_EX_LAYOUTRTL)
2016  {
2017  /* Check system menu */
2018  if ((Style & WS_SYSMENU) && !(ExStyle & WS_EX_TOOLWINDOW) && NC_IconForWindow(pWnd))
2019  {
2020  rcWindow.right -= UserGetSystemMetrics(SM_CYCAPTION) - 1;
2021  if (pt.x > rcWindow.right) return HTSYSMENU;
2022  }
2023 
2024  /* Check close button */
2025  if (Style & WS_SYSMENU)
2026  {
2027  rcWindow.left += UserGetSystemMetrics(SM_CYCAPTION);
2028  if (pt.x < rcWindow.left) return HTCLOSE;
2029  }
2030 
2031  /* Check maximize box */
2032  /* In Win95 there is automatically a Maximize button when there is a minimize one */
2033  if (min_or_max_box && !(ExStyle & WS_EX_TOOLWINDOW))
2034  {
2035  rcWindow.left += UserGetSystemMetrics(SM_CXSIZE);
2036  if (pt.x < rcWindow.left) return HTMAXBUTTON;
2037  }
2038 
2039  /* Check minimize box */
2040  if (min_or_max_box && !(ExStyle & WS_EX_TOOLWINDOW))
2041  {
2042  rcWindow.left += UserGetSystemMetrics(SM_CXSIZE);
2043  if (pt.x < rcWindow.left) return HTMINBUTTON;
2044  }
2045  }
2046  else
2047  {
2048  /* Check system menu */
2049  if ((Style & WS_SYSMENU) && !(ExStyle & WS_EX_TOOLWINDOW) && NC_IconForWindow(pWnd))
2050  {
2051  rcWindow.left += UserGetSystemMetrics(SM_CYCAPTION) - 1;
2052  if (pt.x < rcWindow.left) return HTSYSMENU;
2053  }
2054 
2055  /* Check close button */
2056  if (Style & WS_SYSMENU)
2057  {
2059  if (pt.x > rcWindow.right) return HTCLOSE;
2060  }
2061 
2062  /* Check maximize box */
2063  /* In Win95 there is automatically a Maximize button when there is a minimize one */
2064  if (min_or_max_box && !(ExStyle & WS_EX_TOOLWINDOW))
2065  {
2066  rcWindow.right -= UserGetSystemMetrics(SM_CXSIZE);
2067  if (pt.x > rcWindow.right) return HTMAXBUTTON;
2068  }
2069 
2070  /* Check minimize box */
2071  if (min_or_max_box && !(ExStyle & WS_EX_TOOLWINDOW))
2072  {
2073  rcWindow.right -= UserGetSystemMetrics(SM_CXSIZE);
2074  if (pt.x > rcWindow.right) return HTMINBUTTON;
2075  }
2076  }
2077  return HTCAPTION;
2078  }
2079  }
2080 
2081  /* Check menu bar */
2082 
2083  if (HAS_MENU( pWnd, Style ) && (pt.y < rcClient.top) &&
2084  (pt.x >= rcClient.left) && (pt.x < rcClient.right))
2085  return HTMENU;
2086 
2087  /* Check vertical scroll bar */
2088 
2090  if (Style & WS_VSCROLL)
2091  {
2092  if((ExStyle & WS_EX_LEFTSCROLLBAR) != 0)
2093  rcClient.left -= UserGetSystemMetrics(SM_CXVSCROLL);
2094  else
2096  if (RECTL_bPointInRect( &rcClient, pt.x, pt.y )) return HTVSCROLL;
2097  }
2098 
2099  /* Check horizontal scroll bar */
2100 
2101  if (Style & WS_HSCROLL)
2102  {
2104  if (RECTL_bPointInRect( &rcClient, pt.x, pt.y ))
2105  {
2106  /* Check size box */
2107  if ((Style & WS_VSCROLL) &&
2108  ((((ExStyle & WS_EX_LEFTSCROLLBAR) != 0) && (pt.x <= rcClient.left + UserGetSystemMetrics(SM_CXVSCROLL))) ||
2109  (((ExStyle & WS_EX_LEFTSCROLLBAR) == 0) && (pt.x >= rcClient.right - UserGetSystemMetrics(SM_CXVSCROLL)))))
2110  return HTSIZE;
2111  return HTHSCROLL;
2112  }
2113  }
2114 
2115  /* Has to return HTNOWHERE if nothing was found
2116  Could happen when a window has a customized non client area */
2117  return HTNOWHERE;
2118 }
#define HTMAXBUTTON
Definition: winuser.h:2459
#define HTTOP
Definition: winuser.h:2465
#define HTLEFT
Definition: winuser.h:2462
#define HTHSCROLL
Definition: winuser.h:2456
#define SM_CYHSCROLL
Definition: winuser.h:952
#define SM_CYSIZE
Definition: winuser.h:982
#define UserIsDesktopWindow(pWnd)
Definition: desktop.h:220
VOID FASTCALL RECTL_vInflateRect(_Inout_ RECTL *rect, _In_ INT dx, _In_ INT dy)
Definition: rect.c:101
#define pt(x, y)
Definition: drawing.c:79
LONG top
Definition: windef.h:292
#define WS_EX_LAYOUTRTL
Definition: winuser.h:390
#define SM_CXEDGE
Definition: winuser.h:998
#define HTBOTTOMLEFT
Definition: winuser.h:2469
#define HTRIGHT
Definition: winuser.h:2464
LONG left
Definition: windef.h:291
#define SM_CYFRAME
Definition: winuser.h:986
#define SM_CXFRAME
Definition: winuser.h:984
LONG right
Definition: windef.h:293
#define WS_EX_LEFTSCROLLBAR
Definition: winuser.h:392
#define HTNOWHERE
Definition: winuser.h:2449
#define WS_EX_TOOLWINDOW
Definition: winuser.h:404
#define HTMINBUTTON
Definition: winuser.h:2458
#define HTTOPLEFT
Definition: winuser.h:2466
#define HAS_CLIENTFRAME(Style, ExStyle)
Definition: window.h:19
#define SM_CXSCREEN
Definition: winuser.h:949
#define HTSYSMENU
Definition: winuser.h:2452
#define WS_MINIMIZE
Definition: pedump.c:622
unsigned int BOOL
Definition: ntddk_ex.h:94
#define SM_CYDLGFRAME
Definition: winuser.h:958
#define HAS_THINFRAME(Style, ExStyle)
Definition: window.h:16
#define HAS_THICKFRAME(Style, ExStyle)
Definition: window.h:12
#define SM_CYEDGE
Definition: winuser.h:999
#define WS_MAXIMIZEBOX
Definition: pedump.c:632
PCURICON_OBJECT FASTCALL NC_IconForWindow(PWND pWnd)
Definition: nonclient.c:681
LONG NTAPI UserGetSystemMetrics(ULONG Index)
Definition: metric.c:180
#define WS_CAPTION
Definition: pedump.c:624
#define HTSIZE
Definition: winuser.h:2454
#define SM_CYSCREEN
Definition: winuser.h:950
#define HTTOPRIGHT
Definition: winuser.h:2467
#define SM_CYCAPTION
Definition: winuser.h:953
const DWORD Style
Definition: appswitch.c:71
#define SM_CXDLGFRAME
Definition: winuser.h:956
#define HTBOTTOM
Definition: winuser.h:2468
unsigned long DWORD
Definition: ntddk_ex.h:95
#define WS_HSCROLL
Definition: pedump.c:628
#define HTCLOSE
Definition: winuser.h:2474
FORCEINLINE BOOL RECTL_bPointInRect(_In_ const RECTL *prcl, _In_ INT x, _In_ INT y)
Definition: rect.h:52
#define SM_CYBORDER
Definition: winuser.h:955
#define SM_CXBORDER
Definition: winuser.h:954
#define HTBOTTOMRIGHT
Definition: winuser.h:2470
#define HTCAPTION
Definition: winuser.h:2451
#define HAS_MENU(hwnd, style)
Definition: uxthemep.h:222
#define WS_MINIMIZEBOX
Definition: pedump.c:631
#define HTMENU
Definition: winuser.h:2455
#define HTBORDER
Definition: winuser.h:2472
#define WS_VSCROLL
Definition: pedump.c:627
#define SM_CXVSCROLL
Definition: winuser.h:951
#define HTVSCROLL
Definition: winuser.h:2457
#define SM_CXSIZE
Definition: winuser.h:981
#define HAS_DLGFRAME(Style, ExStyle)
Definition: window.h:8
LONG bottom
Definition: windef.h:294
#define HTCLIENT
Definition: winuser.h:2450
#define WS_SYSMENU
Definition: pedump.c:629
#define SM_CYSMCAPTION
Definition: winuser.h:1004
const DWORD ExStyle
Definition: appswitch.c:72

Referenced by DefWndStartSizeMove(), IntDefWindowProc(), MENU_PtMenu(), NC_DoButton(), and NC_HandleNCRButtonDown().

◆ IntCreateWindow()

PWND FASTCALL IntCreateWindow ( CREATESTRUCTW Cs,
PLARGE_STRING  WindowName,
PCLS  Class,
PWND  ParentWindow,
PWND  OwnerWindow,
PVOID  acbiBuffer,
PDESKTOP  pdeskCreated,
DWORD  dwVer 
)

Definition at line 1612 of file window.c.

1620 {
1621  PWND pWnd = NULL;
1622  HWND hWnd;
1623  PTHREADINFO pti = NULL;
1624  BOOL MenuChanged;
1625  BOOL bUnicodeWindow;
1626 
1627  pti = pdeskCreated ? gptiDesktopThread : GetW32ThreadInfo();
1628 
1629  if (!(Cs->dwExStyle & WS_EX_LAYOUTRTL))
1630  { // Need both here for wine win.c test_CreateWindow.
1631  //if (Cs->hwndParent && ParentWindow)
1632  if (ParentWindow) // It breaks more tests..... WIP.
1633  {
1634  if ( (Cs->style & (WS_CHILD|WS_POPUP)) == WS_CHILD &&
1635  ParentWindow->ExStyle & WS_EX_LAYOUTRTL &&
1636  !(ParentWindow->ExStyle & WS_EX_NOINHERITLAYOUT) )
1637  Cs->dwExStyle |= WS_EX_LAYOUTRTL;
1638  }
1639  else
1640  { /*
1641  * Note from MSDN <http://msdn.microsoft.com/en-us/library/aa913269.aspx>:
1642  *
1643  * Dialog boxes and message boxes do not inherit layout, so you must
1644  * set the layout explicitly.
1645  */
1646  if ( Class->fnid != FNID_DIALOG )
1647  {
1648  if (pti->ppi->dwLayout & LAYOUT_RTL)
1649  {
1650  Cs->dwExStyle |= WS_EX_LAYOUTRTL;
1651  }
1652  }
1653  }
1654  }
1655 
1656  /* Automatically add WS_EX_WINDOWEDGE */
1657  if ((Cs->dwExStyle & WS_EX_DLGMODALFRAME) ||
1658  ((!(Cs->dwExStyle & WS_EX_STATICEDGE)) &&
1659  (Cs->style & (WS_DLGFRAME | WS_THICKFRAME))))
1660  Cs->dwExStyle |= WS_EX_WINDOWEDGE;
1661  else
1662  Cs->dwExStyle &= ~WS_EX_WINDOWEDGE;
1663 
1664  /* Is it a unicode window? */
1665  bUnicodeWindow =!(Cs->dwExStyle & WS_EX_SETANSICREATOR);
1667 
1668  /* Allocate the new window */
1670  pdeskCreated ? pdeskCreated : pti->rpdesk,
1671  pti,
1672  (PHANDLE)&hWnd,
1673  TYPE_WINDOW,
1674  sizeof(WND) + Class->cbwndExtra);
1675 
1676  if (!pWnd)
1677  {
1678  goto AllocError;
1679  }
1680 
1681  TRACE("Created window object with handle %p\n", hWnd);
1682 
1683  if (pdeskCreated && pdeskCreated->DesktopWindow == NULL )
1684  { /* HACK: Helper for win32csr/desktopbg.c */
1685  /* If there is no desktop window yet, we must be creating it */
1686  TRACE("CreateWindow setting desktop.\n");
1687  pdeskCreated->DesktopWindow = hWnd;
1688  pdeskCreated->pDeskInfo->spwnd = pWnd;
1689  }
1690 
1691  /*
1692  * Fill out the structure describing it.
1693  */
1694  /* Remember, pWnd->head is setup in object.c ... */
1695  pWnd->spwndParent = ParentWindow;
1696  pWnd->spwndOwner = OwnerWindow;
1697  pWnd->fnid = 0;
1698  pWnd->spwndLastActive = pWnd;
1699  // Ramp up compatible version sets.
1700  if ( dwVer >= WINVER_WIN31 )
1701  {
1702  pWnd->state2 |= WNDS2_WIN31COMPAT;
1703  if ( dwVer >= WINVER_WINNT4 )
1704  {
1705  pWnd->state2 |= WNDS2_WIN40COMPAT;
1706  if ( dwVer >= WINVER_WIN2K )
1707  {
1708  pWnd->state2 |= WNDS2_WIN50COMPAT;
1709  }
1710  }
1711  }
1712  pWnd->pcls = Class;
1713  pWnd->hModule = Cs->hInstance;
1714  pWnd->style = Cs->style & ~WS_VISIBLE;
1715  pWnd->ExStyle = Cs->dwExStyle;
1716  pWnd->cbwndExtra = pWnd->pcls->cbwndExtra;
1717  pWnd->pActCtx = acbiBuffer;
1718  pWnd->InternalPos.MaxPos.x = pWnd->InternalPos.MaxPos.y = -1;
1719  pWnd->InternalPos.IconPos.x = pWnd->InternalPos.IconPos.y = -1;
1720 
1721  if (pWnd->spwndParent != NULL && Cs->hwndParent != 0)
1722  {
1723  pWnd->HideFocus = pWnd->spwndParent->HideFocus;
1724  pWnd->HideAccel = pWnd->spwndParent->HideAccel;
1725  }
1726 
1727  pWnd->head.pti->cWindows++;
1728 
1729  if (Class->spicn && !Class->spicnSm)
1730  {
1731  HICON IconSmHandle = NULL;
1732  if((Class->spicn->CURSORF_flags & (CURSORF_LRSHARED | CURSORF_FROMRESOURCE))
1734  {
1735  IconSmHandle = co_IntCopyImage(
1736  UserHMGetHandle(Class->spicn),
1737  IMAGE_ICON,
1741  }
1742  if (!IconSmHandle)
1743  {
1744  /* Retry without copying from resource */
1745  IconSmHandle = co_IntCopyImage(
1746  UserHMGetHandle(Class->spicn),
1747  IMAGE_ICON,
1750  0);
1751  }
1752 
1753  if (IconSmHandle)
1754  {
1755  Class->spicnSm = UserGetCurIconObject(IconSmHandle);
1756  Class->CSF_flags |= CSF_CACHEDSMICON;
1757  }
1758  }
1759 
1760  if (pWnd->pcls->CSF_flags & CSF_SERVERSIDEPROC)
1762 
1763  /* BugBoy Comments: Comment below say that System classes are always created
1764  as UNICODE. In windows, creating a window with the ANSI version of CreateWindow
1765  sets the window to ansi as verified by testing with IsUnicodeWindow API.
1766 
1767  No where can I see in code or through testing does the window change back
1768  to ANSI after being created as UNICODE in ROS. I didnt do more testing to
1769  see what problems this would cause. */
1770 
1771  // Set WndProc from Class.
1772  pWnd->lpfnWndProc = pWnd->pcls->lpfnWndProc;
1773 
1774  // GetWindowProc, test for non server side default classes and set WndProc.
1775  if ( pWnd->pcls->fnid <= FNID_GHOST && pWnd->pcls->fnid >= FNID_BUTTON )
1776  {
1777  if (bUnicodeWindow)
1778  {
1779  if (GETPFNCLIENTA(pWnd->pcls->fnid) == pWnd->lpfnWndProc)
1780  pWnd->lpfnWndProc = GETPFNCLIENTW(pWnd->pcls->fnid);
1781  }
1782  else
1783  {
1784  if (GETPFNCLIENTW(pWnd->pcls->fnid) == pWnd->lpfnWndProc)
1785  pWnd->lpfnWndProc = GETPFNCLIENTA(pWnd->pcls->fnid);
1786  }
1787  }
1788 
1789  // If not an Unicode caller, set Ansi creator bit.
1790  if (!bUnicodeWindow) pWnd->state |= WNDS_ANSICREATOR;
1791 
1792  // Clone Class Ansi/Unicode proc type.
1793  if (pWnd->pcls->CSF_flags & CSF_ANSIPROC)
1794  {
1795  pWnd->state |= WNDS_ANSIWINDOWPROC;
1796  pWnd->Unicode = FALSE;
1797  }
1798  else
1799  { /*
1800  * It seems there can be both an Ansi creator and Unicode Class Window
1801  * WndProc, unless the following overriding conditions occur:
1802  */
1803  if ( !bUnicodeWindow &&
1804  ( Class->atomClassName == gpsi->atomSysClass[ICLS_BUTTON] ||
1805  Class->atomClassName == gpsi->atomSysClass[ICLS_COMBOBOX] ||
1806  Class->atomClassName == gpsi->atomSysClass[ICLS_COMBOLBOX] ||
1807  Class->atomClassName == gpsi->atomSysClass[ICLS_DIALOG] ||
1808  Class->atomClassName == gpsi->atomSysClass[ICLS_EDIT] ||
1809  Class->atomClassName == gpsi->atomSysClass[ICLS_IME] ||
1810  Class->atomClassName == gpsi->atomSysClass[ICLS_LISTBOX] ||
1811  Class->atomClassName == gpsi->atomSysClass[ICLS_MDICLIENT] ||
1812  Class->atomClassName == gpsi->atomSysClass[ICLS_STATIC] ) )
1813  { // Override Class and set the window Ansi WndProc.
1814  pWnd->state |= WNDS_ANSIWINDOWPROC;
1815  pWnd->Unicode = FALSE;
1816  }
1817  else
1818  { // Set the window Unicode WndProc.
1819  pWnd->state &= ~WNDS_ANSIWINDOWPROC;
1820  pWnd->Unicode = TRUE;
1821  }
1822  }
1823 
1824  /* BugBoy Comments: if the window being created is a edit control, ATOM 0xCxxx,
1825  then my testing shows that windows (2k and XP) creates a CallProc for it immediately
1826  Dont understand why it does this. */
1827  if (Class->atomClassName == gpsi->atomSysClass[ICLS_EDIT])
1828  {
1829  PCALLPROCDATA CallProc;
1830  CallProc = CreateCallProc(pWnd->head.rpdesk, pWnd->lpfnWndProc, pWnd->Unicode , pWnd->head.pti->ppi);
1831 
1832  if (!CallProc)
1833  {
1835  ERR("Warning: Unable to create CallProc for edit control. Control may not operate correctly! hwnd %p\n", hWnd);
1836  }
1837  else
1838  {
1839  UserAddCallProcToClass(pWnd->pcls, CallProc);
1840  }
1841  }
1842 
1844  pWnd->PropListItems = 0;
1845 
1846  if ( WindowName->Buffer != NULL && WindowName->Length > 0 )
1847  {
1848  pWnd->strName.Buffer = DesktopHeapAlloc(pWnd->head.rpdesk,
1849  WindowName->Length + sizeof(UNICODE_NULL));
1850  if (pWnd->strName.Buffer == NULL)
1851  {
1852  goto AllocError;
1853  }
1854 
1855  RtlCopyMemory(pWnd->strName.Buffer, WindowName->Buffer, WindowName->Length);
1856  pWnd->strName.Buffer[WindowName->Length / sizeof(WCHAR)] = L'\0';
1857  pWnd->strName.Length = WindowName->Length;
1858  pWnd->strName.MaximumLength = WindowName->Length + sizeof(UNICODE_NULL);
1859  }
1860 
1861  /* Correct the window style. */
1862  if ((pWnd->style & (WS_CHILD | WS_POPUP)) != WS_CHILD)
1863  {
1864  pWnd->style |= WS_CLIPSIBLINGS;
1865  if (!(pWnd->style & WS_POPUP))
1866  {
1867  pWnd->style |= WS_CAPTION;
1868  }
1869  }
1870 
1871  /* WS_EX_WINDOWEDGE depends on some other styles */
1872  if (pWnd->ExStyle & WS_EX_DLGMODALFRAME)
1873  pWnd->ExStyle |= WS_EX_WINDOWEDGE;
1874  else if (pWnd->style & (WS_DLGFRAME | WS_THICKFRAME))
1875  {
1876  if (!((pWnd->ExStyle & WS_EX_STATICEDGE) &&
1877  (pWnd->style & (WS_CHILD | WS_POPUP))))
1878  pWnd->ExStyle |= WS_EX_WINDOWEDGE;
1879  }
1880  else
1881  pWnd->ExStyle &= ~WS_EX_WINDOWEDGE;
1882 
1883  if (!(pWnd->style & (WS_CHILD | WS_POPUP)))
1884  pWnd->state |= WNDS_SENDSIZEMOVEMSGS;
1885 
1886  /* Set the window menu */
1887  if ((Cs->style & (WS_CHILD | WS_POPUP)) != WS_CHILD)
1888  {
1889  if (Cs->hMenu)
1890  {
1891  IntSetMenu(pWnd, Cs->hMenu, &MenuChanged);
1892  }
1893  else if (pWnd->pcls->lpszMenuName) // Take it from the parent.
1894  {
1895  UNICODE_STRING MenuName;
1896  HMENU hMenu;
1897 
1898  if (IS_INTRESOURCE(pWnd->pcls->lpszMenuName))
1899  {
1900  MenuName.Length = 0;
1901  MenuName.MaximumLength = 0;
1902  MenuName.Buffer = pWnd->pcls->lpszMenuName;
1903  }
1904  else
1905  {
1906  RtlInitUnicodeString( &MenuName, pWnd->pcls->lpszMenuName);
1907  }
1908  hMenu = co_IntCallLoadMenu( pWnd->pcls->hModule, &MenuName);
1909  if (hMenu) IntSetMenu(pWnd, hMenu, &MenuChanged);
1910  }
1911  }
1912  else // Not a child
1913  pWnd->IDMenu = (UINT_PTR)Cs->hMenu;
1914 
1915 
1916  if ( ParentWindow &&
1917  ParentWindow != ParentWindow->head.rpdesk->spwndMessage &&
1918  ParentWindow != ParentWindow->head.rpdesk->pDeskInfo->spwnd )
1919  {
1920  PWND Owner = IntGetNonChildAncestor(ParentWindow);
1921 
1922  if (!IntValidateOwnerDepth(pWnd, Owner))
1923  {
1925  goto Error;
1926  }
1927  if ( pWnd->spwndOwner &&
1928  pWnd->spwndOwner->ExStyle & WS_EX_TOPMOST )
1929  {
1930  pWnd->ExStyle |= WS_EX_TOPMOST;
1931  }
1932  if ( pWnd->spwndOwner &&
1933  Class->atomClassName != gpsi->atomSysClass[ICLS_IME] &&
1934  pti != pWnd->spwndOwner->head.pti)
1935  {
1936  //ERR("CreateWindow Owner in.\n");
1937  UserAttachThreadInput(pti, pWnd->spwndOwner->head.pti, TRUE);
1938  }
1939  }
1940 
1941  /* Insert the window into the thread's window list. */
1943 
1944  /* Handle "CS_CLASSDC", it is tested first. */
1945  if ( (pWnd->pcls->style & CS_CLASSDC) && !(pWnd->pcls->pdce) )
1946  { /* One DCE per class to have CLASS. */
1947  pWnd->pcls->pdce = DceAllocDCE( pWnd, DCE_CLASS_DC );
1948  }
1949  else if ( pWnd->pcls->style & CS_OWNDC)
1950  { /* Allocate a DCE for this window. */
1951  DceAllocDCE(pWnd, DCE_WINDOW_DC);
1952  }
1953 
1954  return pWnd;
1955 
1956 AllocError:
1957  ERR("IntCreateWindow Allocation Error.\n");
1959 Error:
1960  if(pWnd)
1961  UserDereferenceObject(pWnd);
1962  return NULL;
1963 }
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
static const WCHAR Class[]
Definition: cfgmgr.c:39
unsigned __int3264 UINT_PTR
Definition: activex.cpp:275
#define WS_THICKFRAME
Definition: pedump.c:630
#define WS_EX_WINDOWEDGE
Definition: winuser.h:407
DWORD ExStyle
Definition: ntuser.h:668
static HICON
Definition: imagelist.c:84
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
UINT HideFocus
Definition: ntuser.h:722
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define IMAGE_ICON
Definition: winuser.h:212
#define ICLS_MDICLIENT
Definition: ntuser.h:879
LIST_ENTRY ThreadListEntry
Definition: ntuser.h:728
struct _DESKTOP * rpdesk
Definition: ntuser.h:189
#define LAYOUT_RTL
Definition: wingdi.h:1370
ULONG PropListItems
Definition: ntuser.h:688
NTSTATUS FASTCALL UserAttachThreadInput(PTHREADINFO ptiFrom, PTHREADINFO ptiTo, BOOL fAttach)
Definition: input.c:479
PCURICON_OBJECT FASTCALL UserGetCurIconObject(HCURSOR hCurIcon)
Definition: cursoricon.c:200
USHORT MaximumLength
Definition: env_spec_w32.h:370
PVOID Buffer
Definition: ntuser.h:97
#define GETPFNCLIENTW(fnid)
Definition: ntuser.h:867
#define CURSORF_FROMRESOURCE
Definition: ntuser.h:1148
LIST_ENTRY WindowListHead
Definition: win32.h:149
HINSTANCE hModule
Definition: ntuser.h:672
WNDPROC lpfnWndProc
Definition: ntuser.h:682
BOOL FASTCALL IntValidateOwnerDepth(PWND Wnd, PWND Owner)
Definition: window.c:339
HINSTANCE hModule
Definition: ntuser.h:552
#define WINVER_WIN2K
Definition: window.h:55
#define ICLS_EDIT
Definition: ntuser.h:874
LIST_ENTRY PropListHead
Definition: ntuser.h:687
HWND hWnd
Definition: settings.c:17
struct _WND::@4137 InternalPos
#define WS_EX_LAYOUTRTL
Definition: winuser.h:390
struct _WND WND
#define WS_DLGFRAME
Definition: pedump.c:626
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define SM_CYSMICON
Definition: winuser.h:1003
BOOL FASTCALL UserDereferenceObject(PVOID Object)
Definition: object.c:610
#define WNDS_SENDSIZEMOVEMSGS
Definition: ntuser.h:577
#define WS_CHILD
Definition: pedump.c:617
#define CS_OWNDC
Definition: winuser.h:650
#define InsertTailList(ListHead, Entry)
struct _DESKTOP * rpdesk
Definition: win32.h:91
PSERVERINFO gpsi
Definition: main.c:27
#define WINVER_WINNT4
Definition: window.h:56
#define ICLS_DIALOG
Definition: ntuser.h:891
PVOID FASTCALL UserCreateObject(PUSER_HANDLE_TABLE ht, PDESKTOP pDesktop, PTHREADINFO pti, HANDLE *h, HANDLE_TYPE type, ULONG size)
Definition: object.c:535
DWORD dwLayout
Definition: win32.h:270
struct _THREADINFO * GetW32ThreadInfo(VOID)
Definition: misc.c:781
PPROCESSINFO ppi
Definition: win32.h:87
PCALLPROCDATA CreateCallProc(IN PDESKTOP Desktop, IN WNDPROC WndProc, IN BOOL Unicode, IN PPROCESSINFO pi)
Definition: callproc.c:29
WNDPROC lpfnWndProc
Definition: ntuser.h:549
PTHREADINFO gptiDesktopThread
Definition: desktop.c:37
ULONG cbwndExtra
Definition: ntuser.h:702
#define ICLS_LISTBOX
Definition: ntuser.h:876
DWORD CSF_flags
Definition: ntuser.h:541
#define CSF_CACHEDSMICON
Definition: ntuser.h:530
UINT style
Definition: ntuser.h:548
static __inline PVOID DesktopHeapAlloc(IN PDESKTOP Desktop, IN SIZE_T Bytes)
Definition: desktop.h:230
#define UNICODE_NULL
DWORD fnid
Definition: ntuser.h:673
unsigned int BOOL
Definition: ntddk_ex.h:94
#define CURSORF_LRSHARED
Definition: ntuser.h:1150
HMENU APIENTRY co_IntCallLoadMenu(HINSTANCE hModule, PUNICODE_STRING pMenuName)
Definition: callback.c:889
#define FNID_DIALOG
Definition: ntuser.h:831
struct _WND * spwndOwner
Definition: ntuser.h:679
THRDESKHEAD head
Definition: ntuser.h:659
smooth NULL
Definition: ftsmooth.c:416
#define WS_EX_DLGMODALFRAME
Definition: pedump.c:645
PVOID pdce
Definition: ntuser.h:540
LARGE_UNICODE_STRING strName
Definition: ntuser.h:700
#define ICLS_STATIC
Definition: ntuser.h:875
UINT HideAccel
Definition: ntuser.h:723
HANDLE FASTCALL co_IntCopyImage(HANDLE hnd, UINT type, INT desiredx, INT desiredy, UINT flags)
Definition: callback.c:974
LONG NTAPI UserGetSystemMetrics(ULONG Index)
Definition: metric.c:180
HINSTANCE hInstance
Definition: winuser.h:2930
#define UserHMGetHandle(obj)
Definition: ntuser.h:208
#define WS_CAPTION
Definition: pedump.c:624
UINT_PTR IDMenu
Definition: ntuser.h:695
#define TRACE(s)
Definition: solgame.cpp:4
#define IS_INTRESOURCE(i)
Definition: winuser.h:580
if(!(yy_init))
Definition: macro.lex.yy.c:714
__wchar_t WCHAR
Definition: xmlstorage.h:180
ULONG Length
Definition: ntuser.h:94
DWORD fnid
Definition: ntuser.h:538
#define WS_EX_NOINHERITLAYOUT
Definition: winuser.h:396
BOOL Error
Definition: chkdsk.c:66
#define SM_CXSMICON
Definition: winuser.h:1002
#define CSF_SERVERSIDEPROC
Definition: ntuser.h:524
#define WNDS2_WIN50COMPAT
Definition: ntuser.h:619
static const WCHAR L[]
Definition: oid.c:1250
#define ICLS_IME
Definition: ntuser.h:888
PVOID *typedef PHANDLE
Definition: ntsecpkg.h:414
#define GETPFNCLIENTA(fnid)
Definition: ntuser.h:865
#define WS_EX_TOPMOST
Definition: pedump.c:647
#define CSF_ANSIPROC
Definition: ntuser.h:525
#define ICLS_COMBOLBOX
Definition: ntuser.h:880
VOID FASTCALL SetLastNtError(NTSTATUS Status)
Definition: error.c:36
INT cbwndExtra
Definition: ntuser.h:551
VOID UserAddCallProcToClass(IN OUT PCLS Class, IN PCALLPROCDATA CallProc)
Definition: class.c:400
PWSTR lpszMenuName
Definition: ntuser.h:556
#define CS_CLASSDC
Definition: winuser.h:645
#define WS_EX_SETANSICREATOR
Definition: undocuser.h:28
#define ERR(fmt,...)
Definition: debug.h:109
Definition: ntuser.h:657
#define FNID_GHOST
Definition: ntuser.h:837
#define LR_COPYFROMRESOURCE
Definition: winuser.h:1089
struct _WND * PWND
struct _WND * spwndLastActive
Definition: ntuser.h:703
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
#define WNDS_ANSIWINDOWPROC
Definition: ntuser.h:592
#define FNID_BUTTON
Definition: ntuser.h:828
DWORD state
Definition: ntuser.h:665
#define WNDS2_WIN31COMPAT
Definition: ntuser.h:617
#define WS_POPUP
Definition: pedump.c:616
_Out_writes_bytes_to_opt_ AbsoluteSecurityDescriptorSize PSECURITY_DESCRIPTOR _Inout_ PULONG _Out_writes_bytes_to_opt_ DaclSize PACL _Inout_ PULONG _Out_writes_bytes_to_opt_ SaclSize PACL _Inout_ PULONG _Out_writes_bytes_to_opt_ OwnerSize PSID Owner
Definition: rtlfuncs.h:1557
#define WINVER_WIN31
Definition: window.h:57
PWND FASTCALL IntGetNonChildAncestor(PWND pWnd)
Definition: window.c:323
struct _WND * spwndParent
Definition: ntuser.h:677
DWORD state2
Definition: ntuser.h:666
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define ICLS_BUTTON
Definition: ntuser.h:873
PVOID pActCtx
Definition: ntuser.h:706
#define WNDS2_WIN40COMPAT
Definition: ntuser.h:618
PDCE FASTCALL DceAllocDCE(PWND Window, DCE_TYPE Type)
Definition: windc.c:85
#define WS_VISIBLE
Definition: pedump.c:620
PUSER_HANDLE_TABLE gHandleTable
Definition: object.c:13
#define WNDS_ANSICREATOR
Definition: ntuser.h:602
BOOL FASTCALL IntSetMenu(PWND Wnd, HMENU Menu, BOOL *Changed)
Definition: menu.c:5456
#define WNDS_SERVERSIDEWINDOWPROC
Definition: ntuser.h:591
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
#define WS_EX_STATICEDGE
Definition: winuser.h:403
UINT Unicode
Definition: ntuser.h:720
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27
ATOM atomSysClass[ICLS_NOTUSED+1]
Definition: ntuser.h:1013
PCLS pcls
Definition: ntuser.h:684
DWORD style
Definition: ntuser.h:670
#define ICLS_COMBOBOX
Definition: ntuser.h:878

Referenced by co_UserCreateWindowEx(), and IntCreateDesktop().

◆ IntDefWindowProc()

LRESULT FASTCALL IntDefWindowProc ( PWND  Window,
UINT  Msg,
WPARAM  wParam,
LPARAM  lParam,
BOOL  Ansi 
)

Definition at line 532 of file defwnd.c.

538 {
540  LRESULT lResult = 0;
542  BOOL IsTaskBar;
543  DWORD Style;
544  DWORD ExStyle;
545 
546  if (Msg > WM_USER) return 0;
547 
548  switch (Msg)
549  {
550  case WM_GETTEXTLENGTH:
551  {
552  PWSTR buf;
553  ULONG len;
554 
555  if (Wnd != NULL && Wnd->strName.Length != 0)
556  {
557  buf = Wnd->strName.Buffer;
558  if (buf != NULL &&
560  buf,
561  Wnd->strName.Length)))
562  {
563  lResult = (LRESULT) (Wnd->strName.Length / sizeof(WCHAR));
564  }
565  }
566  else lResult = 0L;
567 
568  break;
569  }
570 
571  case WM_GETTEXT: // FIXME: Handle Ansi
572  {
573  PWSTR buf = NULL;
574  PWSTR outbuf = (PWSTR)lParam;
575 
576  if (Wnd != NULL && wParam != 0)
577  {
578  if (Wnd->strName.Buffer != NULL)
579  buf = Wnd->strName.Buffer;
580  else
581  outbuf[0] = L'\0';
582 
583  if (buf != NULL)
584  {
585  if (Wnd->strName.Length != 0)
586  {
587  lResult = min(Wnd->strName.Length / sizeof(WCHAR), wParam - 1);
588  RtlCopyMemory(outbuf,
589  buf,
590  lResult * sizeof(WCHAR));
591  outbuf[lResult] = L'\0';
592  }
593  else
594  outbuf[0] = L'\0';
595  }
596  }
597  break;
598  }
599 
600  case WM_SETTEXT: // FIXME: Handle Ansi
601  {
602  DefSetText(Wnd, (PCWSTR)lParam);
603 
604  if ((Wnd->style & WS_CAPTION) == WS_CAPTION)
606  IntNotifyWinEvent(EVENT_OBJECT_NAMECHANGE, Wnd, OBJID_WINDOW, CHILDID_SELF, 0);
607  lResult = 1;
608  break;
609  }
610 
611  case WM_SYSCOMMAND:
612  {
613  TRACE("hwnd %p WM_SYSCOMMAND %lx %lx\n", Wnd->head.h, wParam, lParam );
614  lResult = DefWndHandleSysCommand(Wnd, wParam, lParam);
615  break;
616  }
617 
618  case WM_SHOWWINDOW:
619  {
620  if ((Wnd->style & WS_VISIBLE) && wParam) break;
621  if (!(Wnd->style & WS_VISIBLE) && !wParam) break;
622  if (!Wnd->spwndOwner) break;
623  if (LOWORD(lParam))
624  {
626  }
627  break;
628  }
629 
630  case WM_CLIENTSHUTDOWN:
631  return IntClientShutdown(Wnd, wParam, lParam);
632 
633  case WM_APPCOMMAND:
634  if ( (Wnd->style & (WS_POPUP|WS_CHILD)) != WS_CHILD &&
635  Wnd != co_GetDesktopWindow(Wnd) )
636  {
637  if (!co_HOOK_CallHooks(WH_SHELL, HSHELL_APPCOMMAND, wParam, lParam))
638  co_IntShellHookNotify(HSHELL_APPCOMMAND, wParam, lParam);
639  break;
640  }
641  UserRefObjectCo(Wnd->spwndParent, &Ref);
642  lResult = co_IntSendMessage(UserHMGetHandle(Wnd->spwndParent), WM_APPCOMMAND, wParam, lParam);
643  UserDerefObjectCo(Wnd->spwndParent);
644  break;
645 
646  case WM_KEYF1:
647  {
648  HELPINFO hi;
649  HMENU hMenu = UlongToHandle(Wnd->IDMenu);
650  PWND pwndActive = MENU_IsMenuActive();
651  hi.cbSize = sizeof(HELPINFO);
652  hi.MousePos = gpsi->ptCursor;
654  hi.hItemHandle = pwndActive ? UserHMGetHandle(pwndActive) : UserHMGetHandle(Wnd);
655  hi.iCtrlId = (Wnd->style & (WS_POPUP|WS_CHILD)) == WS_CHILD ? IntMenuItemFromPoint(Wnd, hMenu, hi.MousePos) : 0;
657 
658  co_IntSendMessage( UserHMGetHandle(Wnd), WM_HELP, 0, (LPARAM)&hi );
659  break;
660  }
661 
662  case WM_SETICON:
663  {
664  return DefWndSetIcon(Wnd, wParam, lParam);
665  }
666 
667  case WM_GETICON:
668  {
669  return DefWndGetIcon(Wnd, wParam, lParam);
670  }
671 
672  case WM_HELP:
673  {
674  PWND Parent = IntGetParent(Wnd);
676  break;
677  }
678 
679  case WM_LBUTTONDOWN:
680  case WM_RBUTTONDOWN:
681  case WM_MBUTTONDOWN:
682  pti->MessageQueue->QF_flags &= ~(QF_FMENUSTATUS|QF_FMENUSTATUSBREAK);
683  break;
684 
685  case WM_NCLBUTTONDOWN:
686  return NC_HandleNCLButtonDown(Wnd, wParam, lParam);
687 
688  case WM_NCRBUTTONDOWN:
689  return NC_HandleNCRButtonDown(Wnd, wParam, lParam);
690 
691  case WM_LBUTTONDBLCLK:
693 
694  case WM_NCLBUTTONDBLCLK:
695  return NC_HandleNCLButtonDblClk(Wnd, wParam, lParam);
696 
697  case WM_RBUTTONUP:
698  {
699  POINT Pt;
700 
701  Pt.x = GET_X_LPARAM(lParam);
702  Pt.y = GET_Y_LPARAM(lParam);
703  IntClientToScreen(Wnd, &Pt);
704  lParam = MAKELPARAM(Pt.x, Pt.y);
706  break;
707  }
708 
709  case WM_NCRBUTTONUP:
710  /*
711  * FIXME : we must NOT send WM_CONTEXTMENU on a WM_NCRBUTTONUP (checked
712  * in Windows), but what _should_ we do? According to MSDN :
713  * "If it is appropriate to do so, the system sends the WM_SYSCOMMAND
714  * message to the window". When is it appropriate?
715  */
716  ERR("WM_NCRBUTTONUP\n");
717  break;
718 
719  case WM_XBUTTONUP:
720  case WM_NCXBUTTONUP:
721  if (HIWORD(wParam) == XBUTTON1 || HIWORD(wParam) == XBUTTON2)
722  {
724  MAKELPARAM(LOWORD(wParam), FAPPCOMMAND_MOUSE | HIWORD(wParam)));
725  }
726  break;
727 
728 
729  case WM_CONTEXTMENU:
730  {
731  if (Wnd->style & WS_CHILD)
732  {
734  }
735  else
736  {
737  POINT Pt;
738  LONG_PTR Style;
739  LONG HitCode;
740 
741  Style = Wnd->style;
742 
743  Pt.x = GET_X_LPARAM(lParam);
744  Pt.y = GET_Y_LPARAM(lParam);
745  if (Style & WS_CHILD)
746  {
747  IntScreenToClient(IntGetParent(Wnd), &Pt);
748  }
749 
750  HitCode = GetNCHitEx(Wnd, Pt);
751 
752  if (HitCode == HTCAPTION || HitCode == HTSYSMENU)
753  {
754  PMENU SystemMenu;
755  UINT Flags;
756 
757  if((SystemMenu = IntGetSystemMenu(Wnd, FALSE)))
758  {
759  MENU_InitSysMenuPopup(SystemMenu, Wnd->style, Wnd->pcls->style, HitCode);
760 
761  if(HitCode == HTCAPTION)
763  else
765 
766  IntTrackPopupMenuEx(SystemMenu, Flags|TPM_SYSTEM_MENU, Pt.x, Pt.y, Wnd, NULL);
767  }
768  }
769  if (HitCode == HTHSCROLL || HitCode == HTVSCROLL)
770  {
771  WARN("Scroll Menu Not Supported\n");
772  }
773  }
774  break;
775  }
776 
777  case WM_KEYDOWN:
778  if (wParam == VK_F10)
779  {
780  pti->MessageQueue->QF_flags |= QF_FF10STATUS;
781 
782  if (UserGetKeyState(VK_SHIFT) & 0x8000)
783  {
785  }
786  }
788  {
789  HWND hwndTop = UserGetForegroundWindow();
790  PWND topWnd = UserGetWindowObject(hwndTop);
791 
792  /* Test for typical TaskBar ExStyle Values */
793  ExStyle = (topWnd->ExStyle & WS_EX_TOOLWINDOW);
794  TRACE("ExStyle is '%x'.\n", ExStyle);
795 
796  /* Test for typical TaskBar Style Values */
797  Style = (topWnd->style & (WS_POPUP | WS_VISIBLE |
799  TRACE("Style is '%x'.\n", Style);
800 
801  /* Test for masked typical TaskBar Style and ExStyles to detect TaskBar */
802  IsTaskBar = (Style == (WS_POPUP | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN))
803  && (ExStyle == WS_EX_TOOLWINDOW);
804  TRACE("This %s the TaskBar.\n", IsTaskBar ? "is" : "is not");
805 
806  if (topWnd && !IsTaskBar) /* Second test is so we are not touching the Taskbar */
807  {
808  if ((topWnd->style & WS_THICKFRAME) == 0)
809  {
810  return 0;
811  }
812 
813  if (wParam == VK_DOWN)
814  {
815  if (topWnd->style & WS_MAXIMIZE)
817  else
819  }
820  else if (wParam == VK_UP)
821  {
822  RECT currentRect;
823  if ((topWnd->InternalPos.NormalRect.right == topWnd->InternalPos.NormalRect.left) ||
824  (topWnd->InternalPos.NormalRect.top == topWnd->InternalPos.NormalRect.bottom))
825  {
826  currentRect = topWnd->rcWindow;
827  }
828  else
829  {
830  currentRect = topWnd->InternalPos.NormalRect;
831  }
833 
834  // save normal rect if maximazing snapped window
835  topWnd->InternalPos.NormalRect = currentRect;
836  }
837  else if (wParam == VK_LEFT || wParam == VK_RIGHT)
838  {
839  RECT snapRect, normalRect, windowRect;
840  BOOL snapped;
841  normalRect = topWnd->InternalPos.NormalRect;
842  snapped = (normalRect.left != 0 && normalRect.right != 0 &&
843  normalRect.top != 0 && normalRect.bottom != 0);
844 
845  if (topWnd->style & WS_MAXIMIZE)
846  {
848  snapped = FALSE;
849  }
850  windowRect = topWnd->rcWindow;
851 
852  UserSystemParametersInfo(SPI_GETWORKAREA, 0, &snapRect, 0);
853  if (wParam == VK_LEFT)
854  {
855  snapRect.right = (snapRect.left + snapRect.right) / 2;
856  }
857  else // VK_RIGHT
858  {
859  snapRect.left = (snapRect.left + snapRect.right) / 2;
860  }
861 
862  if (snapped)
863  {
864  // if window was snapped but moved to other location - restore normal size
865  if (!IntEqualRect(&snapRect, &windowRect))
866  {
867  RECT empty = {0, 0, 0, 0};
868  co_WinPosSetWindowPos(topWnd,
869  0,
870  normalRect.left,
871  normalRect.top,
872  normalRect.right - normalRect.left,
873  normalRect.bottom - normalRect.top,
874  0);
875  topWnd->InternalPos.NormalRect = empty;
876  }
877  }
878  else
879  {
880  co_WinPosSetWindowPos(topWnd,
881  0,
882  snapRect.left,
883  snapRect.top,
884  snapRect.right - snapRect.left,
885  snapRect.bottom - snapRect.top,
886  0);
887  topWnd->InternalPos.NormalRect = windowRect;
888  }
889  }
890  }
891  }
892  break;
893 
894  case WM_SYSKEYDOWN:
895  {
896  if (HIWORD(lParam) & KF_ALTDOWN)
897  { /* Previous state, if the key was down before this message,
898  this is a cheap way to ignore autorepeat keys. */
899  if ( !(HIWORD(lParam) & KF_REPEAT) )
900  {
901  if ( ( wParam == VK_MENU ||
902  wParam == VK_LMENU ||
903  wParam == VK_RMENU ) && !(pti->MessageQueue->QF_flags & QF_FMENUSTATUS)) //iMenuSysKey )
904  pti->MessageQueue->QF_flags |= QF_FMENUSTATUS; //iMenuSysKey = 1;
905  else
906  pti->MessageQueue->QF_flags &= ~QF_FMENUSTATUS; //iMenuSysKey = 0;
907  }
908 
909  pti->MessageQueue->QF_flags &= ~QF_FF10STATUS; //iF10Key = 0;
910 
911  if (wParam == VK_F4) /* Try to close the window */
912  {
914  if (!(top->style & CS_NOCLOSE))
916  }
917  else if (wParam == VK_SNAPSHOT) // Alt-VK_SNAPSHOT?
918  {
919  PWND pwnd = Wnd;
920  while (IntGetParent(pwnd) != NULL)
921  {
922  pwnd = IntGetParent(pwnd);
923  }
924  ERR("DefWndScreenshot\n");
925  DefWndScreenshot(pwnd);
926  }
927  else if ( wParam == VK_ESCAPE || wParam == VK_TAB ) // Alt-Tab/ESC Alt-Shift-Tab/ESC
928  {
929  WPARAM wParamTmp;
930  HWND Active = UserGetActiveWindow(); // Noticed MDI problem.
931  if (!Active)
932  {
933  FIXME("WM_SYSKEYDOWN VK_ESCAPE no active\n");
934  break;
935  }
936  wParamTmp = UserGetKeyState(VK_SHIFT) & 0x8000 ? SC_PREVWINDOW : SC_NEXTWINDOW;
938  }
939  }
940  else if( wParam == VK_F10 )
941  {
942  if (UserGetKeyState(VK_SHIFT) & 0x8000)
944  pti->MessageQueue->QF_flags |= QF_FF10STATUS; //iF10Key = 1;
945  }
946  else if( wParam == VK_ESCAPE && (UserGetKeyState(VK_SHIFT) & 0x8000))
948  break;
949  }
950 
951  case WM_KEYUP:
952  case WM_SYSKEYUP:
953  {
954  /* Press and release F10 or ALT */
955  if (((wParam == VK_MENU || wParam == VK_LMENU || wParam == VK_RMENU)
956  && (pti->MessageQueue->QF_flags & (QF_FMENUSTATUS|QF_FMENUSTATUSBREAK)) == QF_FMENUSTATUS /*iMenuSysKey*/) ||
957  ((wParam == VK_F10) && pti->MessageQueue->QF_flags & QF_FF10STATUS /*iF10Key*/))
959  pti->MessageQueue->QF_flags &= ~(QF_FMENUSTATUS|QF_FMENUSTATUSBREAK|QF_FF10STATUS); //iMenuSysKey = iF10Key = 0;
960  break;
961  }
962 
963  case WM_SYSCHAR:
964  {
965  pti->MessageQueue->QF_flags &= ~(QF_FMENUSTATUS|QF_FMENUSTATUSBREAK); //iMenuSysKey = 0;
966  if (wParam == VK_RETURN && (Wnd->style & WS_MINIMIZE) != 0)
967  {
969  break;
970  }
971  if ((HIWORD(lParam) & KF_ALTDOWN) && wParam)
972  {
973  if (wParam == VK_TAB || wParam == VK_ESCAPE) break;
974  if (wParam == VK_SPACE && Wnd->style & WS_CHILD)
976  else
978  }
979  else /* check for Ctrl-Esc */
980  if (wParam != VK_ESCAPE) UserPostMessage(hwndSAS, WM_LOGONNOTIFY, LN_MESSAGE_BEEP, 0); //MessageBeep(0);
981  break;
982  }
983 
984  case WM_CANCELMODE:
985  {
986  pti->MessageQueue->QF_flags &= ~(QF_FMENUSTATUS|QF_FMENUSTATUSBREAK);
987 
988  MENU_EndMenu( Wnd );
989  if (IntGetCaptureWindow() == UserHMGetHandle(Wnd))
990  {
992  }
993  break;
994  }
995 
996  case WM_CLOSE:
998  break;
999 
1000  case WM_CTLCOLORMSGBOX:
1001  case WM_CTLCOLOREDIT:
1002  case WM_CTLCOLORLISTBOX:
1003  case WM_CTLCOLORBTN:
1004  case WM_CTLCOLORDLG:
1005  case WM_CTLCOLORSTATIC:
1006  case WM_CTLCOLORSCROLLBAR:
1008 
1009  case WM_CTLCOLOR:
1011 
1012  case WM_SETCURSOR:
1013  {
1014  if (Wnd->style & WS_CHILD)
1015  {
1016  /* with the exception of the border around a resizable wnd,
1017  * give the parent first chance to set the cursor */
1019  {
1020  PWND parent = Wnd->spwndParent;//IntGetParent( Wnd );
1021  if (parent != UserGetDesktopWindow() &&
1023  return TRUE;
1024  }
1025  }
1026  return DefWndHandleSetCursor(Wnd, wParam, lParam);
1027  }
1028 
1029  case WM_MOUSEACTIVATE:
1030  if (Wnd->style & WS_CHILD)
1031  {
1032  LONG Ret;
1033  HWND hwndParent;
1034  PWND pwndParent = IntGetParent(Wnd);
1035  hwndParent = pwndParent ? UserHMGetHandle(pwndParent) : NULL;
1037  if (Ret) return (Ret);
1038  }
1040 
1041  case WM_ACTIVATE:
1042  /* The default action in Windows is to set the keyboard focus to
1043  * the window, if it's being activated and not minimized */
1044  if (LOWORD(wParam) != WA_INACTIVE &&
1045  !(Wnd->style & WS_MINIMIZE))
1046  {
1047  //ERR("WM_ACTIVATE %p\n",hWnd);
1048  co_UserSetFocus(Wnd);
1049  }
1050  break;
1051 
1052  case WM_MOUSEWHEEL:
1053  if (Wnd->style & WS_CHILD)
1054  {
1055  HWND hwndParent;
1056  PWND pwndParent = IntGetParent(Wnd);
1057  hwndParent = pwndParent ? UserHMGetHandle(pwndParent) : NULL;
1059  }
1060  break;
1061 
1062  case WM_ERASEBKGND:
1063  case WM_ICONERASEBKGND:
1064  {
1065  RECT Rect;
1066  HBRUSH hBrush = Wnd->pcls->hbrBackground;
1067  if (!hBrush) return 0;
1068  if (hBrush <= (HBRUSH)COLOR_MENUBAR)
1069  {
1070  hBrush = IntGetSysColorBrush(HandleToUlong(hBrush));
1071  }
1072  if (Wnd->pcls->style & CS_PARENTDC)
1073  {
1074  /* can't use GetClipBox with a parent DC or we fill the whole parent */
1075  IntGetClientRect(Wnd, &Rect);
1076  GreDPtoLP((HDC)wParam, (LPPOINT)&Rect, 2);
1077  }
1078  else
1079  {
1080  GdiGetClipBox((HDC)wParam, &Rect);
1081  }
1082  FillRect((HDC)wParam, &Rect, hBrush);
1083  return (1);
1084  }
1085 
1086  case WM_GETHOTKEY:
1087  //ERR("WM_GETHOTKEY\n");
1088  return DefWndGetHotKey(Wnd);
1089  case WM_SETHOTKEY:
1090  //ERR("WM_SETHOTKEY\n");
1091  return DefWndSetHotKey(Wnd, wParam);
1092 
1093  case WM_NCHITTEST:
1094  {
1095  POINT Point;
1098  return GetNCHitEx(Wnd, Point);
1099  }
1100 
1101  case WM_PRINT:
1102  {
1103  DefWndPrint(Wnd, (HDC)wParam, lParam);
1104  return (0);
1105  }
1106 
1107  case WM_SYSCOLORCHANGE:
1108  {
1109  /* force to redraw non-client area */
1110  UserPaintCaption(Wnd, DC_NC);
1111  /* Use InvalidateRect to redraw client area, enable
1112  * erase to redraw all subcontrols otherwise send the
1113  * WM_SYSCOLORCHANGE to child windows/controls is required
1114  */
1116  return (0);
1117  }
1118 
1119  case WM_PAINTICON:
1120  case WM_PAINT:
1121  {
1122  PAINTSTRUCT Ps;
1123  HDC hDC;
1124 
1125  /* If already in Paint and Client area is not empty just return. */
1126  if (Wnd->state2 & WNDS2_STARTPAINT && !RECTL_bIsEmptyRect(&Wnd->rcClient))
1127  {
1128  ERR("In Paint and Client area is not empty!\n");
1129  return 0;
1130  }
1131 
1132  hDC = IntBeginPaint(Wnd, &Ps);
1133  if (hDC)
1134  {
1135  if (((Wnd->style & WS_MINIMIZE) != 0) && (Wnd->pcls->spicn))
1136  {
1137  RECT ClientRect;
1138  INT x, y;
1139 
1140  ERR("Doing Paint and Client area is empty!\n");
1141  IntGetClientRect(Wnd, &ClientRect);
1142  x = (ClientRect.right - ClientRect.left - UserGetSystemMetrics(SM_CXICON)) / 2;
1143  y = (ClientRect.bottom - ClientRect.top - UserGetSystemMetrics(SM_CYICON)) / 2;
1144  UserReferenceObject(Wnd->pcls->spicn);
1145  UserDrawIconEx(hDC, x, y, Wnd->pcls->spicn, 0, 0, 0, 0, DI_NORMAL | DI_COMPAT | DI_DEFAULTSIZE);
1146  UserDereferenceObject(Wnd->pcls->spicn);
1147  }
1148 
1149  IntEndPaint(Wnd, &Ps);
1150  }
1151  return (0);
1152  }
1153 
1154  case WM_SYNCPAINT:
1155  {
1156  HRGN hRgn;
1157  Wnd->state &= ~WNDS_SYNCPAINTPENDING;
1158  TRACE("WM_SYNCPAINT\n");
1159  hRgn = NtGdiCreateRectRgn(0, 0, 0, 0);
1160  if (hRgn)
1161  {
1162  if (co_UserGetUpdateRgn(Wnd, hRgn, FALSE) != NULLREGION)
1163  {
1164  PREGION pRgn = REGION_LockRgn(hRgn);
1165  if (pRgn) REGION_UnlockRgn(pRgn);
1166  if (!wParam)
1168  co_UserRedrawWindow(Wnd, NULL, pRgn, wParam);
1169  }
1171  }
1172  return 0;
1173  }
1174 
1175  case WM_SETREDRAW:
1176  if (wParam)
1177  {
1178  if (!(Wnd->style & WS_VISIBLE))
1179  {
1180  IntSetStyle( Wnd, WS_VISIBLE, 0 );
1181  Wnd->state |= WNDS_SENDNCPAINT;
1182  }
1183  }
1184  else
1185  {
1186  if (Wnd->style & WS_VISIBLE)
1187  {
1189  IntSetStyle( Wnd, 0, WS_VISIBLE );
1190  }
1191  }
1192  return 0;
1193 
1194  case WM_WINDOWPOSCHANGING:
1195  {
1197  }
1198 
1199  case WM_WINDOWPOSCHANGED:
1200  {
1202  }
1203 
1204  case WM_NCCALCSIZE:
1205  {
1206  return NC_HandleNCCalcSize( Wnd, wParam, (RECTL *)lParam, FALSE );
1207  }
1208 
1209  case WM_NCACTIVATE:
1210  {
1211  return NC_HandleNCActivate( Wnd, wParam, lParam );
1212  }
1213 
1214  //
1215  // NC Paint mode.
1216  //
1217  case WM_NCPAINT:
1218  {
1220  Wnd->state |= WNDS_FORCEMENUDRAW;
1221  NC_DoNCPaint(Wnd, hDC, -1);
1222  Wnd->state &= ~WNDS_FORCEMENUDRAW;
1223  UserReleaseDC(Wnd, hDC, FALSE);
1224  return 0;
1225  }
1226  //
1227  // Draw Caption mode.
1228  //
1229  // wParam are DC_* flags.
1230  //
1231  case WM_NCUAHDRAWCAPTION:
1232  {
1234  TRACE("WM_NCUAHDRAWCAPTION: wParam DC_ flags %08x\n",wParam);
1235  UserDrawCaptionBar(Wnd, hDC, wParam | DC_FRAME); // Include DC_FRAME to comp for drawing glitch.
1236  UserReleaseDC(Wnd, hDC, FALSE);
1237  return 0;
1238  }
1239  //
1240  // Draw Frame mode.
1241  //
1242  // wParam is HDC, lParam are DC_ACTIVE and or DC_REDRAWHUNGWND.
1243  //
1244  case WM_NCUAHDRAWFRAME:
1245  {
1246  TRACE("WM_NCUAHDRAWFRAME: wParam hDC %p lParam DC_ flags %08x\n",wParam,lParam);
1248  return 0;
1249  }
1250 
1251  /* ReactOS only. */
1252  case WM_CBT:
1253  {
1254  switch (wParam)
1255  {
1256  case HCBT_MOVESIZE:
1257  {
1258  RECTL rt;
1259 
1260  if (lParam)
1261  {
1262  _SEH2_TRY
1263  {
1265  sizeof(RECT),
1266  1);
1267 
1268  RtlCopyMemory(&rt,
1269  (PVOID)lParam,
1270  sizeof(RECT));
1271  }
1273  {
1274  lResult = 1;
1275  }
1276  _SEH2_END;
1277  }
1278  if (!lResult)
1279  lResult = co_HOOK_CallHooks(WH_CBT, HCBT_MOVESIZE, (WPARAM)Wnd->head.h, lParam ? (LPARAM)&rt : 0);
1280  }
1281  break;
1282  }
1283  break;
1284  }
1285  break;
1286  }
1287  return lResult;
1288 }
BYTE gafAsyncKeyState[256 *2/8]
Definition: keyboard.c:13
#define WM_NCLBUTTONDOWN
Definition: winuser.h:1674
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
#define WM_SYNCPAINT
Definition: winuser.h:1672
#define WM_GETTEXTLENGTH
Definition: winuser.h:1601
#define GA_ROOT
Definition: winuser.h:2764
__kernel_entry W32KAPI HRGN APIENTRY NtGdiCreateRectRgn(_In_ INT xLeft, _In_ INT yTop, _In_ INT xRight, _In_ INT yBottom)
#define WS_THICKFRAME
Definition: pedump.c:630
#define WM_SETHOTKEY
Definition: winuser.h:1634
#define HTLEFT
Definition: winuser.h:2462
const uint16_t * PCWSTR
Definition: typedefs.h:55
#define WM_PAINTICON
Definition: winuser.h:1623
BOOL FASTCALL UserPostMessage(HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1181
#define WM_SYSCOLORCHANGE
Definition: winuser.h:1608
void FASTCALL MENU_InitSysMenuPopup(PMENU menu, DWORD style, DWORD clsStyle, LONG HitTest)
Definition: menu.c:1362
DWORD ExStyle
Definition: ntuser.h:668
#define HTHSCROLL
Definition: winuser.h:2456
BOOL UserDrawIconEx(HDC hDc, INT xLeft, INT yTop, PCURICON_OBJECT pIcon, INT cxWidth, INT cyHeight, UINT istepIfAniCur, HBRUSH hbrFlickerFreeDraw, UINT diFlags)
Definition: cursoricon.c:1688
BOOL NTAPI GreDeleteObject(HGDIOBJ hobj)
Definition: gdiobj.c:1155
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
#define SC_KEYMENU
Definition: winuser.h:2571
#define SC_RESTORE
Definition: winuser.h:2573
#define SW_SHOWNOACTIVATE
Definition: winuser.h:768
long y
Definition: polytest.cpp:48
BOOL FASTCALL IntClientToScreen(PWND Wnd, LPPOINT lpPoint)
Definition: winpos.c:198
#define WM_CONTEXTMENU
Definition: richedit.h:64
#define WM_LBUTTONDOWN
Definition: winuser.h:1758
HWND FASTCALL co_UserSetFocus(PWND Window)
Definition: focus.c:1196
HGDIOBJ FASTCALL IntGetSysColorBrush(INT Object)
Definition: stockobj.c:317
long x
Definition: polytest.cpp:48
#define TPM_SYSTEM_MENU
Definition: undocuser.h:71
BOOL FASTCALL IntReleaseCapture(VOID)
Definition: focus.c:1412
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define WM_CTLCOLORDLG
Definition: winuser.h:1752
#define WM_GETHOTKEY
Definition: winuser.h:1635
#define SW_HIDE
Definition: winuser.h:762
HWND FASTCALL UserGetActiveWindow(VOID)
Definition: focus.c:1311
#define VK_RMENU
Definition: winuser.h:2262
uint16_t * PWSTR
Definition: typedefs.h:54
#define WM_CLIENTSHUTDOWN
Definition: undocuser.h:35
#define WM_MOUSEWHEEL
Definition: treelist.c:96
#define WM_NCCALCSIZE
Definition: winuser.h:1667
#define WM_CTLCOLORSTATIC
Definition: winuser.h:1754
#define WNDS_SENDNCPAINT
Definition: ntuser.h:584
#define WM_GETTEXT
Definition: winuser.h:1600
VOID FASTCALL IntNotifyWinEvent(DWORD Event, PWND pWnd, LONG idObject, LONG idChild, DWORD flags)
Definition: event.c:179
LRESULT FASTCALL DefWndHandleSysCommand(PWND pWnd, WPARAM wParam, LPARAM lParam)
Definition: defwnd.c:124
#define WARN(fmt,...)
Definition: debug.h:111
#define MAKELPARAM(l, h)
Definition: winuser.h:3947
DWORD_PTR dwContextId
Definition: winuser.h:3290
PVOID NTAPI PsGetCurrentThreadWin32Thread(VOID)
Definition: thread.c:805
BOOLEAN FASTCALL co_WinPosSetWindowPos(PWND Window, HWND WndInsertAfter, INT x, INT y, INT cx, INT cy, UINT flags)
Definition: winpos.c:1720
NTSYSAPI NTSTATUS NTAPI RtlUnicodeToMultiByteSize(PULONG MbSize, PCWCH UnicodeString, ULONG UnicodeSize)
struct @1591 Msg[]
#define HandleToUlong(h)
Definition: basetsd.h:79
static HDC
Definition: imagelist.c:92
HANDLE hItemHandle
Definition: winuser.h:3289
#define WM_SETREDRAW
Definition: winuser.h:1598
#define OBJID_WINDOW
Definition: winable.h:15
struct _WND::@4137 InternalPos
#define NULLREGION
Definition: wingdi.h:360
#define WH_SHELL
Definition: winuser.h:40
LONG top
Definition: windef.h:292
static __inline VOID UserRefObjectCo(PVOID obj, PUSER_REFERENCE_ENTRY UserReferenceEntry)
Definition: object.h:25
#define DI_COMPAT
Definition: wingdi.h:68
#define GET_X_LPARAM(lp)
Definition: windowsx.h:274
static HRGN hRgn
Definition: mapping.c:33
#define CS_NOCLOSE
Definition: winuser.h:649
#define DCX_USESTYLE
Definition: GetDCEx.c:10
#define MA_ACTIVATE
Definition: winuser.h:2476
#define VK_LEFT
Definition: winuser.h:2199
#define WM_SHOWWINDOW
Definition: winuser.h:1610
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define WM_NCRBUTTONDOWN
Definition: winuser.h:1677
HDC FASTCALL UserGetDCEx(PWND Window OPTIONAL, HANDLE ClipRegion, ULONG Flags)
#define WM_CTLCOLOR
Definition: windowsx.h:4
BOOL WINAPI IntTrackPopupMenuEx(PMENU menu, UINT wFlags, int x, int y, PWND pWnd, LPTPMPARAMS lpTpm)
Definition: menu.c:4558
BOOL FASTCALL UserDereferenceObject(PVOID Object)
Definition: object.c:610
#define WM_NCHITTEST
Definition: winuser.h:1668
UINT_PTR WPARAM
Definition: windef.h:207
#define VK_LWIN
Definition: winuser.h:2210
#define VK_TAB
Definition: winuser.h:2174
#define VK_DOWN
Definition: winuser.h:2202
#define WS_CHILD
Definition: pedump.c:617
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn BOOLEAN Physical UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER void *Data ACPI_OBJECT_HANDLER void **Data ACPI_STRING ACPI_OBJECT_LIST ACPI_BUFFER *ReturnObjectBuffer ACPI_DEVICE_INFO **ReturnBuffer ACPI_HANDLE Parent
Definition: acpixf.h:722
#define VK_MENU
Definition: winuser.h:2179
#define RDW_FRAME
Definition: winuser.h:1198
LONG left
Definition: windef.h:291
VOID FASTCALL IntGetClientRect(PWND WindowObject, RECTL *Rect)
Definition: winpos.c:91
HWND FASTCALL IntGetCaptureWindow(VOID)
Definition: focus.c:32
#define WNDS2_STARTPAINT
Definition: ntuser.h:611
#define VK_ESCAPE
Definition: winuser.h:2189
#define WS_CLIPCHILDREN
Definition: pedump.c:619
LONG right
Definition: windef.h:293
#define WM_CTLCOLORLISTBOX
Definition: winuser.h:1750
PREGION FASTCALL REGION_LockRgn(_In_ HRGN hrgn)
Definition: region.c:2377
#define WS_EX_TOOLWINDOW
Definition: winuser.h:404
LRESULT FASTCALL DefWndHandleWindowPosChanging(PWND pWnd, WINDOWPOS *Pos)
Definition: defwnd.c:69
LRESULT FASTCALL DefWndGetIcon(PWND pWnd, WPARAM wParam, LPARAM lParam)
Definition: defwnd.c:472
int32_t INT
Definition: typedefs.h:56
PSERVERINFO gpsi
Definition: main.c:27
#define VK_RETURN
Definition: winuser.h:2176
WPARAM wParam
Definition: combotst.c:138
#define DCX_INTERSECTRGN
Definition: winuser.h:2104
#define DCX_WINDOW
Definition: winuser.h:2095
LRESULT DefWndHandleSetCursor(PWND pWnd, WPARAM wParam, LPARAM lParam)
Definition: defwnd.c:242
#define QF_FF10STATUS
Definition: msgqueue.h:98
DWORD FASTCALL UserGetKeyState(DWORD dwKey)
Definition: msgqueue.c:221
#define QF_FMENUSTATUS
Definition: msgqueue.h:97
_SEH2_TRY
Definition: create.c:4250
#define VK_F10
Definition: winuser.h:2239
#define WM_NCPAINT
Definition: winuser.h:1669
#define TPM_RIGHTBUTTON
Definition: winuser.h:2355
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
#define WM_CTLCOLORBTN
Definition: winuser.h:1751
#define HTSYSMENU
Definition: winuser.h:2452
#define VK_UP
Definition: winuser.h:2200
#define DC_NC
Definition: winuser.h:440
#define WM_NCACTIVATE
Definition: winuser.h:1670
#define WS_MINIMIZE
Definition: pedump.c:622
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
BOOLEAN co_UserDestroyWindow(PVOID Object)
Definition: window.c:2644
static __inline VOID UserDerefObjectCo(PVOID obj)
Definition: object.h:38
#define WM_NCRBUTTONUP
Definition: winuser.h:1678
#define WM_SETCURSOR
Definition: winuser.h:1618
BOOL FASTCALL GreDPtoLP(HDC, LPPOINT, INT)
Definition: dcutil.c:7
#define FIXME(fmt,...)
Definition: debug.h:110
#define WM_CTLCOLORSCROLLBAR
Definition: winuser.h:1753
#define WM_SYSCHAR
Definition: winuser.h:1703
#define SM_CXICON
Definition: winuser.h:962
#define VK_F4
Definition: winuser.h:2233
#define CHILDID_SELF
Definition: winable.h:14
#define SC_MAXIMIZE
Definition: winuser.h:2563
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
LRESULT NC_DoNCPaint(PWND pWnd, HDC hDC, INT Flags)
Definition: nonclient.c:1042
#define VK_SHIFT
Definition: winuser.h:2177
Definition: object.h:3
#define DCX_KEEPCLIPRGN
Definition: undocuser.h:66
smooth NULL
Definition: ftsmooth.c:416
#define WM_ICONERASEBKGND
Definition: winuser.h:1624
HBRUSH FASTCALL DefWndControlColor(HDC hDC, UINT ctlType)
Definition: defwnd.c:33
static HWND hwndParent
Definition: cryptui.c:300
LRESULT FASTCALL DefWndHandleWindowPosChanged(PWND pWnd, WINDOWPOS *Pos)
Definition: defwnd.c:95
#define WM_KEYDOWN
Definition: winuser.h:1697
#define WM_CTLCOLORMSGBOX
Definition: winuser.h:1748
LONG_PTR LPARAM
Definition: windef.h:208
INT FASTCALL co_UserGetUpdateRgn(PWND Window, HRGN hRgn, BOOL bErase)
Definition: painting.c:1770
PWND FASTCALL co_GetDesktopWindow(PWND pWnd)
Definition: desktop.c:1330
#define WH_CBT
Definition: winuser.h:35
#define DI_DEFAULTSIZE
Definition: wingdi.h:69
POINT MousePos
Definition: winuser.h:3291
Definition: region.h:7
#define WM_MOUSEACTIVATE
Definition: winuser.h:1619
Definition: sacdrv.h:287
#define WM_SETTEXT
Definition: winuser.h:1599
VOID FASTCALL DefWndScreenshot(PWND pWnd)
Definition: defwnd.c:496
PWND FASTCALL UserGetWindowObject(HWND hWnd)
Definition: window.c:103
HWND FASTCALL UserGetForegroundWindow(VOID)
Definition: focus.c:1303
#define WM_RBUTTONDOWN
Definition: winuser.h:1761
int iContextType
Definition: winuser.h:3287
void MENU_EndMenu(PWND pwnd)
Definition: menu.c:2662
DWORD FASTCALL IntGetWindowContextHelpId(PWND pWnd)
Definition: window.c:410
LONG NTAPI UserGetSystemMetrics(ULONG Index)
Definition: metric.c:180
#define WM_APPCOMMAND
Definition: winuser.h:1864
BOOLEAN FASTCALL co_WinPosShowWindow(PWND Wnd, INT Cmd)
Definition: winpos.c:2464
HWND hwndSAS
Definition: winsta.c:24
#define UserHMGetHandle(obj)
Definition: ntuser.h:208
#define KF_REPEAT
Definition: winuser.h:2425
#define WS_CAPTION
Definition: pedump.c:624
struct tagHELPINFO HELPINFO
BOOL FASTCALL DefSetText(HWND hWnd, PCWSTR String, BOOL Ansi)
Definition: defwnd.c:64
VOID FASTCALL DefWndPrint(PWND pwnd, HDC hdc, ULONG uFlags)
Definition: defwnd.c:363
#define TRACE(s)
Definition: solgame.cpp:4
const DWORD Style
Definition: appswitch.c:71
r parent
Definition: btrfs.c:2869
PMENU FASTCALL IntGetSystemMenu(PWND Window, BOOL bRevert)
Definition: menu.c:5380
__wchar_t WCHAR
Definition: xmlstorage.h:180
PWND MENU_IsMenuActive(VOID)
Definition: menu.c:2650
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define RDW_ERASE
Definition: winuser.h:1197
#define UlongToHandle(ul)
Definition: basetsd.h:97
#define WM_NCUAHDRAWCAPTION
Definition: undocuser.h:45
#define DC_FRAME
Definition: undocuser.h:147
#define WM_WINDOWPOSCHANGING
Definition: winuser.h:1643
#define WM_CLOSE
Definition: winuser.h:1603
#define WM_KEYUP
Definition: winuser.h:1698
unsigned long DWORD
Definition: ntddk_ex.h:95
HDC FASTCALL IntBeginPaint(PWND Window, PPAINTSTRUCT Ps)
Definition: painting.c:1422
#define HELPINFO_MENUITEM
Definition: winuser.h:1157
#define WM_RBUTTONUP
Definition: winuser.h:1762
#define WM_PRINT
Definition: winuser.h:1862
#define SC_PREVWINDOW
Definition: winuser.h:2566
#define WM_PAINT
Definition: winuser.h:1602
UINT FASTCALL DefWndGetHotKey(PWND pWnd)
Definition: hotkey.c:313
LRESULT APIENTRY co_HOOK_CallHooks(INT HookId, INT Code, WPARAM wParam, LPARAM lParam)
Definition: hook.c:1103
PWND FASTCALL UserGetDesktopWindow(VOID)
Definition: desktop.c:1349
#define RDW_VALIDATE
Definition: winuser.h:1204
LRESULT NC_HandleNCCalcSize(PWND Wnd, WPARAM wparam, RECTL *Rect, BOOL Suspended)
Definition: nonclient.c:1248
struct Point Point
#define SM_CYICON
Definition: winuser.h:963
#define WNDS_SYNCPAINTPENDING
Definition: ntuser.h:596
VOID NTAPI ProbeForRead(IN CONST VOID *Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:102
static const WCHAR L[]
Definition: oid.c:1250
LRESULT FASTCALL co_IntSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1281
#define VK_LMENU
Definition: winuser.h:2261
#define WM_CANCELMODE
Definition: winuser.h:1617
#define DI_NORMAL
Definition: wingdi.h:72
GLenum GLsizei len
Definition: glext.h:6722
#define WM_LBUTTONDBLCLK
Definition: winuser.h:1760
#define LRESULT
Definition: ole.h:14
BOOL FASTCALL IntScreenToClient(PWND Wnd, LPPOINT lpPoint)
Definition: winpos.c:212
RECT rcWindow
Definition: ntuser.h:680
UINT cbSize
Definition: winuser.h:3286
#define WM_LOGONNOTIFY
Definition: undocuser.h:37
#define MA_NOACTIVATE
Definition: winuser.h:2478
#define HTBOTTOMRIGHT
Definition: winuser.h:2470
#define VK_RWIN
Definition: winuser.h:2211
#define WM_USER
Definition: winuser.h:1877
PWND FASTCALL UserGetAncestor(PWND Wnd, UINT Type)
Definition: window.c:3144
#define VK_RIGHT
Definition: winuser.h:2201
#define SC_MINIMIZE
Definition: winuser.h:2561
#define ERR(fmt,...)
Definition: debug.h:109
#define HTCAPTION
Definition: winuser.h:2451
Definition: ntuser.h:657
struct _USER_MESSAGE_QUEUE * MessageQueue
Definition: win32.h:88
LRESULT NC_HandleNCLButtonDblClk(PWND pWnd, WPARAM wParam, LPARAM lParam)
Definition: nonclient.c:1610
static HDC hDC
Definition: 3dtext.c:33
VOID UserDrawCaptionBar(PWND pWnd, HDC hDC, INT Flags)
Definition: nonclient.c:900
_SEH2_END
Definition: create.c:4424
INT FASTCALL DefWndSetHotKey(PWND pWnd, WPARAM wParam)
Definition: hotkey.c:340
#define WM_ACTIVATE
Definition: winuser.h:1594
BOOL FASTCALL co_UserRedrawWindow(PWND Window, const RECTL *UpdateRect, PREGION UpdateRgn, ULONG Flags)
Definition: painting.c:876
#define RDW_ALLCHILDREN
Definition: winuser.h:1207
#define WM_SYSKEYUP
Definition: winuser.h:1702
LRESULT FASTCALL DefWndSetIcon(PWND pWnd, WPARAM wParam, LPARAM lParam)
Definition: defwnd.c:434
#define WM_CTLCOLOREDIT
Definition: winuser.h:1749
FORCEINLINE BOOL IntEqualRect(RECTL *lprc1, RECTL *lprc2)
Definition: winpos.h:48
#define WM_MBUTTONDOWN
Definition: winuser.h:1764
PWND FASTCALL IntGetParent(PWND Wnd)
Definition: window.c:185
int iCtrlId
Definition: winuser.h:3288
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
LRESULT NC_HandleNCRButtonDown(PWND pwnd, WPARAM wParam, LPARAM lParam)
Definition: nonclient.c:1668
#define min(a, b)
Definition: monoChain.cc:55
#define WS_POPUP
Definition: pedump.c:616
BOOL FASTCALL IntEndPaint(PWND Wnd, PPAINTSTRUCT Ps)
Definition: painting.c:1518
unsigned int UINT
Definition: ndis.h:50
BOOL UserPaintCaption(PWND pWnd, INT Flags)
Definition: defwnd.c:396
#define VK_SPACE
Definition: winuser.h:2194
BOOL empty
Definition: button.c:170
INT FASTCALL UserReleaseDC(PWND Window, HDC hDc, BOOL EndPaint)
Definition: windc.c:917
VOID co_IntShellHookNotify(WPARAM Message, WPARAM wParam, LPARAM lParam)
Definition: desktop.c:1656
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
#define KF_ALTDOWN
Definition: winuser.h:2424
#define GET_Y_LPARAM(lp)
Definition: windowsx.h:275
#define HTVSCROLL
Definition: winuser.h:2457
#define WM_WINDOWPOSCHANGED
Definition: winuser.h:1644
INT FASTCALL IntMenuItemFromPoint(PWND pWnd, HMENU hMenu, POINT ptScreen)
Definition: menu.c:1518
VOID FASTCALL REGION_UnlockRgn(_In_ PREGION prgn)
Definition: region.c:2392
#define RDW_ERASENOW
Definition: winuser.h:1205
#define SC_CLOSE
Definition: winuser.h:2567
#define WM_NCUAHDRAWFRAME
Definition: undocuser.h:46
#define HCBT_MOVESIZE
Definition: winuser.h:55
#define WM_SYSKEYDOWN
Definition: winuser.h:1701
#define TPM_LEFTBUTTON
Definition: winuser.h:2354
ULONG FASTCALL IntSetStyle(PWND pwnd, ULONG set_bits, ULONG clear_bits)
Definition: window.c:124
#define HIWORD(l)
Definition: typedefs.h:246
FORCEINLINE BOOL RECTL_bIsEmptyRect(_In_ const RECTL *prcl)
Definition: rect.h:44
unsigned int ULONG
Definition: retypes.h:1
LONG bottom
Definition: windef.h:294
#define IS_KEY_DOWN(ks, vk)
Definition: input.h:98
#define WNDS_FORCEMENUDRAW
Definition: ntuser.h:588
#define WA_INACTIVE
Definition: winuser.h:2597
BOOL FASTCALL UserSystemParametersInfo(UINT uiAction, UINT uiParam, PVOID pvParam, UINT fWinIni)
Definition: sysparams.c:2066
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define SC_NEXTWINDOW
Definition: winuser.h:2565
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859
#define WM_ERASEBKGND
Definition: winuser.h:1607
#define LN_MESSAGE_BEEP
Definition: undocuser.h:118
LRESULT NC_HandleNCLButtonDown(PWND pWnd, WPARAM wParam, LPARAM lParam)
Definition: nonclient.c:1519
#define HTCLIENT
Definition: winuser.h:2450
DWORD FASTCALL GetNCHitEx(PWND pWnd, POINT pt)
Definition: nonclient.c:1927
LONG_PTR LRESULT
Definition: windef.h:209
LRESULT NC_HandleNCActivate(PWND Wnd, WPARAM wParam, LPARAM lParam)
Definition: nonclient.c:1382
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
#define WS_VISIBLE
Definition: pedump.c:620
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
#define WM_SYSCOMMAND
Definition: winuser.h:1723
#define QF_FMENUSTATUSBREAK
Definition: msgqueue.h:96
LPARAM lParam
Definition: combotst.c:139
#define VK_SNAPSHOT
Definition: winuser.h:2206
#define LOWORD(l)
Definition: pedump.c:82
#define DC_TEXT
Definition: winuser.h:430
#define CS_PARENTDC
Definition: winuser.h:651
#define WM_KEYF1
Definition: msg.c:52
#define WM_CBT
Definition: undocuser.h:61
LRESULT IntClientShutdown(IN PWND pWindow, IN WPARAM wParam, IN LPARAM lParam)
Definition: shutdown.c:22
struct Rect Rect
#define RDW_INVALIDATE
Definition: winuser.h:1200
const DWORD ExStyle
Definition: appswitch.c:72
#define WM_NCLBUTTONDBLCLK
Definition: winuser.h:1676
VOID FASTCALL UserReferenceObject(PVOID obj)
Definition: object.c:697
#define WS_MAXIMIZE
Definition: pedump.c:623
DWORD style
Definition: ntuser.h:670

Referenced by GetControlColor(), NtUserMessageCall(), PopupMenuWndProc(), and UserMessageWindowProc().

◆ IntEnableWindow()

BOOL FASTCALL IntEnableWindow ( HWND  ,
BOOL   
)

Definition at line 201 of file window.c.

202 {
203  BOOL Update;
204  PWND pWnd;
205  UINT bIsDisabled;
206 
207  if(!(pWnd = UserGetWindowObject(hWnd)))
208  {
209  return FALSE;
210  }
211 
212  /* check if updating is needed */
213  bIsDisabled = !!(pWnd->style & WS_DISABLED);
214  Update = bIsDisabled;
215 
216  if (bEnable)
217  {
218  IntSetStyle( pWnd, 0, WS_DISABLED );
219  }
220  else
221  {
222  Update = !bIsDisabled;
223 
225 
226  /* Remove keyboard focus from that window if it had focus */
227  if (hWnd == IntGetThreadFocusWindow())
228  {
229  TRACE("IntEnableWindow SF NULL\n");
231  }
232  IntSetStyle( pWnd, WS_DISABLED, 0 );
233  }
234 
235  if (Update)
236  {
237  IntNotifyWinEvent(EVENT_OBJECT_STATECHANGE, pWnd, OBJID_WINDOW, CHILDID_SELF, 0);
239  }
240  // Return nonzero if it was disabled, or zero if it wasn't:
241  return bIsDisabled;
242 }
#define WS_DISABLED
Definition: pedump.c:621
HWND FASTCALL IntGetThreadFocusWindow(VOID)
Definition: focus.c:39
HWND FASTCALL co_UserSetFocus(PWND Window)
Definition: focus.c:1196
VOID FASTCALL IntNotifyWinEvent(DWORD Event, PWND pWnd, LONG idObject, LONG idChild, DWORD flags)
Definition: event.c:179
#define OBJID_WINDOW
Definition: winable.h:15
HWND hWnd
Definition: settings.c:17
#define WM_ENABLE
Definition: winuser.h:1597
unsigned int BOOL
Definition: ntddk_ex.h:94
#define CHILDID_SELF
Definition: winable.h:14
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define TRACE(s)
Definition: solgame.cpp:4
LRESULT FASTCALL co_IntSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1281
#define WM_CANCELMODE
Definition: winuser.h:1617
Definition: ntuser.h:657
_In_ BOOL bEnable
Definition: winddi.h:3426
PWND FASTCALL UserGetWindowObject(HWND hWnd)
Definition: window.c:103
unsigned int UINT
Definition: ndis.h:50
ULONG FASTCALL IntSetStyle(PWND pwnd, ULONG set_bits, ULONG clear_bits)
Definition: window.c:124
DWORD style
Definition: ntuser.h:670

Referenced by NtUserCallTwoParam(), and NtUserEnableScrollBar().

◆ IntGetClientRect()

VOID FASTCALL IntGetClientRect ( PWND  Wnd,
RECTL Rect 
)

Internal function. Returns client window rectangle relative to the upper-left corner of client area.

Note
Does not check the validity of the parameters

Definition at line 91 of file winpos.c.

92 {
93  ASSERT( Wnd );
94  ASSERT( Rect );
95  if (Wnd->style & WS_MINIMIZED)
96  {
97  Rect->left = Rect->top = 0;
100  return;
101  }
102  if (!UserIsDesktopWindow(Wnd))
103  {
104  *Rect = Wnd->rcClient;
106  }
107  else
108  {
109  Rect->left = Rect->top = 0;
110  Rect->right = Wnd->rcClient.right;
111  Rect->bottom = Wnd->rcClient.bottom;
112  /* Do this until Init bug is fixed. This sets 640x480, see InitMetrics.
113  Rect->right = UserGetSystemMetrics(SM_CXSCREEN);
114  Rect->bottom = UserGetSystemMetrics(SM_CYSCREEN);
115  */
116  }
117 }
#define UserIsDesktopWindow(pWnd)
Definition: desktop.h:220
#define SM_CXMINIMIZED
Definition: winuser.h:1010
LONG top
Definition: windef.h:292
RECT rcClient
Definition: ntuser.h:681
LONG left
Definition: windef.h:291
LONG right
Definition: windef.h:293
LONG NTAPI UserGetSystemMetrics(ULONG Index)
Definition: metric.c:180
#define WS_MINIMIZED
Definition: undocuser.h:18
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define SM_CYMINIMIZED
Definition: winuser.h:1011
FORCEINLINE VOID RECTL_vOffsetRect(_Inout_ RECTL *prcl, _In_ INT cx, _In_ INT cy)
Definition: rect.h:31
LONG bottom
Definition: windef.h:294
DWORD style
Definition: ntuser.h:670

Referenced by co_IntDrawCaret(), co_WinPosArrangeIconicWindows(), co_WinPosGetMinMaxInfo(), co_WinPosSendSizeMove(), DefWndDoSizeMove(), DefWndHandleWindowPosChanged(), IntBeginPaint(), IntCalculateThumb(), IntDefWindowProc(), IntFillWindow(), IntGetScrollBarRect(), IntScrollWindowEx(), MENU_DrawPopupMenu(), MENU_EnsureMenuItemVisible(), NC_DoNCPaint(), and WinPosFindIconPos().

◆ IntGetNonChildAncestor()

PWND FASTCALL IntGetNonChildAncestor ( PWND  )

Definition at line 323 of file window.c.

324 {
325  while(pWnd && (pWnd->style & (WS_CHILD | WS_POPUP)) == WS_CHILD)
326  pWnd = pWnd->spwndParent;
327  return pWnd;
328 }
#define WS_CHILD
Definition: pedump.c:617
#define WS_POPUP
Definition: pedump.c:616

Referenced by co_IntProcessMouseMessage(), co_IntSetActiveWindow(), and IntCreateWindow().

◆ IntGetParent()

PWND FASTCALL IntGetParent ( PWND  Wnd)

Definition at line 185 of file window.c.

186 {
187  if (Wnd->style & WS_POPUP)
188  {
189  return Wnd->spwndOwner;
190  }
191  else if (Wnd->style & WS_CHILD)
192  {
193  return Wnd->spwndParent;
194  }
195 
196  return NULL;
197 }
#define WS_CHILD
Definition: pedump.c:617
struct _WND * spwndOwner
Definition: ntuser.h:679
smooth NULL
Definition: ftsmooth.c:416
#define WS_POPUP
Definition: pedump.c:616
struct _WND * spwndParent
Definition: ntuser.h:677
DWORD style
Definition: ntuser.h:670

Referenced by co_UserDestroyWindow(), DefSetText(), DefWndDoSizeMove(), DefWndHandleWindowPosChanged(), GetControlBrush(), IntDefWindowProc(), IntGetWindowContextHelpId(), MsqSendParentNotify(), NC_DoNCPaint(), NC_GetSysPopupPos(), NtUserCallHwndLock(), NtUserDefSetText(), and UserGetAncestor().

◆ IntGetWindow()

HWND FASTCALL IntGetWindow ( HWND  ,
UINT   
)

Definition at line 353 of file window.c.

355 {
356  PWND Wnd, FoundWnd;
357  HWND Ret = NULL;
358 
359  Wnd = ValidateHwndNoErr(hWnd);
360  if (!Wnd)
361  return NULL;
362 
363  FoundWnd = NULL;
364  switch (uCmd)
365  {
366  case GW_OWNER:
367  if (Wnd->spwndOwner != NULL)
368  FoundWnd = Wnd->spwndOwner;
369  break;
370 
371  case GW_HWNDFIRST:
372  if(Wnd->spwndParent != NULL)
373  {
374  FoundWnd = Wnd->spwndParent;
375  if (FoundWnd->spwndChild != NULL)
376  FoundWnd = FoundWnd->spwndChild;
377  }
378  break;
379  case GW_HWNDNEXT:
380  if (Wnd->spwndNext != NULL)
381  FoundWnd = Wnd->spwndNext;
382  break;
383 
384  case GW_HWNDPREV:
385  if (Wnd->spwndPrev != NULL)
386  FoundWnd = Wnd->spwndPrev;
387  break;
388 
389  case GW_CHILD:
390  if (Wnd->spwndChild != NULL)
391  FoundWnd = Wnd->spwndChild;
392  break;
393 
394  case GW_HWNDLAST:
395  FoundWnd = Wnd;
396  while ( FoundWnd->spwndNext != NULL)
397  FoundWnd = FoundWnd->spwndNext;
398  break;
399 
400  default:
401  Wnd = NULL;
402  break;
403  }
404 
405  if (FoundWnd != NULL)
406  Ret = UserHMGetHandle(FoundWnd);
407  return Ret;
408 }
#define GW_HWNDNEXT
Definition: winuser.h:756
PWND FASTCALL ValidateHwndNoErr(HWND hWnd)
Definition: window.c:96
#define GW_CHILD
Definition: winuser.h:758
HWND hWnd
Definition: settings.c:17
struct _WND * spwndOwner
Definition: ntuser.h:679
smooth NULL
Definition: ftsmooth.c:416
struct _WND * spwndNext
Definition: ntuser.h:675
#define UserHMGetHandle(obj)
Definition: ntuser.h:208
#define GW_HWNDLAST
Definition: winuser.h:760
#define GW_HWNDFIRST
Definition: winuser.h:759
Definition: ntuser.h:657
#define GW_OWNER
Definition: winuser.h:761
struct _WND * spwndParent
Definition: ntuser.h:677
struct _WND * spwndChild
Definition: ntuser.h:678
#define GW_HWNDPREV
Definition: winuser.h:757
struct _WND * spwndPrev
Definition: ntuser.h:676

Referenced by WinPosFixupFlags().

◆ IntGetWindowBorderMeasures()

VOID FASTCALL IntGetWindowBorderMeasures ( PWND  WindowObject,
UINT cx,
UINT cy 
)

Definition at line 858 of file winpos.c.

859 {
860  if(HAS_DLGFRAME(Wnd->style, Wnd->ExStyle) && !(Wnd->style & WS_MINIMIZE))
861  {
864  }
865  else
866  {
867  if(HAS_THICKFRAME(Wnd->style, Wnd->ExStyle)&& !(Wnd->style & WS_MINIMIZE))
868  {
871  }
872  else if(HAS_THINFRAME(Wnd->style, Wnd->ExStyle))
873  {
876  }
877  else
878  {
879  *cx = *cy = 0;
880  }
881  }
882 }
#define SM_CYFRAME
Definition: winuser.h:986
#define SM_CXFRAME
Definition: winuser.h:984
#define WS_MINIMIZE
Definition: pedump.c:622
#define SM_CYDLGFRAME
Definition: winuser.h:958
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:581
#define HAS_THINFRAME(Style, ExStyle)
Definition: window.h:16
#define HAS_THICKFRAME(Style, ExStyle)
Definition: window.h:12
LONG NTAPI UserGetSystemMetrics(ULONG Index)
Definition: metric.c:180
#define SM_CXDLGFRAME
Definition: winuser.h:956
#define SM_CYBORDER
Definition: winuser.h:955
#define SM_CXBORDER
Definition: winuser.h:954
_Out_opt_ int * cx
Definition: commctrl.h:581
#define HAS_DLGFRAME(Style, ExStyle)
Definition: window.h:8

◆ IntIsChildWindow()

BOOL FASTCALL IntIsChildWindow ( PWND  Parent,
PWND  Child 
)

Definition at line 882 of file window.c.

883 {
885  do
886  {
887  if ( Window == NULL || (Window->style & (WS_POPUP|WS_CHILD)) != WS_CHILD )
888  return FALSE;
889 
890  Window = Window->spwndParent;
891  }
892  while(Parent != Window);
893  return TRUE;
894 }
#define TRUE
Definition: types.h:120
#define WS_CHILD
Definition: pedump.c:617
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn BOOLEAN Physical UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER void *Data ACPI_OBJECT_HANDLER void **Data ACPI_STRING ACPI_OBJECT_LIST ACPI_BUFFER *ReturnObjectBuffer ACPI_DEVICE_INFO **ReturnBuffer ACPI_HANDLE Parent
Definition: acpixf.h:722
Definition: window.c:29
smooth NULL
Definition: ftsmooth.c:416
Definition: ntuser.h:657
#define WS_POPUP
Definition: pedump.c:616
struct tagBaseWindow BaseWindow

Referenced by co_IntFixCaret(), co_IntSetParent(), DceResetActiveDCEs(), IntGetPaintMessage(), and NC_DoNCPaint().

◆ IntIsWindow()

BOOL FASTCALL IntIsWindow ( HWND  hWnd)

Definition at line 157 of file window.c.

158 {
159  PWND Window;
160 
161  if (!(Window = UserGetWindowObject(hWnd)))
162  {
163  return FALSE;
164  }
165 
166  return TRUE;
167 }
#define TRUE
Definition: types.h:120
HWND hWnd
Definition: settings.c:17
Definition: window.c:29
int Window
Definition: x11stubs.h:26
Definition: ntuser.h:657
PWND FASTCALL UserGetWindowObject(HWND hWnd)
Definition: window.c:103

Referenced by co_IntPaintWindows(), co_UserDestroyWindow(), co_UserSetFocus(), co_WinPosSetWindowPos(), DefWndDoSizeMove(), IntSendDestroyMsg(), IntTrackPopupMenuEx(), NtUserCallHwnd(), NtUserSetActiveWindow(), and NtUserSetLogonNotifyWindow().

◆ IntIsWindowVisible()

BOOL FASTCALL IntIsWindowVisible ( PWND  )

Definition at line 170 of file window.c.

171 {
172  PWND Temp = Wnd;
173  for (;;)
174  {
175  if (!Temp) return TRUE;
176  if (!(Temp->style & WS_VISIBLE)) break;
177  if (Temp->style & WS_MINIMIZE && Temp != Wnd) break;
178  if (Temp->fnid == FNID_DESKTOP) return TRUE;
179  Temp = Temp->spwndParent;
180  }
181  return FALSE;
182 }
#define TRUE
Definition: types.h:120
#define WS_MINIMIZE
Definition: pedump.c:622
DWORD fnid
Definition: ntuser.h:673
#define FNID_DESKTOP
Definition: ntuser.h:824
Definition: ntuser.h:657
struct _WND * spwndParent
Definition: ntuser.h:677
#define WS_VISIBLE
Definition: pedump.c:620
DWORD style
Definition: ntuser.h:670

Referenced by co_IntSendActivateMessages(), DefWndDoSizeMove(), DefWndPrint(), NC_DoNCPaint(), UserDrawCaptionBar(), and WinPosFixupFlags().

◆ IntLinkHwnd()

VOID FASTCALL IntLinkHwnd ( PWND  Wnd,
HWND  hWndPrev 
)

Definition at line 937 of file window.c.

938 {
939  if (hWndPrev == HWND_NOTOPMOST)
940  {
941  if (!(Wnd->ExStyle & WS_EX_TOPMOST) && (Wnd->ExStyle2 & WS_EX2_LINKED))
942  return; /* nothing to do */
943  Wnd->ExStyle &= ~WS_EX_TOPMOST;
944  hWndPrev = HWND_TOP; /* fallback to the HWND_TOP case */
945  }
946 
947  IntUnlinkWindow(Wnd); /* unlink it from the previous location */
948 
949  if (hWndPrev == HWND_BOTTOM)
950  {
951  /* Link in the bottom of the list */
952  PWND WndInsertAfter;
953 
954  WndInsertAfter = Wnd->spwndParent->spwndChild;
955  while (WndInsertAfter && WndInsertAfter->spwndNext)
956  {
957  WndInsertAfter = WndInsertAfter->spwndNext;
958  }
959 
960  IntLinkWindow(Wnd, WndInsertAfter);
961  Wnd->ExStyle &= ~WS_EX_TOPMOST;
962  }
963  else if (hWndPrev == HWND_TOPMOST)
964  {
965  /* Link in the top of the list */
966  IntLinkWindow(Wnd, NULL);
967  Wnd->ExStyle |= WS_EX_TOPMOST;
968  }
969  else if (hWndPrev == HWND_TOP)
970  {
971  /* Link it after the last topmost window */
972  PWND WndInsertBefore;
973 
974  WndInsertBefore = Wnd->spwndParent->spwndChild;
975 
976  if (!(Wnd->ExStyle & WS_EX_TOPMOST)) /* put it above the first non-topmost window */
977  {
978  while (WndInsertBefore != NULL && WndInsertBefore->spwndNext != NULL)
979  {
980  if (!(WndInsertBefore->ExStyle & WS_EX_TOPMOST))
981  break;
982 
983  if (WndInsertBefore == Wnd->spwndOwner) /* keep it above owner */
984  {
985  Wnd->ExStyle |= WS_EX_TOPMOST;
986  break;
987  }
988  WndInsertBefore = WndInsertBefore->spwndNext;
989  }
990  }
991 
992  IntLinkWindow(Wnd, WndInsertBefore ? WndInsertBefore->spwndPrev : NULL);
993  }
994  else
995  {
996  /* Link it after hWndPrev */
997  PWND WndInsertAfter;
998 
999  WndInsertAfter = UserGetWindowObject(hWndPrev);
1000  /* Are we called with an erroneous handle */
1001  if (WndInsertAfter == NULL)
1002  {
1003  /* Link in a default position */
1004  IntLinkHwnd(Wnd, HWND_TOP);
1005  return;
1006  }
1007 
1008  if (Wnd == WndInsertAfter)
1009  ERR("IntLinkHwnd -- Trying to link window 0x%p to itself!!\n", Wnd);
1010  IntLinkWindow(Wnd, WndInsertAfter);
1011 
1012  /* Fix the WS_EX_TOPMOST flag */
1013  if (!(WndInsertAfter->ExStyle & WS_EX_TOPMOST))
1014  {
1015  Wnd->ExStyle &= ~WS_EX_TOPMOST;
1016  }
1017  else
1018  {
1019  if (WndInsertAfter->spwndNext &&
1020  (WndInsertAfter->spwndNext->ExStyle & WS_EX_TOPMOST))
1021  {
1022  Wnd->ExStyle |= WS_EX_TOPMOST;
1023  }
1024  }
1025  }
1026  Wnd->ExStyle2 |= WS_EX2_LINKED;
1027 }
DWORD ExStyle
Definition: ntuser.h:668
VOID FASTCALL IntUnlinkWindow(PWND Wnd)
Definition: window.c:1306
DWORD ExStyle2
Definition: ntuser.h:709
#define WS_EX2_LINKED
Definition: ntuser.h:644
#define HWND_TOPMOST
Definition: winuser.h:1194
#define HWND_TOP
Definition: winuser.h:1193
VOID FASTCALL IntLinkHwnd(PWND Wnd, HWND hWndPrev)
Definition: window.c:937
struct _WND * spwndOwner
Definition: ntuser.h:679
smooth NULL
Definition: ftsmooth.c:416
struct _WND * spwndNext
Definition: ntuser.h:675
#define HWND_BOTTOM
Definition: winuser.h:1191
#define WS_EX_TOPMOST
Definition: pedump.c:647
#define ERR(fmt,...)
Definition: debug.h:109
Definition: ntuser.h:657
VOID FASTCALL IntLinkWindow(PWND Wnd, PWND WndInsertAfter)
Definition: window.c:899
PWND FASTCALL UserGetWindowObject(HWND hWnd)
Definition: window.c:103
struct _WND * spwndParent
Definition: ntuser.h:677
#define HWND_NOTOPMOST
Definition: winuser.h:1192
struct _WND * spwndPrev
Definition: ntuser.h:676

Referenced by co_IntSetParent(), co_UserCreateWindowEx(), co_WinPosSetWindowPos(), and IntLinkHwnd().

◆ IntMapWindowPoints()

INT FASTCALL IntMapWindowPoints ( PWND  FromWnd,
PWND  ToWnd,
LPPOINT  lpPoints,
UINT  cPoints 
)

Definition at line 143 of file winpos.c.

144 {
145  BOOL mirror_from, mirror_to;
146  POINT Delta;
147  UINT i;
148  int Change = 1;
149 
150  /* Note: Desktop Top and Left is always 0! */
151  Delta.x = Delta.y = 0;
152  mirror_from = mirror_to = FALSE;
153 
154  if (FromWnd && !UserIsDesktopWindow(FromWnd))
155  {
156  if (FromWnd->ExStyle & WS_EX_LAYOUTRTL)
157  {
158  mirror_from = TRUE;
159  Change = -Change;
160  Delta.x = -FromWnd->rcClient.right;
161  }
162  else
163  Delta.x = FromWnd->rcClient.left;
164  Delta.y = FromWnd->rcClient.top;
165  }
166 
167  if (ToWnd && !UserIsDesktopWindow(ToWnd))
168  {
169  if (ToWnd->ExStyle & WS_EX_LAYOUTRTL)
170  {
171  mirror_to = TRUE;
172  Change = -Change;
173  Delta.x += Change * ToWnd->rcClient.right;
174  }
175  else
176  Delta.x -= Change * ToWnd->rcClient.left;
177  Delta.y -= ToWnd->rcClient.top;
178  }
179 
180  for (i = 0; i != cPoints; i++)
181  {
182  lpPoints[i].x += Delta.x;
183  lpPoints[i].x *= Change;
184  lpPoints[i].y += Delta.y;
185  }
186 
187  if ((mirror_from || mirror_to) && cPoints == 2) /* special case for rectangle */
188  {
189  int tmp = min(lpPoints[0].x, lpPoints[1].x);
190  lpPoints[1].x = max(lpPoints[0].x, lpPoints[1].x);
191  lpPoints[0].x = tmp;
192  }
193 
194  return MAKELONG(LOWORD(Delta.x), LOWORD(Delta.y));
195 }
#define max(a, b)
Definition: svc.c:63
DWORD ExStyle
Definition: ntuser.h:668
#define TRUE
Definition: types.h:120
long y
Definition: polytest.cpp:48
#define UserIsDesktopWindow(pWnd)
Definition: desktop.h:220
long x
Definition: polytest.cpp:48
LONG top
Definition: windef.h:292
#define WS_EX_LAYOUTRTL
Definition: winuser.h:390
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
RECT rcClient
Definition: ntuser.h:681
LONG left
Definition: windef.h:291
LONG right
Definition: windef.h:293
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int BOOL
Definition: ntddk_ex.h:94
#define MAKELONG(a, b)
Definition: typedefs.h:248
static ULONG Delta
Definition: xboxvideo.c:32
#define min(a, b)
Definition: monoChain.cc:55
unsigned int UINT
Definition: ndis.h:50
#define LOWORD(l)
Definition: pedump.c:82

Referenced by DefWndDoSizeMove(), and DefWndHandleWindowPosChanged().

◆ IntNotifyWinEvent()

VOID FASTCALL IntNotifyWinEvent ( DWORD  ,
PWND  ,
LONG  ,
LONG  ,
DWORD   
)

Definition at line 179 of file event.c.

185 {
186  PEVENTHOOK pEH;
187  PLIST_ENTRY ListEntry;
188  PTHREADINFO pti, ptiCurrent;
190 
191  TRACE("IntNotifyWinEvent GlobalEvents = %p pWnd %p\n", GlobalEvents, pWnd);
192 
193  if (!GlobalEvents || !GlobalEvents->Counts) return;
194 
195  if (pWnd && pWnd->state & WNDS_DESTROYED) return;
196 
197  ptiCurrent = PsGetCurrentThreadWin32Thread();
198 
199  if (pWnd && flags & WEF_SETBYWNDPTI)
200  pti = pWnd->head.pti;
201  else
202  pti = ptiCurrent;
203 
204  ListEntry = GlobalEvents->Events.Flink;
205  ASSERT(ListEntry != &GlobalEvents->Events);
206  while (ListEntry != &GlobalEvents->Events)
207  {
208  pEH = CONTAINING_RECORD(ListEntry, EVENTHOOK, Chain);
209  ListEntry = ListEntry->Flink;
210 
211  // Must be inside the event window.
212  if ( Event >= pEH->eventMin && Event <= pEH->eventMax )
213  {
214  // if all process || all thread || other thread same process
215  // if ^skip own thread && ((Pid && CPid == Pid && ^skip own process) || all process)
216  if (!( (pEH->idProcess && pEH->idProcess != PtrToUint(pti->pEThread->Cid.UniqueProcess)) ||
217  (pEH->Flags & WINEVENT_SKIPOWNPROCESS && pEH->head.pti->ppi == pti->ppi) ||
218  (pEH->idThread && pEH->idThread != PtrToUint(pti->pEThread->Cid.UniqueThread)) ||
219  (pEH->Flags & WINEVENT_SKIPOWNTHREAD && pEH->head.pti == pti) ||
220  pEH->head.pti->rpdesk != ptiCurrent->rpdesk ) ) // Same as hooks.
221  {
222  UserRefObjectCo(pEH, &Ref);
223  if (pEH->Flags & WINEVENT_INCONTEXT)
224  {
225  TRACE("In Event 0x%x, idObject %d hwnd %p\n", Event, idObject, pWnd ? UserHMGetHandle(pWnd) : NULL);
227  Event,
228  pWnd ? UserHMGetHandle(pWnd) : NULL,
229  idObject,
230  idChild,
233  pEH->Proc,
234  pEH->ihmod,
235  pEH->offPfn);
236  }
237  else
238  {
239  TRACE("Out Event 0x%x, idObject %d hwnd %p\n", Event, idObject, pWnd ? UserHMGetHandle(pWnd) : NULL);
241  Event,
242  pWnd ? UserHMGetHandle(pWnd) : NULL,
243  idObject,
244  idChild,
246  }
247  UserDerefObjectCo(pEH);
248  }
249  }
250  }
251 }
#define PtrToUint(p)
Definition: basetsd.h:85
UINT Counts
Definition: hook.h:32
INT_PTR ihmod
Definition: hook.h:26
#define WINEVENT_SKIPOWNPROCESS
Definition: winable.h:34
LIST_ENTRY Events
Definition: hook.h:31
#define EngGetTickCount32()
Definition: eng.h:43
THROBJHEAD head
Definition: hook.h:17
PVOID NTAPI PsGetCurrentThreadWin32Thread(VOID)
Definition: thread.c:805
static __inline VOID UserRefObjectCo(PVOID obj, PUSER_REFERENCE_ENTRY UserReferenceEntry)
Definition: object.h:25
struct _DESKTOP * rpdesk
Definition: win32.h:91
PPROCESSINFO ppi
Definition: win32.h:87
static LRESULT FASTCALL IntCallLowLevelEvent(PEVENTHOOK pEH, DWORD event, HWND hwnd, LONG idObject, LONG idChild, LONG idThread)
Definition: event.c:98
ULONG Flags
Definition: hook.h:24
static __inline VOID UserDerefObjectCo(PVOID obj)
Definition: object.h:38
LRESULT APIENTRY co_IntCallEventProc(HWINEVENTHOOK hook, DWORD event, HWND hWnd, LONG idObject, LONG idChild, DWORD dwEventThread, DWORD dwmsEventTime, WINEVENTPROC Proc, INT Mod, ULONG_PTR offPfn)
Definition: callback.c:824
Definition: object.h:3
smooth NULL
Definition: ftsmooth.c:416
WINEVENTPROC Proc
Definition: hook.h:23
#define WEF_SETBYWNDPTI
Definition: ntuser.h:213
UINT eventMin
Definition: hook.h:19
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
#define UserHMGetHandle(obj)
Definition: ntuser.h:208
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
#define TRACE(s)
Definition: solgame.cpp:4
_Out_ PCLIENT_ID ClientId
Definition: kefuncs.h:1176
GLbitfield flags
Definition: glext.h:7161
HANDLE UniqueThread
Definition: compat.h:483
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define WINEVENT_INCONTEXT
Definition: winable.h:35
struct _THREADINFO * pti
Definition: ntuser.h:183
Definition: typedefs.h:117
DWORD idThread
Definition: hook.h:22
static PEVENTTABLE GlobalEvents
Definition: event.c:20
FORCEINLINE struct _TEB * NtCurrentTeb(VOID)
Definition: psfuncs.h:420
#define WINEVENT_SKIPOWNTHREAD
Definition: winable.h:33
ULONG_PTR offPfn
Definition: hook.h:25
#define WNDS_DESTROYED
Definition: ntuser.h:604
DWORD idProcess
Definition: hook.h:21

Referenced by co_IntDestroyCaret(), co_IntHideCaret(), co_IntProcessMouseMessage(), co_IntSetActiveWindow(), co_IntSetCaretPos(), co_IntSetParent(), co_UserCreateWindowEx(), co_UserDestroyWindow(), co_UserSetCapture(), co_UserShowCaret(), co_WinPosSetWindowPos(), co_WinPosShowWindow(), DefWndDoSizeMove(), DIALOG_CreateIndirect(), IntDefWindowProc(), IntEnableWindow(), IntSendFocusMessages(), IntSetScrollInfo(), MENU_ExitTracking(), MENU_InitTracking(), MENU_ShowPopup(), MENU_TrackMenu(), NtUserCallHwndParam(), NtUserCreateCaret(), NtUserNotifyWinEvent(), and RealDefWindowProcA().

◆ IntSetStyle()

ULONG FASTCALL IntSetStyle ( PWND  ,
ULONG  ,
ULONG   
)

Definition at line 124 of file window.c.

125 {
126  ULONG styleOld, styleNew;
127  styleOld = pwnd->style;
128  styleNew = (pwnd->style | set_bits) & ~clear_bits;
129  if (styleNew == styleOld) return styleNew;
130  pwnd->style = styleNew;
131  if ((styleOld ^ styleNew) & WS_VISIBLE) // State Change.
132  {
133  if (styleOld & WS_VISIBLE) pwnd->head.pti->cVisWindows--;
134  if (styleNew & WS_VISIBLE) pwnd->head.pti->cVisWindows++;
135  DceResetActiveDCEs( pwnd );
136  }
137  return styleOld;
138 }
VOID FASTCALL DceResetActiveDCEs(PWND Window)
Definition: windc.c:815
unsigned int ULONG
Definition: retypes.h:1
#define WS_VISIBLE
Definition: pedump.c:620

Referenced by co_UserCreateWindowEx(), co_UserShowScrollBar(), co_WinPosMinMaximize(), co_WinPosShowWindow(), IntDefWindowProc(), and IntEnableWindow().

◆ IntShowOwnedPopups()

BOOL FASTCALL IntShowOwnedPopups ( PWND  owner,
BOOL  fShow 
)

Definition at line 4442 of file window.c.

4443 {
4444  int count = 0;
4445  PWND pWnd;
4446  HWND *win_array;
4447 
4448 // ASSERT(OwnerWnd);
4449 
4450  TRACE("Enter ShowOwnedPopups Show: %s\n", (fShow ? "TRUE" : "FALSE"));
4451 
4452  /* NOTE: Popups are not children */
4453  win_array = IntWinListOwnedPopups(OwnerWnd);
4454 
4455  if (!win_array)
4456  return TRUE;
4457 
4458  while (win_array[count])
4459  count++;
4460  while (--count >= 0)
4461  {
4462  if (!(pWnd = ValidateHwndNoErr( win_array[count] )))
4463  continue;
4464  if (pWnd->spwndOwner != OwnerWnd)
4465  continue;
4466 
4467  if (fShow)
4468  {
4469  if (pWnd->state & WNDS_HIDDENPOPUP)
4470  {
4471  /* In Windows, ShowOwnedPopups(TRUE) generates
4472  * WM_SHOWWINDOW messages with SW_PARENTOPENING,
4473  * regardless of the state of the owner
4474  */
4476  pWnd->state &= ~WNDS_HIDDENPOPUP;
4477  continue;
4478  }
4479  }
4480  else
4481  {
4482  if (pWnd->style & WS_VISIBLE)
4483  {
4484  /* In Windows, ShowOwnedPopups(FALSE) generates
4485  * WM_SHOWWINDOW messages with SW_PARENTCLOSING,
4486  * regardless of the state of the owner
4487  */
4489  pWnd->state |= WNDS_HIDDENPOPUP;
4490  continue;
4491  }
4492  }
4493  }
4495  TRACE("Leave ShowOwnedPopups\n");
4496  return TRUE;
4497 }
#define TRUE
Definition: types.h:120
PWND FASTCALL ValidateHwndNoErr(HWND hWnd)
Definition: window.c:96
#define SW_HIDE
Definition: winuser.h:762
GLuint GLuint GLsizei count
Definition: gl.h:1545
HWND *FASTCALL IntWinListOwnedPopups(PWND Window)
Definition: window.c:287
#define WM_SHOWWINDOW
Definition: winuser.h:1610
#define SW_PARENTCLOSING
Definition: winuser.h:2417
struct _WND * spwndOwner
Definition: ntuser.h:679
#define TRACE(s)
Definition: solgame.cpp:4
LRESULT FASTCALL co_IntSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1281
Definition: ntuser.h:657
#define SW_SHOWNORMAL
Definition: winuser.h:764
DWORD state
Definition: ntuser.h:665
#define WNDS_HIDDENPOPUP
Definition: ntuser.h:587
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
#define USERTAG_WINDOWLIST
Definition: tags.h:297
#define WS_VISIBLE
Definition: pedump.c:620
#define SW_PARENTOPENING
Definition: winuser.h:2419
DWORD style
Definition: ntuser.h:670

Referenced by co_WinPosMin