ReactOS 0.4.16-dev-433-g6363f78
window.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  tagWINDOWLIST
 

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
 
#define HWND_TERMINATOR   ((HWND)UlongToHandle(1))
 
#define WL_IS_BAD(pwl)   ((pwl)->phwndEnd <= (pwl)->phwndLast)
 
#define WL_CAPACITY(pwl)   ((pwl)->phwndEnd - &((pwl)->ahwnd[0]))
 
#define IACE_LIST   0x0002
 
#define IS_WND_CHILD(pWnd)   ((pWnd)->style & WS_CHILD)
 
#define IS_WND_MENU(pWnd)   ((pWnd)->pcls->atomClassName == gpsi->atomSysClass[ICLS_MENU])
 
#define IS_WND_IMELIKE(pWnd)
 

Typedefs

typedef struct tagWINDOWLIST WINDOWLIST
 
typedef struct tagWINDOWLISTPWINDOWLIST
 

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)
 
PWINDOWLIST FASTCALL IntBuildHwndList (PWND pwnd, DWORD dwFlags, PTHREADINFO pti)
 
VOID FASTCALL IntFreeHwndList (PWINDOWLIST pwlTarget)
 
HWND FASTCALL IntFindWindow (PWND Parent, PWND ChildAfter, RTL_ATOM ClassAtom, PUNICODE_STRING WindowName)
 
BOOL FASTCALL IntWantImeWindow (PWND pwndTarget)
 
PWND FASTCALL co_IntCreateDefaultImeWindow (PWND pwndTarget, HINSTANCE hInst)
 
BOOL FASTCALL IntImeCanDestroyDefIMEforChild (PWND pImeWnd, PWND pwndTarget)
 
BOOL FASTCALL IntImeCanDestroyDefIME (PWND pImeWnd, PWND pwndTarget)
 
BOOL FASTCALL IntBroadcastImeShowStatusChange (PWND pImeWnd, BOOL bShow)
 
VOID FASTCALL IntNotifyImeShowStatus (PWND pImeWnd)
 
VOID FASTCALL IntCheckImeShowStatusInThread (PWND pImeWnd)
 
static VOID ReplaceWndPtr (_Inout_ PWND *ppwnd, _In_opt_ PWND pwndNew)
 
static VOID WndSetOwner (_Inout_ PWND pwnd, _In_opt_ PWND pwndOwner)
 
static VOID WndSetParent (_Inout_ PWND pwnd, _In_opt_ PWND pwndParent)
 
static VOID WndSetChild (_Inout_ PWND pwnd, _In_opt_ PWND pwndChild)
 
static VOID WndSetNext (_Inout_ PWND pwnd, _In_opt_ PWND pwndNext)
 
static VOID WndSetPrev (_Inout_ PWND pwnd, _In_opt_ PWND pwndPrev)
 
static VOID WndSetLastActive (_Inout_ PWND pwnd, _In_opt_ PWND pwndLastActive)
 

Variables

ATOM AtomMessage
 
ATOM AtomWndObj
 
ATOM AtomLayer
 
ATOM AtomFlashWndState
 
BOOL g_bWindowSnapEnabled
 
PWINDOWLIST gpwlList
 
PWINDOWLIST gpwlCache
 
BOOL gfIMEShowStatus
 

Macro Definition Documentation

◆ HAS_CLIENTFRAME

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

Definition at line 20 of file window.h.

◆ HAS_DLGFRAME

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

Definition at line 9 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 23 of file window.h.

◆ HAS_THICKFRAME

#define HAS_THICKFRAME (   Style,
  ExStyle 
)
Value:
(((Style) & WS_THICKFRAME) && \
#define WS_BORDER
Definition: pedump.c:625

Definition at line 13 of file window.h.

◆ HAS_THINFRAME

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

Definition at line 17 of file window.h.

◆ HWND_TERMINATOR

#define HWND_TERMINATOR   ((HWND)UlongToHandle(1))

Definition at line 83 of file window.h.

◆ IACE_LIST

#define IACE_LIST   0x0002

Definition at line 106 of file window.h.

◆ IntGetWndProcessId

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

Definition at line 38 of file window.h.

◆ IntGetWndThreadId

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

Definition at line 35 of file window.h.

◆ IntIsBroadcastHwnd

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

Definition at line 28 of file window.h.

◆ IntIsDesktopWindow

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

Definition at line 25 of file window.h.

◆ IntWndBelongsToThread

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

Definition at line 32 of file window.h.

◆ IS_WND_CHILD

#define IS_WND_CHILD (   pWnd)    ((pWnd)->style & WS_CHILD)

Definition at line 108 of file window.h.

◆ IS_WND_IMELIKE

#define IS_WND_IMELIKE (   pWnd)
Value:
(((pWnd)->pcls->style & CS_IME) || \
((pWnd)->pcls->atomClassName == gpsi->atomSysClass[ICLS_IME]))
PSERVERINFO gpsi
Definition: imm.c:18
#define ICLS_IME
Definition: ntuser.h:927
ATOM atomSysClass[ICLS_NOTUSED+1]
Definition: ntuser.h:1060
#define CS_IME
Definition: winuser.h:659

Definition at line 114 of file window.h.

◆ IS_WND_MENU

#define IS_WND_MENU (   pWnd)    ((pWnd)->pcls->atomClassName == gpsi->atomSysClass[ICLS_MENU])

Definition at line 109 of file window.h.

◆ WINVER_WIN2K

#define WINVER_WIN2K   _WIN32_WINNT_WIN2K

Definition at line 56 of file window.h.

◆ WINVER_WIN31

#define WINVER_WIN31   0x30A

Definition at line 58 of file window.h.

◆ WINVER_WINNT4

#define WINVER_WINNT4   _WIN32_WINNT_NT4

Definition at line 57 of file window.h.

◆ WL_CAPACITY

#define WL_CAPACITY (   pwl)    ((pwl)->phwndEnd - &((pwl)->ahwnd[0]))

Definition at line 98 of file window.h.

◆ WL_IS_BAD

#define WL_IS_BAD (   pwl)    ((pwl)->phwndEnd <= (pwl)->phwndLast)

Definition at line 97 of file window.h.

Typedef Documentation

◆ PWINDOWLIST

◆ WINDOWLIST

Function Documentation

◆ co_IntCreateDefaultImeWindow()

PWND FASTCALL co_IntCreateDefaultImeWindow ( PWND  pwndTarget,
HINSTANCE  hInst 
)

Definition at line 1954 of file ime.c.

1955{
1956 LARGE_UNICODE_STRING WindowName;
1957 UNICODE_STRING ClassName;
1958 PWND pImeWnd;
1959 PIMEUI pimeui;
1960 CREATESTRUCTW Cs;
1963 HANDLE pid = PsGetThreadProcessId(pti->pEThread);
1964
1965 if (!(pti->spDefaultImc) && pid == gpidLogon)
1967
1968 if (!(pti->spDefaultImc) || IS_WND_IMELIKE(pwndTarget) || !(pti->rpdesk->pheapDesktop))
1969 return NULL;
1970
1971 if (IS_WND_CHILD(pwndTarget) && !(pwndTarget->style & WS_VISIBLE) &&
1972 pwndTarget->spwndParent->head.pti->ppi != pti->ppi)
1973 {
1974 return NULL;
1975 }
1976
1977 RtlInitLargeUnicodeString(&WindowName, L"Default IME", 0);
1978
1980 ClassName.Length = 0;
1981 ClassName.MaximumLength = 0;
1982
1983 UserRefObjectCo(pwndTarget, &Ref);
1984
1985 RtlZeroMemory(&Cs, sizeof(Cs));
1986 Cs.style = WS_POPUP | WS_DISABLED;
1987 Cs.hInstance = hInst;
1988 Cs.hwndParent = UserHMGetHandle(pwndTarget);
1989 Cs.lpszName = WindowName.Buffer;
1990 Cs.lpszClass = ClassName.Buffer;
1991
1992 // NOTE: LARGE_UNICODE_STRING is compatible to LARGE_STRING.
1993 pImeWnd = co_UserCreateWindowEx(&Cs, &ClassName, (PLARGE_STRING)&WindowName, NULL, WINVER);
1994 if (pImeWnd)
1995 {
1996 pimeui = ((PIMEWND)pImeWnd)->pimeui;
1997 _SEH2_TRY
1998 {
1999 ProbeForWrite(pimeui, sizeof(IMEUI), 1);
2000 pimeui->fDefault = TRUE;
2001 if (IS_WND_CHILD(pwndTarget) && pwndTarget->spwndParent->head.pti != pti)
2002 pimeui->fChildThreadDef = TRUE;
2003 }
2005 {
2006 ERR("%p\n", pimeui);
2007 }
2008 _SEH2_END;
2009 }
2010
2011 UserDerefObjectCo(pwndTarget);
2012 return pImeWnd;
2013}
#define ERR(fmt,...)
Definition: precomp.h:57
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define UlongToPtr(u)
Definition: config.h:106
HINSTANCE hInst
Definition: dxdiag.c:13
VOID NTAPI ProbeForWrite(IN PVOID Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:143
#define UserHMGetHandle(obj)
Definition: ntuser.h:230
struct _IMEWND * PIMEWND
VOID NTAPI RtlInitLargeUnicodeString(IN OUT PLARGE_UNICODE_STRING, IN PCWSTR, IN INT)
Definition: rtlstr.c:42
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:90
PVOID NTAPI PsGetCurrentThreadWin32Thread(VOID)
Definition: thread.c:805
HANDLE NTAPI PsGetThreadProcessId(IN PETHREAD Thread)
Definition: thread.c:745
#define L(x)
Definition: ntvdm.h:50
static __inline VOID UserDerefObjectCo(PVOID obj)
Definition: object.h:43
static __inline VOID UserRefObjectCo(PVOID obj, PUSER_REFERENCE_ENTRY UserReferenceEntry)
Definition: object.h:27
#define WS_POPUP
Definition: pedump.c:616
#define WS_VISIBLE
Definition: pedump.c:620
#define WS_DISABLED
Definition: pedump.c:621
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:66
#define _SEH2_END
Definition: pseh2_64.h:155
#define _SEH2_TRY
Definition: pseh2_64.h:55
HANDLE gpidLogon
Definition: simplecall.c:15
PPROCESSINFO ppi
Definition: win32.h:88
struct tagIMC * spDefaultImc
Definition: win32.h:132
struct _DESKTOP * rpdesk
Definition: win32.h:92
USHORT MaximumLength
Definition: env_spec_w32.h:370
Definition: object.h:4
Definition: ntuser.h:694
DWORD style
Definition: ntuser.h:706
struct _WND * spwndParent
Definition: ntuser.h:713
LPCWSTR lpszClass
Definition: winuser.h:2968
LPCWSTR lpszName
Definition: winuser.h:2967
HINSTANCE hInstance
Definition: winuser.h:2959
UINT fDefault
Definition: ntuser.h:1225
UINT fChildThreadDef
Definition: ntuser.h:1226
#define WINVER
Definition: targetver.h:11
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
PIMC FASTCALL UserCreateInputContext(ULONG_PTR dwClientImcData)
Definition: ime.c:1558
PWND FASTCALL co_UserCreateWindowEx(CREATESTRUCTW *Cs, PUNICODE_STRING ClassName, PLARGE_STRING WindowName, PVOID acbiBuffer, DWORD dwVer)
Definition: window.c:2176
#define IS_WND_IMELIKE(pWnd)
Definition: window.h:114
#define IS_WND_CHILD(pWnd)
Definition: window.h:108
_In_ ULONG_PTR _In_ ULONG _Out_ ULONG_PTR * pid
Definition: winddi.h:3837

Referenced by co_UserCreateWindowEx().

◆ co_UserCreateWindowEx()

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

Definition at line 2176 of file window.c.

2181{
2182 ULONG style;
2183 PWND Window = NULL, ParentWindow = NULL, OwnerWindow;
2184 HWND hWnd, hWndParent, hWndOwner, hwndInsertAfter;
2185 PWINSTATION_OBJECT WinSta;
2186 PCLS Class = NULL;
2187 SIZE Size;
2188 POINT MaxSize, MaxPos, MinTrack, MaxTrack;
2189 CBT_CREATEWNDW * pCbtCreate;
2191 USER_REFERENCE_ENTRY ParentRef, Ref;
2192 PTHREADINFO pti;
2193 DWORD dwShowMode = SW_SHOW;
2194 CREATESTRUCTW *pCsw = NULL;
2195 PVOID pszClass = NULL, pszName = NULL;
2196 PWND ret = NULL;
2197
2198 /* Get the current window station and reference it */
2199 pti = GetW32ThreadInfo();
2200 if (pti == NULL || pti->rpdesk == NULL)
2201 {
2202 ERR("Thread is not attached to a desktop! Cannot create window (%wZ)\n", ClassName);
2203 return NULL; // There is nothing to cleanup.
2204 }
2205 WinSta = pti->rpdesk->rpwinstaParent;
2207
2208 pCsw = NULL;
2209 pCbtCreate = NULL;
2210
2211 /* Get the class and reference it */
2212 Class = IntGetAndReferenceClass(ClassName, Cs->hInstance, FALSE);
2213 if(!Class)
2214 {
2216 ERR("Failed to find class %wZ\n", ClassName);
2217 goto cleanup;
2218 }
2219
2220 /* Now find the parent and the owner window */
2221 hWndParent = UserHMGetHandle(pti->rpdesk->pDeskInfo->spwnd);
2222 hWndOwner = NULL;
2223
2224 if (Cs->hwndParent == HWND_MESSAGE)
2225 {
2226 Cs->hwndParent = hWndParent = UserHMGetHandle(pti->rpdesk->spwndMessage);
2227 }
2228 else if (Cs->hwndParent)
2229 {
2230 if ((Cs->style & (WS_CHILD|WS_POPUP)) != WS_CHILD)
2231 hWndOwner = Cs->hwndParent;
2232 else
2233 hWndParent = Cs->hwndParent;
2234 }
2235 else if ((Cs->style & (WS_CHILD|WS_POPUP)) == WS_CHILD)
2236 {
2237 ERR("Cannot create a child window (%wZ) without a parent\n", ClassName);
2239 goto cleanup; /* WS_CHILD needs a parent, but WS_POPUP doesn't */
2240 }
2242 (IS_INTRESOURCE(Cs->lpszClass) ||
2243 Cs->lpszClass != (LPCWSTR)MAKEINTATOM(gpsi->atomSysClass[ICLS_HWNDMESSAGE]) ||
2244 _wcsicmp(Cs->lpszClass, L"Message") != 0))
2245 {
2246 if (pti->ppi->dwLayout & LAYOUT_RTL)
2247 {
2249 }
2250 }
2251
2252 ParentWindow = hWndParent ? UserGetWindowObject(hWndParent): NULL;
2253 OwnerWindow = hWndOwner ? UserGetWindowObject(hWndOwner): NULL;
2254
2255 if (hWndParent && !ParentWindow)
2256 {
2257 ERR("Got invalid parent window handle for %wZ\n", ClassName);
2258 goto cleanup;
2259 }
2260 else if (hWndOwner && !OwnerWindow)
2261 {
2262 ERR("Got invalid owner window handle for %wZ\n", ClassName);
2263 ParentWindow = NULL;
2264 goto cleanup;
2265 }
2266
2267 if(OwnerWindow)
2268 {
2269 if (IntIsDesktopWindow(OwnerWindow)) OwnerWindow = NULL;
2270 else if (ParentWindow && !IntIsDesktopWindow(ParentWindow))
2271 {
2272 ERR("an owned window must be created as top-level\n");
2274 goto cleanup;
2275 }
2276 else /* owner must be a top-level window */
2277 {
2278 while ((OwnerWindow->style & (WS_POPUP|WS_CHILD)) == WS_CHILD && !IntIsDesktopWindow(OwnerWindow->spwndParent))
2279 OwnerWindow = OwnerWindow->spwndParent;
2280 }
2281 }
2282
2283 /* Fix the position and the size of the window */
2284 if (ParentWindow)
2285 {
2286 UserRefObjectCo(ParentWindow, &ParentRef);
2287 IntFixWindowCoordinates(Cs, ParentWindow, &dwShowMode);
2288 }
2289
2290 /* Allocate and initialize the new window */
2292 WindowName,
2293 Class,
2294 ParentWindow,
2295 OwnerWindow,
2296 acbiBuffer,
2297 NULL,
2298 dwVer );
2299 if(!Window)
2300 {
2301 ERR("IntCreateWindow(%wZ) failed\n", ClassName);
2302 goto cleanup;
2303 }
2304
2306 hwndInsertAfter = HWND_TOP;
2307
2308 UserRefObjectCo(Window, &Ref);
2310 ObDereferenceObject(WinSta);
2311
2312 /* NCCREATE, WM_NCCALCSIZE and Hooks need the original values */
2313 Cs->lpszName = (LPCWSTR) WindowName;
2314 Cs->lpszClass = (LPCWSTR) ClassName;
2315
2317 if ( ISITHOOKED(WH_CBT) || (pti->rpdesk->pDeskInfo->fsHooks & HOOKID_TO_FLAG(WH_CBT)) )
2318 {
2319 // Allocate the calling structures Justin Case this goes Global.
2322 if (!pCsw || !pCbtCreate)
2323 {
2324 ERR("UserHeapAlloc() failed!\n");
2325 goto cleanup;
2326 }
2327
2328 if (!IntMsgCreateStructW( Window, pCsw, Cs, &pszClass, &pszName ) )
2329 {
2330 ERR("IntMsgCreateStructW() failed!\n");
2331 goto cleanup;
2332 }
2333
2334 pCbtCreate->lpcs = pCsw;
2335 pCbtCreate->hwndInsertAfter = hwndInsertAfter;
2336
2339 if (Result != 0)
2340 {
2341 ERR("WH_CBT HCBT_CREATEWND hook failed! 0x%x\n", Result);
2342 goto cleanup;
2343 }
2344 // Write back changes.
2345 Cs->cx = pCsw->cx;
2346 Cs->cy = pCsw->cy;
2347 Cs->x = pCsw->x;
2348 Cs->y = pCsw->y;
2349 hwndInsertAfter = pCbtCreate->hwndInsertAfter;
2350 }
2351
2352 if ((Cs->style & (WS_CHILD|WS_POPUP)) == WS_CHILD)
2353 {
2354 if (ParentWindow != co_GetDesktopWindow(Window))
2355 {
2356 Cs->x += ParentWindow->rcClient.left;
2357 Cs->y += ParentWindow->rcClient.top;
2358 }
2359 }
2360
2361 /* Send the WM_GETMINMAXINFO message */
2362 Size.cx = Cs->cx;
2363 Size.cy = Cs->cy;
2364
2365 if ((Cs->style & WS_THICKFRAME) || !(Cs->style & (WS_POPUP | WS_CHILD)))
2366 {
2367 co_WinPosGetMinMaxInfo(Window, &MaxSize, &MaxPos, &MinTrack, &MaxTrack);
2368 if (Size.cx > MaxTrack.x) Size.cx = MaxTrack.x;
2369 if (Size.cy > MaxTrack.y) Size.cy = MaxTrack.y;
2370 if (Size.cx < MinTrack.x) Size.cx = MinTrack.x;
2371 if (Size.cy < MinTrack.y) Size.cy = MinTrack.y;
2372 }
2373
2374 Window->rcWindow.left = Cs->x;
2375 Window->rcWindow.top = Cs->y;
2376 Window->rcWindow.right = Cs->x + Size.cx;
2377 Window->rcWindow.bottom = Cs->y + Size.cy;
2378 /*
2379 if (0 != (Window->style & WS_CHILD) && ParentWindow)
2380 {
2381 ERR("co_UserCreateWindowEx(): Offset rcWindow\n");
2382 RECTL_vOffsetRect(&Window->rcWindow,
2383 ParentWindow->rcClient.left,
2384 ParentWindow->rcClient.top);
2385 }
2386 */
2387 /* correct child window coordinates if mirroring on parent is enabled */
2388 if (ParentWindow != NULL)
2389 {
2390 if ( ((Cs->style & WS_CHILD) == WS_CHILD) &&
2391 ((ParentWindow->ExStyle & WS_EX_LAYOUTRTL) == WS_EX_LAYOUTRTL))
2392 {
2393 Window->rcWindow.right = ParentWindow->rcClient.right - (Window->rcWindow.left - ParentWindow->rcClient.left);
2394 Window->rcWindow.left = Window->rcWindow.right - Size.cx;
2395 }
2396 }
2397
2398 Window->rcClient = Window->rcWindow;
2399
2400 if (Window->spwndNext || Window->spwndPrev)
2401 {
2402 ERR("Window 0x%p has been linked too early!\n", Window);
2403 }
2404
2405 if (!(Window->state2 & WNDS2_WIN31COMPAT))
2406 {
2407 if (Class->style & CS_PARENTDC && !(ParentWindow->style & WS_CLIPCHILDREN))
2408 Window->style &= ~(WS_CLIPSIBLINGS | WS_CLIPCHILDREN);
2409 }
2410
2411 if ((Window->style & (WS_CHILD | WS_POPUP)) == WS_CHILD)
2412 {
2414 {
2415 if (pti != ParentWindow->head.pti)
2416 {
2417 //ERR("CreateWindow Parent in.\n");
2418 UserAttachThreadInput(pti, ParentWindow->head.pti, TRUE);
2419 }
2420 }
2421 }
2422
2423 /* Send the NCCREATE message */
2425 if (!Result)
2426 {
2427 ERR("co_UserCreateWindowEx(%wZ): NCCREATE message failed\n", ClassName);
2428 goto cleanup;
2429 }
2430
2431 /* Link the window */
2432 if (ParentWindow != NULL)
2433 {
2434 /* Link the window into the siblings list */
2435 if ((Cs->style & (WS_CHILD | WS_MAXIMIZE)) == WS_CHILD)
2437 else
2438 IntLinkHwnd(Window, hwndInsertAfter);
2439 }
2440
2441 /* Create the IME window for pWnd */
2443 {
2444 PWND pwndDefaultIme = co_IntCreateDefaultImeWindow(Window, Window->hModule);
2445 UserAssignmentLock((PVOID*)&pti->spwndDefaultIme, pwndDefaultIme);
2446
2447 if (pwndDefaultIme)
2448 {
2449 HWND hImeWnd;
2451 UserRefObjectCo(pwndDefaultIme, &Ref);
2452
2453 hImeWnd = UserHMGetHandle(pwndDefaultIme);
2454
2456
2457 if (pti->pClientInfo->CI_flags & CI_IMMACTIVATE)
2458 {
2459 HKL hKL = pti->KeyboardLayout->hkl;
2461 pti->pClientInfo->CI_flags &= ~CI_IMMACTIVATE;
2462 }
2463
2464 UserDerefObjectCo(pwndDefaultIme);
2465 }
2466 }
2467
2468 /* Send the WM_NCCALCSIZE message */
2469 {
2470 // RECT rc;
2471 MaxPos.x = Window->rcWindow.left;
2472 MaxPos.y = Window->rcWindow.top;
2473
2474 Result = co_WinPosGetNonClientSize(Window, &Window->rcWindow, &Window->rcClient);
2475 //rc = Window->rcWindow;
2476 //Result = co_IntSendMessageNoWait(UserHMGetHandle(Window), WM_NCCALCSIZE, FALSE, (LPARAM)&rc);
2477 //Window->rcClient = rc;
2478
2479 RECTL_vOffsetRect(&Window->rcWindow, MaxPos.x - Window->rcWindow.left,
2480 MaxPos.y - Window->rcWindow.top);
2481 }
2482
2483 /* Send the WM_CREATE message. */
2485 if (Result == (LRESULT)-1)
2486 {
2487 ERR("co_UserCreateWindowEx(%wZ): WM_CREATE message failed\n", ClassName);
2488 goto cleanup;
2489 }
2490
2491 /* Send the EVENT_OBJECT_CREATE event */
2492 IntNotifyWinEvent(EVENT_OBJECT_CREATE, Window, OBJID_WINDOW, CHILDID_SELF, 0);
2493
2494 /* By setting the flag below it can be examined to determine if the window
2495 was created successfully and a valid pwnd was passed back to caller since
2496 from here the function has to succeed. */
2498
2499 /* Send the WM_SIZE and WM_MOVE messages. */
2500 if (!(Window->state & WNDS_SENDSIZEMOVEMSGS))
2501 {
2503 }
2504
2505 /* Show or maybe minimize or maximize the window. */
2506
2508 if (style & (WS_MINIMIZE | WS_MAXIMIZE))
2509 {
2510 RECTL NewPos;
2511 UINT SwFlag = (style & WS_MINIMIZE) ? SW_MINIMIZE : SW_MAXIMIZE;
2512
2513 SwFlag = co_WinPosMinMaximize(Window, SwFlag, &NewPos);
2514 SwFlag |= SWP_NOZORDER|SWP_FRAMECHANGED; /* Frame always gets changed */
2515 if (!(style & WS_VISIBLE) || (style & WS_CHILD) || UserGetActiveWindow() ||
2516 (Window->ExStyle & WS_EX_NOACTIVATE))
2517 {
2518 SwFlag |= SWP_NOACTIVATE;
2519 }
2520 co_WinPosSetWindowPos(Window, 0, NewPos.left, NewPos.top,
2521 NewPos.right, NewPos.bottom, SwFlag);
2522 }
2523
2524 /* Send the WM_PARENTNOTIFY message */
2526
2527 /* Notify the shell that a new window was created */
2528 if (Window->spwndOwner == NULL ||
2529 !(Window->spwndOwner->style & WS_VISIBLE) ||
2530 (Window->spwndOwner->ExStyle & WS_EX_TOOLWINDOW))
2531 {
2532 if (UserIsDesktopWindow(Window->spwndParent) &&
2533 (Window->style & WS_VISIBLE) &&
2534 (!(Window->ExStyle & WS_EX_TOOLWINDOW) ||
2535 (Window->ExStyle & WS_EX_APPWINDOW)))
2536 {
2538 }
2539 }
2540
2541 /* Initialize and show the window's scrollbars */
2542 if (Window->style & WS_VSCROLL)
2543 {
2545 }
2546 if (Window->style & WS_HSCROLL)
2547 {
2549 }
2550
2551 /* Show the new window */
2552 if (Cs->style & WS_VISIBLE)
2553 {
2554 if (Window->style & WS_MAXIMIZE)
2555 dwShowMode = SW_SHOW;
2556 else if (Window->style & WS_MINIMIZE)
2557 dwShowMode = SW_SHOWMINIMIZED;
2558
2559 co_WinPosShowWindow(Window, dwShowMode);
2560
2561 if (Window->ExStyle & WS_EX_MDICHILD)
2562 {
2563 ASSERT(ParentWindow);
2564 if(!ParentWindow)
2565 goto cleanup;
2567 /* ShowWindow won't activate child windows */
2569 }
2570 }
2571
2572 if (Class->atomClassName == gaGuiConsoleWndClass)
2573 {
2574 /* Count only console windows manually */
2576 }
2577
2578 TRACE("co_UserCreateWindowEx(%wZ): Created window %p\n", ClassName, hWnd);
2579 ret = Window;
2580
2581cleanup:
2582 if (!ret)
2583 {
2584 TRACE("co_UserCreateWindowEx(): Error Created window!\n");
2585 /* If the window was created, the class will be dereferenced by co_UserDestroyWindow */
2586 if (Window)
2588 else if (Class)
2590 }
2591
2592 if (pCsw) ExFreePoolWithTag(pCsw, TAG_HOOK);
2593 if (pCbtCreate) ExFreePoolWithTag(pCbtCreate, TAG_HOOK);
2594 if (pszName) UserHeapFree(pszName);
2595 if (pszClass) UserHeapFree(pszClass);
2596
2597 if (Window)
2598 {
2600 }
2601 if (ParentWindow) UserDerefObjectCo(ParentWindow);
2602
2603 // See CORE-13717, not setting error on success.
2604 if (ret)
2606
2607 return ret;
2608}
Arabic default style
Definition: afstyles.h:94
HWND hWnd
Definition: settings.c:17
#define ERROR_SUCCESS
Definition: deptool.c:10
#define FALSE
Definition: types.h:117
static void cleanup(void)
Definition: main.c:1335
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define NonPagedPool
Definition: env_spec_w32.h:307
unsigned long DWORD
Definition: ntddk_ex.h:95
HWND FASTCALL UserGetActiveWindow(VOID)
Definition: focus.c:1432
VOID FASTCALL co_IntUserManualGuiCheck(BOOL Create)
Definition: guicheck.c:77
#define ISITHOOKED(HookId)
Definition: hook.h:6
#define HOOKID_TO_FLAG(HookId)
Definition: hook.h:5
#define IMS_LOADTHREADLAYOUT
Definition: immdev.h:115
#define IMS_ACTIVATELAYOUT
Definition: immdev.h:110
#define WNDS2_WIN31COMPAT
Definition: ntuser.h:649
struct _THREADINFO * GetW32ThreadInfo(VOID)
Definition: misc.c:807
#define CI_IMMACTIVATE
Definition: ntuser.h:306
#define WNDS2_WMCREATEMSGPROCESSED
Definition: ntuser.h:670
#define IS_IMM_MODE()
Definition: ntuser.h:1209
#define ICLS_DESKTOP
Definition: ntuser.h:929
#define WNDS_SENDSIZEMOVEMSGS
Definition: ntuser.h:609
#define ASSERT(a)
Definition: mode.c:44
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
UINT_PTR HKL
Definition: msctf.idl:143
unsigned int UINT
Definition: ndis.h:50
#define KernelMode
Definition: asm.h:38
LRESULT APIENTRY co_HOOK_CallHooks(INT HookId, INT Code, WPARAM wParam, LPARAM lParam)
Definition: hook.c:1102
UINT FASTCALL co_WinPosMinMaximize(PWND Wnd, UINT ShowFlag, RECT *NewPos)
Definition: winpos.c:2426
BOOLEAN FASTCALL co_WinPosSetWindowPos(PWND Window, HWND WndInsertAfter, INT x, INT y, INT cx, INT cy, UINT flags)
Definition: winpos.c:1792
LRESULT FASTCALL co_WinPosGetNonClientSize(PWND Window, RECT *WindowRect, RECT *ClientRect)
Definition: winpos.c:2377
UINT FASTCALL co_WinPosGetMinMaxInfo(PWND Window, POINT *MaxSize, POINT *MaxPos, POINT *MinTrack, POINT *MaxTrack)
Definition: winpos.c:940
void FASTCALL co_WinPosSendSizeMove(PWND Wnd)
Definition: winpos.c:2392
BOOLEAN FASTCALL co_WinPosShowWindow(PWND Wnd, INT Cmd)
Definition: winpos.c:2584
ATOM gaGuiConsoleWndClass
Definition: ntuser.c:27
NTSTATUS NTAPI ObReferenceObjectByPointer(IN PVOID Object, IN ACCESS_MASK DesiredAccess, IN POBJECT_TYPE ObjectType, IN KPROCESSOR_MODE AccessMode)
Definition: obref.c:381
#define WS_CHILD
Definition: pedump.c:617
#define WS_MAXIMIZE
Definition: pedump.c:623
#define WS_VSCROLL
Definition: pedump.c:627
#define WS_MINIMIZE
Definition: pedump.c:622
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
#define WS_HSCROLL
Definition: pedump.c:628
#define WS_CLIPCHILDREN
Definition: pedump.c:619
DWORD FASTCALL co_UserShowScrollBar(PWND, int, BOOL, BOOL)
Definition: scrollbar.c:852
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
#define TRACE(s)
Definition: solgame.cpp:4
long bottom
Definition: polytest.cpp:53
long right
Definition: polytest.cpp:53
long top
Definition: polytest.cpp:53
long left
Definition: polytest.cpp:53
Definition: window.c:28
Definition: ntuser.h:566
DWORD dwLayout
Definition: win32.h:280
struct _DESKTOPINFO * pDeskInfo
Definition: win32.h:93
struct _CLIENTINFO * pClientInfo
Definition: win32.h:94
struct tagKL * KeyboardLayout
Definition: win32.h:90
struct _WND * spwndDefaultIme
Definition: win32.h:131
LPCREATESTRUCTW lpcs
Definition: winuser.h:2978
HWND hwndInsertAfter
Definition: winuser.h:2979
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
uint32_t ULONG
Definition: typedefs.h:59
#define STATUS_ACCESS_DENIED
Definition: udferr_usr.h:145
#define WM_IME_SYSTEM
Definition: undocuser.h:60
static __inline BOOL UserHeapFree(PVOID lpMem)
Definition: usrheap.h:44
int ret
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533
POBJECT_TYPE ExWindowStationObjectType
Definition: win32k.c:21
FORCEINLINE VOID RECTL_vOffsetRect(_Inout_ RECTL *prcl, _In_ INT cx, _In_ INT cy)
Definition: rect.h:31
BOOL FASTCALL IntMsgCreateStructW(PWND, CREATESTRUCTW *, CREATESTRUCTW *, PVOID *, PVOID *)
Definition: message.c:646
VOID IntDereferenceClass(IN OUT PCLS Class, IN PDESKTOPINFO Desktop, IN PPROCESSINFO pi)
Definition: class.c:820
PCLS IntGetAndReferenceClass(PUNICODE_STRING ClassName, HINSTANCE hInstance, BOOL bDesktopThread)
Definition: class.c:1450
VOID co_IntShellHookNotify(WPARAM Message, WPARAM wParam, LPARAM lParam)
Definition: desktop.c:1709
PWND FASTCALL co_GetDesktopWindow(PWND pWnd)
Definition: desktop.c:1383
#define UserIsDesktopWindow(pWnd)
Definition: desktop.h:194
VOID FASTCALL IntNotifyWinEvent(DWORD Event, PWND pWnd, LONG idObject, LONG idChild, DWORD flags)
Definition: event.c:178
PWND FASTCALL co_IntCreateDefaultImeWindow(PWND pwndTarget, HINSTANCE hInst)
Definition: ime.c:1954
BOOL FASTCALL IntWantImeWindow(PWND pwndTarget)
Definition: ime.c:1914
NTSTATUS FASTCALL UserAttachThreadInput(PTHREADINFO ptiFrom, PTHREADINFO ptiTo, BOOL fAttach)
Definition: input.c:480
LRESULT FASTCALL co_IntSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1495
PVOID FASTCALL UserAssignmentLock(PVOID *ppvObj, PVOID pvNew)
Definition: object.c:839
BOOL FASTCALL UserDereferenceObject(PVOID Object)
Definition: object.c:644
#define TAG_HOOK
Definition: tags.h:5
ULONG FASTCALL IntSetStyle(PWND pwnd, ULONG set_bits, ULONG clear_bits)
Definition: window.c:145
PWND FASTCALL UserGetWindowObject(HWND hWnd)
Definition: window.c:124
PWND FASTCALL IntCreateWindow(CREATESTRUCTW *Cs, PLARGE_STRING WindowName, PCLS Class, PWND ParentWindow, PWND OwnerWindow, PVOID acbiBuffer, PDESKTOP pdeskCreated, DWORD dwVer)
Definition: window.c:1804
void FASTCALL IntFixWindowCoordinates(CREATESTRUCTW *Cs, PWND ParentWindow, DWORD *dwShowMode)
Definition: window.c:1714
BOOL FASTCALL IntIsTopLevelWindow(PWND pWnd)
Definition: window.c:361
BOOLEAN co_UserDestroyWindow(PVOID Object)
Definition: window.c:2856
VOID FASTCALL IntLinkHwnd(PWND Wnd, HWND hWndPrev)
Definition: window.c:986
static void IntSendParentNotify(PWND pWindow, UINT msg)
Definition: window.c:1695
#define IntIsDesktopWindow(WndObj)
Definition: window.h:25
#define OBJID_WINDOW
Definition: winable.h:15
#define CHILDID_SELF
Definition: winable.h:14
#define MAKEINTATOM(i)
Definition: winbase.h:1488
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:22
LONG_PTR LPARAM
Definition: windef.h:208
LONG_PTR LRESULT
Definition: windef.h:209
UINT_PTR WPARAM
Definition: windef.h:207
#define ERROR_TLW_WITH_WSCHILD
Definition: winerror.h:887
#define ERROR_CANNOT_FIND_WND_CLASS
Definition: winerror.h:888
#define LAYOUT_RTL
Definition: wingdi.h:1371
#define WS_EX_LAYOUTRTL
Definition: winuser.h:390
#define HWND_MESSAGE
Definition: winuser.h:1213
#define SWP_NOACTIVATE
Definition: winuser.h:1245
#define SWP_FRAMECHANGED
Definition: winuser.h:1243
#define WM_CREATE
Definition: winuser.h:1611
#define WS_EX_APPWINDOW
Definition: winuser.h:383
#define SW_MINIMIZE
Definition: winuser.h:779
#define HSHELL_WINDOWCREATED
Definition: winuser.h:1258
#define SB_VERT
Definition: winuser.h:553
#define SWP_NOMOVE
Definition: winuser.h:1247
#define IS_INTRESOURCE(i)
Definition: winuser.h:580
#define WS_EX_NOACTIVATE
Definition: winuser.h:395
#define WS_EX_TOOLWINDOW
Definition: winuser.h:404
#define SWP_NOSIZE
Definition: winuser.h:1248
#define WH_CBT
Definition: winuser.h:35
#define HCBT_CREATEWND
Definition: winuser.h:58
#define WM_NCCREATE
Definition: winuser.h:1686
#define WM_MDIREFRESHMENU
Definition: winuser.h:1829
#define SW_SHOWMINIMIZED
Definition: winuser.h:774
#define HWND_TOP
Definition: winuser.h:1210
#define WS_EX_MDICHILD
Definition: winuser.h:394
#define SWP_SHOWWINDOW
Definition: winuser.h:1251
#define SW_SHOW
Definition: winuser.h:778
#define SWP_NOZORDER
Definition: winuser.h:1250
#define SW_MAXIMIZE
Definition: winuser.h:775
#define CS_PARENTDC
Definition: winuser.h:656
#define HWND_BOTTOM
Definition: winuser.h:1208
#define SB_HORZ
Definition: winuser.h:552
_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:409
#define ObDereferenceObject
Definition: obfuncs.h:203
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

Referenced by co_IntCreateDefaultImeWindow(), MENU_InitPopup(), and NtUserCreateWindowEx().

◆ co_UserFreeWindow()

LRESULT co_UserFreeWindow ( PWND  Window,
PPROCESSINFO  ProcessData,
PTHREADINFO  ThreadData,
BOOLEAN  SendMessages 
)

Definition at line 576 of file window.c.

580{
581 HWND *Children;
582 HWND *ChildHandle;
583 PWND Child;
584 PMENU Menu;
585 BOOLEAN BelongsToThreadData;
587
588 ASSERT(Window);
589
590 if(Window->state2 & WNDS2_INDESTROY)
591 {
592 TRACE("Tried to call co_UserFreeWindow() twice\n");
593 return 0;
594 }
595 Window->state2 |= WNDS2_INDESTROY;
596 Window->style &= ~WS_VISIBLE;
597 Window->head.pti->cVisWindows--;
598
599 /* remove the window already at this point from the thread window list so we
600 don't get into trouble when destroying the thread windows while we're still
601 in co_UserFreeWindow() */
602 if (!IsListEmpty(&Window->ThreadListEntry))
603 RemoveEntryList(&Window->ThreadListEntry);
604
605 BelongsToThreadData = IntWndBelongsToThread(Window, ThreadData);
606
608
609 /* free child windows */
610 Children = IntWinListChildren(Window);
611 if (Children)
612 {
613 for (ChildHandle = Children; *ChildHandle; ++ChildHandle)
614 {
615 if ((Child = IntGetWindowObject(*ChildHandle)))
616 {
618 {
619 /* send WM_DESTROY messages to windows not belonging to the same thread */
621 }
622 else
623 co_UserFreeWindow(Child, ProcessData, ThreadData, SendMessages);
624
626 }
627 }
629 }
630
631 if (SendMessages)
632 {
633 /*
634 * Clear the update region to make sure no WM_PAINT messages will be
635 * generated for this window while processing the WM_NCDESTROY.
636 */
640 if (BelongsToThreadData)
642 }
643
645
647
648 /* Unregister hot keys */
650
651 /* flush the message queue */
653
654 /* from now on no messages can be sent to this window anymore */
655 Window->state |= WNDS_DESTROYED;
656 Window->fnid |= FNID_FREED;
657
658 /* don't remove the WINDOWSTATUS_DESTROYING bit */
659
660 /* reset shell window handles */
661 if (ThreadData->rpdesk)
662 {
663 if (UserHMGetHandle(Window) == ThreadData->rpdesk->rpwinstaParent->ShellWindow)
664 ThreadData->rpdesk->rpwinstaParent->ShellWindow = NULL;
665
666 if (UserHMGetHandle(Window) == ThreadData->rpdesk->rpwinstaParent->ShellListView)
667 ThreadData->rpdesk->rpwinstaParent->ShellListView = NULL;
668 }
669
670 if (ThreadData->spwndDefaultIme &&
671 ThreadData->spwndDefaultIme->spwndOwner == Window)
672 {
673 WndSetOwner(ThreadData->spwndDefaultIme, NULL);
674 }
675
676 if (IS_IMM_MODE() && Window == ThreadData->spwndDefaultIme)
677 {
678 UserAssignmentUnlock((PVOID*)&(ThreadData->spwndDefaultIme));
679 }
680
681 /* Fixes dialog test_focus breakage due to r66237. */
682 if (ThreadData->MessageQueue->spwndFocus == Window)
683 ThreadData->MessageQueue->spwndFocus = NULL;
684
685 if (ThreadData->MessageQueue->spwndActive == Window)
686 ThreadData->MessageQueue->spwndActive = NULL;
687
688 if (ThreadData->MessageQueue->spwndCapture == Window)
689 {
691 }
692
694 if ( Window->hrgnUpdate != NULL || Window->state & WNDS_INTERNALPAINT )
695 {
696 MsqDecPaintCountQueue(Window->head.pti);
697 if (Window->hrgnUpdate > HRGN_WINDOW && GreIsHandleValid(Window->hrgnUpdate))
698 {
700 GreDeleteObject(Window->hrgnUpdate);
701 }
702 Window->hrgnUpdate = NULL;
703 Window->state &= ~WNDS_INTERNALPAINT;
704 }
705
707 {
709 }
710
711 if ( ((Window->style & (WS_CHILD|WS_POPUP)) != WS_CHILD) &&
712 Window->IDMenu &&
713 (Menu = UserGetMenuObject((HMENU)Window->IDMenu)))
714 {
715 TRACE("UFW: IDMenu %p\n",Window->IDMenu);
717 Window->IDMenu = 0;
718 }
719
720 if (Window->SystemMenu
721 && (Menu = UserGetMenuObject(Window->SystemMenu)))
722 {
724 Window->SystemMenu = (HMENU)0;
725 }
726
727 DceFreeWindowDCE(Window); /* Always do this to catch orphaned DCs */
728
730
731 if (Window->PropListItems)
732 {
734 TRACE("Window->PropListItems %lu\n",Window->PropListItems);
735 ASSERT(Window->PropListItems==0);
736 }
737
738 /* Kill any reference to linked windows. Prev & Next are taken care of in IntUnlinkWindow */
743
744 UserRefObjectCo(Window, &Ref);
746
748
749 if (Window->pcls->atomClassName == gaGuiConsoleWndClass)
750 {
751 /* Count only console windows manually */
753 }
754
755 /* dereference the class */
756 NT_ASSERT(Window->head.pti != NULL);
758 Window->head.pti->pDeskInfo,
759 Window->head.pti->ppi);
760 Window->pcls = NULL;
761
762 if (Window->hrgnClip)
763 {
765 GreDeleteObject(Window->hrgnClip);
766 Window->hrgnClip = NULL;
767 }
768 Window->head.pti->cWindows--;
769
770// ASSERT(Window != NULL);
771 UserFreeWindowInfo(Window->head.pti, Window);
772
775
776 return 0;
777}
unsigned char BOOLEAN
void FASTCALL DceFreeWindowDCE(PWND)
Definition: windc.c:686
#define RemoveEntryList(Entry)
Definition: env_spec_w32.h:986
#define IsListEmpty(ListHead)
Definition: env_spec_w32.h:954
BOOL FASTCALL IntReleaseCapture(VOID)
Definition: focus.c:1532
#define WNDS_DESTROYED
Definition: ntuser.h:636
#define WNDS_SENDNCPAINT
Definition: ntuser.h:616
#define WNDS_INTERNALPAINT
Definition: ntuser.h:617
@ TYPE_WINDOW
Definition: ntuser.h:41
#define WNDS2_INDESTROY
Definition: ntuser.h:648
#define FNID_FREED
Definition: ntuser.h:900
#define HRGN_WINDOW
Definition: ntuser.h:361
#define WNDS_SENDERASEBACKGROUND
Definition: ntuser.h:614
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:63
VOID APIENTRY MsqRemoveWindowMessagesFromQueue(PWND Window)
Definition: msgqueue.c:798
VOID FASTCALL MsqDecPaintCountQueue(PTHREADINFO pti)
Definition: msgqueue.c:508
@ WM_ASYNC_DESTROYWINDOW
Definition: msgqueue.h:120
#define GDI_OBJ_HMGR_POWNED
Definition: ntgdihdl.h:117
BOOL FASTCALL IntDestroyScrollBars(PWND)
Definition: scrollbar.c:799
BOOL FASTCALL co_UserRedrawWindow(PWND Window, const RECTL *UpdateRect, PREGION UpdateRgn, ULONG Flags)
Definition: painting.c:895
FORCEINLINE PMENU UserGetMenuObject(HMENU hMenu)
Definition: userfuncs.h:4
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFDEVICE Child
Definition: wdffdo.h:536
BOOL NTAPI GreDeleteObject(HGDIOBJ hobj)
Definition: gdiobj.c:1158
BOOL NTAPI GreIsHandleValid(HGDIOBJ hobj)
Definition: gdiobj.c:1146
BOOL FASTCALL IntGdiSetRegionOwner(HRGN hRgn, DWORD OwnerMask)
Definition: region.c:2459
VOID FASTCALL UserClipboardFreeWindow(PWND pWindow)
Definition: clipboard.c:414
BOOL IntDeRegisterShellHookWindow(HWND hWnd)
Definition: desktop.c:1801
VOID FASTCALL UnregisterWindowHotKeys(PWND pWnd)
Definition: hotkey.c:91
BOOL FASTCALL IntDestroyMenuObject(PMENU Menu, BOOL bRecurse)
Definition: menu.c:317
BOOL FASTCALL UserMarkObjectDestroy(PVOID Object)
Definition: object.c:621
BOOL FASTCALL UserDeleteObject(HANDLE h, HANDLE_TYPE type)
Definition: object.c:717
PVOID FASTCALL UserAssignmentUnlock(PVOID *ppvObj)
Definition: object.c:860
VOID FASTCALL UserRemoveWindowProps(_In_ PWND Window)
Definition: prop.c:115
#define USERTAG_WINDOWLIST
Definition: tags.h:298
BOOL FASTCALL DestroyTimersForWindow(PTHREADINFO pti, PWND Window)
Definition: timer.c:528
HWND *FASTCALL IntWinListChildren(PWND Window)
Definition: window.c:276
static VOID UserFreeWindowInfo(PTHREADINFO ti, PWND Wnd)
Definition: window.c:543
PWND FASTCALL IntGetWindowObject(HWND hWnd)
Definition: window.c:75
VOID FASTCALL IntUnlinkWindow(PWND Wnd)
Definition: window.c:1357
LRESULT co_UserFreeWindow(PWND Window, PPROCESSINFO ProcessData, PTHREADINFO ThreadData, BOOLEAN SendMessages)
Definition: window.c:576
static VOID WndSetOwner(_Inout_ PWND pwnd, _In_opt_ PWND pwndOwner)
Definition: window.h:150
static VOID WndSetChild(_Inout_ PWND pwnd, _In_opt_ PWND pwndChild)
Definition: window.h:164
#define IntWndBelongsToThread(WndObj, W32Thread)
Definition: window.h:32
static VOID WndSetParent(_Inout_ PWND pwnd, _In_opt_ PWND pwndParent)
Definition: window.h:157
static VOID WndSetLastActive(_Inout_ PWND pwnd, _In_opt_ PWND pwndLastActive)
Definition: window.h:185
#define RDW_NOINTERNALPAINT
Definition: winuser.h:1220
#define RDW_NOCHILDREN
Definition: winuser.h:1225
#define WM_NCDESTROY
Definition: winuser.h:1687
#define RDW_NOFRAME
Definition: winuser.h:1219
#define RDW_NOERASE
Definition: winuser.h:1218
#define RDW_VALIDATE
Definition: winuser.h:1221
#define NT_ASSERT
Definition: rtlfuncs.h:3327

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

◆ co_UserSetWindowLong()

LONG FASTCALL co_UserSetWindowLong ( HWND  hWnd,
DWORD  Index,
LONG  NewValue,
BOOL  Ansi 
)

Definition at line 4025 of file window.c.

4026{
4027 return (LONG)co_IntSetWindowLongPtr(hWnd, Index, NewValue, Ansi, sizeof(LONG), FALSE);
4028}
long LONG
Definition: pedump.c:60
_In_ WDFCOLLECTION _In_ ULONG Index
static LONG_PTR co_IntSetWindowLongPtr(HWND hWnd, DWORD Index, LONG_PTR NewValue, BOOL Ansi, ULONG Size, BOOL bAlter)
Definition: window.c:3828

Referenced by DesktopWindowProc(), and NtUserSetWindowWord().

◆ co_UserSetWindowLongPtr()

LONG_PTR FASTCALL co_UserSetWindowLongPtr ( HWND  hWnd,
DWORD  Index,
LONG_PTR  NewValue,
BOOL  Ansi 
)

Definition at line 4031 of file window.c.

4032{
4033 return co_IntSetWindowLongPtr(hWnd, Index, NewValue, Ansi, sizeof(LONG_PTR), FALSE);
4034}
__int3264 LONG_PTR
Definition: mstsclib_h.h:276

◆ GetNCHitEx()

DWORD FASTCALL GetNCHitEx ( PWND  pWnd,
POINT  pt 
)

Definition at line 1982 of file nonclient.c.

1983{
1984 RECT rcWindow, rcClient;
1986
1987 if (!pWnd) return HTNOWHERE;
1988
1989 if (UserIsDesktopWindow(pWnd))
1990 {
1991 rcClient.left = rcClient.top = rcWindow.left = rcWindow.top = 0;
1996 }
1997 else
1998 {
1999 rcClient = pWnd->rcClient;
2000 rcWindow = pWnd->rcWindow;
2001 }
2002
2003 if (!RECTL_bPointInRect(&rcWindow, pt.x, pt.y)) return HTNOWHERE;
2004
2005 Style = pWnd->style;
2006 ExStyle = pWnd->ExStyle;
2007
2008 if (Style & WS_MINIMIZE) return HTCAPTION;
2009
2010 if (RECTL_bPointInRect( &rcClient, pt.x, pt.y )) return HTCLIENT;
2011
2012 /* Check borders */
2014 {
2016 if (!RECTL_bPointInRect(&rcWindow, pt.x, pt.y ))
2017 {
2018 /* Check top sizing border */
2019 if (pt.y < rcWindow.top)
2020 {
2021 if (pt.x < rcWindow.left+UserGetSystemMetrics(SM_CXSIZE)) return HTTOPLEFT;
2022 if (pt.x >= rcWindow.right-UserGetSystemMetrics(SM_CXSIZE)) return HTTOPRIGHT;
2023 return HTTOP;
2024 }
2025 /* Check bottom sizing border */
2026 if (pt.y >= rcWindow.bottom)
2027 {
2028 if (pt.x < rcWindow.left+UserGetSystemMetrics(SM_CXSIZE)) return HTBOTTOMLEFT;
2029 if (pt.x >= rcWindow.right-UserGetSystemMetrics(SM_CXSIZE)) return HTBOTTOMRIGHT;
2030 return HTBOTTOM;
2031 }
2032 /* Check left sizing border */
2033 if (pt.x < rcWindow.left)
2034 {
2035 if (pt.y < rcWindow.top+UserGetSystemMetrics(SM_CYSIZE)) return HTTOPLEFT;
2036 if (pt.y >= rcWindow.bottom-UserGetSystemMetrics(SM_CYSIZE)) return HTBOTTOMLEFT;
2037 return HTLEFT;
2038 }
2039 /* Check right sizing border */
2040 if (pt.x >= rcWindow.right)
2041 {
2042 if (pt.y < rcWindow.top+UserGetSystemMetrics(SM_CYSIZE)) return HTTOPRIGHT;
2043 if (pt.y >= rcWindow.bottom-UserGetSystemMetrics(SM_CYSIZE)) return HTBOTTOMRIGHT;
2044 return HTRIGHT;
2045 }
2046 }
2047 }
2048 else /* No thick frame */
2049 {
2050 if (HAS_DLGFRAME( Style, ExStyle ))
2052 else if (HAS_THINFRAME( Style, ExStyle ))
2054 else if (HAS_CLIENTFRAME( Style, ExStyle ))
2056 if (!RECTL_bPointInRect( &rcWindow, pt.x, pt.y )) return HTBORDER;
2057 }
2058
2059 /* Check caption */
2060
2061 if ((Style & WS_CAPTION) == WS_CAPTION)
2062 {
2064 rcWindow.top += UserGetSystemMetrics(SM_CYSMCAPTION) - 1;
2065 else
2066 rcWindow.top += UserGetSystemMetrics(SM_CYCAPTION) - 1;
2067 if (!RECTL_bPointInRect( &rcWindow, pt.x, pt.y ))
2068 {
2069 BOOL min_or_max_box = (Style & WS_SYSMENU) && (Style & (WS_MINIMIZEBOX|WS_MAXIMIZEBOX));
2071 {
2072 /* Check system menu */
2073 if ((Style & WS_SYSMENU) && !(ExStyle & WS_EX_TOOLWINDOW) && NC_IconForWindow(pWnd))
2074 {
2075 rcWindow.right -= UserGetSystemMetrics(SM_CYCAPTION) - 1;
2076 if (pt.x > rcWindow.right) return HTSYSMENU;
2077 }
2078
2079 /* Check close button */
2080 if (Style & WS_SYSMENU)
2081 {
2083 if (pt.x < rcWindow.left) return HTCLOSE;
2084 }
2085
2086 /* Check maximize box */
2087 /* In Win95 there is automatically a Maximize button when there is a minimize one */
2088 if (min_or_max_box && !(ExStyle & WS_EX_TOOLWINDOW))
2089 {
2090 rcWindow.left += UserGetSystemMetrics(SM_CXSIZE);
2091 if (pt.x < rcWindow.left) return HTMAXBUTTON;
2092 }
2093
2094 /* Check minimize box */
2095 if (min_or_max_box && !(ExStyle & WS_EX_TOOLWINDOW))
2096 {
2097 rcWindow.left += UserGetSystemMetrics(SM_CXSIZE);
2098 if (pt.x < rcWindow.left) return HTMINBUTTON;
2099 }
2100 }
2101 else
2102 {
2103 /* Check system menu */
2104 if ((Style & WS_SYSMENU) && !(ExStyle & WS_EX_TOOLWINDOW) && NC_IconForWindow(pWnd))
2105 {
2106 rcWindow.left += UserGetSystemMetrics(SM_CYCAPTION) - 1;
2107 if (pt.x < rcWindow.left) return HTSYSMENU;
2108 }
2109
2110 /* Check close button */
2111 if (Style & WS_SYSMENU)
2112 {
2114 if (pt.x > rcWindow.right) return HTCLOSE;
2115 }
2116
2117 /* Check maximize box */
2118 /* In Win95 there is automatically a Maximize button when there is a minimize one */
2119 if (min_or_max_box && !(ExStyle & WS_EX_TOOLWINDOW))
2120 {
2122 if (pt.x > rcWindow.right) return HTMAXBUTTON;
2123 }
2124
2125 /* Check minimize box */
2126 if (min_or_max_box && !(ExStyle & WS_EX_TOOLWINDOW))
2127 {
2129 if (pt.x > rcWindow.right) return HTMINBUTTON;
2130 }
2131 }
2132 return HTCAPTION;
2133 }
2134 }
2135
2136 /* Check menu bar */
2137
2138 if (HAS_MENU( pWnd, Style ) && (pt.y < rcClient.top) &&
2139 (pt.x >= rcClient.left) && (pt.x < rcClient.right))
2140 return HTMENU;
2141
2142 /* Check vertical scroll bar */
2143
2145 if (Style & WS_VSCROLL)
2146 {
2147 if((ExStyle & WS_EX_LEFTSCROLLBAR) != 0)
2149 else
2151 if (RECTL_bPointInRect( &rcClient, pt.x, pt.y )) return HTVSCROLL;
2152 }
2153
2154 /* Check horizontal scroll bar */
2155
2156 if (Style & WS_HSCROLL)
2157 {
2159 if (RECTL_bPointInRect( &rcClient, pt.x, pt.y ))
2160 {
2161 /* Check size box */
2162 if ((Style & WS_VSCROLL) &&
2163 ((((ExStyle & WS_EX_LEFTSCROLLBAR) != 0) && (pt.x <= rcClient.left + UserGetSystemMetrics(SM_CXVSCROLL))) ||
2164 (((ExStyle & WS_EX_LEFTSCROLLBAR) == 0) && (pt.x >= rcClient.right - UserGetSystemMetrics(SM_CXVSCROLL)))))
2165 return HTSIZE;
2166 return HTHSCROLL;
2167 }
2168 }
2169
2170 /* Has to return HTNOWHERE if nothing was found
2171 Could happen when a window has a customized non client area */
2172 return HTNOWHERE;
2173}
#define pt(x, y)
Definition: drawing.c:79
unsigned int BOOL
Definition: ntddk_ex.h:94
#define WS_CAPTION
Definition: pedump.c:624
#define WS_MAXIMIZEBOX
Definition: pedump.c:632
#define WS_SYSMENU
Definition: pedump.c:629
#define WS_MINIMIZEBOX
Definition: pedump.c:631
DWORD ExStyle
Definition: ntuser.h:704
RECT rcClient
Definition: ntuser.h:717
RECT rcWindow
Definition: ntuser.h:716
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
#define HAS_MENU(hwnd, style)
Definition: uxthemep.h:238
VOID FASTCALL RECTL_vInflateRect(_Inout_ RECTL *rect, _In_ INT dx, _In_ INT dy)
Definition: rect.c:101
FORCEINLINE BOOL RECTL_bPointInRect(_In_ const RECTL *prcl, _In_ INT x, _In_ INT y)
Definition: rect.h:52
LONG NTAPI UserGetSystemMetrics(ULONG Index)
Definition: metric.c:214
PCURICON_OBJECT FASTCALL NC_IconForWindow(PWND pWnd)
Definition: nonclient.c:733
#define HAS_DLGFRAME(Style, ExStyle)
Definition: window.h:9
#define HAS_CLIENTFRAME(Style, ExStyle)
Definition: window.h:20
#define HAS_THINFRAME(Style, ExStyle)
Definition: window.h:17
#define HAS_THICKFRAME(Style, ExStyle)
Definition: window.h:13
#define HTTOPRIGHT
Definition: winuser.h:2495
#define HTCLOSE
Definition: winuser.h:2502
#define SM_CYEDGE
Definition: winuser.h:1012
#define SM_CYSCREEN
Definition: winuser.h:963
#define HTCAPTION
Definition: winuser.h:2479
#define SM_CXEDGE
Definition: winuser.h:1011
#define HTTOPLEFT
Definition: winuser.h:2494
#define SM_CYSIZE
Definition: winuser.h:995
#define SM_CXVSCROLL
Definition: winuser.h:964
#define HTBOTTOM
Definition: winuser.h:2496
#define HTBORDER
Definition: winuser.h:2500
#define SM_CXFRAME
Definition: winuser.h:997
#define HTVSCROLL
Definition: winuser.h:2485
#define HTHSCROLL
Definition: winuser.h:2484
#define HTMAXBUTTON
Definition: winuser.h:2487
#define SM_CXSIZE
Definition: winuser.h:994
#define SM_CYFRAME
Definition: winuser.h:999
#define SM_CYHSCROLL
Definition: winuser.h:965
#define HTMENU
Definition: winuser.h:2483
#define SM_CYBORDER
Definition: winuser.h:968
#define SM_CXBORDER
Definition: winuser.h:967
#define HTRIGHT
Definition: winuser.h:2492
#define HTCLIENT
Definition: winuser.h:2478
#define HTBOTTOMRIGHT
Definition: winuser.h:2498
#define HTNOWHERE
Definition: winuser.h:2477
#define SM_CXDLGFRAME
Definition: winuser.h:969
#define HTSIZE
Definition: winuser.h:2482
#define HTBOTTOMLEFT
Definition: winuser.h:2497
#define HTTOP
Definition: winuser.h:2493
#define SM_CYSMCAPTION
Definition: winuser.h:1017
#define SM_CYDLGFRAME
Definition: winuser.h:971
#define WS_EX_LEFTSCROLLBAR
Definition: winuser.h:392
#define SM_CXSCREEN
Definition: winuser.h:962
#define HTMINBUTTON
Definition: winuser.h:2486
#define HTSYSMENU
Definition: winuser.h:2480
#define HTLEFT
Definition: winuser.h:2490
#define SM_CYCAPTION
Definition: winuser.h:966

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

◆ IntBroadcastImeShowStatusChange()

BOOL FASTCALL IntBroadcastImeShowStatusChange ( PWND  pImeWnd,
BOOL  bShow 
)

Definition at line 2383 of file ime.c.

2384{
2385 if (gfIMEShowStatus == bShow || !IS_IMM_MODE())
2386 return TRUE;
2387
2388 gfIMEShowStatus = bShow;
2389 IntNotifyImeShowStatus(pImeWnd);
2390 return TRUE;
2391}
BOOL gfIMEShowStatus
Definition: ime.c:29
VOID FASTCALL IntNotifyImeShowStatus(PWND pImeWnd)
Definition: ime.c:2323

Referenced by NtUserCallHwndParamLock().

◆ IntBuildHwndList()

PWINDOWLIST FASTCALL IntBuildHwndList ( PWND  pwnd,
DWORD  dwFlags,
PTHREADINFO  pti 
)

Definition at line 1427 of file window.c.

1428{
1429 PWINDOWLIST pwl;
1430 DWORD cbWL;
1431
1432 if (gpwlCache)
1433 {
1434 pwl = gpwlCache;
1435 gpwlCache = NULL;
1436 }
1437 else
1438 {
1439#define INITIAL_COUNT 32
1440 cbWL = sizeof(WINDOWLIST) + (INITIAL_COUNT - 1) * sizeof(HWND);
1442 if (!pwl)
1443 return NULL;
1444
1445 pwl->phwndEnd = &pwl->ahwnd[INITIAL_COUNT];
1446#undef INITIAL_COUNT
1447 }
1448
1449 pwl->pti = pti;
1450 pwl->phwndLast = pwl->ahwnd;
1451 pwl = IntPopulateHwndList(pwl, pwnd, dwFlags);
1452 if (WL_IS_BAD(pwl))
1453 {
1455 return NULL;
1456 }
1457
1458 *(pwl->phwndLast) = HWND_TERMINATOR;
1459
1460 if (dwFlags & 0x8)
1461 {
1462 // TODO:
1463 }
1464
1465 pwl->pti = GetW32ThreadInfo();
1466 pwl->pNextList = gpwlList;
1467 gpwlList = pwl;
1468
1469 return pwl;
1470}
HANDLE HWND
Definition: compat.h:19
#define PagedPool
Definition: env_spec_w32.h:308
HWND * phwndLast
Definition: window.h:88
HWND ahwnd[ANYSIZE_ARRAY]
Definition: window.h:91
struct tagWINDOWLIST * pNextList
Definition: window.h:87
PTHREADINFO pti
Definition: window.h:90
HWND * phwndEnd
Definition: window.h:89
PWINDOWLIST gpwlCache
Definition: window.c:19
PWINDOWLIST FASTCALL IntPopulateHwndList(PWINDOWLIST pwl, PWND pwnd, DWORD dwFlags)
Definition: window.c:1397
#define INITIAL_COUNT
PWINDOWLIST gpwlList
Definition: window.c:18
#define WL_IS_BAD(pwl)
Definition: window.h:97
#define HWND_TERMINATOR
Definition: window.h:83
struct tagWINDOWLIST WINDOWLIST
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176

Referenced by IntAssociateInputContextEx(), IntCheckImeShowStatus(), IntDestroyInputContext(), and IntImeWindowPosChanged().

◆ IntCheckImeShowStatusInThread()

VOID FASTCALL IntCheckImeShowStatusInThread ( PWND  pImeWnd)

Definition at line 2394 of file ime.c.

2395{
2396 if (IS_IMM_MODE() && !(pImeWnd->state2 & WNDS2_INDESTROY))
2397 IntCheckImeShowStatus(pImeWnd, pImeWnd->head.pti);
2398}
THRDESKHEAD head
Definition: ntuser.h:695
DWORD state2
Definition: ntuser.h:702
BOOL FASTCALL IntCheckImeShowStatus(PWND pwndIme, PTHREADINFO pti)
Definition: ime.c:2126

Referenced by NtUserCallHwndLock().

◆ IntCreateWindow()

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

Definition at line 1804 of file window.c.

1812{
1813 PWND pWnd = NULL;
1814 HWND hWnd;
1815 PTHREADINFO pti;
1816 BOOL MenuChanged;
1817 BOOL bUnicodeWindow;
1818 PCALLPROCDATA pcpd;
1819
1820 pti = pdeskCreated ? gptiDesktopThread : GetW32ThreadInfo();
1821
1822 if (!(Cs->dwExStyle & WS_EX_LAYOUTRTL))
1823 { // Need both here for wine win.c test_CreateWindow.
1824 //if (Cs->hwndParent && ParentWindow)
1825 if (ParentWindow) // It breaks more tests..... WIP.
1826 {
1827 if ( (Cs->style & (WS_CHILD|WS_POPUP)) == WS_CHILD &&
1828 ParentWindow->ExStyle & WS_EX_LAYOUTRTL &&
1829 !(ParentWindow->ExStyle & WS_EX_NOINHERITLAYOUT) )
1831 }
1832 else
1833 { /*
1834 * Note from MSDN <http://msdn.microsoft.com/en-us/library/aa913269.aspx>:
1835 *
1836 * Dialog boxes and message boxes do not inherit layout, so you must
1837 * set the layout explicitly.
1838 */
1839 if ( Class->fnid != FNID_DIALOG )
1840 {
1841 if (pti->ppi->dwLayout & LAYOUT_RTL)
1842 {
1844 }
1845 }
1846 }
1847 }
1848
1849 /* Automatically add WS_EX_WINDOWEDGE */
1850 if ((Cs->dwExStyle & WS_EX_DLGMODALFRAME) ||
1851 ((!(Cs->dwExStyle & WS_EX_STATICEDGE)) &&
1852 (Cs->style & (WS_DLGFRAME | WS_THICKFRAME))))
1854 else
1855 Cs->dwExStyle &= ~WS_EX_WINDOWEDGE;
1856
1857 /* Is it a unicode window? */
1858 bUnicodeWindow =!(Cs->dwExStyle & WS_EX_SETANSICREATOR);
1859 Cs->dwExStyle &= ~WS_EX_SETANSICREATOR;
1860
1861 /* Allocate the new window */
1863 pdeskCreated ? pdeskCreated : pti->rpdesk,
1864 pti,
1865 (PHANDLE)&hWnd,
1867 sizeof(WND) + Class->cbwndExtra);
1868
1869 if (!pWnd)
1870 {
1871 goto AllocError;
1872 }
1873
1874 TRACE("Created window object with handle %p\n", hWnd);
1875
1876 if (pdeskCreated && pdeskCreated->DesktopWindow == NULL )
1877 { /* HACK: Helper for win32csr/desktopbg.c */
1878 /* If there is no desktop window yet, we must be creating it */
1879 TRACE("CreateWindow setting desktop.\n");
1880 pdeskCreated->DesktopWindow = hWnd;
1881 pdeskCreated->pDeskInfo->spwnd = pWnd;
1882 }
1883
1884 /*
1885 * Fill out the structure describing it.
1886 */
1887 /* Remember, pWnd->head is setup in object.c ... */
1888 WndSetParent(pWnd, ParentWindow);
1889 WndSetOwner(pWnd, OwnerWindow);
1890 pWnd->fnid = 0;
1891 WndSetLastActive(pWnd, pWnd);
1892 // Ramp up compatible version sets.
1893 if ( dwVer >= WINVER_WIN31 )
1894 {
1895 pWnd->state2 |= WNDS2_WIN31COMPAT;
1896 if ( dwVer >= WINVER_WINNT4 )
1897 {
1898 pWnd->state2 |= WNDS2_WIN40COMPAT;
1899 if ( dwVer >= WINVER_WIN2K )
1900 {
1901 pWnd->state2 |= WNDS2_WIN50COMPAT;
1902 }
1903 }
1904 }
1905 pWnd->pcls = Class;
1906 pWnd->hModule = Cs->hInstance;
1907 pWnd->style = Cs->style & ~WS_VISIBLE;
1908 pWnd->ExStyle = Cs->dwExStyle;
1909 pWnd->cbwndExtra = pWnd->pcls->cbwndExtra;
1910 pWnd->pActCtx = acbiBuffer;
1911
1912 if (pti->spDefaultImc && Class->atomClassName != gpsi->atomSysClass[ICLS_BUTTON])
1913 pWnd->hImc = UserHMGetHandle(pti->spDefaultImc);
1914
1915 pWnd->InternalPos.MaxPos.x = pWnd->InternalPos.MaxPos.y = -1;
1916 pWnd->InternalPos.IconPos.x = pWnd->InternalPos.IconPos.y = -1;
1917
1918 if (pWnd->spwndParent != NULL && Cs->hwndParent != 0)
1919 {
1920 pWnd->HideFocus = pWnd->spwndParent->HideFocus;
1921 pWnd->HideAccel = pWnd->spwndParent->HideAccel;
1922 }
1923
1925 pWnd->head.pti->cWindows++;
1926
1927 if (Class->spicn && !Class->spicnSm)
1928 {
1929 HICON IconSmHandle = NULL;
1930 if((Class->spicn->CURSORF_flags & (CURSORF_LRSHARED | CURSORF_FROMRESOURCE))
1932 {
1933 IconSmHandle = co_IntCopyImage(
1934 UserHMGetHandle(Class->spicn),
1935 IMAGE_ICON,
1939 }
1940 if (!IconSmHandle)
1941 {
1942 /* Retry without copying from resource */
1943 IconSmHandle = co_IntCopyImage(
1944 UserHMGetHandle(Class->spicn),
1945 IMAGE_ICON,
1948 0);
1949 }
1950
1951 if (IconSmHandle)
1952 {
1953 Class->spicnSm = UserGetCurIconObject(IconSmHandle);
1954 Class->CSF_flags |= CSF_CACHEDSMICON;
1955 }
1956 }
1957
1958 if (pWnd->pcls->CSF_flags & CSF_SERVERSIDEPROC)
1960
1961 /* BugBoy Comments: Comment below say that System classes are always created
1962 as UNICODE. In windows, creating a window with the ANSI version of CreateWindow
1963 sets the window to ansi as verified by testing with IsUnicodeWindow API.
1964
1965 No where can I see in code or through testing does the window change back
1966 to ANSI after being created as UNICODE in ROS. I didnt do more testing to
1967 see what problems this would cause. */
1968
1969 // Set WndProc from Class.
1970 if (IsCallProcHandle(pWnd->pcls->lpfnWndProc))
1971 {
1973 if (pcpd)
1974 pWnd->lpfnWndProc = pcpd->pfnClientPrevious;
1975 }
1976 else
1977 {
1978 pWnd->lpfnWndProc = pWnd->pcls->lpfnWndProc;
1979 }
1980
1981 // GetWindowProc, test for non server side default classes and set WndProc.
1982 if ( pWnd->pcls->fnid <= FNID_GHOST && pWnd->pcls->fnid >= FNID_BUTTON )
1983 {
1984 if (bUnicodeWindow)
1985 {
1986 if (GETPFNCLIENTA(pWnd->pcls->fnid) == pWnd->lpfnWndProc)
1987 pWnd->lpfnWndProc = GETPFNCLIENTW(pWnd->pcls->fnid);
1988 }
1989 else
1990 {
1991 if (GETPFNCLIENTW(pWnd->pcls->fnid) == pWnd->lpfnWndProc)
1992 pWnd->lpfnWndProc = GETPFNCLIENTA(pWnd->pcls->fnid);
1993 }
1994 }
1995
1996 // If not an Unicode caller, set Ansi creator bit.
1997 if (!bUnicodeWindow) pWnd->state |= WNDS_ANSICREATOR;
1998
1999 // Clone Class Ansi/Unicode proc type.
2000 if (pWnd->pcls->CSF_flags & CSF_ANSIPROC)
2001 {
2002 pWnd->state |= WNDS_ANSIWINDOWPROC;
2003 pWnd->Unicode = FALSE;
2004 }
2005 else
2006 { /*
2007 * It seems there can be both an Ansi creator and Unicode Class Window
2008 * WndProc, unless the following overriding conditions occur:
2009 */
2010 if ( !bUnicodeWindow &&
2011 ( Class->atomClassName == gpsi->atomSysClass[ICLS_BUTTON] ||
2012 Class->atomClassName == gpsi->atomSysClass[ICLS_COMBOBOX] ||
2013 Class->atomClassName == gpsi->atomSysClass[ICLS_COMBOLBOX] ||
2014 Class->atomClassName == gpsi->atomSysClass[ICLS_DIALOG] ||
2015 Class->atomClassName == gpsi->atomSysClass[ICLS_EDIT] ||
2016 Class->atomClassName == gpsi->atomSysClass[ICLS_IME] ||
2017 Class->atomClassName == gpsi->atomSysClass[ICLS_LISTBOX] ||
2018 Class->atomClassName == gpsi->atomSysClass[ICLS_MDICLIENT] ||
2019 Class->atomClassName == gpsi->atomSysClass[ICLS_STATIC] ) )
2020 { // Override Class and set the window Ansi WndProc.
2021 pWnd->state |= WNDS_ANSIWINDOWPROC;
2022 pWnd->Unicode = FALSE;
2023 }
2024 else
2025 { // Set the window Unicode WndProc.
2026 pWnd->state &= ~WNDS_ANSIWINDOWPROC;
2027 pWnd->Unicode = TRUE;
2028 }
2029 }
2030
2031 /* BugBoy Comments: if the window being created is a edit control, ATOM 0xCxxx,
2032 then my testing shows that windows (2k and XP) creates a CallProc for it immediately
2033 Dont understand why it does this. */
2034 if (Class->atomClassName == gpsi->atomSysClass[ICLS_EDIT])
2035 {
2036 PCALLPROCDATA CallProc;
2037 CallProc = CreateCallProc(pWnd->head.rpdesk, pWnd->lpfnWndProc, pWnd->Unicode , pWnd->head.pti->ppi);
2038
2039 if (!CallProc)
2040 {
2042 ERR("Warning: Unable to create CallProc for edit control. Control may not operate correctly! hwnd %p\n", hWnd);
2043 }
2044 else
2045 {
2046 UserAddCallProcToClass(pWnd->pcls, CallProc);
2047 }
2048 }
2049
2051 pWnd->PropListItems = 0;
2052
2053 if ( WindowName->Buffer != NULL && WindowName->Length > 0 )
2054 {
2056 WindowName->Length + sizeof(UNICODE_NULL));
2057 if (pWnd->strName.Buffer == NULL)
2058 {
2059 goto AllocError;
2060 }
2061
2062 RtlCopyMemory(pWnd->strName.Buffer, WindowName->Buffer, WindowName->Length);
2063 pWnd->strName.Buffer[WindowName->Length / sizeof(WCHAR)] = L'\0';
2064 pWnd->strName.Length = WindowName->Length;
2065 pWnd->strName.MaximumLength = WindowName->Length + sizeof(UNICODE_NULL);
2066 }
2067
2068 /* Correct the window style. */
2069 if ((pWnd->style & (WS_CHILD | WS_POPUP)) != WS_CHILD)
2070 {
2071 pWnd->style |= WS_CLIPSIBLINGS;
2072 if (!(pWnd->style & WS_POPUP))
2073 {
2074 pWnd->style |= WS_CAPTION;
2075 }
2076 }
2077
2078 /* WS_EX_WINDOWEDGE depends on some other styles */
2079 if (pWnd->ExStyle & WS_EX_DLGMODALFRAME)
2080 pWnd->ExStyle |= WS_EX_WINDOWEDGE;
2081 else if (pWnd->style & (WS_DLGFRAME | WS_THICKFRAME))
2082 {
2083 if (!((pWnd->ExStyle & WS_EX_STATICEDGE) &&
2084 (pWnd->style & (WS_CHILD | WS_POPUP))))
2085 pWnd->ExStyle |= WS_EX_WINDOWEDGE;
2086 }
2087 else
2088 pWnd->ExStyle &= ~WS_EX_WINDOWEDGE;
2089
2090 if (!(pWnd->style & (WS_CHILD | WS_POPUP)))
2092
2093 /* Set the window menu */
2094 if ((Cs->style & (WS_CHILD | WS_POPUP)) != WS_CHILD)
2095 {
2096 if (Cs->hMenu)
2097 {
2098 IntSetMenu(pWnd, Cs->hMenu, &MenuChanged);
2099 }
2100 else if (pWnd->pcls->lpszMenuName) // Take it from the parent.
2101 {
2102 UNICODE_STRING MenuName;
2103 HMENU hMenu;
2104
2105 if (IS_INTRESOURCE(pWnd->pcls->lpszMenuName))
2106 {
2107 MenuName.Length = 0;
2108 MenuName.MaximumLength = 0;
2109 MenuName.Buffer = pWnd->pcls->lpszMenuName;
2110 }
2111 else
2112 {
2113 RtlInitUnicodeString( &MenuName, pWnd->pcls->lpszMenuName);
2114 }
2115 hMenu = co_IntCallLoadMenu( pWnd->pcls->hModule, &MenuName);
2116 if (hMenu) IntSetMenu(pWnd, hMenu, &MenuChanged);
2117 }
2118 }
2119 else // Not a child
2120 pWnd->IDMenu = (UINT_PTR)Cs->hMenu;
2121
2122
2123 if ( ParentWindow &&
2124 ParentWindow != ParentWindow->head.rpdesk->spwndMessage &&
2125 ParentWindow != ParentWindow->head.rpdesk->pDeskInfo->spwnd )
2126 {
2127 PWND Owner = IntGetNonChildAncestor(ParentWindow);
2128
2129 if (!IntValidateOwnerDepth(pWnd, Owner))
2130 {
2132 goto Error;
2133 }
2134 if ( pWnd->spwndOwner &&
2135 pWnd->spwndOwner->ExStyle & WS_EX_TOPMOST )
2136 {
2137 pWnd->ExStyle |= WS_EX_TOPMOST;
2138 }
2139 if ( pWnd->spwndOwner &&
2140 Class->atomClassName != gpsi->atomSysClass[ICLS_IME] &&
2141 pti != pWnd->spwndOwner->head.pti)
2142 {
2143 //ERR("CreateWindow Owner in.\n");
2144 UserAttachThreadInput(pti, pWnd->spwndOwner->head.pti, TRUE);
2145 }
2146 }
2147
2148 /* Insert the window into the thread's window list. */
2150
2151 /* Handle "CS_CLASSDC", it is tested first. */
2152 if ( (pWnd->pcls->style & CS_CLASSDC) && !(pWnd->pcls->pdce) )
2153 { /* One DCE per class to have CLASS. */
2154 pWnd->pcls->pdce = DceAllocDCE( pWnd, DCE_CLASS_DC );
2155 }
2156 else if ( pWnd->pcls->style & CS_OWNDC)
2157 { /* Allocate a DCE for this window. */
2159 }
2160
2161 return pWnd;
2162
2163AllocError:
2164 ERR("IntCreateWindow Allocation Error.\n");
2166Error:
2167 if(pWnd)
2169 return NULL;
2170}
BOOL Error
Definition: chkdsk.c:66
PCALLPROCDATA CreateCallProc(IN PDESKTOP Desktop, IN WNDPROC WndProc, IN BOOL Unicode, IN PPROCESSINFO pi)
Definition: callproc.c:29
static __inline BOOL IsCallProcHandle(IN WNDPROC lpWndProc)
Definition: class.h:13
PDCE FASTCALL DceAllocDCE(PWND Window, DCE_TYPE Type)
Definition: windc.c:86
@ DCE_CLASS_DC
Definition: dce.h:13
@ DCE_WINDOW_DC
Definition: dce.h:14
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define InsertTailList(ListHead, Entry)
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
#define ICLS_DIALOG
Definition: ntuser.h:930
#define ICLS_LISTBOX
Definition: ntuser.h:915
#define WNDS2_WIN40COMPAT
Definition: ntuser.h:650
#define ICLS_EDIT
Definition: ntuser.h:913
#define CURSORF_LRSHARED
Definition: ntuser.h:1201
#define ICLS_COMBOBOX
Definition: ntuser.h:917
#define ICLS_STATIC
Definition: ntuser.h:914
#define GETPFNCLIENTW(fnid)
Definition: ntuser.h:906
#define GETPFNCLIENTA(fnid)
Definition: ntuser.h:904
#define CSF_ANSIPROC
Definition: ntuser.h:557
#define WNDS_SERVERSIDEWINDOWPROC
Definition: ntuser.h:623
#define FNID_BUTTON
Definition: ntuser.h:866
#define CSF_CACHEDSMICON
Definition: ntuser.h:562
struct _WND * PWND
#define FNID_DIALOG
Definition: ntuser.h:869
#define ICLS_COMBOLBOX
Definition: ntuser.h:919
#define ICLS_BUTTON
Definition: ntuser.h:912
struct _WND WND
@ TYPE_CALLPROC
Definition: ntuser.h:47
#define CURSORF_FROMRESOURCE
Definition: ntuser.h:1199
#define CSF_SERVERSIDEPROC
Definition: ntuser.h:556
#define WNDS_ANSICREATOR
Definition: ntuser.h:634
#define FNID_GHOST
Definition: ntuser.h:875
#define ICLS_MDICLIENT
Definition: ntuser.h:918
#define WNDS2_WIN50COMPAT
Definition: ntuser.h:651
#define WNDS_ANSIWINDOWPROC
Definition: ntuser.h:624
if(dx< 0)
Definition: linetemp.h:194
static HICON
Definition: imagelist.c:80
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
_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:1609
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define UNICODE_NULL
PVOID *typedef PHANDLE
Definition: ntsecpkg.h:455
#define WS_EX_TOPMOST
Definition: pedump.c:647
WNDPROC pfnClientPrevious
Definition: ntuser.h:552
PWSTR lpszMenuName
Definition: ntuser.h:588
WNDPROC lpfnWndProc
Definition: ntuser.h:581
INT cbwndExtra
Definition: ntuser.h:583
DWORD CSF_flags
Definition: ntuser.h:573
UINT style
Definition: ntuser.h:580
HINSTANCE hModule
Definition: ntuser.h:584
DWORD fnid
Definition: ntuser.h:570
PVOID pdce
Definition: ntuser.h:572
ULONG Length
Definition: ntuser.h:91
PVOID Buffer
Definition: ntuser.h:94
struct _DESKTOP * rpdesk
Definition: ntuser.h:194
LIST_ENTRY WindowListHead
Definition: win32.h:155
LIST_ENTRY ThreadListEntry
Definition: ntuser.h:764
PCLS pcls
Definition: ntuser.h:720
struct _WND * spwndOwner
Definition: ntuser.h:715
UINT Unicode
Definition: ntuser.h:756
ULONG PropListItems
Definition: ntuser.h:724
PVOID pActCtx
Definition: ntuser.h:742
DWORD fnid
Definition: ntuser.h:709
UINT HideFocus
Definition: ntuser.h:758
UINT HideAccel
Definition: ntuser.h:759
LIST_ENTRY PropListHead
Definition: ntuser.h:723
HIMC hImc
Definition: ntuser.h:740
LARGE_UNICODE_STRING strName
Definition: ntuser.h:736
DWORD state
Definition: ntuser.h:701
UINT_PTR IDMenu
Definition: ntuser.h:731
WNDPROC lpfnWndProc
Definition: ntuser.h:718
HINSTANCE hModule
Definition: ntuser.h:708
struct _WND::@5119 InternalPos
ULONG cbwndExtra
Definition: ntuser.h:738
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define WS_EX_SETANSICREATOR
Definition: undocuser.h:28
VOID FASTCALL SetLastNtError(_In_ NTSTATUS Status)
Definition: error.c:31
HMENU APIENTRY co_IntCallLoadMenu(HINSTANCE hModule, PUNICODE_STRING pMenuName)
Definition: callback.c:903
HANDLE FASTCALL co_IntCopyImage(HANDLE hnd, UINT type, INT desiredx, INT desiredy, UINT flags)
Definition: callback.c:985
VOID UserAddCallProcToClass(IN OUT PCLS Class, IN PCALLPROCDATA CallProc)
Definition: class.c:428
PCURICON_OBJECT FASTCALL UserGetCurIconObject(HCURSOR hCurIcon)
Definition: cursoricon.c:200
PTHREADINFO gptiDesktopThread
Definition: desktop.c:54
static __inline PVOID DesktopHeapAlloc(IN PDESKTOP Desktop, IN SIZE_T Bytes)
Definition: desktop.h:204
BOOL FASTCALL IntSetMenu(PWND Wnd, HMENU Menu, BOOL *Changed)
Definition: menu.c:5475
PVOID UserGetObject(PUSER_HANDLE_TABLE ht, HANDLE handle, HANDLE_TYPE type)
Definition: object.c:495
PUSER_HANDLE_TABLE gHandleTable
Definition: object.c:13
PVOID FASTCALL UserCreateObject(PUSER_HANDLE_TABLE ht, PDESKTOP pDesktop, PTHREADINFO pti, HANDLE *h, HANDLE_TYPE type, ULONG size)
Definition: object.c:568
BOOL FASTCALL IntValidateOwnerDepth(PWND Wnd, PWND Owner)
Definition: window.c:369
PWND FASTCALL IntGetNonChildAncestor(PWND pWnd)
Definition: window.c:353
#define WINVER_WIN2K
Definition: window.h:56
#define WINVER_WINNT4
Definition: window.h:57
#define WINVER_WIN31
Definition: window.h:58
#define WS_EX_STATICEDGE
Definition: winuser.h:403
#define IMAGE_ICON
Definition: winuser.h:212
#define LR_COPYFROMRESOURCE
Definition: winuser.h:1102
#define SM_CYSMICON
Definition: winuser.h:1016
#define SM_CXSMICON
Definition: winuser.h:1015
#define WS_EX_WINDOWEDGE
Definition: winuser.h:407
#define CS_OWNDC
Definition: winuser.h:655
#define CS_CLASSDC
Definition: winuser.h:650
#define WS_EX_NOINHERITLAYOUT
Definition: winuser.h:396
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by co_UserCreateWindowEx(), and IntCreateDesktop().

◆ IntDefWindowProc()

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

Definition at line 535 of file defwnd.c.

541{
543 LRESULT lResult = 0;
545
546 if (Msg > WM_USER) return 0;
547
548 switch (Msg)
549 {
550 case WM_DEVICECHANGE:
551 return TRUE;
552
553 case WM_GETTEXTLENGTH:
554 {
555 PWSTR buf;
556 ULONG len;
557
558 if (Wnd != NULL && Wnd->strName.Length != 0)
559 {
560 buf = Wnd->strName.Buffer;
561 if (buf != NULL &&
563 buf,
564 Wnd->strName.Length)))
565 {
566 lResult = (LRESULT) (Wnd->strName.Length / sizeof(WCHAR));
567 }
568 }
569
570 break;
571 }
572
573 case WM_GETTEXT: // FIXME: Handle Ansi
574 {
575 PWSTR buf = NULL;
576 PWSTR outbuf = (PWSTR)lParam;
577
578 if (Wnd != NULL && wParam != 0)
579 {
580 if (Wnd->strName.Buffer != NULL)
581 buf = Wnd->strName.Buffer;
582 else
583 outbuf[0] = L'\0';
584
585 if (buf != NULL)
586 {
587 if (Wnd->strName.Length != 0)
588 {
589 lResult = min(Wnd->strName.Length / sizeof(WCHAR), wParam - 1);
590 RtlCopyMemory(outbuf,
591 buf,
592 lResult * sizeof(WCHAR));
593 outbuf[lResult] = L'\0';
594 }
595 else
596 outbuf[0] = L'\0';
597 }
598 }
599 break;
600 }
601
602 case WM_SETTEXT: // FIXME: Handle Ansi
603 {
604 DefSetText(Wnd, (PCWSTR)lParam);
605
606 if ((Wnd->style & WS_CAPTION) == WS_CAPTION)
608 IntNotifyWinEvent(EVENT_OBJECT_NAMECHANGE, Wnd, OBJID_WINDOW, CHILDID_SELF, 0);
609 lResult = 1;
610 break;
611 }
612
613 case WM_SYSCOMMAND:
614 {
615 TRACE("hwnd %p WM_SYSCOMMAND %lx %lx\n", UserHMGetHandle(Wnd), wParam, lParam );
616 lResult = DefWndHandleSysCommand(Wnd, wParam, lParam);
617 break;
618 }
619
620 case WM_SHOWWINDOW:
621 {
622 if ((Wnd->style & WS_VISIBLE) && wParam) break;
623 if (!(Wnd->style & WS_VISIBLE) && !wParam) break;
624 if (!Wnd->spwndOwner) break;
625 if (LOWORD(lParam))
626 {
628 }
629 break;
630 }
631
633 return IntClientShutdown(Wnd, wParam, lParam);
634
635 case WM_APPCOMMAND:
636 if ( (Wnd->style & (WS_POPUP|WS_CHILD)) != WS_CHILD &&
637 Wnd != co_GetDesktopWindow(Wnd) )
638 {
639 if (!co_HOOK_CallHooks(WH_SHELL, HSHELL_APPCOMMAND, wParam, lParam))
640 co_IntShellHookNotify(HSHELL_APPCOMMAND, wParam, lParam);
641 break;
642 }
643 UserRefObjectCo(Wnd->spwndParent, &Ref);
644 lResult = co_IntSendMessage(UserHMGetHandle(Wnd->spwndParent), WM_APPCOMMAND, wParam, lParam);
645 UserDerefObjectCo(Wnd->spwndParent);
646 break;
647
648 case WM_KEYF1:
649 {
650 HELPINFO hi;
651 HMENU hMenu = UlongToHandle(Wnd->IDMenu);
652 PWND pwndActive = MENU_IsMenuActive();
653 hi.cbSize = sizeof(HELPINFO);
654 hi.MousePos = gpsi->ptCursor;
656 hi.hItemHandle = pwndActive ? UserHMGetHandle(pwndActive) : UserHMGetHandle(Wnd);
657 hi.iCtrlId = (Wnd->style & (WS_POPUP|WS_CHILD)) == WS_CHILD ? IntMenuItemFromPoint(Wnd, hMenu, hi.MousePos) : 0;
659
660 co_IntSendMessage( UserHMGetHandle(Wnd), WM_HELP, 0, (LPARAM)&hi );
661 break;
662 }
663
664 case WM_SETICON:
665 {
666 return DefWndSetIcon(Wnd, wParam, lParam);
667 }
668
669 case WM_GETICON:
670 {
671 return DefWndGetIcon(Wnd, wParam, lParam);
672 }
673
674 case WM_HELP:
675 {
676 PWND Parent = IntGetParent(Wnd);
678 break;
679 }
680
681 case WM_LBUTTONDOWN:
682 case WM_RBUTTONDOWN:
683 case WM_MBUTTONDOWN:
685 break;
686
687 case WM_NCLBUTTONDOWN:
689
690 case WM_NCRBUTTONDOWN:
692
693 case WM_LBUTTONDBLCLK:
695
698
699 case WM_RBUTTONUP:
700 {
701 POINT Pt;
702
703 Pt.x = GET_X_LPARAM(lParam);
704 Pt.y = GET_Y_LPARAM(lParam);
705 IntClientToScreen(Wnd, &Pt);
706 lParam = MAKELPARAM(Pt.x, Pt.y);
708 break;
709 }
710
711 case WM_NCRBUTTONUP:
712 /*
713 * FIXME : we must NOT send WM_CONTEXTMENU on a WM_NCRBUTTONUP (checked
714 * in Windows), but what _should_ we do? According to MSDN :
715 * "If it is appropriate to do so, the system sends the WM_SYSCOMMAND
716 * message to the window". When is it appropriate?
717 */
718 ERR("WM_NCRBUTTONUP\n");
719 break;
720
721 case WM_XBUTTONUP:
722 case WM_NCXBUTTONUP:
723 if (HIWORD(wParam) == XBUTTON1 || HIWORD(wParam) == XBUTTON2)
724 {
726 MAKELPARAM(LOWORD(wParam), FAPPCOMMAND_MOUSE | HIWORD(wParam)));
727 }
728 break;
729
730
731 case WM_CONTEXTMENU:
732 {
733 if (Wnd->style & WS_CHILD)
734 {
736 }
737 else
738 {
739 POINT Pt;
741 LONG HitCode;
742
743 Style = Wnd->style;
744
745 Pt.x = GET_X_LPARAM(lParam);
746 Pt.y = GET_Y_LPARAM(lParam);
747 if (Style & WS_CHILD)
748 {
750 }
751
752 HitCode = GetNCHitEx(Wnd, Pt);
753
754 if (HitCode == HTCAPTION || HitCode == HTSYSMENU)
755 {
756 PMENU SystemMenu;
757 UINT Flags;
758
759 if((SystemMenu = IntGetSystemMenu(Wnd, FALSE)))
760 {
761 MENU_InitSysMenuPopup(SystemMenu, Wnd->style, Wnd->pcls->style, HitCode);
762
763 if(HitCode == HTCAPTION)
765 else
767
768 IntTrackPopupMenuEx(SystemMenu, Flags|TPM_SYSTEM_MENU, Pt.x, Pt.y, Wnd, NULL);
769 }
770 }
771 if (HitCode == HTHSCROLL || HitCode == HTVSCROLL)
772 {
773 WARN("Scroll Menu Not Supported\n");
774 }
775 }
776 break;
777 }
778
779 case WM_KEYDOWN:
780 if (wParam == VK_F10)
781 {
782 pti->MessageQueue->QF_flags |= QF_FF10STATUS;
783
784 if (UserGetKeyState(VK_SHIFT) & 0x8000)
785 {
787 }
788 }
790 {
791 HWND hwndTop = UserGetForegroundWindow();
792 PWND topWnd = UserGetWindowObject(hwndTop);
793 BOOL allowSnap;
794
795 // MS Doc: foreground window can be NULL, e.g. when window is losing activation
796 if (!topWnd)
797 return 0;
798
799 allowSnap = IntIsSnapAllowedForWindow(topWnd);
800 /* Allow the minimize action if it has a minimize button, even if the window cannot be snapped (e.g. Calc.exe) */
801 if (!allowSnap && (topWnd->style & (WS_MINIMIZEBOX|WS_THICKFRAME)) == WS_MINIMIZEBOX)
802 allowSnap = wParam == VK_DOWN;
803
804 if (allowSnap)
805 {
806 UINT snapped = IntGetWindowSnapEdge(topWnd);
807
808 if (wParam == VK_DOWN)
809 {
810 if (topWnd->style & WS_MAXIMIZE)
812 else if (snapped)
813 co_IntUnsnapWindow(topWnd);
814 else
816 }
817 else if (wParam == VK_UP)
818 {
819 if (topWnd->style & WS_MINIMIZE)
821 else
823 }
824 else if (wParam == VK_LEFT || wParam == VK_RIGHT)
825 {
826 UINT edge = wParam == VK_LEFT ? HTLEFT : HTRIGHT;
827 UINT otherEdge = edge == HTLEFT ? HTRIGHT : HTLEFT;
828
829 if (topWnd->style & WS_MAXIMIZE)
830 {
831 /* SC_RESTORE + Snap causes the window to visually move twice, place it manually in the snap position */
832 RECT normalRect = topWnd->InternalPos.NormalRect;
833 co_IntCalculateSnapPosition(topWnd, edge, &topWnd->InternalPos.NormalRect); /* Calculate edge position */
834 IntSetSnapEdge(topWnd, edge); /* Tell everyone the edge we are snapped to */
836 IntSetSnapInfo(topWnd, edge, &normalRect); /* Reset the real place to unsnap to */
837 snapped = HTNOWHERE; /* Force snap */
838 }
839#if 0 /* Windows 8 does this but is it a good feature? */
840 else if (snapped == edge)
841 {
842 /* Already snapped to this edge, snap to the opposite side */
843 edge = otherEdge;
844 }
845#endif
846
847 if (snapped == otherEdge)
848 co_IntUnsnapWindow(topWnd);
849 else
850 co_IntSnapWindow(topWnd, edge);
851 }
852 }
853 }
854 break;
855
856 case WM_SYSKEYDOWN:
857 {
858 if (HIWORD(lParam) & KF_ALTDOWN)
859 { /* Previous state, if the key was down before this message,
860 this is a cheap way to ignore autorepeat keys. */
861 if ( !(HIWORD(lParam) & KF_REPEAT) )
862 {
863 if ( ( wParam == VK_MENU ||
864 wParam == VK_LMENU ||
865 wParam == VK_RMENU ) && !(pti->MessageQueue->QF_flags & QF_FMENUSTATUS)) //iMenuSysKey )
866 pti->MessageQueue->QF_flags |= QF_FMENUSTATUS; //iMenuSysKey = 1;
867 else
868 pti->MessageQueue->QF_flags &= ~QF_FMENUSTATUS; //iMenuSysKey = 0;
869 }
870
871 pti->MessageQueue->QF_flags &= ~QF_FF10STATUS; //iF10Key = 0;
872
873 if (wParam == VK_F4) /* Try to close the window */
874 {
876 if (!(top->pcls->style & CS_NOCLOSE))
878 }
879 else if (wParam == VK_SNAPSHOT) // Alt-VK_SNAPSHOT?
880 {
881 PWND pwnd = Wnd;
882 while (IntGetParent(pwnd) != NULL)
883 {
884 pwnd = IntGetParent(pwnd);
885 }
886 ERR("DefWndScreenshot\n");
887 DefWndScreenshot(pwnd);
888 }
889 else if ( wParam == VK_ESCAPE || wParam == VK_TAB ) // Alt-Tab/ESC Alt-Shift-Tab/ESC
890 {
891 WPARAM wParamTmp;
892 HWND Active = UserGetActiveWindow(); // Noticed MDI problem.
893 if (!Active)
894 {
895 FIXME("WM_SYSKEYDOWN VK_ESCAPE no active\n");
896 break;
897 }
898 wParamTmp = UserGetKeyState(VK_SHIFT) & 0x8000 ? SC_PREVWINDOW : SC_NEXTWINDOW;
900 }
901 }
902 else if( wParam == VK_F10 )
903 {
904 if (UserGetKeyState(VK_SHIFT) & 0x8000)
906 pti->MessageQueue->QF_flags |= QF_FF10STATUS; //iF10Key = 1;
907 }
908 else if( wParam == VK_ESCAPE && (UserGetKeyState(VK_SHIFT) & 0x8000))
910 break;
911 }
912
913 case WM_KEYUP:
914 case WM_SYSKEYUP:
915 {
916 /* Press and release F10 or ALT */
917 if (((wParam == VK_MENU || wParam == VK_LMENU || wParam == VK_RMENU)
918 && (pti->MessageQueue->QF_flags & (QF_FMENUSTATUS|QF_FMENUSTATUSBREAK)) == QF_FMENUSTATUS /*iMenuSysKey*/) ||
919 ((wParam == VK_F10) && pti->MessageQueue->QF_flags & QF_FF10STATUS /*iF10Key*/))
921 pti->MessageQueue->QF_flags &= ~(QF_FMENUSTATUS|QF_FMENUSTATUSBREAK|QF_FF10STATUS); //iMenuSysKey = iF10Key = 0;
922 break;
923 }
924
925 case WM_SYSCHAR:
926 {
927 pti->MessageQueue->QF_flags &= ~(QF_FMENUSTATUS|QF_FMENUSTATUSBREAK); //iMenuSysKey = 0;
928 if (wParam == VK_RETURN && (Wnd->style & WS_MINIMIZE) != 0)
929 {
931 break;
932 }
933 if ((HIWORD(lParam) & KF_ALTDOWN) && wParam)
934 {
935 if (wParam == VK_TAB || wParam == VK_ESCAPE) break;
936 if (wParam == VK_SPACE && Wnd->style & WS_CHILD)
938 else
940 }
941 else /* check for Ctrl-Esc */
943 break;
944 }
945
946 case WM_CANCELMODE:
947 {
949
950 MENU_EndMenu( Wnd );
952 {
954 }
955 break;
956 }
957
958 case WM_CLOSE:
960 break;
961
963 case WM_CTLCOLOREDIT:
965 case WM_CTLCOLORBTN:
966 case WM_CTLCOLORDLG:
970
971 case WM_CTLCOLOR:
973
974 case WM_SETCURSOR:
975 {
976 if (Wnd->style & WS_CHILD)
977 {
978 /* with the exception of the border around a resizable wnd,
979 * give the parent first chance to set the cursor */
981 {
982 PWND parent = Wnd->spwndParent;//IntGetParent( Wnd );
983 if (parent != UserGetDesktopWindow() &&
985 return TRUE;
986 }
987 }
988 return DefWndHandleSetCursor(Wnd, wParam, lParam);
989 }
990
991 case WM_MOUSEACTIVATE:
992 if (Wnd->style & WS_CHILD)
993 {
995 PWND pwndParent = IntGetParent(Wnd);
996 hwndParent = pwndParent ? UserHMGetHandle(pwndParent) : NULL;
997 if (hwndParent)
998 {
1000 if (lResult)
1001 break;
1002 }
1003 }
1005
1006 case WM_ACTIVATE:
1007 /* The default action in Windows is to set the keyboard focus to
1008 * the window, if it's being activated and not minimized */
1009 if (LOWORD(wParam) != WA_INACTIVE &&
1010 !(Wnd->style & WS_MINIMIZE))
1011 {
1012 //ERR("WM_ACTIVATE %p\n",hWnd);
1013 co_UserSetFocus(Wnd);
1014 }
1015 break;
1016
1017 case WM_MOUSEWHEEL:
1018 if (Wnd->style & WS_CHILD)
1019 {
1021 PWND pwndParent = IntGetParent(Wnd);
1022 hwndParent = pwndParent ? UserHMGetHandle(pwndParent) : NULL;
1024 }
1025 break;
1026
1027 case WM_ERASEBKGND:
1028 case WM_ICONERASEBKGND:
1029 {
1030 RECT Rect;
1031 HBRUSH hBrush = Wnd->pcls->hbrBackground;
1032 if (!hBrush) return 0;
1033 if (hBrush <= (HBRUSH)COLOR_MENUBAR)
1034 {
1035 hBrush = IntGetSysColorBrush(HandleToUlong(hBrush));
1036 }
1037 if (Wnd->pcls->style & CS_PARENTDC)
1038 {
1039 /* can't use GetClipBox with a parent DC or we fill the whole parent */
1040 IntGetClientRect(Wnd, &Rect);
1042 }
1043 else
1044 {
1045 GdiGetClipBox((HDC)wParam, &Rect);
1046 }
1047 FillRect((HDC)wParam, &Rect, hBrush);
1048 return (1);
1049 }
1050
1051 case WM_GETHOTKEY:
1052 //ERR("WM_GETHOTKEY\n");
1053 return DefWndGetHotKey(Wnd);
1054 case WM_SETHOTKEY:
1055 //ERR("WM_SETHOTKEY\n");
1056 return DefWndSetHotKey(Wnd, wParam);
1057
1058 case WM_NCHITTEST:
1059 {
1060 POINT Point;
1063 return GetNCHitEx(Wnd, Point);
1064 }
1065
1066 case WM_PRINT:
1067 {
1068 DefWndPrint(Wnd, (HDC)wParam, lParam);
1069 return (0);
1070 }
1071
1072 case WM_SYSCOLORCHANGE:
1073 {
1074 /* force to redraw non-client area */
1075 UserPaintCaption(Wnd, DC_NC);
1076 /* Use InvalidateRect to redraw client area, enable
1077 * erase to redraw all subcontrols otherwise send the
1078 * WM_SYSCOLORCHANGE to child windows/controls is required
1079 */
1081 return (0);
1082 }
1083
1084 case WM_PAINTICON:
1085 case WM_PAINT:
1086 {
1087 PAINTSTRUCT Ps;
1088 HDC hDC;
1089
1090 /* If already in Paint and Client area is not empty just return. */
1091 if (Wnd->state2 & WNDS2_STARTPAINT && !RECTL_bIsEmptyRect(&Wnd->rcClient))
1092 {
1093 ERR("In Paint and Client area is not empty!\n");
1094 return 0;
1095 }
1096
1097 hDC = IntBeginPaint(Wnd, &Ps);
1098 if (hDC)
1099 {
1100 if (((Wnd->style & WS_MINIMIZE) != 0) && (Wnd->pcls->spicn))
1101 {
1102 RECT ClientRect;
1103 INT x, y;
1104
1105 ERR("Doing Paint and Client area is empty!\n");
1106 IntGetClientRect(Wnd, &ClientRect);
1107 x = (ClientRect.right - ClientRect.left - UserGetSystemMetrics(SM_CXICON)) / 2;
1108 y = (ClientRect.bottom - ClientRect.top - UserGetSystemMetrics(SM_CYICON)) / 2;
1109 UserReferenceObject(Wnd->pcls->spicn);
1110 UserDrawIconEx(hDC, x, y, Wnd->pcls->spicn, 0, 0, 0, 0, DI_NORMAL | DI_COMPAT | DI_DEFAULTSIZE);
1111 UserDereferenceObject(Wnd->pcls->spicn);
1112 }
1113
1114 IntEndPaint(Wnd, &Ps);
1115 }
1116 return (0);
1117 }
1118
1119 case WM_SYNCPAINT:
1120 {
1121 HRGN hRgn;
1122 Wnd->state &= ~WNDS_SYNCPAINTPENDING;
1123 TRACE("WM_SYNCPAINT\n");
1124 hRgn = NtGdiCreateRectRgn(0, 0, 0, 0);
1125 if (hRgn)
1126 {
1128 {
1129 PREGION pRgn = REGION_LockRgn(hRgn);
1130 if (pRgn) REGION_UnlockRgn(pRgn);
1131 if (!wParam)
1133 co_UserRedrawWindow(Wnd, NULL, pRgn, wParam);
1134 }
1136 }
1137 return 0;
1138 }
1139
1140 case WM_SETREDRAW:
1141 if (wParam)
1142 {
1143 if (!(Wnd->style & WS_VISIBLE))
1144 {
1145 IntSetStyle( Wnd, WS_VISIBLE, 0 );
1146 Wnd->state |= WNDS_SENDNCPAINT;
1147 }
1148 }
1149 else
1150 {
1151 if (Wnd->style & WS_VISIBLE)
1152 {
1154 IntSetStyle( Wnd, 0, WS_VISIBLE );
1155 }
1156 }
1157 return 0;
1158
1160 {
1162 }
1163
1165 {
1167 }
1168
1169 case WM_NCCALCSIZE:
1170 {
1171 return NC_HandleNCCalcSize( Wnd, wParam, (RECTL *)lParam, FALSE );
1172 }
1173
1174 case WM_NCACTIVATE:
1175 {
1176 return NC_HandleNCActivate( Wnd, wParam, lParam );
1177 }
1178
1179 //
1180 // NC Paint mode.
1181 //
1182 case WM_NCPAINT:
1183 {
1185 Wnd->state |= WNDS_FORCEMENUDRAW;
1186 NC_DoNCPaint(Wnd, hDC, -1);
1187 Wnd->state &= ~WNDS_FORCEMENUDRAW;
1188 UserReleaseDC(Wnd, hDC, FALSE);
1189 return 0;
1190 }
1191 //
1192 // Draw Caption mode.
1193 //
1194 // wParam are DC_* flags.
1195 //
1197 {
1199 TRACE("WM_NCUAHDRAWCAPTION: wParam DC_ flags %08x\n",wParam);
1200 UserDrawCaptionBar(Wnd, hDC, wParam | DC_FRAME); // Include DC_FRAME to comp for drawing glitch.
1201 UserReleaseDC(Wnd, hDC, FALSE);
1202 return 0;
1203 }
1204 //
1205 // Draw Frame mode.
1206 //
1207 // wParam is HDC, lParam are DC_ACTIVE and or DC_REDRAWHUNGWND.
1208 //
1209 case WM_NCUAHDRAWFRAME:
1210 {
1211 TRACE("WM_NCUAHDRAWFRAME: wParam hDC %p lParam DC_ flags %08x\n",wParam,lParam);
1213 return 0;
1214 }
1215
1216 /* ReactOS only. */
1217 case WM_CBT:
1218 {
1219 switch (wParam)
1220 {
1221 case HCBT_MOVESIZE:
1222 {
1223 RECTL rt;
1224
1225 if (lParam)
1226 {
1227 _SEH2_TRY
1228 {
1230 sizeof(RECT),
1231 1);
1232
1233 RtlCopyMemory(&rt,
1234 (PVOID)lParam,
1235 sizeof(RECT));
1236 }
1238 {
1239 lResult = 1;
1240 }
1241 _SEH2_END;
1242 }
1243 if (!lResult)
1245
1246 break;
1247 }
1248 }
1249 break;
1250 }
1251 }
1252 return lResult;
1253}
static HDC hDC
Definition: 3dtext.c:33
#define DCX_USESTYLE
Definition: GetDCEx.c:10
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn UINT32 *TableIdx 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:732
#define FIXME(fmt,...)
Definition: precomp.h:53
#define WARN(fmt,...)
Definition: precomp.h:61
#define UlongToHandle(ul)
Definition: basetsd.h:97
#define HandleToUlong(h)
Definition: basetsd.h:79
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
struct @1645 Msg[]
BOOL FASTCALL GreDPtoLP(HDC, LPPOINT, INT)
Definition: dcutil.c:7
static HWND hwndParent
Definition: cryptui.c:300
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
r parent
Definition: btrfs.c:3010
VOID NTAPI ProbeForRead(IN CONST VOID *Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:102
HWND FASTCALL co_UserSetFocus(PWND Window)
Definition: focus.c:1317
HWND FASTCALL IntGetCaptureWindow(VOID)
Definition: focus.c:34
HWND FASTCALL UserGetForegroundWindow(VOID)
Definition: focus.c:1424
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLenum GLsizei len
Definition: glext.h:6722
#define WNDS_FORCEMENUDRAW
Definition: ntuser.h:620
#define WNDS2_STARTPAINT
Definition: ntuser.h:643
HGDIOBJ FASTCALL IntGetSysColorBrush(INT Object)
Definition: stockobj.c:317
static HDC
Definition: imagelist.c:88
static HRGN hRgn
Definition: mapping.c:33
#define WM_KEYF1
Definition: msg.c:47
#define min(a, b)
Definition: monoChain.cc:55
DWORD FASTCALL UserGetKeyState(DWORD dwKey)
Definition: msgqueue.c:221
#define QF_FMENUSTATUSBREAK
Definition: msgqueue.h:96
#define QF_FMENUSTATUS
Definition: msgqueue.h:97
#define QF_FF10STATUS
Definition: msgqueue.h:98
_Use_decl_annotations_ NTSTATUS NTAPI RtlUnicodeToMultiByteSize(_Out_ PULONG MbSize, _In_ PCWCH UnicodeString, _In_ ULONG UnicodeSize)
Definition: nlsboot.c:145
__kernel_entry W32KAPI HRGN APIENTRY NtGdiCreateRectRgn(_In_ INT xLeft, _In_ INT yTop, _In_ INT xRight, _In_ INT yBottom)
LRESULT FASTCALL DefWndHandleWindowPosChanged(PWND pWnd, WINDOWPOS *Pos)
Definition: defwnd.c:95
LRESULT DefWndHandleSetCursor(PWND pWnd, WPARAM wParam, LPARAM lParam)
Definition: defwnd.c:243
LRESULT FASTCALL DefWndGetIcon(PWND pWnd, WPARAM wParam, LPARAM lParam)
Definition: defwnd.c:476
VOID FASTCALL DefWndScreenshot(PWND pWnd)
Definition: defwnd.c:499
LRESULT FASTCALL DefWndHandleWindowPosChanging(PWND pWnd, WINDOWPOS *Pos)
Definition: defwnd.c:68
VOID FASTCALL DefWndPrint(PWND pwnd, HDC hdc, ULONG uFlags)
Definition: defwnd.c:365
LRESULT FASTCALL DefWndHandleSysCommand(PWND pWnd, WPARAM wParam, LPARAM lParam)
Definition: defwnd.c:125
BOOL UserPaintCaption(PWND pWnd, INT Flags)
Definition: defwnd.c:398
LRESULT FASTCALL DefWndSetIcon(PWND pWnd, WPARAM wParam, LPARAM lParam)
Definition: defwnd.c:437
HBRUSH FASTCALL DefWndControlColor(HDC hDC, UINT ctlType)
Definition: defwnd.c:32
BOOL FASTCALL IntClientToScreen(PWND Wnd, LPPOINT lpPoint)
Definition: winpos.c:199
VOID FASTCALL IntSetSnapInfo(PWND Wnd, UINT Edge, IN const RECT *Pos OPTIONAL)
Definition: winpos.c:4004
VOID FASTCALL co_IntSnapWindow(PWND Wnd, UINT Edge)
Definition: winpos.c:3932
VOID FASTCALL co_IntCalculateSnapPosition(PWND Wnd, UINT Edge, OUT RECT *Pos)
Definition: winpos.c:3902
BOOL FASTCALL IntScreenToClient(PWND Wnd, LPPOINT lpPoint)
Definition: winpos.c:213
UINT FASTCALL IntGetWindowSnapEdge(PWND Wnd)
Definition: winpos.c:3894
VOID FASTCALL IntSetSnapEdge(PWND Wnd, UINT Edge)
Definition: winpos.c:3979
HWND hwndSAS
Definition: winsta.c:24
#define LRESULT
Definition: ole.h:14
#define LOWORD(l)
Definition: pedump.c:82
#define WM_CONTEXTMENU
Definition: richedit.h:64
Definition: region.h:8
struct _USER_MESSAGE_QUEUE * MessageQueue
Definition: win32.h:89
POINT MousePos
Definition: winuser.h:3320
int iCtrlId
Definition: winuser.h:3317
DWORD_PTR dwContextId
Definition: winuser.h:3319
HANDLE hItemHandle
Definition: winuser.h:3318
int iContextType
Definition: winuser.h:3316
UINT cbSize
Definition: winuser.h:3315
#define WM_MOUSEWHEEL
Definition: treelist.c:96
uint16_t * PWSTR
Definition: typedefs.h:56
const uint16_t * PCWSTR
Definition: typedefs.h:57
int32_t INT
Definition: typedefs.h:58
#define MAKELONG(a, b)
Definition: typedefs.h:249
#define HIWORD(l)
Definition: typedefs.h:247
#define DCX_KEEPCLIPRGN
Definition: undocuser.h:68
#define TPM_SYSTEM_MENU
Definition: undocuser.h:73
#define WM_NCUAHDRAWCAPTION
Definition: undocuser.h:46
#define DC_FRAME
Definition: undocuser.h:149
#define WM_LOGONNOTIFY
Definition: undocuser.h:37
#define LN_MESSAGE_BEEP
Definition: undocuser.h:120
#define WM_CLIENTSHUTDOWN
Definition: undocuser.h:35
#define WM_CBT
Definition: undocuser.h:63
#define WM_NCUAHDRAWFRAME
Definition: undocuser.h:47
HDC FASTCALL IntBeginPaint(PWND Window, PPAINTSTRUCT Ps)
Definition: painting.c:1442
BOOL FASTCALL IntEndPaint(PWND Wnd, PPAINTSTRUCT Ps)
Definition: painting.c:1539
INT FASTCALL co_UserGetUpdateRgn(PWND Window, HRGN hRgn, BOOL bErase)
Definition: painting.c:1791
DWORD FASTCALL IntGetWindowContextHelpId(PWND pWnd)
Definition: window.c:440
PWND FASTCALL UserGetWindowObject(HWND hWnd)
Definition: window.c:124
PWND FASTCALL UserGetAncestor(PWND Wnd, UINT Type)
Definition: window.c:3344
BOOLEAN co_UserDestroyWindow(PVOID Object)
Definition: window.c:2856
INT FASTCALL UserReleaseDC(PWND Window, HDC hDc, BOOL EndPaint)
Definition: windc.c:918
BOOL APIENTRY DefSetText(PWND Wnd, PCWSTR WindowText)
Definition: window.c:4377
HDC FASTCALL UserGetDCEx(PWND Window OPTIONAL, HANDLE ClipRegion, ULONG Flags)
FORCEINLINE BOOL RECTL_bIsEmptyRect(_In_ const RECTL *prcl)
Definition: rect.h:44
PREGION FASTCALL REGION_LockRgn(_In_ HRGN hrgn)
Definition: region.c:2358
VOID FASTCALL REGION_UnlockRgn(_In_ PREGION prgn)
Definition: region.c:2373
BOOL UserDrawIconEx(HDC hDc, INT xLeft, INT yTop, PCURICON_OBJECT pIcon, INT cxWidth, INT cyHeight, UINT istepIfAniCur, HBRUSH hbrFlickerFreeDraw, UINT diFlags)
Definition: cursoricon.c:1689
PWND FASTCALL UserGetDesktopWindow(VOID)
Definition: desktop.c:1403
UINT FASTCALL DefWndGetHotKey(PWND pWnd)
Definition: hotkey.c:313
INT FASTCALL DefWndSetHotKey(PWND pWnd, WPARAM wParam)
Definition: hotkey.c:340
BYTE gafAsyncKeyState[256 *2/8]
Definition: keyboard.c:13
#define IS_KEY_DOWN(ks, vk)
Definition: input.h:98
PMENU FASTCALL IntGetSystemMenu(PWND Window, BOOL bRevert)
Definition: menu.c:5399
INT FASTCALL IntMenuItemFromPoint(PWND pWnd, HMENU hMenu, POINT ptScreen)
Definition: menu.c:1518
PWND MENU_IsMenuActive(VOID)
Definition: menu.c:2650
void MENU_EndMenu(PWND pwnd)
Definition: menu.c:2662
void FASTCALL MENU_InitSysMenuPopup(PMENU menu, DWORD style, DWORD clsStyle, LONG HitTest)
Definition: menu.c:1362
BOOL WINAPI IntTrackPopupMenuEx(PMENU menu, UINT wFlags, int x, int y, PWND pWnd, LPTPMPARAMS lpTpm)
Definition: menu.c:4577
BOOL FASTCALL UserPostMessage(HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1395
LRESULT NC_HandleNCLButtonDown(PWND pWnd, WPARAM wParam, LPARAM lParam)
Definition: nonclient.c:1572
VOID UserDrawCaptionBar(PWND pWnd, HDC hDC, INT Flags)
Definition: nonclient.c:952
DWORD FASTCALL GetNCHitEx(PWND pWnd, POINT pt)
Definition: nonclient.c:1982
LRESULT NC_HandleNCActivate(PWND Wnd, WPARAM wParam, LPARAM lParam)
Definition: nonclient.c:1435
LRESULT NC_DoNCPaint(PWND pWnd, HDC hDC, INT Flags)
Definition: nonclient.c:1094
LRESULT NC_HandleNCCalcSize(PWND Wnd, WPARAM wparam, RECTL *Rect, BOOL Suspended)
Definition: nonclient.c:1301
LRESULT NC_HandleNCRButtonDown(PWND pwnd, WPARAM wParam, LPARAM lParam)
Definition: nonclient.c:1722
LRESULT NC_HandleNCLButtonDblClk(PWND pWnd, WPARAM wParam, LPARAM lParam)
Definition: nonclient.c:1664
VOID FASTCALL UserReferenceObject(PVOID obj)
Definition: object.c:731
LRESULT IntClientShutdown(IN PWND pWindow, IN WPARAM wParam, IN LPARAM lParam)
Definition: shutdown.c:22
BOOL g_bWindowSnapEnabled
Definition: sysparams.c:20
PWND FASTCALL IntGetParent(PWND Wnd)
Definition: window.c:206
VOID FASTCALL IntGetClientRect(PWND WindowObject, RECTL *Rect)
Definition: winpos.c:92
#define GET_Y_LPARAM(lp)
Definition: windowsx.h:300
#define WM_CTLCOLOR
Definition: windowsx.h:29
#define GET_X_LPARAM(lp)
Definition: windowsx.h:299
#define DI_COMPAT
Definition: wingdi.h:68
#define NULLREGION
Definition: wingdi.h:361
#define DI_NORMAL
Definition: wingdi.h:72
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
#define DI_DEFAULTSIZE
Definition: wingdi.h:69
FORCEINLINE VOID co_IntUnsnapWindow(PWND Wnd)
Definition: winpos.h:82
FORCEINLINE BOOLEAN IntIsSnapAllowedForWindow(PWND Wnd)
Definition: winpos.h:94
#define WM_PAINT
Definition: winuser.h:1623
#define WM_ERASEBKGND
Definition: winuser.h:1628
#define WM_GETHOTKEY
Definition: winuser.h:1656
#define WM_CTLCOLORSTATIC
Definition: winuser.h:1775
#define WM_GETTEXTLENGTH
Definition: winuser.h:1622
#define SW_HIDE
Definition: winuser.h:771
#define WM_CLOSE
Definition: winuser.h:1624
#define VK_SNAPSHOT
Definition: winuser.h:2234
#define WM_SYSCOMMAND
Definition: winuser.h:1744
#define SC_KEYMENU
Definition: winuser.h:2599
#define VK_TAB
Definition: winuser.h:2202
#define GA_ROOT
Definition: winuser.h:2792
#define MAKELPARAM(l, h)
Definition: winuser.h:4011
#define WM_KEYUP
Definition: winuser.h:1719
#define DCX_WINDOW
Definition: winuser.h:2116
#define HELPINFO_MENUITEM
Definition: winuser.h:1174
#define VK_F10
Definition: winuser.h:2267
#define WM_SETHOTKEY
Definition: winuser.h:1655
#define WM_WINDOWPOSCHANGING
Definition: winuser.h:1664
#define TPM_RIGHTBUTTON
Definition: winuser.h:2383
#define WM_SYNCPAINT
Definition: winuser.h:1693
#define SC_PREVWINDOW
Definition: winuser.h:2594
#define VK_SPACE
Definition: winuser.h:2222
#define WM_CANCELMODE
Definition: winuser.h:1638
#define WM_LBUTTONDBLCLK
Definition: winuser.h:1781
#define KF_ALTDOWN
Definition: winuser.h:2452
#define MA_ACTIVATE
Definition: winuser.h:2504
#define WM_APPCOMMAND
Definition: winuser.h:1885
#define WM_NCHITTEST
Definition: winuser.h:1689
#define WM_RBUTTONUP
Definition: winuser.h:1783
#define VK_UP
Definition: winuser.h:2228
#define SW_SHOWNOACTIVATE
Definition: winuser.h:777
#define WH_SHELL
Definition: winuser.h:40
#define WM_GETTEXT
Definition: winuser.h:1621
#define RDW_ERASE
Definition: winuser.h:1214
#define WM_CTLCOLORSCROLLBAR
Definition: winuser.h:1774
#define WA_INACTIVE
Definition: winuser.h:2625
#define MA_NOACTIVATE
Definition: winuser.h:2506
#define WM_LBUTTONDOWN
Definition: winuser.h:1779
#define WM_DEVICECHANGE
Definition: winuser.h:1814
#define WM_SYSCOLORCHANGE
Definition: winuser.h:1629
#define WM_CTLCOLORMSGBOX
Definition: winuser.h:1769
#define WM_NCLBUTTONDBLCLK
Definition: winuser.h:1697
#define WM_ACTIVATE
Definition: winuser.h:1615
#define WM_SHOWWINDOW
Definition: winuser.h:1631
#define WM_RBUTTONDOWN
Definition: winuser.h:1782
#define SC_MINIMIZE
Definition: winuser.h:2589
#define WM_CTLCOLORBTN
Definition: winuser.h:1772
#define WM_SETTEXT
Definition: winuser.h:1620
#define SC_NEXTWINDOW
Definition: winuser.h:2593
#define DC_NC
Definition: winuser.h:440
#define DCX_INTERSECTRGN
Definition: winuser.h:2125
#define WM_NCACTIVATE
Definition: winuser.h:1691
#define WM_SYSCHAR
Definition: winuser.h:1724
#define VK_RETURN
Definition: winuser.h:2204
#define SM_CYICON
Definition: winuser.h:976
#define VK_RMENU
Definition: winuser.h:2290
#define RDW_ALLCHILDREN
Definition: winuser.h:1224
#define RDW_ERASENOW
Definition: winuser.h:1222
#define RDW_FRAME
Definition: winuser.h:1215
#define WM_SYSKEYUP
Definition: winuser.h:1723
#define HCBT_MOVESIZE
Definition: winuser.h:55
#define SC_CLOSE
Definition: winuser.h:2595
#define DC_TEXT
Definition: winuser.h:430
#define VK_LWIN
Definition: winuser.h:2238
struct tagHELPINFO HELPINFO
#define WM_MOUSEACTIVATE
Definition: winuser.h:1640
#define TPM_LEFTBUTTON
Definition: winuser.h:2382
#define VK_F4
Definition: winuser.h:2261
#define VK_LEFT
Definition: winuser.h:2227
#define VK_RIGHT
Definition: winuser.h:2229
#define VK_DOWN
Definition: winuser.h:2230
#define WM_SETCURSOR
Definition: winuser.h:1639
#define KF_REPEAT
Definition: winuser.h:2453
#define WM_USER
Definition: winuser.h:1898
#define WM_CTLCOLORLISTBOX
Definition: winuser.h:1771
#define VK_SHIFT
Definition: winuser.h:2205
#define WM_NCRBUTTONUP
Definition: winuser.h:1699
#define WM_KEYDOWN
Definition: winuser.h:1718
#define WM_ICONERASEBKGND
Definition: winuser.h:1645
#define WM_PRINT
Definition: winuser.h:1883
#define WM_NCCALCSIZE
Definition: winuser.h:1688
#define SM_CXICON
Definition: winuser.h:975
#define WM_CTLCOLOREDIT
Definition: winuser.h:1770
#define VK_ESCAPE
Definition: winuser.h:2217
#define WM_WINDOWPOSCHANGED
Definition: winuser.h:1665
#define SC_RESTORE
Definition: winuser.h:2601
#define WM_CTLCOLORDLG
Definition: winuser.h:1773
#define CS_NOCLOSE
Definition: winuser.h:654
#define WM_SYSKEYDOWN
Definition: winuser.h:1722
#define WM_NCLBUTTONDOWN
Definition: winuser.h:1695
#define RDW_INVALIDATE
Definition: winuser.h:1217
#define WM_PAINTICON
Definition: winuser.h:1644
#define WM_MBUTTONDOWN
Definition: winuser.h:1785
#define VK_RWIN
Definition: winuser.h:2239
#define SC_MAXIMIZE
Definition: winuser.h:2591
#define VK_LMENU
Definition: winuser.h:2289
#define VK_MENU
Definition: winuser.h:2207
#define WM_NCPAINT
Definition: winuser.h:1690
#define WM_NCRBUTTONDOWN
Definition: winuser.h:1698
#define WM_SETREDRAW
Definition: winuser.h:1619
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
_In_ ULONG _In_ BOOLEAN Active
Definition: potypes.h:561

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

◆ IntEnableWindow()

BOOL FASTCALL IntEnableWindow ( HWND  hWnd,
BOOL  bEnable 
)

Definition at line 222 of file window.c.

223{
224 BOOL Update;
225 PWND pWnd;
226 UINT bIsDisabled;
227
228 if(!(pWnd = UserGetWindowObject(hWnd)))
229 {
230 return FALSE;
231 }
232
233 /* check if updating is needed */
234 bIsDisabled = !!(pWnd->style & WS_DISABLED);
235 Update = bIsDisabled;
236
237 if (bEnable)
238 {
239 IntSetStyle( pWnd, 0, WS_DISABLED );
240 }
241 else
242 {
243 Update = !bIsDisabled;
244
246
247 /* Remove keyboard focus from that window if it had focus */
249 {
250 TRACE("IntEnableWindow SF NULL\n");
252 }
253 IntSetStyle( pWnd, WS_DISABLED, 0 );
254 }
255
256 if (Update)
257 {
258 IntNotifyWinEvent(EVENT_OBJECT_STATECHANGE, pWnd, OBJID_WINDOW, CHILDID_SELF, 0);
260 }
261 // Return nonzero if it was disabled, or zero if it wasn't:
262 return bIsDisabled;
263}
@ Update
Definition: registry.c:565
HWND FASTCALL IntGetThreadFocusWindow(VOID)
Definition: focus.c:41
_In_ BOOL bEnable
Definition: winddi.h:3426
#define WM_ENABLE
Definition: winuser.h:1618

Referenced by NtUserCallTwoParam(), and NtUserEnableScrollBar().

◆ IntFindWindow()

HWND FASTCALL IntFindWindow ( PWND  Parent,
PWND  ChildAfter,
RTL_ATOM  ClassAtom,
PUNICODE_STRING  WindowName 
)

Definition at line 3064 of file window.c.

3068{
3069 BOOL CheckWindowName;
3070 HWND *List, *phWnd;
3071 HWND Ret = NULL;
3072 UNICODE_STRING CurrentWindowName;
3073
3074 ASSERT(Parent);
3075
3076 CheckWindowName = WindowName->Buffer != 0;
3077
3079 {
3080 phWnd = List;
3081 if(ChildAfter)
3082 {
3083 /* skip handles before and including ChildAfter */
3084 while(*phWnd && (*(phWnd++) != UserHMGetHandle(ChildAfter)))
3085 ;
3086 }
3087
3088 /* search children */
3089 while(*phWnd)
3090 {
3091 PWND Child;
3092 if(!(Child = UserGetWindowObject(*(phWnd++))))
3093 {
3094 continue;
3095 }
3096
3097 /* Do not send WM_GETTEXT messages in the kernel mode version!
3098 The user mode version however calls GetWindowText() which will
3099 send WM_GETTEXT messages to windows belonging to its processes */
3100 if (!ClassAtom || Child->pcls->atomNVClassName == ClassAtom)
3101 {
3102 // FIXME: LARGE_STRING truncated
3103 CurrentWindowName.Buffer = Child->strName.Buffer;
3104 CurrentWindowName.Length = (USHORT)min(Child->strName.Length, MAXUSHORT);
3105 CurrentWindowName.MaximumLength = (USHORT)min(Child->strName.MaximumLength, MAXUSHORT);
3106 if(!CheckWindowName ||
3107 (Child->strName.Length < 0xFFFF &&
3108 !RtlCompareUnicodeString(WindowName, &CurrentWindowName, TRUE)))
3109 {
3110 Ret = UserHMGetHandle(Child);
3111 break;
3112 }
3113 }
3114 }
3116 }
3117
3118 return Ret;
3119}
ULONG RtlCompareUnicodeString(PUNICODE_STRING s1, PUNICODE_STRING s2, BOOLEAN UpCase)
Definition: string_lib.cpp:31
unsigned short USHORT
Definition: pedump.c:61
#define MAXUSHORT
Definition: typedefs.h:83
_Must_inspect_result_ _In_ WDFCMRESLIST List
Definition: wdfresource.h:550

Referenced by NtUserFindWindowEx().

◆ IntFreeHwndList()

VOID FASTCALL IntFreeHwndList ( PWINDOWLIST  pwlTarget)

Definition at line 1473 of file window.c.

1474{
1475 PWINDOWLIST pwl, *ppwl;
1476
1477 for (ppwl = &gpwlList; *ppwl; ppwl = &(*ppwl)->pNextList)
1478 {
1479 if (*ppwl != pwlTarget)
1480 continue;
1481
1482 *ppwl = pwlTarget->pNextList;
1483
1484 if (gpwlCache)
1485 {
1486 if (WL_CAPACITY(pwlTarget) > WL_CAPACITY(gpwlCache))
1487 {
1488 pwl = gpwlCache;
1489 gpwlCache = pwlTarget;
1491 }
1492 else
1493 {
1495 }
1496 }
1497 else
1498 {
1499 gpwlCache = pwlTarget;
1500 }
1501
1502 break;
1503 }
1504}
#define WL_CAPACITY(pwl)
Definition: window.h:98

Referenced by ExitThreadCallback(), IntAssociateInputContextEx(), IntCheckImeShowStatus(), IntDestroyInputContext(), and IntImeWindowPosChanged().

◆ 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 92 of file winpos.c.

93{
94 ASSERT( Wnd );
95 ASSERT( Rect );
96 if (Wnd->style & WS_MINIMIZED)
97 {
98 Rect->left = Rect->top = 0;
101 return;
102 }
103 if (!UserIsDesktopWindow(Wnd))
104 {
105 *Rect = Wnd->rcClient;
107 }
108 else
109 {
110 Rect->left = Rect->top = 0;
111 Rect->right = Wnd->rcClient.right;
112 Rect->bottom = Wnd->rcClient.bottom;
113 /* Do this until Init bug is fixed. This sets 640x480, see InitMetrics.
114 Rect->right = UserGetSystemMetrics(SM_CXSCREEN);
115 Rect->bottom = UserGetSystemMetrics(SM_CYSCREEN);
116 */
117 }
118}
#define WS_MINIMIZED
Definition: undocuser.h:18
#define SM_CXMINIMIZED
Definition: winuser.h:1023
#define SM_CYMINIMIZED
Definition: winuser.h:1024

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

Definition at line 353 of file window.c.

354{
355 while(pWnd && (pWnd->style & (WS_CHILD | WS_POPUP)) == WS_CHILD)
356 pWnd = pWnd->spwndParent;
357 return pWnd;
358}

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

◆ IntGetParent()

PWND FASTCALL IntGetParent ( PWND  Wnd)

◆ IntGetWindow()

HWND FASTCALL IntGetWindow ( HWND  hWnd,
UINT  uCmd 
)

Definition at line 383 of file window.c.

385{
386 PWND Wnd, FoundWnd;
387 HWND Ret = NULL;
388
389 Wnd = ValidateHwndNoErr(hWnd);
390 if (!Wnd)
391 return NULL;
392
393 FoundWnd = NULL;
394 switch (uCmd)
395 {
396 case GW_OWNER:
397 if (Wnd->spwndOwner != NULL)
398 FoundWnd = Wnd->spwndOwner;
399 break;
400
401 case GW_HWNDFIRST:
402 if(Wnd->spwndParent != NULL)
403 {
404 FoundWnd = Wnd->spwndParent;
405 if (FoundWnd->spwndChild != NULL)
406 FoundWnd = FoundWnd->spwndChild;
407 }
408 break;
409 case GW_HWNDNEXT:
410 if (Wnd->spwndNext != NULL)
411 FoundWnd = Wnd->spwndNext;
412 break;
413
414 case GW_HWNDPREV:
415 if (Wnd->spwndPrev != NULL)
416 FoundWnd = Wnd->spwndPrev;
417 break;
418
419 case GW_CHILD:
420 if (Wnd->spwndChild != NULL)
421 FoundWnd = Wnd->spwndChild;
422 break;
423
424 case GW_HWNDLAST:
425 FoundWnd = Wnd;
426 while ( FoundWnd->spwndNext != NULL)
427 FoundWnd = FoundWnd->spwndNext;
428 break;
429
430 default:
431 Wnd = NULL;
432 break;
433 }
434
435 if (FoundWnd != NULL)
436 Ret = UserHMGetHandle(FoundWnd);
437 return Ret;
438}
#define ValidateHwndNoErr(hwnd)
Definition: precomp.h:84
struct _WND * spwndPrev
Definition: ntuser.h:712
struct _WND * spwndChild
Definition: ntuser.h:714
struct _WND * spwndNext
Definition: ntuser.h:711
#define GW_OWNER
Definition: winuser.h:769
#define GW_HWNDFIRST
Definition: winuser.h:767
#define GW_HWNDLAST
Definition: winuser.h:768
#define GW_HWNDNEXT
Definition: winuser.h:764
#define GW_HWNDPREV
Definition: winuser.h:765
#define GW_CHILD
Definition: winuser.h:766

Referenced by WinPosFixupFlags().

◆ IntGetWindowBorderMeasures()

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

Definition at line 867 of file winpos.c.

868{
869 if(HAS_DLGFRAME(Wnd->style, Wnd->ExStyle) && !(Wnd->style & WS_MINIMIZE))
870 {
873 }
874 else
875 {
876 if(HAS_THICKFRAME(Wnd->style, Wnd->ExStyle)&& !(Wnd->style & WS_MINIMIZE))
877 {
880 }
881 else if(HAS_THINFRAME(Wnd->style, Wnd->ExStyle))
882 {
885 }
886 else
887 {
888 *cx = *cy = 0;
889 }
890 }
891}
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:586
_Out_opt_ int * cx
Definition: commctrl.h:585

◆ IntImeCanDestroyDefIME()

BOOL FASTCALL IntImeCanDestroyDefIME ( PWND  pImeWnd,
PWND  pwndTarget 
)

Definition at line 2062 of file ime.c.

2063{
2064 PWND pwndNode;
2065 PIMEUI pimeui;
2066 IMEUI SafeImeUI;
2067
2068 pimeui = ((PIMEWND)pImeWnd)->pimeui;
2069 if (!pimeui || (LONG_PTR)pimeui == (LONG_PTR)-1)
2070 return FALSE;
2071
2072 // Check IMEUI.fDestroy
2073 _SEH2_TRY
2074 {
2075 ProbeForRead(pimeui, sizeof(IMEUI), 1);
2076 SafeImeUI = *pimeui;
2077 if (SafeImeUI.fDestroy)
2078 return FALSE;
2079 }
2081 {
2082 ERR("%p\n", pimeui);
2083 }
2084 _SEH2_END;
2085
2086 // Any ancestor of pImeWnd is pwndTarget?
2087 if (pImeWnd->spwndOwner)
2088 {
2089 for (pwndNode = pImeWnd->spwndOwner; pwndNode; pwndNode = pwndNode->spwndOwner)
2090 {
2091 if (pwndNode == pwndTarget)
2092 break;
2093 }
2094
2095 if (!pwndNode)
2096 return FALSE;
2097 }
2098
2099 // Any ancestor of pwndTarget is IME-like?
2100 for (pwndNode = pwndTarget; pwndNode; pwndNode = pwndNode->spwndOwner)
2101 {
2102 if (IS_WND_IMELIKE(pwndNode))
2103 return FALSE;
2104 }
2105
2106 // Adjust the ordering and top-mode status
2107 IntImeSetFutureOwner(pImeWnd, pwndTarget);
2108 for (pwndNode = pImeWnd->spwndOwner; pwndNode; pwndNode = pwndNode->spwndNext)
2109 {
2110 if (pwndNode == pImeWnd)
2111 break;
2112 }
2113 if (pwndNode == pImeWnd)
2114 IntImeCheckTopmost(pImeWnd);
2115
2116 // Is the owner of pImeWnd NULL or pwndTarget?
2117 if (pImeWnd->spwndOwner && pwndTarget != pImeWnd->spwndOwner)
2118 return FALSE;
2119
2120 WndSetOwner(pImeWnd, NULL);
2121 return TRUE;
2122}
UINT fDestroy
Definition: ntuser.h:1224
#define LONG_PTR
Definition: treelist.c:79
VOID FASTCALL IntImeSetFutureOwner(PWND pImeWnd, PWND pwndOwner)
Definition: ime.c:1162
VOID FASTCALL IntImeCheckTopmost(PWND pImeWnd)
Definition: ime.c:1346

Referenced by co_UserDestroyWindow().

◆ IntImeCanDestroyDefIMEforChild()

BOOL FASTCALL IntImeCanDestroyDefIMEforChild ( PWND  pImeWnd,
PWND  pwndTarget 
)

Definition at line 2017 of file ime.c.

2018{
2019 PWND pwndNode;
2020 PIMEUI pimeui;
2021 IMEUI SafeImeUI;
2022
2023 pimeui = ((PIMEWND)pImeWnd)->pimeui;
2024 if (!pimeui || (LONG_PTR)pimeui == (LONG_PTR)-1)
2025 return FALSE;
2026
2027 // Check IMEUI.fChildThreadDef
2028 _SEH2_TRY
2029 {
2030 ProbeForRead(pimeui, sizeof(IMEUI), 1);
2031 SafeImeUI = *pimeui;
2032 if (!SafeImeUI.fChildThreadDef)
2033 return FALSE;
2034 }
2036 {
2037 ERR("%p\n", pimeui);
2038 }
2039 _SEH2_END;
2040
2041 // The parent of pwndTarget is NULL or of the same thread of pwndTarget?
2042 if (pwndTarget->spwndParent == NULL ||
2043 pwndTarget->head.pti == pwndTarget->spwndParent->head.pti)
2044 {
2045 return FALSE;
2046 }
2047
2048 for (pwndNode = pwndTarget; pwndNode; pwndNode = pwndNode->spwndParent)
2049 {
2050 if (pwndNode == pwndNode->head.rpdesk->pDeskInfo->spwnd)
2051 break;
2052
2053 if (IntFindNonImeRelatedWndOfSameThread(pwndNode->spwndParent, pwndTarget))
2054 return FALSE;
2055 }
2056
2057 return TRUE;
2058}
BOOL IntFindNonImeRelatedWndOfSameThread(PWND pwndParent, PWND pwndTarget)
Definition: ime.c:1838

Referenced by co_UserDestroyWindow().

◆ IntIsChildWindow()

BOOL FASTCALL IntIsChildWindow ( PWND  Parent,
PWND  Child 
)

Definition at line 930 of file window.c.

931{
933 do
934 {
935 if ( Window == NULL || (Window->style & (WS_POPUP|WS_CHILD)) != WS_CHILD )
936 return FALSE;
937
938 Window = Window->spwndParent;
939 }
940 while(Parent != Window);
941 return TRUE;
942}
struct tagBaseWindow BaseWindow

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

◆ IntIsWindow()

◆ IntIsWindowVisible()

BOOL FASTCALL IntIsWindowVisible ( PWND  Wnd)

Definition at line 191 of file window.c.

192{
193 PWND Temp = Wnd;
194 for (;;)
195 {
196 if (!Temp) return TRUE;
197 if (!(Temp->style & WS_VISIBLE)) break;
198 if (Temp->style & WS_MINIMIZE && Temp != Wnd) break;
199 if (Temp->fnid == FNID_DESKTOP) return TRUE;
200 Temp = Temp->spwndParent;
201 }
202 return FALSE;
203}
#define FNID_DESKTOP
Definition: ntuser.h:862

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

◆ IntLinkHwnd()

VOID FASTCALL IntLinkHwnd ( PWND  Wnd,
HWND  hWndPrev 
)

Definition at line 986 of file window.c.

987{
988 if (hWndPrev == HWND_NOTOPMOST)
989 {
990 if (!(Wnd->ExStyle & WS_EX_TOPMOST) && (Wnd->ExStyle2 & WS_EX2_LINKED))
991 return; /* nothing to do */
992 Wnd->ExStyle &= ~WS_EX_TOPMOST;
993 hWndPrev = HWND_TOP; /* fallback to the HWND_TOP case */
994 }
995
996 IntUnlinkWindow(Wnd); /* unlink it from the previous location */
997
998 if (hWndPrev == HWND_BOTTOM)
999 {
1000 /* Link in the bottom of the list */
1001 PWND WndInsertAfter;
1002
1003 WndInsertAfter = Wnd->spwndParent->spwndChild;
1004 while (WndInsertAfter && WndInsertAfter->spwndNext)
1005 {
1006 WndInsertAfter = WndInsertAfter->spwndNext;
1007 }
1008
1009 IntLinkWindow(Wnd, WndInsertAfter);
1010 Wnd->ExStyle &= ~WS_EX_TOPMOST;
1011 }
1012 else if (hWndPrev == HWND_TOPMOST)
1013 {
1014 /* Link in the top of the list */
1015 IntLinkWindow(Wnd, NULL);
1016 Wnd->ExStyle |= WS_EX_TOPMOST;
1017 }
1018 else if (hWndPrev == HWND_TOP)
1019 {
1020 /* Link it after the last topmost window */
1021 PWND WndInsertBefore;
1022
1023 WndInsertBefore = Wnd->spwndParent->spwndChild;
1024
1025 if (!(Wnd->ExStyle & WS_EX_TOPMOST)) /* put it above the first non-topmost window */
1026 {
1027 while (WndInsertBefore != NULL && WndInsertBefore->spwndNext != NULL)
1028 {
1029 if (!(WndInsertBefore->ExStyle & WS_EX_TOPMOST))
1030 break;
1031
1032 if (WndInsertBefore == Wnd->spwndOwner) /* keep it above owner */
1033 {
1034 Wnd->ExStyle |= WS_EX_TOPMOST;
1035 break;
1036 }
1037 WndInsertBefore = WndInsertBefore->spwndNext;
1038 }
1039 }
1040
1041 IntLinkWindow(Wnd, WndInsertBefore ? WndInsertBefore->spwndPrev : NULL);
1042 }
1043 else
1044 {
1045 /* Link it after hWndPrev */
1046 PWND WndInsertAfter;
1047
1048 WndInsertAfter = UserGetWindowObject(hWndPrev);
1049 /* Are we called with an erroneous handle */
1050 if (WndInsertAfter == NULL)
1051 {
1052 /* Link in a default position */
1053 IntLinkHwnd(Wnd, HWND_TOP);
1054 return;
1055 }
1056
1057 if (Wnd == WndInsertAfter)
1058 {
1059 ERR("Trying to link window 0x%p to itself\n", Wnd);
1060 ASSERT(WndInsertAfter != Wnd);
1061 // FIXME: IntUnlinkWindow(Wnd) was already called. Continuing as is seems wrong!
1062 }
1063 else
1064 {
1065 IntLinkWindow(Wnd, WndInsertAfter);
1066 }
1067
1068 /* Fix the WS_EX_TOPMOST flag */
1069 if (!(WndInsertAfter->ExStyle & WS_EX_TOPMOST))
1070 {
1071 Wnd->ExStyle &= ~WS_EX_TOPMOST;
1072 }
1073 else
1074 {
1075 if (WndInsertAfter->spwndNext &&
1076 (WndInsertAfter->spwndNext->ExStyle & WS_EX_TOPMOST))
1077 {
1078 Wnd->ExStyle |= WS_EX_TOPMOST;
1079 }
1080 }
1081 }
1082 Wnd->ExStyle2 |= WS_EX2_LINKED;
1083}
#define WS_EX2_LINKED
Definition: ntuser.h:676
DWORD ExStyle2
Definition: ntuser.h:745
VOID FASTCALL IntLinkWindow(PWND Wnd, PWND WndInsertAfter)
Definition: window.c:947
#define HWND_TOPMOST
Definition: winuser.h:1211
#define HWND_NOTOPMOST
Definition: winuser.h:1209

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

◆ IntMapWindowPoints()

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

Definition at line 144 of file winpos.c.

145{
146 BOOL mirror_from, mirror_to;
147 POINT Delta;
148 UINT i;
149 int Change = 1;
150
151 /* Note: Desktop Top and Left is always 0! */
152 Delta.x = Delta.y = 0;
153 mirror_from = mirror_to = FALSE;
154
155 if (FromWnd && !UserIsDesktopWindow(FromWnd))
156 {
157 if (FromWnd->ExStyle & WS_EX_LAYOUTRTL)
158 {
159 mirror_from = TRUE;
160 Change = -Change;
161 Delta.x = -FromWnd->rcClient.right;
162 }
163 else
164 Delta.x = FromWnd->rcClient.left;
165 Delta.y = FromWnd->rcClient.top;
166 }
167
168 if (ToWnd && !UserIsDesktopWindow(ToWnd))
169 {
170 if (ToWnd->ExStyle & WS_EX_LAYOUTRTL)
171 {
172 mirror_to = TRUE;
173 Change = -Change;
174 Delta.x += Change * ToWnd->rcClient.right;
175 }
176 else
177 Delta.x -= Change * ToWnd->rcClient.left;
178 Delta.y -= ToWnd->rcClient.top;
179 }
180
181 for (i = 0; i != cPoints; i++)
182 {
183 lpPoints[i].x += Delta.x;
184 lpPoints[i].x *= Change;
185 lpPoints[i].y += Delta.y;
186 }
187
188 if ((mirror_from || mirror_to) && cPoints == 2) /* special case for rectangle */
189 {
190 int tmp = min(lpPoints[0].x, lpPoints[1].x);
191 lpPoints[1].x = max(lpPoints[0].x, lpPoints[1].x);
192 lpPoints[0].x = tmp;
193 }
194
195 return MAKELONG(LOWORD(Delta.x), LOWORD(Delta.y));
196}
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
#define max(a, b)
Definition: svc.c:63
static ULONG Delta
Definition: xboxvideo.c:33

Referenced by DefWndDoSizeMove(), and DefWndHandleWindowPosChanged().

◆ IntNotifyImeShowStatus()

VOID FASTCALL IntNotifyImeShowStatus ( PWND  pImeWnd)

Definition at line 2323 of file ime.c.

2324{
2325 PIMEUI pimeui;
2326 PWND pWnd;
2327 PTHREADINFO pti, ptiIME;
2328 BOOL bShow, bSendNotify = FALSE;
2329 IMEUI SafeImeUI;
2330
2331 if (!IS_IMM_MODE() || (pImeWnd->state2 & WNDS2_INDESTROY))
2332 return;
2333
2335 ptiIME = pImeWnd->head.pti;
2336
2337 // Attach to the process if necessary
2338 if (pti != ptiIME)
2339 KeAttachProcess(&(ptiIME->ppi->peProcess->Pcb));
2340
2341 // Get an IMEUI and check whether hwndIMC is valid and update fShowStatus
2342 _SEH2_TRY
2343 {
2344 ProbeForWrite(pImeWnd, sizeof(IMEWND), 1);
2345 pimeui = ((PIMEWND)pImeWnd)->pimeui;
2346 SafeImeUI = *pimeui;
2347
2348 bShow = (gfIMEShowStatus == TRUE) && SafeImeUI.fCtrlShowStatus;
2349
2350 pWnd = ValidateHwndNoErr(SafeImeUI.hwndIMC);
2351 if (!pWnd)
2352 pWnd = ptiIME->MessageQueue->spwndFocus;
2353
2354 if (pWnd)
2355 {
2356 bSendNotify = TRUE;
2357 pimeui->fShowStatus = bShow;
2358 }
2359 }
2361 {
2362 ERR("%p, %p\n", pImeWnd, pimeui);
2363
2364 if (pti != ptiIME)
2366
2367 _SEH2_YIELD(return);
2368 }
2369 _SEH2_END;
2370
2371 // Detach from the process if necessary
2372 if (pti != ptiIME)
2374
2375 if (bSendNotify)
2376 IntSendOpenStatusNotify(ptiIME, &SafeImeUI, pWnd, bShow);
2377
2378 if (!(pImeWnd->state2 & WNDS2_INDESTROY))
2379 IntCheckImeShowStatus(pImeWnd, NULL);
2380}
VOID NTAPI KeDetachProcess(VOID)
Definition: procobj.c:621
VOID NTAPI KeAttachProcess(IN PKPROCESS Process)
Definition: procobj.c:582
#define _SEH2_YIELD(__stmt)
Definition: pseh2_64.h:168
UINT fCtrlShowStatus
Definition: ntuser.h:1227
HWND hwndIMC
Definition: ntuser.h:1217
UINT fShowStatus
Definition: ntuser.h:1222
VOID FASTCALL IntSendOpenStatusNotify(PTHREADINFO ptiIME, PIMEUI pimeui, PWND pWnd, BOOL bOpen)
Definition: ime.c:2304

Referenced by IntBroadcastImeShowStatusChange().

◆ IntNotifyWinEvent()

VOID FASTCALL IntNotifyWinEvent ( DWORD  Event,
PWND  pWnd,
LONG  idObject,
LONG  idChild,
DWORD  flags 
)

Definition at line 178 of file event.c.

184{
185 PEVENTHOOK pEH;
186 PLIST_ENTRY ListEntry;
187 PTHREADINFO pti, ptiCurrent;
189
190 TRACE("IntNotifyWinEvent GlobalEvents = %p pWnd %p\n", GlobalEvents, pWnd);
191
192 if (!GlobalEvents || !GlobalEvents->Counts) return;
193
194 if (pWnd && pWnd->state & WNDS_DESTROYED) return;
195
196 ptiCurrent = PsGetCurrentThreadWin32Thread();
197
198 if (pWnd && flags & WEF_SETBYWNDPTI)
199 pti = pWnd->head.pti;
200 else
201 pti = ptiCurrent;
202
203 ListEntry = GlobalEvents->Events.Flink;
204 ASSERT(ListEntry != &GlobalEvents->Events);
205 while (ListEntry != &GlobalEvents->Events)
206 {
207 pEH = CONTAINING_RECORD(ListEntry, EVENTHOOK, Chain);
208 ListEntry = ListEntry->Flink;
209
210 // Must be inside the event window.
211 if ( Event >= pEH->eventMin && Event <= pEH->eventMax )
212 {
213 // if all process || all thread || other thread same process
214 // if ^skip own thread && ((Pid && CPid == Pid && ^skip own process) || all process)
215 if (!( (pEH->idProcess && pEH->idProcess != PtrToUint(pti->pEThread->Cid.UniqueProcess)) ||
216 (pEH->Flags & WINEVENT_SKIPOWNPROCESS && pEH->head.pti->ppi == pti->ppi) ||
217 (pEH->idThread && pEH->idThread != PtrToUint(pti->pEThread->Cid.UniqueThread)) ||
218 (pEH->Flags & WINEVENT_SKIPOWNTHREAD && pEH->head.pti == pti) ||
219 pEH->head.pti->rpdesk != ptiCurrent->rpdesk ) ) // Same as hooks.
220 {
221 UserRefObjectCo(pEH, &Ref);
222 if (pEH->Flags & WINEVENT_INCONTEXT)
223 {
224 TRACE("In Event 0x%x, idObject %d hwnd %p\n", Event, idObject, pWnd ? UserHMGetHandle(pWnd) : NULL);
226 Event,
227 pWnd ? UserHMGetHandle(pWnd) : NULL,
228 idObject,
229 idChild,
232 pEH->Proc,
233 pEH->ihmod,
234 pEH->offPfn);
235 }
236 else
237 {
238 TRACE("Out Event 0x%x, idObject %d hwnd %p\n", Event, idObject, pWnd ? UserHMGetHandle(pWnd) : NULL);
240 Event,
241 pWnd ? UserHMGetHandle(pWnd) : NULL,
242 idObject,
243 idChild,
245 }
247 }
248 }
249 }
250}
#define PtrToUint(p)
Definition: basetsd.h:85
#define EngGetTickCount32()
Definition: eng.h:43
GLbitfield flags
Definition: glext.h:7161
#define WEF_SETBYWNDPTI
Definition: ntuser.h:236
#define NtCurrentTeb
HANDLE UniqueThread
Definition: compat.h:826
Definition: typedefs.h:120
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
struct _THREADINFO * pti
Definition: ntuser.h:188
DWORD idThread
Definition: hook.h:22
WINEVENTPROC Proc
Definition: hook.h:23
ULONG_PTR offPfn
Definition: hook.h:25
INT_PTR ihmod
Definition: hook.h:26
UINT eventMin
Definition: hook.h:19
THROBJHEAD head
Definition: hook.h:17
ULONG Flags
Definition: hook.h:24
DWORD idProcess
Definition: hook.h:21
UINT Counts
Definition: hook.h:32
LIST_ENTRY Events
Definition: hook.h:31
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
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:838
static PEVENTTABLE GlobalEvents
Definition: event.c:19
static LRESULT FASTCALL IntCallLowLevelEvent(PEVENTHOOK pEH, DWORD event, HWND hwnd, LONG idObject, LONG idChild, LONG idThread)
Definition: event.c:97
#define WINEVENT_INCONTEXT
Definition: winable.h:35
#define WINEVENT_SKIPOWNPROCESS
Definition: winable.h:34
#define WINEVENT_SKIPOWNTHREAD
Definition: winable.h:33
_Out_ PCLIENT_ID ClientId
Definition: kefuncs.h:1151

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  pwnd,
ULONG  set_bits,
ULONG  clear_bits 
)

Definition at line 145 of file window.c.

146{
147 ULONG styleOld, styleNew;
148 styleOld = pwnd->style;
149 styleNew = (pwnd->style | set_bits) & ~clear_bits;
150 if (styleNew == styleOld) return styleNew;
151 pwnd->style = styleNew;
152 if ((styleOld ^ styleNew) & WS_VISIBLE) // State Change.
153 {
154 if (styleOld & WS_VISIBLE) pwnd->head.pti->cVisWindows--;
155 if (styleNew & WS_VISIBLE) pwnd->head.pti->cVisWindows++;
156 DceResetActiveDCEs( pwnd );
157 }
158 return styleOld;
159}
VOID FASTCALL DceResetActiveDCEs(PWND Window)
Definition: windc.c:816

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

◆ IntShowOwnedPopups()

BOOL FASTCALL IntShowOwnedPopups ( PWND  owner,
BOOL  fShow 
)

Definition at line 4654 of file window.c.

4655{
4656 int count = 0;
4657 PWND pWnd;
4658 HWND *win_array;
4659
4660// ASSERT(OwnerWnd);
4661
4662 TRACE("Enter ShowOwnedPopups Show: %s\n", (fShow ? "TRUE" : "FALSE"));
4663
4664 /* NOTE: Popups are not children */
4665 win_array = IntWinListOwnedPopups(OwnerWnd);
4666
4667 if (!win_array)
4668 return TRUE;
4669
4670 while (win_array[count])
4671 count++;
4672 while (--count >= 0)
4673 {
4674 if (!(pWnd = ValidateHwndNoErr( win_array[count] )))
4675 continue;
4676 ASSERT(pWnd->spwndOwner == OwnerWnd);
4677
4678 if (fShow)
4679 {
4680 if (pWnd->state & WNDS_HIDDENPOPUP)
4681 {
4682 /* In Windows, ShowOwnedPopups(TRUE) generates
4683 * WM_SHOWWINDOW messages with SW_PARENTOPENING,
4684 * regardless of the state of the owner
4685 */
4687 pWnd->state &= ~WNDS_HIDDENPOPUP;
4688 continue;
4689 }
4690 }
4691 else
4692 {
4693 if (pWnd->style & WS_VISIBLE)
4694 {
4695 /* In Windows, ShowOwnedPopups(FALSE) generates
4696 * WM_SHOWWINDOW messages with SW_PARENTCLOSING,
4697 * regardless of the state of the owner
4698 */
4700 pWnd->state |= WNDS_HIDDENPOPUP;
4701 continue;
4702 }
4703 }
4704 }
4706 TRACE("Leave ShowOwnedPopups\n");
4707 return TRUE;
4708}
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define WNDS_HIDDENPOPUP
Definition: ntuser.h:619
HWND *FASTCALL IntWinListOwnedPopups(PWND Window)
Definition: window.c:317
#define SW_SHOWNORMAL
Definition: winuser.h:773
#define SW_PARENTCLOSING
Definition: winuser.h:2445
#define SW_PARENTOPENING
Definition: winuser.h:2447

Referenced by co_WinPosMinMaximize(), co_WinPosShowWindow(), DefWndHandleSysCommand(), and NtUserCallTwoParam().

◆ IntUnlinkWindow()

VOID FASTCALL IntUnlinkWindow ( PWND  Wnd)

Definition at line 1357 of file window.c.

1358{
1359 ASSERT(Wnd != Wnd->spwndNext);
1360 ASSERT(Wnd != Wnd->spwndPrev);
1361
1362 if (Wnd->spwndNext)
1363 WndSetPrev(Wnd->spwndNext, Wnd->spwndPrev);
1364
1365 if (Wnd->spwndPrev)
1366 WndSetNext(Wnd->spwndPrev, Wnd->spwndNext);
1367
1368 if (Wnd->spwndParent && Wnd->spwndParent->spwndChild == Wnd)
1369 WndSetChild(Wnd->spwndParent, Wnd->spwndNext);
1370
1371 WndSetPrev(Wnd, NULL);
1372 WndSetNext(Wnd, NULL);
1373}
static VOID WndSetPrev(_Inout_ PWND pwnd, _In_opt_ PWND pwndPrev)
Definition: window.h:178
static VOID WndSetNext(_Inout_ PWND pwnd, _In_opt_ PWND pwndNext)
Definition: window.h:171

Referenced by co_IntSetParent(), co_UserFreeWindow(), IntImeSetTopMost(), and IntLinkHwnd().

◆ IntWantImeWindow()

BOOL FASTCALL IntWantImeWindow ( PWND  pwndTarget)

Definition at line 1914 of file ime.c.

1915{
1916 PDESKTOP rpdesk;
1917 PWINSTATION_OBJECT rpwinstaParent;
1918 PWND pwndNode, pwndParent = pwndTarget->spwndParent;
1919
1921 return FALSE;
1922
1923 if (IS_WND_IMELIKE(pwndTarget))
1924 return FALSE;
1925
1926 if (pwndTarget->fnid == FNID_DESKTOP || pwndTarget->fnid == FNID_MESSAGEWND)
1927 return FALSE;
1928
1929 if (pwndTarget->state & WNDS_SERVERSIDEWINDOWPROC)
1930 return FALSE;
1931
1932 rpdesk = pwndTarget->head.rpdesk;
1933 if (!rpdesk)
1934 return FALSE;
1935
1936 rpwinstaParent = rpdesk->rpwinstaParent;
1937 if (!rpwinstaParent || (rpwinstaParent->Flags & WSS_NOIO))
1938 return FALSE;
1939
1940 for (pwndNode = pwndParent; pwndNode; pwndNode = pwndNode->spwndParent)
1941 {
1942 if (rpdesk != pwndNode->head.rpdesk)
1943 break;
1944
1945 if (pwndNode == rpdesk->spwndMessage)
1946 return FALSE;
1947 }
1948
1949 return TRUE;
1950}
#define TIF_DISABLEIME
Definition: ntuser.h:288
#define FNID_MESSAGEWND
Definition: ntuser.h:864
PTHREADINFO gptiCurrent
Definition: ntuser.c:15
struct _WINSTATION_OBJECT * rpwinstaParent
Definition: desktop.h:11
PWND spwndMessage
Definition: desktop.h:20
FLONG TIF_flags
Definition: win32.h:95
#define WSS_NOIO
Definition: winsta.h:9

Referenced by co_UserCreateWindowEx().

◆ IntWinListChildren()

HWND *FASTCALL IntWinListChildren ( PWND  Window)

Definition at line 276 of file window.c.

277{
278 PWND Child;
279 HWND *List;
280 UINT Index, NumChildren = 0;
281
282 if (!Window) return NULL;
283
284 for (Child = Window->spwndChild; Child; Child = Child->spwndNext)
285 {
286 ++NumChildren;
287 }
288
289 List = ExAllocatePoolWithTag(PagedPool, (NumChildren + 1) * sizeof(HWND), USERTAG_WINDOWLIST);
290 if(!List)
291 {
292 ERR("Failed to allocate memory for children array\n");
294 return NULL;
295 }
296
297 Index = 0;
298 for (Child = Window->spwndChild; Child; Child = Child->spwndNext)
299 {
301 }
302 List[Index] = NULL;
303
304 return List;
305}

Referenced by co_IntPaintWindows(), co_IntSendActivateMessages(), co_IntSendMessageTimeout(), co_UserFreeWindow(), co_WinPosSearchChildren(), IntChildWindowFromPointEx(), IntClientShutdown(), IntDeactivateWindow(), IntFindWindow(), IntRealChildWindowFromPoint(), IntSendDestroyMsg(), NtUserBuildHwndList(), NtUserFindWindowEx(), NtUserMessageCall(), SpiNotifyNCMetricsChanged(), UserPostMessage(), UserRegisterUserApiHook(), UserSendNotifyMessage(), and WinPosDoOwnedPopups().

◆ IntWinListOwnedPopups()

HWND *FASTCALL IntWinListOwnedPopups ( PWND  Window)

Definition at line 317 of file window.c.

318{
320 HWND *List;
321 UINT Index, NumOwned = 0;
322
324 if (!Desktop)
325 return NULL;
326
327 for (Child = Desktop->spwndChild; Child; Child = Child->spwndNext)
328 {
329 if (Child->spwndOwner == Window && !IntWndIsDefaultIme(Child))
330 ++NumOwned;
331 }
332
333 List = ExAllocatePoolWithTag(PagedPool, (NumOwned + 1) * sizeof(HWND), USERTAG_WINDOWLIST);
334 if (!List)
335 {
336 ERR("Failed to allocate memory for children array\n");
338 return NULL;
339 }
340
341 Index = 0;
342 for (Child = Desktop->spwndChild; Child; Child = Child->spwndNext)
343 {
344 if (Child->spwndOwner == Window && !IntWndIsDefaultIme(Child))
346 }
347 List[Index] = NULL;
348
349 return List;
350}
static BOOL IntWndIsDefaultIme(_In_ PWND Window)
Definition: window.c:308

Referenced by IntDestroyOwnedWindows(), and IntShowOwnedPopups().

◆ ReplaceWndPtr()

static VOID ReplaceWndPtr ( _Inout_ PWND ppwnd,
_In_opt_ PWND  pwndNew 
)
inlinestatic

Definition at line 130 of file window.h.

131{
132 /* First reference the new one */
133 if (pwndNew != NULL)
134 {
135 UserReferenceObject(pwndNew);
136 }
137
138 /* Then dereference the previous one */
139 if (*ppwnd != NULL)
140 {
141 UserDereferenceObject(*ppwnd);
142 }
143
144 /* And set */
145 *ppwnd = pwndNew;
146}

Referenced by WndSetChild(), WndSetLastActive(), WndSetNext(), WndSetOwner(), WndSetParent(), and WndSetPrev().

◆ UserUpdateUiState()

BOOL FASTCALL UserUpdateUiState ( PWND  Wnd,
WPARAM  wParam 
)

Definition at line 40 of file window.c.

41{
44
45 if (Flags & ~(UISF_HIDEFOCUS | UISF_HIDEACCEL | UISF_ACTIVE))
46 {
48 return FALSE;
49 }
50
51 switch (Action)
52 {
53 case UIS_INITIALIZE:
55 return FALSE;
56
57 case UIS_SET:
58 if (Flags & UISF_HIDEFOCUS)
59 Wnd->HideFocus = TRUE;
60 if (Flags & UISF_HIDEACCEL)
61 Wnd->HideAccel = TRUE;
62 break;
63
64 case UIS_CLEAR:
65 if (Flags & UISF_HIDEFOCUS)
66 Wnd->HideFocus = FALSE;
67 if (Flags & UISF_HIDEACCEL)
68 Wnd->HideAccel = FALSE;
69 break;
70 }
71
72 return TRUE;
73}
unsigned short WORD
Definition: ntddk_ex.h:93
_In_ WDFIOTARGET _In_ _Strict_type_match_ WDF_IO_TARGET_SENT_IO_ACTION Action
Definition: wdfiotarget.h:510

Referenced by NtUserCallTwoParam().

◆ ValidateHwndNoErr()

PWND FASTCALL ValidateHwndNoErr ( HWND  hWnd)

Definition at line 108 of file window.c.

109{
110 PWND Window;
111
112 if (!hWnd)
113 return NULL;
114
116 if (!Window || (Window->state & WNDS_DESTROYED))
117 return NULL;
118
119 return Window;
120}
PVOID UserGetObjectNoErr(PUSER_HANDLE_TABLE ht, HANDLE handle, HANDLE_TYPE type)
Definition: object.c:481

◆ VerifyWnd()

PWND FASTCALL VerifyWnd ( PWND  pWnd)

Definition at line 88 of file window.c.

89{
91
92 if (!pWnd ||
93 (pWnd->state & WNDS_DESTROYED) ||
94 (pWnd->state2 & WNDS2_INDESTROY))
95 {
96 return NULL;
97 }
98
100
102 pWnd = NULL;
103
105 return pWnd;
106}
BOOL FASTCALL UserObjectInDestroy(HANDLE h)
Definition: object.c:703
ENGAPI ULONG APIENTRY EngGetLastError(VOID)
Definition: error.c:9

Referenced by ActivateOtherWindowMin(), co_IntMakeWindowActive(), co_IntSetActiveWindow(), co_IntSetForegroundMessageQueue(), co_WinPosShowWindow(), IntActivateWindow(), IntDispatchMessage(), IntSendParentNotify(), MENU_TrackMenu(), UserSetActiveWindow(), and VIS_ComputeVisibleRegion().

◆ WndSetChild()

static VOID WndSetChild ( _Inout_ PWND  pwnd,
_In_opt_ PWND  pwndChild 
)
inlinestatic

Definition at line 164 of file window.h.

165{
166 ReplaceWndPtr(&pwnd->spwndChild, pwndChild);
167}
static VOID ReplaceWndPtr(_Inout_ PWND *ppwnd, _In_opt_ PWND pwndNew)
Definition: window.h:130

Referenced by co_UserFreeWindow(), IntLinkWindow(), and IntUnlinkWindow().

◆ WndSetLastActive()

static VOID WndSetLastActive ( _Inout_ PWND  pwnd,
_In_opt_ PWND  pwndLastActive 
)
inlinestatic

Definition at line 185 of file window.h.

186{
187 ReplaceWndPtr(&pwnd->spwndLastActive, pwndLastActive);
188}

Referenced by co_IntMakeWindowActive(), co_UserDestroyWindow(), co_UserFreeWindow(), and IntCreateWindow().

◆ WndSetNext()

static VOID WndSetNext ( _Inout_ PWND  pwnd,
_In_opt_ PWND  pwndNext 
)
inlinestatic

Definition at line 171 of file window.h.

172{
173 ReplaceWndPtr(&pwnd->spwndNext, pwndNext);
174}

Referenced by IntLinkWindow(), and IntUnlinkWindow().

◆ WndSetOwner()

static VOID WndSetOwner ( _Inout_ PWND  pwnd,
_In_opt_ PWND  pwndOwner 
)
inlinestatic

◆ WndSetParent()

static VOID WndSetParent ( _Inout_ PWND  pwnd,
_In_opt_ PWND  pwndParent 
)
inlinestatic

Definition at line 157 of file window.h.

158{
159 ReplaceWndPtr(&pwnd->spwndParent, pwndParent);
160}

Referenced by co_IntSetParent(), co_UserFreeWindow(), and IntCreateWindow().

◆ WndSetPrev()

static VOID WndSetPrev ( _Inout_ PWND  pwnd,
_In_opt_ PWND  pwndPrev 
)
inlinestatic

Definition at line 178 of file window.h.

179{
180 ReplaceWndPtr(&pwnd->spwndPrev, pwndPrev);
181}

Referenced by IntLinkWindow(), and IntUnlinkWindow().

Variable Documentation

◆ AtomFlashWndState

ATOM AtomFlashWndState
extern

Definition at line 22 of file ntuser.c.

Referenced by InitUserAtoms(), and IntFlashWindowEx().

◆ AtomLayer

◆ AtomMessage

ATOM AtomMessage
extern

Definition at line 19 of file ntuser.c.

Referenced by InitUserAtoms().

◆ AtomWndObj

ATOM AtomWndObj
extern

Definition at line 20 of file ntuser.c.

Referenced by EngCreateWnd(), EngDeleteWnd(), InitUserAtoms(), IntEngWindowChanged(), and UserGethWnd().

◆ g_bWindowSnapEnabled

BOOL g_bWindowSnapEnabled
extern

◆ gfIMEShowStatus

BOOL gfIMEShowStatus
extern

◆ gpwlCache

PWINDOWLIST gpwlCache
extern

Definition at line 19 of file window.c.

Referenced by IntBuildHwndList(), IntFreeHwndList(), and UserProcessDestroy().

◆ gpwlList

PWINDOWLIST gpwlList
extern

Definition at line 18 of file window.c.

Referenced by ExitThreadCallback(), IntBuildHwndList(), and IntFreeHwndList().