ReactOS 0.4.15-dev-8093-g3285f69
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)(ULONG_PTR)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)(ULONG_PTR)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 1957 of file ime.c.

1958{
1959 LARGE_UNICODE_STRING WindowName;
1960 UNICODE_STRING ClassName;
1961 PWND pImeWnd;
1962 PIMEUI pimeui;
1963 CREATESTRUCTW Cs;
1966 HANDLE pid = PsGetThreadProcessId(pti->pEThread);
1967
1968 if (!(pti->spDefaultImc) && pid == gpidLogon)
1970
1971 if (!(pti->spDefaultImc) || IS_WND_IMELIKE(pwndTarget) || !(pti->rpdesk->pheapDesktop))
1972 return NULL;
1973
1974 if (IS_WND_CHILD(pwndTarget) && !(pwndTarget->style & WS_VISIBLE) &&
1975 pwndTarget->spwndParent->head.pti->ppi != pti->ppi)
1976 {
1977 return NULL;
1978 }
1979
1980 RtlInitLargeUnicodeString(&WindowName, L"Default IME", 0);
1981
1983 ClassName.Length = 0;
1984 ClassName.MaximumLength = 0;
1985
1986 UserRefObjectCo(pwndTarget, &Ref);
1987
1988 RtlZeroMemory(&Cs, sizeof(Cs));
1989 Cs.style = WS_POPUP | WS_DISABLED;
1990 Cs.hInstance = hInst;
1991 Cs.hwndParent = UserHMGetHandle(pwndTarget);
1992 Cs.lpszName = WindowName.Buffer;
1993 Cs.lpszClass = ClassName.Buffer;
1994
1995 // NOTE: LARGE_UNICODE_STRING is compatible to LARGE_STRING.
1996 pImeWnd = co_UserCreateWindowEx(&Cs, &ClassName, (PLARGE_STRING)&WindowName, NULL, WINVER);
1997 if (pImeWnd)
1998 {
1999 pimeui = ((PIMEWND)pImeWnd)->pimeui;
2000 _SEH2_TRY
2001 {
2002 ProbeForWrite(pimeui, sizeof(IMEUI), 1);
2003 pimeui->fDefault = TRUE;
2004 if (IS_WND_CHILD(pwndTarget) && pwndTarget->spwndParent->head.pti != pti)
2005 pimeui->fChildThreadDef = TRUE;
2006 }
2008 {
2009 ERR("%p\n", pimeui);
2010 }
2011 _SEH2_END;
2012 }
2013
2014 UserDerefObjectCo(pwndTarget);
2015 return pImeWnd;
2016}
#define ERR(fmt,...)
Definition: debug.h:113
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
HINSTANCE hInst
Definition: dxdiag.c:13
VOID NTAPI ProbeForWrite(IN PVOID Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:143
#define _SEH2_END
Definition: filesup.c:22
#define _SEH2_TRY
Definition: filesup.c:19
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
#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
WCHAR * PWCH
Definition: ntbasedef.h:410
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:40
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
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:2965
LPCWSTR lpszName
Definition: winuser.h:2964
HINSTANCE hInstance
Definition: winuser.h:2956
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
uint32_t ULONG_PTR
Definition: typedefs.h:65
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:2173
#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 2173 of file window.c.

2178{
2179 ULONG style;
2180 PWND Window = NULL, ParentWindow = NULL, OwnerWindow;
2181 HWND hWnd, hWndParent, hWndOwner, hwndInsertAfter;
2182 PWINSTATION_OBJECT WinSta;
2183 PCLS Class = NULL;
2184 SIZE Size;
2185 POINT MaxSize, MaxPos, MinTrack, MaxTrack;
2186 CBT_CREATEWNDW * pCbtCreate;
2188 USER_REFERENCE_ENTRY ParentRef, Ref;
2189 PTHREADINFO pti;
2190 DWORD dwShowMode = SW_SHOW;
2191 CREATESTRUCTW *pCsw = NULL;
2192 PVOID pszClass = NULL, pszName = NULL;
2193 PWND ret = NULL;
2194
2195 /* Get the current window station and reference it */
2196 pti = GetW32ThreadInfo();
2197 if (pti == NULL || pti->rpdesk == NULL)
2198 {
2199 ERR("Thread is not attached to a desktop! Cannot create window (%wZ)\n", ClassName);
2200 return NULL; // There is nothing to cleanup.
2201 }
2202 WinSta = pti->rpdesk->rpwinstaParent;
2204
2205 pCsw = NULL;
2206 pCbtCreate = NULL;
2207
2208 /* Get the class and reference it */
2209 Class = IntGetAndReferenceClass(ClassName, Cs->hInstance, FALSE);
2210 if(!Class)
2211 {
2213 ERR("Failed to find class %wZ\n", ClassName);
2214 goto cleanup;
2215 }
2216
2217 /* Now find the parent and the owner window */
2218 hWndParent = UserHMGetHandle(pti->rpdesk->pDeskInfo->spwnd);
2219 hWndOwner = NULL;
2220
2221 if (Cs->hwndParent == HWND_MESSAGE)
2222 {
2223 Cs->hwndParent = hWndParent = UserHMGetHandle(pti->rpdesk->spwndMessage);
2224 }
2225 else if (Cs->hwndParent)
2226 {
2227 if ((Cs->style & (WS_CHILD|WS_POPUP)) != WS_CHILD)
2228 hWndOwner = Cs->hwndParent;
2229 else
2230 hWndParent = Cs->hwndParent;
2231 }
2232 else if ((Cs->style & (WS_CHILD|WS_POPUP)) == WS_CHILD)
2233 {
2234 ERR("Cannot create a child window (%wZ) without a parent\n", ClassName);
2236 goto cleanup; /* WS_CHILD needs a parent, but WS_POPUP doesn't */
2237 }
2239 (IS_INTRESOURCE(Cs->lpszClass) ||
2240 Cs->lpszClass != (LPCWSTR)MAKEINTATOM(gpsi->atomSysClass[ICLS_HWNDMESSAGE]) ||
2241 _wcsicmp(Cs->lpszClass, L"Message") != 0))
2242 {
2243 if (pti->ppi->dwLayout & LAYOUT_RTL)
2244 {
2246 }
2247 }
2248
2249 ParentWindow = hWndParent ? UserGetWindowObject(hWndParent): NULL;
2250 OwnerWindow = hWndOwner ? UserGetWindowObject(hWndOwner): NULL;
2251
2252 if (hWndParent && !ParentWindow)
2253 {
2254 ERR("Got invalid parent window handle for %wZ\n", ClassName);
2255 goto cleanup;
2256 }
2257 else if (hWndOwner && !OwnerWindow)
2258 {
2259 ERR("Got invalid owner window handle for %wZ\n", ClassName);
2260 ParentWindow = NULL;
2261 goto cleanup;
2262 }
2263
2264 if(OwnerWindow)
2265 {
2266 if (IntIsDesktopWindow(OwnerWindow)) OwnerWindow = NULL;
2267 else if (ParentWindow && !IntIsDesktopWindow(ParentWindow))
2268 {
2269 ERR("an owned window must be created as top-level\n");
2271 goto cleanup;
2272 }
2273 else /* owner must be a top-level window */
2274 {
2275 while ((OwnerWindow->style & (WS_POPUP|WS_CHILD)) == WS_CHILD && !IntIsDesktopWindow(OwnerWindow->spwndParent))
2276 OwnerWindow = OwnerWindow->spwndParent;
2277 }
2278 }
2279
2280 /* Fix the position and the size of the window */
2281 if (ParentWindow)
2282 {
2283 UserRefObjectCo(ParentWindow, &ParentRef);
2284 IntFixWindowCoordinates(Cs, ParentWindow, &dwShowMode);
2285 }
2286
2287 /* Allocate and initialize the new window */
2289 WindowName,
2290 Class,
2291 ParentWindow,
2292 OwnerWindow,
2293 acbiBuffer,
2294 NULL,
2295 dwVer );
2296 if(!Window)
2297 {
2298 ERR("IntCreateWindow(%wZ) failed\n", ClassName);
2299 goto cleanup;
2300 }
2301
2303 hwndInsertAfter = HWND_TOP;
2304
2305 UserRefObjectCo(Window, &Ref);
2307 ObDereferenceObject(WinSta);
2308
2309 /* NCCREATE, WM_NCCALCSIZE and Hooks need the original values */
2310 Cs->lpszName = (LPCWSTR) WindowName;
2311 Cs->lpszClass = (LPCWSTR) ClassName;
2312
2314 if ( ISITHOOKED(WH_CBT) || (pti->rpdesk->pDeskInfo->fsHooks & HOOKID_TO_FLAG(WH_CBT)) )
2315 {
2316 // Allocate the calling structures Justin Case this goes Global.
2319 if (!pCsw || !pCbtCreate)
2320 {
2321 ERR("UserHeapAlloc() failed!\n");
2322 goto cleanup;
2323 }
2324
2325 if (!IntMsgCreateStructW( Window, pCsw, Cs, &pszClass, &pszName ) )
2326 {
2327 ERR("IntMsgCreateStructW() failed!\n");
2328 goto cleanup;
2329 }
2330
2331 pCbtCreate->lpcs = pCsw;
2332 pCbtCreate->hwndInsertAfter = hwndInsertAfter;
2333
2336 if (Result != 0)
2337 {
2338 ERR("WH_CBT HCBT_CREATEWND hook failed! 0x%x\n", Result);
2339 goto cleanup;
2340 }
2341 // Write back changes.
2342 Cs->cx = pCsw->cx;
2343 Cs->cy = pCsw->cy;
2344 Cs->x = pCsw->x;
2345 Cs->y = pCsw->y;
2346 hwndInsertAfter = pCbtCreate->hwndInsertAfter;
2347 }
2348
2349 if ((Cs->style & (WS_CHILD|WS_POPUP)) == WS_CHILD)
2350 {
2351 if (ParentWindow != co_GetDesktopWindow(Window))
2352 {
2353 Cs->x += ParentWindow->rcClient.left;
2354 Cs->y += ParentWindow->rcClient.top;
2355 }
2356 }
2357
2358 /* Send the WM_GETMINMAXINFO message */
2359 Size.cx = Cs->cx;
2360 Size.cy = Cs->cy;
2361
2362 if ((Cs->style & WS_THICKFRAME) || !(Cs->style & (WS_POPUP | WS_CHILD)))
2363 {
2364 co_WinPosGetMinMaxInfo(Window, &MaxSize, &MaxPos, &MinTrack, &MaxTrack);
2365 if (Size.cx > MaxTrack.x) Size.cx = MaxTrack.x;
2366 if (Size.cy > MaxTrack.y) Size.cy = MaxTrack.y;
2367 if (Size.cx < MinTrack.x) Size.cx = MinTrack.x;
2368 if (Size.cy < MinTrack.y) Size.cy = MinTrack.y;
2369 }
2370
2371 Window->rcWindow.left = Cs->x;
2372 Window->rcWindow.top = Cs->y;
2373 Window->rcWindow.right = Cs->x + Size.cx;
2374 Window->rcWindow.bottom = Cs->y + Size.cy;
2375 /*
2376 if (0 != (Window->style & WS_CHILD) && ParentWindow)
2377 {
2378 ERR("co_UserCreateWindowEx(): Offset rcWindow\n");
2379 RECTL_vOffsetRect(&Window->rcWindow,
2380 ParentWindow->rcClient.left,
2381 ParentWindow->rcClient.top);
2382 }
2383 */
2384 /* correct child window coordinates if mirroring on parent is enabled */
2385 if (ParentWindow != NULL)
2386 {
2387 if ( ((Cs->style & WS_CHILD) == WS_CHILD) &&
2388 ((ParentWindow->ExStyle & WS_EX_LAYOUTRTL) == WS_EX_LAYOUTRTL))
2389 {
2390 Window->rcWindow.right = ParentWindow->rcClient.right - (Window->rcWindow.left - ParentWindow->rcClient.left);
2391 Window->rcWindow.left = Window->rcWindow.right - Size.cx;
2392 }
2393 }
2394
2395 Window->rcClient = Window->rcWindow;
2396
2397 if (Window->spwndNext || Window->spwndPrev)
2398 {
2399 ERR("Window 0x%p has been linked too early!\n", Window);
2400 }
2401
2402 if (!(Window->state2 & WNDS2_WIN31COMPAT))
2403 {
2404 if (Class->style & CS_PARENTDC && !(ParentWindow->style & WS_CLIPCHILDREN))
2405 Window->style &= ~(WS_CLIPSIBLINGS | WS_CLIPCHILDREN);
2406 }
2407
2408 if ((Window->style & (WS_CHILD | WS_POPUP)) == WS_CHILD)
2409 {
2411 {
2412 if (pti != ParentWindow->head.pti)
2413 {
2414 //ERR("CreateWindow Parent in.\n");
2415 UserAttachThreadInput(pti, ParentWindow->head.pti, TRUE);
2416 }
2417 }
2418 }
2419
2420 /* Send the NCCREATE message */
2422 if (!Result)
2423 {
2424 ERR("co_UserCreateWindowEx(%wZ): NCCREATE message failed\n", ClassName);
2425 goto cleanup;
2426 }
2427
2428 /* Link the window */
2429 if (ParentWindow != NULL)
2430 {
2431 /* Link the window into the siblings list */
2432 if ((Cs->style & (WS_CHILD | WS_MAXIMIZE)) == WS_CHILD)
2434 else
2435 IntLinkHwnd(Window, hwndInsertAfter);
2436 }
2437
2438 /* Create the IME window for pWnd */
2440 {
2441 PWND pwndDefaultIme = co_IntCreateDefaultImeWindow(Window, Window->hModule);
2442 UserAssignmentLock((PVOID*)&pti->spwndDefaultIme, pwndDefaultIme);
2443
2444 if (pwndDefaultIme)
2445 {
2446 HWND hImeWnd;
2448 UserRefObjectCo(pwndDefaultIme, &Ref);
2449
2450 hImeWnd = UserHMGetHandle(pwndDefaultIme);
2451
2453
2454 if (pti->pClientInfo->CI_flags & CI_IMMACTIVATE)
2455 {
2456 HKL hKL = pti->KeyboardLayout->hkl;
2458 pti->pClientInfo->CI_flags &= ~CI_IMMACTIVATE;
2459 }
2460
2461 UserDerefObjectCo(pwndDefaultIme);
2462 }
2463 }
2464
2465 /* Send the WM_NCCALCSIZE message */
2466 {
2467 // RECT rc;
2468 MaxPos.x = Window->rcWindow.left;
2469 MaxPos.y = Window->rcWindow.top;
2470
2471 Result = co_WinPosGetNonClientSize(Window, &Window->rcWindow, &Window->rcClient);
2472 //rc = Window->rcWindow;
2473 //Result = co_IntSendMessageNoWait(UserHMGetHandle(Window), WM_NCCALCSIZE, FALSE, (LPARAM)&rc);
2474 //Window->rcClient = rc;
2475
2476 RECTL_vOffsetRect(&Window->rcWindow, MaxPos.x - Window->rcWindow.left,
2477 MaxPos.y - Window->rcWindow.top);
2478 }
2479
2480 /* Send the WM_CREATE message. */
2482 if (Result == (LRESULT)-1)
2483 {
2484 ERR("co_UserCreateWindowEx(%wZ): WM_CREATE message failed\n", ClassName);
2485 goto cleanup;
2486 }
2487
2488 /* Send the EVENT_OBJECT_CREATE event */
2489 IntNotifyWinEvent(EVENT_OBJECT_CREATE, Window, OBJID_WINDOW, CHILDID_SELF, 0);
2490
2491 /* By setting the flag below it can be examined to determine if the window
2492 was created successfully and a valid pwnd was passed back to caller since
2493 from here the function has to succeed. */
2495
2496 /* Send the WM_SIZE and WM_MOVE messages. */
2497 if (!(Window->state & WNDS_SENDSIZEMOVEMSGS))
2498 {
2500 }
2501
2502 /* Show or maybe minimize or maximize the window. */
2503
2505 if (style & (WS_MINIMIZE | WS_MAXIMIZE))
2506 {
2507 RECTL NewPos;
2508 UINT SwFlag = (style & WS_MINIMIZE) ? SW_MINIMIZE : SW_MAXIMIZE;
2509
2510 SwFlag = co_WinPosMinMaximize(Window, SwFlag, &NewPos);
2511 SwFlag |= SWP_NOZORDER|SWP_FRAMECHANGED; /* Frame always gets changed */
2512 if (!(style & WS_VISIBLE) || (style & WS_CHILD) || UserGetActiveWindow() ||
2513 (Window->ExStyle & WS_EX_NOACTIVATE))
2514 {
2515 SwFlag |= SWP_NOACTIVATE;
2516 }
2517 co_WinPosSetWindowPos(Window, 0, NewPos.left, NewPos.top,
2518 NewPos.right, NewPos.bottom, SwFlag);
2519 }
2520
2521 /* Send the WM_PARENTNOTIFY message */
2523
2524 /* Notify the shell that a new window was created */
2525 if (Window->spwndOwner == NULL ||
2526 !(Window->spwndOwner->style & WS_VISIBLE) ||
2527 (Window->spwndOwner->ExStyle & WS_EX_TOOLWINDOW))
2528 {
2529 if (UserIsDesktopWindow(Window->spwndParent) &&
2530 (Window->style & WS_VISIBLE) &&
2531 (!(Window->ExStyle & WS_EX_TOOLWINDOW) ||
2532 (Window->ExStyle & WS_EX_APPWINDOW)))
2533 {
2535 }
2536 }
2537
2538 /* Initialize and show the window's scrollbars */
2539 if (Window->style & WS_VSCROLL)
2540 {
2542 }
2543 if (Window->style & WS_HSCROLL)
2544 {
2546 }
2547
2548 /* Show the new window */
2549 if (Cs->style & WS_VISIBLE)
2550 {
2551 if (Window->style & WS_MAXIMIZE)
2552 dwShowMode = SW_SHOW;
2553 else if (Window->style & WS_MINIMIZE)
2554 dwShowMode = SW_SHOWMINIMIZED;
2555
2556 co_WinPosShowWindow(Window, dwShowMode);
2557
2558 if (Window->ExStyle & WS_EX_MDICHILD)
2559 {
2560 ASSERT(ParentWindow);
2561 if(!ParentWindow)
2562 goto cleanup;
2564 /* ShowWindow won't activate child windows */
2566 }
2567 }
2568
2569 if (Class->atomClassName == gaGuiConsoleWndClass)
2570 {
2571 /* Count only console windows manually */
2573 }
2574
2575 TRACE("co_UserCreateWindowEx(%wZ): Created window %p\n", ClassName, hWnd);
2576 ret = Window;
2577
2578cleanup:
2579 if (!ret)
2580 {
2581 TRACE("co_UserCreateWindowEx(): Error Created window!\n");
2582 /* If the window was created, the class will be dereferenced by co_UserDestroyWindow */
2583 if (Window)
2585 else if (Class)
2587 }
2588
2589 if (pCsw) ExFreePoolWithTag(pCsw, TAG_HOOK);
2590 if (pCbtCreate) ExFreePoolWithTag(pCbtCreate, TAG_HOOK);
2591 if (pszName) UserHeapFree(pszName);
2592 if (pszClass) UserHeapFree(pszClass);
2593
2594 if (Window)
2595 {
2597 }
2598 if (ParentWindow) UserDerefObjectCo(ParentWindow);
2599
2600 // See CORE-13717, not setting error on success.
2601 if (ret)
2603
2604 return ret;
2605}
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:805
#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:34
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:2415
BOOLEAN FASTCALL co_WinPosSetWindowPos(PWND Window, HWND WndInsertAfter, INT x, INT y, INT cx, INT cy, UINT flags)
Definition: winpos.c:1786
LRESULT FASTCALL co_WinPosGetNonClientSize(PWND Window, RECT *WindowRect, RECT *ClientRect)
Definition: winpos.c:2366
UINT FASTCALL co_WinPosGetMinMaxInfo(PWND Window, POINT *MaxSize, POINT *MaxPos, POINT *MinTrack, POINT *MaxTrack)
Definition: winpos.c:934
void FASTCALL co_WinPosSendSizeMove(PWND Wnd)
Definition: winpos.c:2381
BOOLEAN FASTCALL co_WinPosShowWindow(PWND Wnd, INT Cmd)
Definition: winpos.c:2566
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:279
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:2975
HWND hwndInsertAfter
Definition: winuser.h:2976
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:596
VOID IntDereferenceClass(IN OUT PCLS Class, IN PDESKTOPINFO Desktop, IN PPROCESSINFO pi)
Definition: class.c:818
PCLS IntGetAndReferenceClass(PUNICODE_STRING ClassName, HINSTANCE hInstance, BOOL bDesktopThread)
Definition: class.c:1448
VOID co_IntShellHookNotify(WPARAM Message, WPARAM wParam, LPARAM lParam)
Definition: desktop.c:1692
PWND FASTCALL co_GetDesktopWindow(PWND pWnd)
Definition: desktop.c:1366
#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:1957
BOOL FASTCALL IntWantImeWindow(PWND pwndTarget)
Definition: ime.c:1917
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:1445
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:143
PWND FASTCALL UserGetWindowObject(HWND hWnd)
Definition: window.c:122
PWND FASTCALL IntCreateWindow(CREATESTRUCTW *Cs, PLARGE_STRING WindowName, PCLS Class, PWND ParentWindow, PWND OwnerWindow, PVOID acbiBuffer, PDESKTOP pdeskCreated, DWORD dwVer)
Definition: window.c:1801
void FASTCALL IntFixWindowCoordinates(CREATESTRUCTW *Cs, PWND ParentWindow, DWORD *dwShowMode)
Definition: window.c:1711
BOOL FASTCALL IntIsTopLevelWindow(PWND pWnd)
Definition: window.c:359
BOOLEAN co_UserDestroyWindow(PVOID Object)
Definition: window.c:2853
VOID FASTCALL IntLinkHwnd(PWND Wnd, HWND hWndPrev)
Definition: window.c:983
static void IntSendParentNotify(PWND pWindow, UINT msg)
Definition: window.c:1692
#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:1463
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:1210
#define SWP_NOACTIVATE
Definition: winuser.h:1242
#define SWP_FRAMECHANGED
Definition: winuser.h:1240
#define WM_CREATE
Definition: winuser.h:1608
#define WS_EX_APPWINDOW
Definition: winuser.h:383
#define SW_MINIMIZE
Definition: winuser.h:776
#define HSHELL_WINDOWCREATED
Definition: winuser.h:1255
#define SB_VERT
Definition: winuser.h:553
#define SWP_NOMOVE
Definition: winuser.h:1244
#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:1245
#define WH_CBT
Definition: winuser.h:35
#define HCBT_CREATEWND
Definition: winuser.h:58
#define WM_NCCREATE
Definition: winuser.h:1683
#define WM_MDIREFRESHMENU
Definition: winuser.h:1826
#define SW_SHOWMINIMIZED
Definition: winuser.h:771
#define HWND_TOP
Definition: winuser.h:1207
#define WS_EX_MDICHILD
Definition: winuser.h:394
#define SWP_SHOWWINDOW
Definition: winuser.h:1248
#define SW_SHOW
Definition: winuser.h:775
#define SWP_NOZORDER
Definition: winuser.h:1247
#define SW_MAXIMIZE
Definition: winuser.h:772
#define CS_PARENTDC
Definition: winuser.h:656
#define HWND_BOTTOM
Definition: winuser.h:1205
#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 574 of file window.c.

578{
579 HWND *Children;
580 HWND *ChildHandle;
581 PWND Child;
582 PMENU Menu;
583 BOOLEAN BelongsToThreadData;
584
585 ASSERT(Window);
586
587 if(Window->state2 & WNDS2_INDESTROY)
588 {
589 TRACE("Tried to call co_UserFreeWindow() twice\n");
590 return 0;
591 }
592 Window->state2 |= WNDS2_INDESTROY;
593 Window->style &= ~WS_VISIBLE;
594 Window->head.pti->cVisWindows--;
595
596 /* remove the window already at this point from the thread window list so we
597 don't get into trouble when destroying the thread windows while we're still
598 in co_UserFreeWindow() */
599 if (!IsListEmpty(&Window->ThreadListEntry))
600 RemoveEntryList(&Window->ThreadListEntry);
601
602 BelongsToThreadData = IntWndBelongsToThread(Window, ThreadData);
603
605
606 /* free child windows */
607 Children = IntWinListChildren(Window);
608 if (Children)
609 {
610 for (ChildHandle = Children; *ChildHandle; ++ChildHandle)
611 {
612 if ((Child = IntGetWindowObject(*ChildHandle)))
613 {
615 {
616 /* send WM_DESTROY messages to windows not belonging to the same thread */
618 }
619 else
620 co_UserFreeWindow(Child, ProcessData, ThreadData, SendMessages);
621
623 }
624 }
626 }
627
628 if (SendMessages)
629 {
630 /*
631 * Clear the update region to make sure no WM_PAINT messages will be
632 * generated for this window while processing the WM_NCDESTROY.
633 */
637 if (BelongsToThreadData)
639 }
640
642
644
645 /* Unregister hot keys */
647
648 /* flush the message queue */
650
651 /* from now on no messages can be sent to this window anymore */
652 Window->state |= WNDS_DESTROYED;
653 Window->fnid |= FNID_FREED;
654
655 /* don't remove the WINDOWSTATUS_DESTROYING bit */
656
657 /* reset shell window handles */
658 if (ThreadData->rpdesk)
659 {
660 if (UserHMGetHandle(Window) == ThreadData->rpdesk->rpwinstaParent->ShellWindow)
661 ThreadData->rpdesk->rpwinstaParent->ShellWindow = NULL;
662
663 if (UserHMGetHandle(Window) == ThreadData->rpdesk->rpwinstaParent->ShellListView)
664 ThreadData->rpdesk->rpwinstaParent->ShellListView = NULL;
665 }
666
667 if (ThreadData->spwndDefaultIme &&
668 ThreadData->spwndDefaultIme->spwndOwner == Window)
669 {
670 WndSetOwner(ThreadData->spwndDefaultIme, NULL);
671 }
672
673 if (IS_IMM_MODE() && Window == ThreadData->spwndDefaultIme)
674 {
675 UserAssignmentUnlock((PVOID*)&(ThreadData->spwndDefaultIme));
676 }
677
678 /* Fixes dialog test_focus breakage due to r66237. */
679 if (ThreadData->MessageQueue->spwndFocus == Window)
680 ThreadData->MessageQueue->spwndFocus = NULL;
681
682 if (ThreadData->MessageQueue->spwndActive == Window)
683 ThreadData->MessageQueue->spwndActive = NULL;
684
685 if (ThreadData->MessageQueue->spwndCapture == Window)
686 {
688 }
689
691 if ( Window->hrgnUpdate != NULL || Window->state & WNDS_INTERNALPAINT )
692 {
693 MsqDecPaintCountQueue(Window->head.pti);
694 if (Window->hrgnUpdate > HRGN_WINDOW && GreIsHandleValid(Window->hrgnUpdate))
695 {
697 GreDeleteObject(Window->hrgnUpdate);
698 }
699 Window->hrgnUpdate = NULL;
700 Window->state &= ~WNDS_INTERNALPAINT;
701 }
702
704 {
706 }
707
708 if ( ((Window->style & (WS_CHILD|WS_POPUP)) != WS_CHILD) &&
709 Window->IDMenu &&
710 (Menu = UserGetMenuObject((HMENU)Window->IDMenu)))
711 {
712 TRACE("UFW: IDMenu %p\n",Window->IDMenu);
714 Window->IDMenu = 0;
715 }
716
717 if (Window->SystemMenu
718 && (Menu = UserGetMenuObject(Window->SystemMenu)))
719 {
721 Window->SystemMenu = (HMENU)0;
722 }
723
724 DceFreeWindowDCE(Window); /* Always do this to catch orphaned DCs */
725
727
728 if (Window->PropListItems)
729 {
731 TRACE("Window->PropListItems %lu\n",Window->PropListItems);
732 ASSERT(Window->PropListItems==0);
733 }
734
735 /* Kill any reference to linked windows. Prev & Next are taken care of in IntUnlinkWindow */
740
743
745
746 if (Window->pcls->atomClassName == gaGuiConsoleWndClass)
747 {
748 /* Count only console windows manually */
750 }
751
752 /* dereference the class */
753 NT_ASSERT(Window->head.pti != NULL);
755 Window->head.pti->pDeskInfo,
756 Window->head.pti->ppi);
757 Window->pcls = NULL;
758
759 if (Window->hrgnClip)
760 {
762 GreDeleteObject(Window->hrgnClip);
763 Window->hrgnClip = NULL;
764 }
765 Window->head.pti->cWindows--;
766
767// ASSERT(Window != NULL);
768 UserFreeWindowInfo(Window->head.pti, Window);
769
772
773 return 0;
774}
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:894
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:1784
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 UserReferenceObject(PVOID obj)
Definition: object.c:731
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:522
HWND *FASTCALL IntWinListChildren(PWND Window)
Definition: window.c:274
static VOID UserFreeWindowInfo(PTHREADINFO ti, PWND Wnd)
Definition: window.c:541
PWND FASTCALL IntGetWindowObject(HWND hWnd)
Definition: window.c:73
VOID FASTCALL IntUnlinkWindow(PWND Wnd)
Definition: window.c:1354
LRESULT co_UserFreeWindow(PWND Window, PPROCESSINFO ProcessData, PTHREADINFO ThreadData, BOOLEAN SendMessages)
Definition: window.c:574
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:1217
#define RDW_NOCHILDREN
Definition: winuser.h:1222
#define WM_NCDESTROY
Definition: winuser.h:1684
#define RDW_NOFRAME
Definition: winuser.h:1216
#define RDW_NOERASE
Definition: winuser.h:1215
#define RDW_VALIDATE
Definition: winuser.h:1218
#define NT_ASSERT
Definition: rtlfuncs.h:3310

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 4020 of file window.c.

4021{
4022 return (LONG)co_IntSetWindowLongPtr(hWnd, Index, NewValue, Ansi, sizeof(LONG), FALSE);
4023}
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:3825

Referenced by DesktopWindowProc(), and NtUserSetWindowWord().

◆ co_UserSetWindowLongPtr()

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

Definition at line 4026 of file window.c.

4027{
4028 return co_IntSetWindowLongPtr(hWnd, Index, NewValue, Ansi, sizeof(LONG_PTR), FALSE);
4029}
__int3264 LONG_PTR
Definition: mstsclib_h.h:276

◆ GetNCHitEx()

DWORD FASTCALL GetNCHitEx ( PWND  pWnd,
POINT  pt 
)

Definition at line 1954 of file nonclient.c.

1955{
1956 RECT rcWindow, rcClient;
1958
1959 if (!pWnd) return HTNOWHERE;
1960
1961 if (UserIsDesktopWindow(pWnd))
1962 {
1963 rcClient.left = rcClient.top = rcWindow.left = rcWindow.top = 0;
1968 }
1969 else
1970 {
1971 rcClient = pWnd->rcClient;
1972 rcWindow = pWnd->rcWindow;
1973 }
1974
1975 if (!RECTL_bPointInRect(&rcWindow, pt.x, pt.y)) return HTNOWHERE;
1976
1977 Style = pWnd->style;
1978 ExStyle = pWnd->ExStyle;
1979
1980 if (Style & WS_MINIMIZE) return HTCAPTION;
1981
1982 if (RECTL_bPointInRect( &rcClient, pt.x, pt.y )) return HTCLIENT;
1983
1984 /* Check borders */
1986 {
1988 if (!RECTL_bPointInRect(&rcWindow, pt.x, pt.y ))
1989 {
1990 /* Check top sizing border */
1991 if (pt.y < rcWindow.top)
1992 {
1993 if (pt.x < rcWindow.left+UserGetSystemMetrics(SM_CXSIZE)) return HTTOPLEFT;
1994 if (pt.x >= rcWindow.right-UserGetSystemMetrics(SM_CXSIZE)) return HTTOPRIGHT;
1995 return HTTOP;
1996 }
1997 /* Check bottom sizing border */
1998 if (pt.y >= rcWindow.bottom)
1999 {
2000 if (pt.x < rcWindow.left+UserGetSystemMetrics(SM_CXSIZE)) return HTBOTTOMLEFT;
2001 if (pt.x >= rcWindow.right-UserGetSystemMetrics(SM_CXSIZE)) return HTBOTTOMRIGHT;
2002 return HTBOTTOM;
2003 }
2004 /* Check left sizing border */
2005 if (pt.x < rcWindow.left)
2006 {
2007 if (pt.y < rcWindow.top+UserGetSystemMetrics(SM_CYSIZE)) return HTTOPLEFT;
2008 if (pt.y >= rcWindow.bottom-UserGetSystemMetrics(SM_CYSIZE)) return HTBOTTOMLEFT;
2009 return HTLEFT;
2010 }
2011 /* Check right sizing border */
2012 if (pt.x >= rcWindow.right)
2013 {
2014 if (pt.y < rcWindow.top+UserGetSystemMetrics(SM_CYSIZE)) return HTTOPRIGHT;
2015 if (pt.y >= rcWindow.bottom-UserGetSystemMetrics(SM_CYSIZE)) return HTBOTTOMRIGHT;
2016 return HTRIGHT;
2017 }
2018 }
2019 }
2020 else /* No thick frame */
2021 {
2022 if (HAS_DLGFRAME( Style, ExStyle ))
2024 else if (HAS_THINFRAME( Style, ExStyle ))
2026 else if (HAS_CLIENTFRAME( Style, ExStyle ))
2028 if (!RECTL_bPointInRect( &rcWindow, pt.x, pt.y )) return HTBORDER;
2029 }
2030
2031 /* Check caption */
2032
2033 if ((Style & WS_CAPTION) == WS_CAPTION)
2034 {
2036 rcWindow.top += UserGetSystemMetrics(SM_CYSMCAPTION) - 1;
2037 else
2038 rcWindow.top += UserGetSystemMetrics(SM_CYCAPTION) - 1;
2039 if (!RECTL_bPointInRect( &rcWindow, pt.x, pt.y ))
2040 {
2041 BOOL min_or_max_box = (Style & WS_SYSMENU) && (Style & (WS_MINIMIZEBOX|WS_MAXIMIZEBOX));
2043 {
2044 /* Check system menu */
2045 if ((Style & WS_SYSMENU) && !(ExStyle & WS_EX_TOOLWINDOW) && NC_IconForWindow(pWnd))
2046 {
2047 rcWindow.right -= UserGetSystemMetrics(SM_CYCAPTION) - 1;
2048 if (pt.x > rcWindow.right) return HTSYSMENU;
2049 }
2050
2051 /* Check close button */
2052 if (Style & WS_SYSMENU)
2053 {
2055 if (pt.x < rcWindow.left) return HTCLOSE;
2056 }
2057
2058 /* Check maximize box */
2059 /* In Win95 there is automatically a Maximize button when there is a minimize one */
2060 if (min_or_max_box && !(ExStyle & WS_EX_TOOLWINDOW))
2061 {
2062 rcWindow.left += UserGetSystemMetrics(SM_CXSIZE);
2063 if (pt.x < rcWindow.left) return HTMAXBUTTON;
2064 }
2065
2066 /* Check minimize box */
2067 if (min_or_max_box && !(ExStyle & WS_EX_TOOLWINDOW))
2068 {
2069 rcWindow.left += UserGetSystemMetrics(SM_CXSIZE);
2070 if (pt.x < rcWindow.left) return HTMINBUTTON;
2071 }
2072 }
2073 else
2074 {
2075 /* Check system menu */
2076 if ((Style & WS_SYSMENU) && !(ExStyle & WS_EX_TOOLWINDOW) && NC_IconForWindow(pWnd))
2077 {
2078 rcWindow.left += UserGetSystemMetrics(SM_CYCAPTION) - 1;
2079 if (pt.x < rcWindow.left) return HTSYSMENU;
2080 }
2081
2082 /* Check close button */
2083 if (Style & WS_SYSMENU)
2084 {
2086 if (pt.x > rcWindow.right) return HTCLOSE;
2087 }
2088
2089 /* Check maximize box */
2090 /* In Win95 there is automatically a Maximize button when there is a minimize one */
2091 if (min_or_max_box && !(ExStyle & WS_EX_TOOLWINDOW))
2092 {
2094 if (pt.x > rcWindow.right) return HTMAXBUTTON;
2095 }
2096
2097 /* Check minimize box */
2098 if (min_or_max_box && !(ExStyle & WS_EX_TOOLWINDOW))
2099 {
2101 if (pt.x > rcWindow.right) return HTMINBUTTON;
2102 }
2103 }
2104 return HTCAPTION;
2105 }
2106 }
2107
2108 /* Check menu bar */
2109
2110 if (HAS_MENU( pWnd, Style ) && (pt.y < rcClient.top) &&
2111 (pt.x >= rcClient.left) && (pt.x < rcClient.right))
2112 return HTMENU;
2113
2114 /* Check vertical scroll bar */
2115
2117 if (Style & WS_VSCROLL)
2118 {
2119 if((ExStyle & WS_EX_LEFTSCROLLBAR) != 0)
2121 else
2123 if (RECTL_bPointInRect( &rcClient, pt.x, pt.y )) return HTVSCROLL;
2124 }
2125
2126 /* Check horizontal scroll bar */
2127
2128 if (Style & WS_HSCROLL)
2129 {
2131 if (RECTL_bPointInRect( &rcClient, pt.x, pt.y ))
2132 {
2133 /* Check size box */
2134 if ((Style & WS_VSCROLL) &&
2135 ((((ExStyle & WS_EX_LEFTSCROLLBAR) != 0) && (pt.x <= rcClient.left + UserGetSystemMetrics(SM_CXVSCROLL))) ||
2136 (((ExStyle & WS_EX_LEFTSCROLLBAR) == 0) && (pt.x >= rcClient.right - UserGetSystemMetrics(SM_CXVSCROLL)))))
2137 return HTSIZE;
2138 return HTHSCROLL;
2139 }
2140 }
2141
2142 /* Has to return HTNOWHERE if nothing was found
2143 Could happen when a window has a customized non client area */
2144 return HTNOWHERE;
2145}
#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:213
PCURICON_OBJECT FASTCALL NC_IconForWindow(PWND pWnd)
Definition: nonclient.c:705
#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:2492
#define HTCLOSE
Definition: winuser.h:2499
#define SM_CYEDGE
Definition: winuser.h:1009
#define SM_CYSCREEN
Definition: winuser.h:960
#define HTCAPTION
Definition: winuser.h:2476
#define SM_CXEDGE
Definition: winuser.h:1008
#define HTTOPLEFT
Definition: winuser.h:2491
#define SM_CYSIZE
Definition: winuser.h:992
#define SM_CXVSCROLL
Definition: winuser.h:961
#define HTBOTTOM
Definition: winuser.h:2493
#define HTBORDER
Definition: winuser.h:2497
#define SM_CXFRAME
Definition: winuser.h:994
#define HTVSCROLL
Definition: winuser.h:2482
#define HTHSCROLL
Definition: winuser.h:2481
#define HTMAXBUTTON
Definition: winuser.h:2484
#define SM_CXSIZE
Definition: winuser.h:991
#define SM_CYFRAME
Definition: winuser.h:996
#define SM_CYHSCROLL
Definition: winuser.h:962
#define HTMENU
Definition: winuser.h:2480
#define SM_CYBORDER
Definition: winuser.h:965
#define SM_CXBORDER
Definition: winuser.h:964
#define HTRIGHT
Definition: winuser.h:2489
#define HTCLIENT
Definition: winuser.h:2475
#define HTBOTTOMRIGHT
Definition: winuser.h:2495
#define HTNOWHERE
Definition: winuser.h:2474
#define SM_CXDLGFRAME
Definition: winuser.h:966
#define HTSIZE
Definition: winuser.h:2479
#define HTBOTTOMLEFT
Definition: winuser.h:2494
#define HTTOP
Definition: winuser.h:2490
#define SM_CYSMCAPTION
Definition: winuser.h:1014
#define SM_CYDLGFRAME
Definition: winuser.h:968
#define WS_EX_LEFTSCROLLBAR
Definition: winuser.h:392
#define SM_CXSCREEN
Definition: winuser.h:959
#define HTMINBUTTON
Definition: winuser.h:2483
#define HTSYSMENU
Definition: winuser.h:2477
#define HTLEFT
Definition: winuser.h:2487
#define SM_CYCAPTION
Definition: winuser.h:963

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

◆ IntBroadcastImeShowStatusChange()

BOOL FASTCALL IntBroadcastImeShowStatusChange ( PWND  pImeWnd,
BOOL  bShow 
)

Definition at line 2386 of file ime.c.

2387{
2388 if (gfIMEShowStatus == bShow || !IS_IMM_MODE())
2389 return TRUE;
2390
2391 gfIMEShowStatus = bShow;
2392 IntNotifyImeShowStatus(pImeWnd);
2393 return TRUE;
2394}
BOOL gfIMEShowStatus
Definition: ime.c:29
VOID FASTCALL IntNotifyImeShowStatus(PWND pImeWnd)
Definition: ime.c:2326

Referenced by NtUserCallHwndParamLock().

◆ IntBuildHwndList()

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

Definition at line 1424 of file window.c.

1425{
1426 PWINDOWLIST pwl;
1427 DWORD cbWL;
1428
1429 if (gpwlCache)
1430 {
1431 pwl = gpwlCache;
1432 gpwlCache = NULL;
1433 }
1434 else
1435 {
1436#define INITIAL_COUNT 32
1437 cbWL = sizeof(WINDOWLIST) + (INITIAL_COUNT - 1) * sizeof(HWND);
1439 if (!pwl)
1440 return NULL;
1441
1442 pwl->phwndEnd = &pwl->ahwnd[INITIAL_COUNT];
1443#undef INITIAL_COUNT
1444 }
1445
1446 pwl->pti = pti;
1447 pwl->phwndLast = pwl->ahwnd;
1448 pwl = IntPopulateHwndList(pwl, pwnd, dwFlags);
1449 if (WL_IS_BAD(pwl))
1450 {
1452 return NULL;
1453 }
1454
1455 *(pwl->phwndLast) = HWND_TERMINATOR;
1456
1457 if (dwFlags & 0x8)
1458 {
1459 // TODO:
1460 }
1461
1462 pwl->pti = GetW32ThreadInfo();
1463 pwl->pNextList = gpwlList;
1464 gpwlList = pwl;
1465
1466 return pwl;
1467}
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:17
PWINDOWLIST FASTCALL IntPopulateHwndList(PWINDOWLIST pwl, PWND pwnd, DWORD dwFlags)
Definition: window.c:1394
#define INITIAL_COUNT
PWINDOWLIST gpwlList
Definition: window.c:16
#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 2397 of file ime.c.

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

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 1801 of file window.c.

1809{
1810 PWND pWnd = NULL;
1811 HWND hWnd;
1812 PTHREADINFO pti;
1813 BOOL MenuChanged;
1814 BOOL bUnicodeWindow;
1815 PCALLPROCDATA pcpd;
1816
1817 pti = pdeskCreated ? gptiDesktopThread : GetW32ThreadInfo();
1818
1819 if (!(Cs->dwExStyle & WS_EX_LAYOUTRTL))
1820 { // Need both here for wine win.c test_CreateWindow.
1821 //if (Cs->hwndParent && ParentWindow)
1822 if (ParentWindow) // It breaks more tests..... WIP.
1823 {
1824 if ( (Cs->style & (WS_CHILD|WS_POPUP)) == WS_CHILD &&
1825 ParentWindow->ExStyle & WS_EX_LAYOUTRTL &&
1826 !(ParentWindow->ExStyle & WS_EX_NOINHERITLAYOUT) )
1828 }
1829 else
1830 { /*
1831 * Note from MSDN <http://msdn.microsoft.com/en-us/library/aa913269.aspx>:
1832 *
1833 * Dialog boxes and message boxes do not inherit layout, so you must
1834 * set the layout explicitly.
1835 */
1836 if ( Class->fnid != FNID_DIALOG )
1837 {
1838 if (pti->ppi->dwLayout & LAYOUT_RTL)
1839 {
1841 }
1842 }
1843 }
1844 }
1845
1846 /* Automatically add WS_EX_WINDOWEDGE */
1847 if ((Cs->dwExStyle & WS_EX_DLGMODALFRAME) ||
1848 ((!(Cs->dwExStyle & WS_EX_STATICEDGE)) &&
1849 (Cs->style & (WS_DLGFRAME | WS_THICKFRAME))))
1851 else
1852 Cs->dwExStyle &= ~WS_EX_WINDOWEDGE;
1853
1854 /* Is it a unicode window? */
1855 bUnicodeWindow =!(Cs->dwExStyle & WS_EX_SETANSICREATOR);
1856 Cs->dwExStyle &= ~WS_EX_SETANSICREATOR;
1857
1858 /* Allocate the new window */
1860 pdeskCreated ? pdeskCreated : pti->rpdesk,
1861 pti,
1862 (PHANDLE)&hWnd,
1864 sizeof(WND) + Class->cbwndExtra);
1865
1866 if (!pWnd)
1867 {
1868 goto AllocError;
1869 }
1870
1871 TRACE("Created window object with handle %p\n", hWnd);
1872
1873 if (pdeskCreated && pdeskCreated->DesktopWindow == NULL )
1874 { /* HACK: Helper for win32csr/desktopbg.c */
1875 /* If there is no desktop window yet, we must be creating it */
1876 TRACE("CreateWindow setting desktop.\n");
1877 pdeskCreated->DesktopWindow = hWnd;
1878 pdeskCreated->pDeskInfo->spwnd = pWnd;
1879 }
1880
1881 /*
1882 * Fill out the structure describing it.
1883 */
1884 /* Remember, pWnd->head is setup in object.c ... */
1885 WndSetParent(pWnd, ParentWindow);
1886 WndSetOwner(pWnd, OwnerWindow);
1887 pWnd->fnid = 0;
1888 WndSetLastActive(pWnd, pWnd);
1889 // Ramp up compatible version sets.
1890 if ( dwVer >= WINVER_WIN31 )
1891 {
1892 pWnd->state2 |= WNDS2_WIN31COMPAT;
1893 if ( dwVer >= WINVER_WINNT4 )
1894 {
1895 pWnd->state2 |= WNDS2_WIN40COMPAT;
1896 if ( dwVer >= WINVER_WIN2K )
1897 {
1898 pWnd->state2 |= WNDS2_WIN50COMPAT;
1899 }
1900 }
1901 }
1902 pWnd->pcls = Class;
1903 pWnd->hModule = Cs->hInstance;
1904 pWnd->style = Cs->style & ~WS_VISIBLE;
1905 pWnd->ExStyle = Cs->dwExStyle;
1906 pWnd->cbwndExtra = pWnd->pcls->cbwndExtra;
1907 pWnd->pActCtx = acbiBuffer;
1908
1909 if (pti->spDefaultImc && Class->atomClassName != gpsi->atomSysClass[ICLS_BUTTON])
1910 pWnd->hImc = UserHMGetHandle(pti->spDefaultImc);
1911
1912 pWnd->InternalPos.MaxPos.x = pWnd->InternalPos.MaxPos.y = -1;
1913 pWnd->InternalPos.IconPos.x = pWnd->InternalPos.IconPos.y = -1;
1914
1915 if (pWnd->spwndParent != NULL && Cs->hwndParent != 0)
1916 {
1917 pWnd->HideFocus = pWnd->spwndParent->HideFocus;
1918 pWnd->HideAccel = pWnd->spwndParent->HideAccel;
1919 }
1920
1922 pWnd->head.pti->cWindows++;
1923
1924 if (Class->spicn && !Class->spicnSm)
1925 {
1926 HICON IconSmHandle = NULL;
1927 if((Class->spicn->CURSORF_flags & (CURSORF_LRSHARED | CURSORF_FROMRESOURCE))
1929 {
1930 IconSmHandle = co_IntCopyImage(
1931 UserHMGetHandle(Class->spicn),
1932 IMAGE_ICON,
1936 }
1937 if (!IconSmHandle)
1938 {
1939 /* Retry without copying from resource */
1940 IconSmHandle = co_IntCopyImage(
1941 UserHMGetHandle(Class->spicn),
1942 IMAGE_ICON,
1945 0);
1946 }
1947
1948 if (IconSmHandle)
1949 {
1950 Class->spicnSm = UserGetCurIconObject(IconSmHandle);
1951 Class->CSF_flags |= CSF_CACHEDSMICON;
1952 }
1953 }
1954
1955 if (pWnd->pcls->CSF_flags & CSF_SERVERSIDEPROC)
1957
1958 /* BugBoy Comments: Comment below say that System classes are always created
1959 as UNICODE. In windows, creating a window with the ANSI version of CreateWindow
1960 sets the window to ansi as verified by testing with IsUnicodeWindow API.
1961
1962 No where can I see in code or through testing does the window change back
1963 to ANSI after being created as UNICODE in ROS. I didnt do more testing to
1964 see what problems this would cause. */
1965
1966 // Set WndProc from Class.
1967 if (IsCallProcHandle(pWnd->pcls->lpfnWndProc))
1968 {
1970 if (pcpd)
1971 pWnd->lpfnWndProc = pcpd->pfnClientPrevious;
1972 }
1973 else
1974 {
1975 pWnd->lpfnWndProc = pWnd->pcls->lpfnWndProc;
1976 }
1977
1978 // GetWindowProc, test for non server side default classes and set WndProc.
1979 if ( pWnd->pcls->fnid <= FNID_GHOST && pWnd->pcls->fnid >= FNID_BUTTON )
1980 {
1981 if (bUnicodeWindow)
1982 {
1983 if (GETPFNCLIENTA(pWnd->pcls->fnid) == pWnd->lpfnWndProc)
1984 pWnd->lpfnWndProc = GETPFNCLIENTW(pWnd->pcls->fnid);
1985 }
1986 else
1987 {
1988 if (GETPFNCLIENTW(pWnd->pcls->fnid) == pWnd->lpfnWndProc)
1989 pWnd->lpfnWndProc = GETPFNCLIENTA(pWnd->pcls->fnid);
1990 }
1991 }
1992
1993 // If not an Unicode caller, set Ansi creator bit.
1994 if (!bUnicodeWindow) pWnd->state |= WNDS_ANSICREATOR;
1995
1996 // Clone Class Ansi/Unicode proc type.
1997 if (pWnd->pcls->CSF_flags & CSF_ANSIPROC)
1998 {
1999 pWnd->state |= WNDS_ANSIWINDOWPROC;
2000 pWnd->Unicode = FALSE;
2001 }
2002 else
2003 { /*
2004 * It seems there can be both an Ansi creator and Unicode Class Window
2005 * WndProc, unless the following overriding conditions occur:
2006 */
2007 if ( !bUnicodeWindow &&
2008 ( Class->atomClassName == gpsi->atomSysClass[ICLS_BUTTON] ||
2009 Class->atomClassName == gpsi->atomSysClass[ICLS_COMBOBOX] ||
2010 Class->atomClassName == gpsi->atomSysClass[ICLS_COMBOLBOX] ||
2011 Class->atomClassName == gpsi->atomSysClass[ICLS_DIALOG] ||
2012 Class->atomClassName == gpsi->atomSysClass[ICLS_EDIT] ||
2013 Class->atomClassName == gpsi->atomSysClass[ICLS_IME] ||
2014 Class->atomClassName == gpsi->atomSysClass[ICLS_LISTBOX] ||
2015 Class->atomClassName == gpsi->atomSysClass[ICLS_MDICLIENT] ||
2016 Class->atomClassName == gpsi->atomSysClass[ICLS_STATIC] ) )
2017 { // Override Class and set the window Ansi WndProc.
2018 pWnd->state |= WNDS_ANSIWINDOWPROC;
2019 pWnd->Unicode = FALSE;
2020 }
2021 else
2022 { // Set the window Unicode WndProc.
2023 pWnd->state &= ~WNDS_ANSIWINDOWPROC;
2024 pWnd->Unicode = TRUE;
2025 }
2026 }
2027
2028 /* BugBoy Comments: if the window being created is a edit control, ATOM 0xCxxx,
2029 then my testing shows that windows (2k and XP) creates a CallProc for it immediately
2030 Dont understand why it does this. */
2031 if (Class->atomClassName == gpsi->atomSysClass[ICLS_EDIT])
2032 {
2033 PCALLPROCDATA CallProc;
2034 CallProc = CreateCallProc(pWnd->head.rpdesk, pWnd->lpfnWndProc, pWnd->Unicode , pWnd->head.pti->ppi);
2035
2036 if (!CallProc)
2037 {
2039 ERR("Warning: Unable to create CallProc for edit control. Control may not operate correctly! hwnd %p\n", hWnd);
2040 }
2041 else
2042 {
2043 UserAddCallProcToClass(pWnd->pcls, CallProc);
2044 }
2045 }
2046
2048 pWnd->PropListItems = 0;
2049
2050 if ( WindowName->Buffer != NULL && WindowName->Length > 0 )
2051 {
2053 WindowName->Length + sizeof(UNICODE_NULL));
2054 if (pWnd->strName.Buffer == NULL)
2055 {
2056 goto AllocError;
2057 }
2058
2059 RtlCopyMemory(pWnd->strName.Buffer, WindowName->Buffer, WindowName->Length);
2060 pWnd->strName.Buffer[WindowName->Length / sizeof(WCHAR)] = L'\0';
2061 pWnd->strName.Length = WindowName->Length;
2062 pWnd->strName.MaximumLength = WindowName->Length + sizeof(UNICODE_NULL);
2063 }
2064
2065 /* Correct the window style. */
2066 if ((pWnd->style & (WS_CHILD | WS_POPUP)) != WS_CHILD)
2067 {
2068 pWnd->style |= WS_CLIPSIBLINGS;
2069 if (!(pWnd->style & WS_POPUP))
2070 {
2071 pWnd->style |= WS_CAPTION;
2072 }
2073 }
2074
2075 /* WS_EX_WINDOWEDGE depends on some other styles */
2076 if (pWnd->ExStyle & WS_EX_DLGMODALFRAME)
2077 pWnd->ExStyle |= WS_EX_WINDOWEDGE;
2078 else if (pWnd->style & (WS_DLGFRAME | WS_THICKFRAME))
2079 {
2080 if (!((pWnd->ExStyle & WS_EX_STATICEDGE) &&
2081 (pWnd->style & (WS_CHILD | WS_POPUP))))
2082 pWnd->ExStyle |= WS_EX_WINDOWEDGE;
2083 }
2084 else
2085 pWnd->ExStyle &= ~WS_EX_WINDOWEDGE;
2086
2087 if (!(pWnd->style & (WS_CHILD | WS_POPUP)))
2089
2090 /* Set the window menu */
2091 if ((Cs->style & (WS_CHILD | WS_POPUP)) != WS_CHILD)
2092 {
2093 if (Cs->hMenu)
2094 {
2095 IntSetMenu(pWnd, Cs->hMenu, &MenuChanged);
2096 }
2097 else if (pWnd->pcls->lpszMenuName) // Take it from the parent.
2098 {
2099 UNICODE_STRING MenuName;
2100 HMENU hMenu;
2101
2102 if (IS_INTRESOURCE(pWnd->pcls->lpszMenuName))
2103 {
2104 MenuName.Length = 0;
2105 MenuName.MaximumLength = 0;
2106 MenuName.Buffer = pWnd->pcls->lpszMenuName;
2107 }
2108 else
2109 {
2110 RtlInitUnicodeString( &MenuName, pWnd->pcls->lpszMenuName);
2111 }
2112 hMenu = co_IntCallLoadMenu( pWnd->pcls->hModule, &MenuName);
2113 if (hMenu) IntSetMenu(pWnd, hMenu, &MenuChanged);
2114 }
2115 }
2116 else // Not a child
2117 pWnd->IDMenu = (UINT_PTR)Cs->hMenu;
2118
2119
2120 if ( ParentWindow &&
2121 ParentWindow != ParentWindow->head.rpdesk->spwndMessage &&
2122 ParentWindow != ParentWindow->head.rpdesk->pDeskInfo->spwnd )
2123 {
2124 PWND Owner = IntGetNonChildAncestor(ParentWindow);
2125
2126 if (!IntValidateOwnerDepth(pWnd, Owner))
2127 {
2129 goto Error;
2130 }
2131 if ( pWnd->spwndOwner &&
2132 pWnd->spwndOwner->ExStyle & WS_EX_TOPMOST )
2133 {
2134 pWnd->ExStyle |= WS_EX_TOPMOST;
2135 }
2136 if ( pWnd->spwndOwner &&
2137 Class->atomClassName != gpsi->atomSysClass[ICLS_IME] &&
2138 pti != pWnd->spwndOwner->head.pti)
2139 {
2140 //ERR("CreateWindow Owner in.\n");
2141 UserAttachThreadInput(pti, pWnd->spwndOwner->head.pti, TRUE);
2142 }
2143 }
2144
2145 /* Insert the window into the thread's window list. */
2147
2148 /* Handle "CS_CLASSDC", it is tested first. */
2149 if ( (pWnd->pcls->style & CS_CLASSDC) && !(pWnd->pcls->pdce) )
2150 { /* One DCE per class to have CLASS. */
2151 pWnd->pcls->pdce = DceAllocDCE( pWnd, DCE_CLASS_DC );
2152 }
2153 else if ( pWnd->pcls->style & CS_OWNDC)
2154 { /* Allocate a DCE for this window. */
2156 }
2157
2158 return pWnd;
2159
2160AllocError:
2161 ERR("IntCreateWindow Allocation Error.\n");
2163Error:
2164 if(pWnd)
2166 return NULL;
2167}
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:84
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:1597
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:426
PCURICON_OBJECT FASTCALL UserGetCurIconObject(HCURSOR hCurIcon)
Definition: cursoricon.c:200
PTHREADINFO gptiDesktopThread
Definition: desktop.c:37
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:5470
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:367
PWND FASTCALL IntGetNonChildAncestor(PWND pWnd)
Definition: window.c:351
#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:1099
#define SM_CYSMICON
Definition: winuser.h:1013
#define SM_CXSMICON
Definition: winuser.h:1012
#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 else lResult = 0L;
570
571 break;
572 }
573
574 case WM_GETTEXT: // FIXME: Handle Ansi
575 {
576 PWSTR buf = NULL;
577 PWSTR outbuf = (PWSTR)lParam;
578
579 if (Wnd != NULL && wParam != 0)
580 {
581 if (Wnd->strName.Buffer != NULL)
582 buf = Wnd->strName.Buffer;
583 else
584 outbuf[0] = L'\0';
585
586 if (buf != NULL)
587 {
588 if (Wnd->strName.Length != 0)
589 {
590 lResult = min(Wnd->strName.Length / sizeof(WCHAR), wParam - 1);
591 RtlCopyMemory(outbuf,
592 buf,
593 lResult * sizeof(WCHAR));
594 outbuf[lResult] = L'\0';
595 }
596 else
597 outbuf[0] = L'\0';
598 }
599 }
600 break;
601 }
602
603 case WM_SETTEXT: // FIXME: Handle Ansi
604 {
605 DefSetText(Wnd, (PCWSTR)lParam);
606
607 if ((Wnd->style & WS_CAPTION) == WS_CAPTION)
609 IntNotifyWinEvent(EVENT_OBJECT_NAMECHANGE, Wnd, OBJID_WINDOW, CHILDID_SELF, 0);
610 lResult = 1;
611 break;
612 }
613
614 case WM_SYSCOMMAND:
615 {
616 TRACE("hwnd %p WM_SYSCOMMAND %lx %lx\n", UserHMGetHandle(Wnd), wParam, lParam );
617 lResult = DefWndHandleSysCommand(Wnd, wParam, lParam);
618 break;
619 }
620
621 case WM_SHOWWINDOW:
622 {
623 if ((Wnd->style & WS_VISIBLE) && wParam) break;
624 if (!(Wnd->style & WS_VISIBLE) && !wParam) break;
625 if (!Wnd->spwndOwner) break;
626 if (LOWORD(lParam))
627 {
629 }
630 break;
631 }
632
634 return IntClientShutdown(Wnd, wParam, lParam);
635
636 case WM_APPCOMMAND:
637 if ( (Wnd->style & (WS_POPUP|WS_CHILD)) != WS_CHILD &&
638 Wnd != co_GetDesktopWindow(Wnd) )
639 {
640 if (!co_HOOK_CallHooks(WH_SHELL, HSHELL_APPCOMMAND, wParam, lParam))
641 co_IntShellHookNotify(HSHELL_APPCOMMAND, wParam, lParam);
642 break;
643 }
644 UserRefObjectCo(Wnd->spwndParent, &Ref);
645 lResult = co_IntSendMessage(UserHMGetHandle(Wnd->spwndParent), WM_APPCOMMAND, wParam, lParam);
646 UserDerefObjectCo(Wnd->spwndParent);
647 break;
648
649 case WM_KEYF1:
650 {
651 HELPINFO hi;
652 HMENU hMenu = UlongToHandle(Wnd->IDMenu);
653 PWND pwndActive = MENU_IsMenuActive();
654 hi.cbSize = sizeof(HELPINFO);
655 hi.MousePos = gpsi->ptCursor;
657 hi.hItemHandle = pwndActive ? UserHMGetHandle(pwndActive) : UserHMGetHandle(Wnd);
658 hi.iCtrlId = (Wnd->style & (WS_POPUP|WS_CHILD)) == WS_CHILD ? IntMenuItemFromPoint(Wnd, hMenu, hi.MousePos) : 0;
660
661 co_IntSendMessage( UserHMGetHandle(Wnd), WM_HELP, 0, (LPARAM)&hi );
662 break;
663 }
664
665 case WM_SETICON:
666 {
667 return DefWndSetIcon(Wnd, wParam, lParam);
668 }
669
670 case WM_GETICON:
671 {
672 return DefWndGetIcon(Wnd, wParam, lParam);
673 }
674
675 case WM_HELP:
676 {
677 PWND Parent = IntGetParent(Wnd);
679 break;
680 }
681
682 case WM_LBUTTONDOWN:
683 case WM_RBUTTONDOWN:
684 case WM_MBUTTONDOWN:
686 break;
687
688 case WM_NCLBUTTONDOWN:
690
691 case WM_NCRBUTTONDOWN:
693
694 case WM_LBUTTONDBLCLK:
696
699
700 case WM_RBUTTONUP:
701 {
702 POINT Pt;
703
704 Pt.x = GET_X_LPARAM(lParam);
705 Pt.y = GET_Y_LPARAM(lParam);
706 IntClientToScreen(Wnd, &Pt);
707 lParam = MAKELPARAM(Pt.x, Pt.y);
709 break;
710 }
711
712 case WM_NCRBUTTONUP:
713 /*
714 * FIXME : we must NOT send WM_CONTEXTMENU on a WM_NCRBUTTONUP (checked
715 * in Windows), but what _should_ we do? According to MSDN :
716 * "If it is appropriate to do so, the system sends the WM_SYSCOMMAND
717 * message to the window". When is it appropriate?
718 */
719 ERR("WM_NCRBUTTONUP\n");
720 break;
721
722 case WM_XBUTTONUP:
723 case WM_NCXBUTTONUP:
724 if (HIWORD(wParam) == XBUTTON1 || HIWORD(wParam) == XBUTTON2)
725 {
727 MAKELPARAM(LOWORD(wParam), FAPPCOMMAND_MOUSE | HIWORD(wParam)));
728 }
729 break;
730
731
732 case WM_CONTEXTMENU:
733 {
734 if (Wnd->style & WS_CHILD)
735 {
737 }
738 else
739 {
740 POINT Pt;
742 LONG HitCode;
743
744 Style = Wnd->style;
745
746 Pt.x = GET_X_LPARAM(lParam);
747 Pt.y = GET_Y_LPARAM(lParam);
748 if (Style & WS_CHILD)
749 {
751 }
752
753 HitCode = GetNCHitEx(Wnd, Pt);
754
755 if (HitCode == HTCAPTION || HitCode == HTSYSMENU)
756 {
757 PMENU SystemMenu;
758 UINT Flags;
759
760 if((SystemMenu = IntGetSystemMenu(Wnd, FALSE)))
761 {
762 MENU_InitSysMenuPopup(SystemMenu, Wnd->style, Wnd->pcls->style, HitCode);
763
764 if(HitCode == HTCAPTION)
766 else
768
769 IntTrackPopupMenuEx(SystemMenu, Flags|TPM_SYSTEM_MENU, Pt.x, Pt.y, Wnd, NULL);
770 }
771 }
772 if (HitCode == HTHSCROLL || HitCode == HTVSCROLL)
773 {
774 WARN("Scroll Menu Not Supported\n");
775 }
776 }
777 break;
778 }
779
780 case WM_KEYDOWN:
781 if (wParam == VK_F10)
782 {
783 pti->MessageQueue->QF_flags |= QF_FF10STATUS;
784
785 if (UserGetKeyState(VK_SHIFT) & 0x8000)
786 {
788 }
789 }
791 {
792 BOOL IsTaskBar;
793 DWORD StyleTB;
794 DWORD ExStyleTB;
795 HWND hwndTop = UserGetForegroundWindow();
796 PWND topWnd = UserGetWindowObject(hwndTop);
797
798 // MS Doc: foreground window can be NULL, e.g. when window is losing activation
799 if (!topWnd)
800 return 0;
801
802 // We want to forbid snapping operations on the TaskBar
803 // We use a heuristic for detecting the TaskBar Wnd by its typical Style & ExStyle Values
804 ExStyleTB = (topWnd->ExStyle & WS_EX_TOOLWINDOW);
805 StyleTB = (topWnd->style & (WS_POPUP | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN));
806 IsTaskBar = (StyleTB == (WS_POPUP | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN))
807 && (ExStyleTB == WS_EX_TOOLWINDOW);
808 TRACE("ExStyle=%x Style=%x IsTaskBar=%d\n", ExStyleTB, StyleTB, IsTaskBar);
809
810 if (!IsTaskBar)
811 {
812 if ((topWnd->style & WS_THICKFRAME) == 0)
813 return 0;
814
815 if (wParam == VK_DOWN)
816 {
817 if (topWnd->style & WS_MAXIMIZE)
818 {
820
821 /* "Normal size" must be erased after restoring, otherwise it will block next side snap actions */
822 RECTL_vSetEmptyRect(&topWnd->InternalPos.NormalRect);
823 }
824 else
825 {
827 }
828 }
829 else if (wParam == VK_UP)
830 {
831 RECT currentRect;
832 if ((topWnd->InternalPos.NormalRect.right == topWnd->InternalPos.NormalRect.left) ||
833 (topWnd->InternalPos.NormalRect.top == topWnd->InternalPos.NormalRect.bottom))
834 {
835 currentRect = topWnd->rcWindow;
836 }
837 else
838 {
839 currentRect = topWnd->InternalPos.NormalRect;
840 }
842
843 // save normal rect if maximazing snapped window
844 topWnd->InternalPos.NormalRect = currentRect;
845 }
846 else if (wParam == VK_LEFT || wParam == VK_RIGHT)
847 {
848 RECT snapRect, normalRect, windowRect;
849 BOOL snapped;
850 normalRect = topWnd->InternalPos.NormalRect;
851 snapped = (normalRect.left != 0 && normalRect.right != 0 &&
852 normalRect.top != 0 && normalRect.bottom != 0);
853
854 if (topWnd->style & WS_MAXIMIZE)
855 {
857 snapped = FALSE;
858 }
859 windowRect = topWnd->rcWindow;
860
861 UserSystemParametersInfo(SPI_GETWORKAREA, 0, &snapRect, 0);
862 if (wParam == VK_LEFT)
863 {
864 snapRect.right = (snapRect.left + snapRect.right) / 2;
865 }
866 else // VK_RIGHT
867 {
868 snapRect.left = (snapRect.left + snapRect.right) / 2;
869 }
870
871 if (snapped)
872 {
873 // if window was snapped but moved to other location - restore normal size
874 if (!IntEqualRect(&snapRect, &windowRect))
875 {
876 RECT empty = {0, 0, 0, 0};
878 0,
879 normalRect.left,
880 normalRect.top,
881 normalRect.right - normalRect.left,
882 normalRect.bottom - normalRect.top,
883 0);
884 topWnd->InternalPos.NormalRect = empty;
885 }
886 }
887 else
888 {
890 0,
891 snapRect.left,
892 snapRect.top,
893 snapRect.right - snapRect.left,
894 snapRect.bottom - snapRect.top,
895 0);
896 topWnd->InternalPos.NormalRect = windowRect;
897 }
898 }
899 }
900 }
901 break;
902
903 case WM_SYSKEYDOWN:
904 {
905 if (HIWORD(lParam) & KF_ALTDOWN)
906 { /* Previous state, if the key was down before this message,
907 this is a cheap way to ignore autorepeat keys. */
908 if ( !(HIWORD(lParam) & KF_REPEAT) )
909 {
910 if ( ( wParam == VK_MENU ||
911 wParam == VK_LMENU ||
912 wParam == VK_RMENU ) && !(pti->MessageQueue->QF_flags & QF_FMENUSTATUS)) //iMenuSysKey )
913 pti->MessageQueue->QF_flags |= QF_FMENUSTATUS; //iMenuSysKey = 1;
914 else
915 pti->MessageQueue->QF_flags &= ~QF_FMENUSTATUS; //iMenuSysKey = 0;
916 }
917
918 pti->MessageQueue->QF_flags &= ~QF_FF10STATUS; //iF10Key = 0;
919
920 if (wParam == VK_F4) /* Try to close the window */
921 {
923 if (!(top->style & CS_NOCLOSE))
925 }
926 else if (wParam == VK_SNAPSHOT) // Alt-VK_SNAPSHOT?
927 {
928 PWND pwnd = Wnd;
929 while (IntGetParent(pwnd) != NULL)
930 {
931 pwnd = IntGetParent(pwnd);
932 }
933 ERR("DefWndScreenshot\n");
934 DefWndScreenshot(pwnd);
935 }
936 else if ( wParam == VK_ESCAPE || wParam == VK_TAB ) // Alt-Tab/ESC Alt-Shift-Tab/ESC
937 {
938 WPARAM wParamTmp;
939 HWND Active = UserGetActiveWindow(); // Noticed MDI problem.
940 if (!Active)
941 {
942 FIXME("WM_SYSKEYDOWN VK_ESCAPE no active\n");
943 break;
944 }
945 wParamTmp = UserGetKeyState(VK_SHIFT) & 0x8000 ? SC_PREVWINDOW : SC_NEXTWINDOW;
947 }
948 }
949 else if( wParam == VK_F10 )
950 {
951 if (UserGetKeyState(VK_SHIFT) & 0x8000)
953 pti->MessageQueue->QF_flags |= QF_FF10STATUS; //iF10Key = 1;
954 }
955 else if( wParam == VK_ESCAPE && (UserGetKeyState(VK_SHIFT) & 0x8000))
957 break;
958 }
959
960 case WM_KEYUP:
961 case WM_SYSKEYUP:
962 {
963 /* Press and release F10 or ALT */
964 if (((wParam == VK_MENU || wParam == VK_LMENU || wParam == VK_RMENU)
965 && (pti->MessageQueue->QF_flags & (QF_FMENUSTATUS|QF_FMENUSTATUSBREAK)) == QF_FMENUSTATUS /*iMenuSysKey*/) ||
966 ((wParam == VK_F10) && pti->MessageQueue->QF_flags & QF_FF10STATUS /*iF10Key*/))
968 pti->MessageQueue->QF_flags &= ~(QF_FMENUSTATUS|QF_FMENUSTATUSBREAK|QF_FF10STATUS); //iMenuSysKey = iF10Key = 0;
969 break;
970 }
971
972 case WM_SYSCHAR:
973 {
974 pti->MessageQueue->QF_flags &= ~(QF_FMENUSTATUS|QF_FMENUSTATUSBREAK); //iMenuSysKey = 0;
975 if (wParam == VK_RETURN && (Wnd->style & WS_MINIMIZE) != 0)
976 {
978 break;
979 }
980 if ((HIWORD(lParam) & KF_ALTDOWN) && wParam)
981 {
982 if (wParam == VK_TAB || wParam == VK_ESCAPE) break;
983 if (wParam == VK_SPACE && Wnd->style & WS_CHILD)
985 else
987 }
988 else /* check for Ctrl-Esc */
990 break;
991 }
992
993 case WM_CANCELMODE:
994 {
996
997 MENU_EndMenu( Wnd );
999 {
1001 }
1002 break;
1003 }
1004
1005 case WM_CLOSE:
1007 break;
1008
1009 case WM_CTLCOLORMSGBOX:
1010 case WM_CTLCOLOREDIT:
1011 case WM_CTLCOLORLISTBOX:
1012 case WM_CTLCOLORBTN:
1013 case WM_CTLCOLORDLG:
1014 case WM_CTLCOLORSTATIC:
1017
1018 case WM_CTLCOLOR:
1020
1021 case WM_SETCURSOR:
1022 {
1023 if (Wnd->style & WS_CHILD)
1024 {
1025 /* with the exception of the border around a resizable wnd,
1026 * give the parent first chance to set the cursor */
1028 {
1029 PWND parent = Wnd->spwndParent;//IntGetParent( Wnd );
1030 if (parent != UserGetDesktopWindow() &&
1032 return TRUE;
1033 }
1034 }
1035 return DefWndHandleSetCursor(Wnd, wParam, lParam);
1036 }
1037
1038 case WM_MOUSEACTIVATE:
1039 if (Wnd->style & WS_CHILD)
1040 {
1041 LONG Ret;
1043 PWND pwndParent = IntGetParent(Wnd);
1044 hwndParent = pwndParent ? UserHMGetHandle(pwndParent) : NULL;
1046 if (Ret) return (Ret);
1047 }
1049
1050 case WM_ACTIVATE:
1051 /* The default action in Windows is to set the keyboard focus to
1052 * the window, if it's being activated and not minimized */
1053 if (LOWORD(wParam) != WA_INACTIVE &&
1054 !(Wnd->style & WS_MINIMIZE))
1055 {
1056 //ERR("WM_ACTIVATE %p\n",hWnd);
1057 co_UserSetFocus(Wnd);
1058 }
1059 break;
1060
1061 case WM_MOUSEWHEEL:
1062 if (Wnd->style & WS_CHILD)
1063 {
1065 PWND pwndParent = IntGetParent(Wnd);
1066 hwndParent = pwndParent ? UserHMGetHandle(pwndParent) : NULL;
1068 }
1069 break;
1070
1071 case WM_ERASEBKGND:
1072 case WM_ICONERASEBKGND:
1073 {
1074 RECT Rect;
1075 HBRUSH hBrush = Wnd->pcls->hbrBackground;
1076 if (!hBrush) return 0;
1077 if (hBrush <= (HBRUSH)COLOR_MENUBAR)
1078 {
1079 hBrush = IntGetSysColorBrush(HandleToUlong(hBrush));
1080 }
1081 if (Wnd->pcls->style & CS_PARENTDC)
1082 {
1083 /* can't use GetClipBox with a parent DC or we fill the whole parent */
1084 IntGetClientRect(Wnd, &Rect);
1086 }
1087 else
1088 {
1089 GdiGetClipBox((HDC)wParam, &Rect);
1090 }
1091 FillRect((HDC)wParam, &Rect, hBrush);
1092 return (1);
1093 }
1094
1095 case WM_GETHOTKEY:
1096 //ERR("WM_GETHOTKEY\n");
1097 return DefWndGetHotKey(Wnd);
1098 case WM_SETHOTKEY:
1099 //ERR("WM_SETHOTKEY\n");
1100 return DefWndSetHotKey(Wnd, wParam);
1101
1102 case WM_NCHITTEST:
1103 {
1104 POINT Point;
1107 return GetNCHitEx(Wnd, Point);
1108 }
1109
1110 case WM_PRINT:
1111 {
1112 DefWndPrint(Wnd, (HDC)wParam, lParam);
1113 return (0);
1114 }
1115
1116 case WM_SYSCOLORCHANGE:
1117 {
1118 /* force to redraw non-client area */
1119 UserPaintCaption(Wnd, DC_NC);
1120 /* Use InvalidateRect to redraw client area, enable
1121 * erase to redraw all subcontrols otherwise send the
1122 * WM_SYSCOLORCHANGE to child windows/controls is required
1123 */
1125 return (0);
1126 }
1127
1128 case WM_PAINTICON:
1129 case WM_PAINT:
1130 {
1131 PAINTSTRUCT Ps;
1132 HDC hDC;
1133
1134 /* If already in Paint and Client area is not empty just return. */
1135 if (Wnd->state2 & WNDS2_STARTPAINT && !RECTL_bIsEmptyRect(&Wnd->rcClient))
1136 {
1137 ERR("In Paint and Client area is not empty!\n");
1138 return 0;
1139 }
1140
1141 hDC = IntBeginPaint(Wnd, &Ps);
1142 if (hDC)
1143 {
1144 if (((Wnd->style & WS_MINIMIZE) != 0) && (Wnd->pcls->spicn))
1145 {
1146 RECT ClientRect;
1147 INT x, y;
1148
1149 ERR("Doing Paint and Client area is empty!\n");
1150 IntGetClientRect(Wnd, &ClientRect);
1151 x = (ClientRect.right - ClientRect.left - UserGetSystemMetrics(SM_CXICON)) / 2;
1152 y = (ClientRect.bottom - ClientRect.top - UserGetSystemMetrics(SM_CYICON)) / 2;
1153 UserReferenceObject(Wnd->pcls->spicn);
1154 UserDrawIconEx(hDC, x, y, Wnd->pcls->spicn, 0, 0, 0, 0, DI_NORMAL | DI_COMPAT | DI_DEFAULTSIZE);
1155 UserDereferenceObject(Wnd->pcls->spicn);
1156 }
1157
1158 IntEndPaint(Wnd, &Ps);
1159 }
1160 return (0);
1161 }
1162
1163 case WM_SYNCPAINT:
1164 {
1165 HRGN hRgn;
1166 Wnd->state &= ~WNDS_SYNCPAINTPENDING;
1167 TRACE("WM_SYNCPAINT\n");
1168 hRgn = NtGdiCreateRectRgn(0, 0, 0, 0);
1169 if (hRgn)
1170 {
1172 {
1173 PREGION pRgn = REGION_LockRgn(hRgn);
1174 if (pRgn) REGION_UnlockRgn(pRgn);
1175 if (!wParam)
1177 co_UserRedrawWindow(Wnd, NULL, pRgn, wParam);
1178 }
1180 }
1181 return 0;
1182 }
1183
1184 case WM_SETREDRAW:
1185 if (wParam)
1186 {
1187 if (!(Wnd->style & WS_VISIBLE))
1188 {
1189 IntSetStyle( Wnd, WS_VISIBLE, 0 );
1190 Wnd->state |= WNDS_SENDNCPAINT;
1191 }
1192 }
1193 else
1194 {
1195 if (Wnd->style & WS_VISIBLE)
1196 {
1198 IntSetStyle( Wnd, 0, WS_VISIBLE );
1199 }
1200 }
1201 return 0;
1202
1204 {
1206 }
1207
1209 {
1211 }
1212
1213 case WM_NCCALCSIZE:
1214 {
1215 return NC_HandleNCCalcSize( Wnd, wParam, (RECTL *)lParam, FALSE );
1216 }
1217
1218 case WM_NCACTIVATE:
1219 {
1220 return NC_HandleNCActivate( Wnd, wParam, lParam );
1221 }
1222
1223 //
1224 // NC Paint mode.
1225 //
1226 case WM_NCPAINT:
1227 {
1229 Wnd->state |= WNDS_FORCEMENUDRAW;
1230 NC_DoNCPaint(Wnd, hDC, -1);
1231 Wnd->state &= ~WNDS_FORCEMENUDRAW;
1232 UserReleaseDC(Wnd, hDC, FALSE);
1233 return 0;
1234 }
1235 //
1236 // Draw Caption mode.
1237 //
1238 // wParam are DC_* flags.
1239 //
1241 {
1243 TRACE("WM_NCUAHDRAWCAPTION: wParam DC_ flags %08x\n",wParam);
1244 UserDrawCaptionBar(Wnd, hDC, wParam | DC_FRAME); // Include DC_FRAME to comp for drawing glitch.
1245 UserReleaseDC(Wnd, hDC, FALSE);
1246 return 0;
1247 }
1248 //
1249 // Draw Frame mode.
1250 //
1251 // wParam is HDC, lParam are DC_ACTIVE and or DC_REDRAWHUNGWND.
1252 //
1253 case WM_NCUAHDRAWFRAME:
1254 {
1255 TRACE("WM_NCUAHDRAWFRAME: wParam hDC %p lParam DC_ flags %08x\n",wParam,lParam);
1257 return 0;
1258 }
1259
1260 /* ReactOS only. */
1261 case WM_CBT:
1262 {
1263 switch (wParam)
1264 {
1265 case HCBT_MOVESIZE:
1266 {
1267 RECTL rt;
1268
1269 if (lParam)
1270 {
1271 _SEH2_TRY
1272 {
1274 sizeof(RECT),
1275 1);
1276
1277 RtlCopyMemory(&rt,
1278 (PVOID)lParam,
1279 sizeof(RECT));
1280 }
1282 {
1283 lResult = 1;
1284 }
1285 _SEH2_END;
1286 }
1287 if (!lResult)
1289 }
1290 break;
1291 }
1292 break;
1293 }
1294 break;
1295 }
1296 return lResult;
1297}
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 UlongToHandle(ul)
Definition: basetsd.h:97
#define HandleToUlong(h)
Definition: basetsd.h:79
#define FIXME(fmt,...)
Definition: debug.h:114
#define WARN(fmt,...)
Definition: debug.h:115
struct @1636 Msg[]
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
BOOL FASTCALL GreDPtoLP(HDC, LPPOINT, INT)
Definition: dcutil.c:7
static HWND hwndParent
Definition: cryptui.c:300
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
static const WCHAR empty[]
Definition: main.c:47
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:92
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
BOOL FASTCALL IntScreenToClient(PWND Wnd, LPPOINT lpPoint)
Definition: winpos.c:213
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:3317
int iCtrlId
Definition: winuser.h:3314
DWORD_PTR dwContextId
Definition: winuser.h:3316
HANDLE hItemHandle
Definition: winuser.h:3315
int iContextType
Definition: winuser.h:3313
UINT cbSize
Definition: winuser.h:3312
#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 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:1441
BOOL FASTCALL IntEndPaint(PWND Wnd, PPAINTSTRUCT Ps)
Definition: painting.c:1538
INT FASTCALL co_UserGetUpdateRgn(PWND Window, HRGN hRgn, BOOL bErase)
Definition: painting.c:1790
DWORD FASTCALL IntGetWindowContextHelpId(PWND pWnd)
Definition: window.c:438
PWND FASTCALL UserGetWindowObject(HWND hWnd)
Definition: window.c:122
PWND FASTCALL UserGetAncestor(PWND Wnd, UINT Type)
Definition: window.c:3341
BOOLEAN co_UserDestroyWindow(PVOID Object)
Definition: window.c:2853
INT FASTCALL UserReleaseDC(PWND Window, HDC hDc, BOOL EndPaint)
Definition: windc.c:918
BOOL APIENTRY DefSetText(PWND Wnd, PCWSTR WindowText)
Definition: window.c:4372
HDC FASTCALL UserGetDCEx(PWND Window OPTIONAL, HANDLE ClipRegion, ULONG Flags)
FORCEINLINE BOOL RECTL_bIsEmptyRect(_In_ const RECTL *prcl)
Definition: rect.h:44
FORCEINLINE VOID RECTL_vSetEmptyRect(_Out_ RECTL *prcl)
Definition: rect.h:20
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:1386
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:101
PMENU FASTCALL IntGetSystemMenu(PWND Window, BOOL bRevert)
Definition: menu.c:5394
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:4572
BOOL FASTCALL UserPostMessage(HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1345
LRESULT NC_HandleNCLButtonDown(PWND pWnd, WPARAM wParam, LPARAM lParam)
Definition: nonclient.c:1544
VOID UserDrawCaptionBar(PWND pWnd, HDC hDC, INT Flags)
Definition: nonclient.c:924
DWORD FASTCALL GetNCHitEx(PWND pWnd, POINT pt)
Definition: nonclient.c:1954
LRESULT NC_HandleNCActivate(PWND Wnd, WPARAM wParam, LPARAM lParam)
Definition: nonclient.c:1407
LRESULT NC_DoNCPaint(PWND pWnd, HDC hDC, INT Flags)
Definition: nonclient.c:1066
LRESULT NC_HandleNCCalcSize(PWND Wnd, WPARAM wparam, RECTL *Rect, BOOL Suspended)
Definition: nonclient.c:1273
LRESULT NC_HandleNCRButtonDown(PWND pwnd, WPARAM wParam, LPARAM lParam)
Definition: nonclient.c:1694
LRESULT NC_HandleNCLButtonDblClk(PWND pWnd, WPARAM wParam, LPARAM lParam)
Definition: nonclient.c:1636
LRESULT IntClientShutdown(IN PWND pWindow, IN WPARAM wParam, IN LPARAM lParam)
Definition: shutdown.c:22
BOOL g_bWindowSnapEnabled
Definition: sysparams.c:20
BOOL FASTCALL UserSystemParametersInfo(UINT uiAction, UINT uiParam, PVOID pvParam, UINT fWinIni)
Definition: sysparams.c:2105
PWND FASTCALL IntGetParent(PWND Wnd)
Definition: window.c:204
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 BOOL IntEqualRect(RECTL *lprc1, RECTL *lprc2)
Definition: winpos.h:48
#define WM_PAINT
Definition: winuser.h:1620
#define WM_ERASEBKGND
Definition: winuser.h:1625
#define WM_GETHOTKEY
Definition: winuser.h:1653
#define WM_CTLCOLORSTATIC
Definition: winuser.h:1772
#define WM_GETTEXTLENGTH
Definition: winuser.h:1619
#define SW_HIDE
Definition: winuser.h:768
#define WM_CLOSE
Definition: winuser.h:1621
#define VK_SNAPSHOT
Definition: winuser.h:2231
#define WM_SYSCOMMAND
Definition: winuser.h:1741
#define SC_KEYMENU
Definition: winuser.h:2596
#define VK_TAB
Definition: winuser.h:2199
#define GA_ROOT
Definition: winuser.h:2789
#define MAKELPARAM(l, h)
Definition: winuser.h:4008
#define WM_KEYUP
Definition: winuser.h:1716
#define DCX_WINDOW
Definition: winuser.h:2113
#define HELPINFO_MENUITEM
Definition: winuser.h:1171
#define VK_F10
Definition: winuser.h:2264
#define WM_SETHOTKEY
Definition: winuser.h:1652
#define WM_WINDOWPOSCHANGING
Definition: winuser.h:1661
#define TPM_RIGHTBUTTON
Definition: winuser.h:2380
#define WM_SYNCPAINT
Definition: winuser.h:1690
#define SC_PREVWINDOW
Definition: winuser.h:2591
#define VK_SPACE
Definition: winuser.h:2219
#define WM_CANCELMODE
Definition: winuser.h:1635
#define WM_LBUTTONDBLCLK
Definition: winuser.h:1778
#define KF_ALTDOWN
Definition: winuser.h:2449
#define MA_ACTIVATE
Definition: winuser.h:2501
#define WM_APPCOMMAND
Definition: winuser.h:1882
#define WM_NCHITTEST
Definition: winuser.h:1686
#define WM_RBUTTONUP
Definition: winuser.h:1780
#define VK_UP
Definition: winuser.h:2225
#define SW_SHOWNOACTIVATE
Definition: winuser.h:774
#define WH_SHELL
Definition: winuser.h:40
#define WM_GETTEXT
Definition: winuser.h:1618
#define RDW_ERASE
Definition: winuser.h:1211
#define WM_CTLCOLORSCROLLBAR
Definition: winuser.h:1771
#define WA_INACTIVE
Definition: winuser.h:2622
#define MA_NOACTIVATE
Definition: winuser.h:2503
#define WM_LBUTTONDOWN
Definition: winuser.h:1776
#define WM_DEVICECHANGE
Definition: winuser.h:1811
#define WM_SYSCOLORCHANGE
Definition: winuser.h:1626
#define WM_CTLCOLORMSGBOX
Definition: winuser.h:1766
#define WM_NCLBUTTONDBLCLK
Definition: winuser.h:1694
#define WM_ACTIVATE
Definition: winuser.h:1612
#define WM_SHOWWINDOW
Definition: winuser.h:1628
#define WM_RBUTTONDOWN
Definition: winuser.h:1779
#define SC_MINIMIZE
Definition: winuser.h:2586
#define WM_CTLCOLORBTN
Definition: winuser.h:1769
#define WM_SETTEXT
Definition: winuser.h:1617
#define SC_NEXTWINDOW
Definition: winuser.h:2590
#define DC_NC
Definition: winuser.h:440
#define DCX_INTERSECTRGN
Definition: winuser.h:2122
#define WM_NCACTIVATE
Definition: winuser.h:1688
#define WM_SYSCHAR
Definition: winuser.h:1721
#define VK_RETURN
Definition: winuser.h:2201
#define SM_CYICON
Definition: winuser.h:973
#define VK_RMENU
Definition: winuser.h:2287
#define RDW_ALLCHILDREN
Definition: winuser.h:1221
#define RDW_ERASENOW
Definition: winuser.h:1219
#define RDW_FRAME
Definition: winuser.h:1212
#define WM_SYSKEYUP
Definition: winuser.h:1720
#define HCBT_MOVESIZE
Definition: winuser.h:55
#define SC_CLOSE
Definition: winuser.h:2592
#define DC_TEXT
Definition: winuser.h:430
#define VK_LWIN
Definition: winuser.h:2235
struct tagHELPINFO HELPINFO
#define WM_MOUSEACTIVATE
Definition: winuser.h:1637
#define TPM_LEFTBUTTON
Definition: winuser.h:2379
#define VK_F4
Definition: winuser.h:2258
#define VK_LEFT
Definition: winuser.h:2224
#define VK_RIGHT
Definition: winuser.h:2226
#define VK_DOWN
Definition: winuser.h:2227
#define WM_SETCURSOR
Definition: winuser.h:1636
#define KF_REPEAT
Definition: winuser.h:2450
#define WM_USER
Definition: winuser.h:1895
#define WM_CTLCOLORLISTBOX
Definition: winuser.h:1768
#define VK_SHIFT
Definition: winuser.h:2202
#define WM_NCRBUTTONUP
Definition: winuser.h:1696
#define WM_KEYDOWN
Definition: winuser.h:1715
#define WM_ICONERASEBKGND
Definition: winuser.h:1642
#define WM_PRINT
Definition: winuser.h:1880
#define WM_NCCALCSIZE
Definition: winuser.h:1685
#define SM_CXICON
Definition: winuser.h:972
#define WM_CTLCOLOREDIT
Definition: winuser.h:1767
#define VK_ESCAPE
Definition: winuser.h:2214
#define WM_WINDOWPOSCHANGED
Definition: winuser.h:1662
#define SC_RESTORE
Definition: winuser.h:2598
#define WM_CTLCOLORDLG
Definition: winuser.h:1770
#define CS_NOCLOSE
Definition: winuser.h:654
#define WM_SYSKEYDOWN
Definition: winuser.h:1719
#define WM_NCLBUTTONDOWN
Definition: winuser.h:1692
#define RDW_INVALIDATE
Definition: winuser.h:1214
#define WM_PAINTICON
Definition: winuser.h:1641
#define WM_MBUTTONDOWN
Definition: winuser.h:1782
#define VK_RWIN
Definition: winuser.h:2236
#define SC_MAXIMIZE
Definition: winuser.h:2588
#define VK_LMENU
Definition: winuser.h:2286
#define VK_MENU
Definition: winuser.h:2204
#define WM_NCPAINT
Definition: winuser.h:1687
#define WM_NCRBUTTONDOWN
Definition: winuser.h:1695
#define WM_SETREDRAW
Definition: winuser.h:1616
_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 220 of file window.c.

221{
222 BOOL Update;
223 PWND pWnd;
224 UINT bIsDisabled;
225
226 if(!(pWnd = UserGetWindowObject(hWnd)))
227 {
228 return FALSE;
229 }
230
231 /* check if updating is needed */
232 bIsDisabled = !!(pWnd->style & WS_DISABLED);
233 Update = bIsDisabled;
234
235 if (bEnable)
236 {
237 IntSetStyle( pWnd, 0, WS_DISABLED );
238 }
239 else
240 {
241 Update = !bIsDisabled;
242
244
245 /* Remove keyboard focus from that window if it had focus */
247 {
248 TRACE("IntEnableWindow SF NULL\n");
250 }
251 IntSetStyle( pWnd, WS_DISABLED, 0 );
252 }
253
254 if (Update)
255 {
256 IntNotifyWinEvent(EVENT_OBJECT_STATECHANGE, pWnd, OBJID_WINDOW, CHILDID_SELF, 0);
258 }
259 // Return nonzero if it was disabled, or zero if it wasn't:
260 return bIsDisabled;
261}
@ 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:1615

Referenced by NtUserCallTwoParam(), and NtUserEnableScrollBar().

◆ IntFindWindow()

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

Definition at line 3061 of file window.c.

3065{
3066 BOOL CheckWindowName;
3067 HWND *List, *phWnd;
3068 HWND Ret = NULL;
3069 UNICODE_STRING CurrentWindowName;
3070
3071 ASSERT(Parent);
3072
3073 CheckWindowName = WindowName->Buffer != 0;
3074
3076 {
3077 phWnd = List;
3078 if(ChildAfter)
3079 {
3080 /* skip handles before and including ChildAfter */
3081 while(*phWnd && (*(phWnd++) != UserHMGetHandle(ChildAfter)))
3082 ;
3083 }
3084
3085 /* search children */
3086 while(*phWnd)
3087 {
3088 PWND Child;
3089 if(!(Child = UserGetWindowObject(*(phWnd++))))
3090 {
3091 continue;
3092 }
3093
3094 /* Do not send WM_GETTEXT messages in the kernel mode version!
3095 The user mode version however calls GetWindowText() which will
3096 send WM_GETTEXT messages to windows belonging to its processes */
3097 if (!ClassAtom || Child->pcls->atomNVClassName == ClassAtom)
3098 {
3099 // FIXME: LARGE_STRING truncated
3100 CurrentWindowName.Buffer = Child->strName.Buffer;
3101 CurrentWindowName.Length = (USHORT)min(Child->strName.Length, MAXUSHORT);
3102 CurrentWindowName.MaximumLength = (USHORT)min(Child->strName.MaximumLength, MAXUSHORT);
3103 if(!CheckWindowName ||
3104 (Child->strName.Length < 0xFFFF &&
3105 !RtlCompareUnicodeString(WindowName, &CurrentWindowName, TRUE)))
3106 {
3107 Ret = UserHMGetHandle(Child);
3108 break;
3109 }
3110 }
3111 }
3113 }
3114
3115 return Ret;
3116}
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 1470 of file window.c.

1471{
1472 PWINDOWLIST pwl, *ppwl;
1473
1474 for (ppwl = &gpwlList; *ppwl; ppwl = &(*ppwl)->pNextList)
1475 {
1476 if (*ppwl != pwlTarget)
1477 continue;
1478
1479 *ppwl = pwlTarget->pNextList;
1480
1481 if (gpwlCache)
1482 {
1483 if (WL_CAPACITY(pwlTarget) > WL_CAPACITY(gpwlCache))
1484 {
1485 pwl = gpwlCache;
1486 gpwlCache = pwlTarget;
1488 }
1489 else
1490 {
1492 }
1493 }
1494 else
1495 {
1496 gpwlCache = pwlTarget;
1497 }
1498
1499 break;
1500 }
1501}
#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:1020
#define SM_CYMINIMIZED
Definition: winuser.h:1021

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 351 of file window.c.

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

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 381 of file window.c.

383{
384 PWND Wnd, FoundWnd;
385 HWND Ret = NULL;
386
387 Wnd = ValidateHwndNoErr(hWnd);
388 if (!Wnd)
389 return NULL;
390
391 FoundWnd = NULL;
392 switch (uCmd)
393 {
394 case GW_OWNER:
395 if (Wnd->spwndOwner != NULL)
396 FoundWnd = Wnd->spwndOwner;
397 break;
398
399 case GW_HWNDFIRST:
400 if(Wnd->spwndParent != NULL)
401 {
402 FoundWnd = Wnd->spwndParent;
403 if (FoundWnd->spwndChild != NULL)
404 FoundWnd = FoundWnd->spwndChild;
405 }
406 break;
407 case GW_HWNDNEXT:
408 if (Wnd->spwndNext != NULL)
409 FoundWnd = Wnd->spwndNext;
410 break;
411
412 case GW_HWNDPREV:
413 if (Wnd->spwndPrev != NULL)
414 FoundWnd = Wnd->spwndPrev;
415 break;
416
417 case GW_CHILD:
418 if (Wnd->spwndChild != NULL)
419 FoundWnd = Wnd->spwndChild;
420 break;
421
422 case GW_HWNDLAST:
423 FoundWnd = Wnd;
424 while ( FoundWnd->spwndNext != NULL)
425 FoundWnd = FoundWnd->spwndNext;
426 break;
427
428 default:
429 Wnd = NULL;
430 break;
431 }
432
433 if (FoundWnd != NULL)
434 Ret = UserHMGetHandle(FoundWnd);
435 return Ret;
436}
#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:766
#define GW_HWNDFIRST
Definition: winuser.h:764
#define GW_HWNDLAST
Definition: winuser.h:765
#define GW_HWNDNEXT
Definition: winuser.h:761
#define GW_HWNDPREV
Definition: winuser.h:762
#define GW_CHILD
Definition: winuser.h:763

Referenced by WinPosFixupFlags().

◆ IntGetWindowBorderMeasures()

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

Definition at line 861 of file winpos.c.

862{
863 if(HAS_DLGFRAME(Wnd->style, Wnd->ExStyle) && !(Wnd->style & WS_MINIMIZE))
864 {
867 }
868 else
869 {
870 if(HAS_THICKFRAME(Wnd->style, Wnd->ExStyle)&& !(Wnd->style & WS_MINIMIZE))
871 {
874 }
875 else if(HAS_THINFRAME(Wnd->style, Wnd->ExStyle))
876 {
879 }
880 else
881 {
882 *cx = *cy = 0;
883 }
884 }
885}
_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 2065 of file ime.c.

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

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

Referenced by co_UserDestroyWindow().

◆ IntIsChildWindow()

BOOL FASTCALL IntIsChildWindow ( PWND  Parent,
PWND  Child 
)

Definition at line 927 of file window.c.

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

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

◆ IntIsWindow()

◆ IntIsWindowVisible()

BOOL FASTCALL IntIsWindowVisible ( PWND  Wnd)

Definition at line 189 of file window.c.

190{
191 PWND Temp = Wnd;
192 for (;;)
193 {
194 if (!Temp) return TRUE;
195 if (!(Temp->style & WS_VISIBLE)) break;
196 if (Temp->style & WS_MINIMIZE && Temp != Wnd) break;
197 if (Temp->fnid == FNID_DESKTOP) return TRUE;
198 Temp = Temp->spwndParent;
199 }
200 return FALSE;
201}
#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 983 of file window.c.

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

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
#define MAKELONG(a, b)
Definition: typedefs.h:249
static ULONG Delta
Definition: xboxvideo.c:33

Referenced by DefWndDoSizeMove(), and DefWndHandleWindowPosChanged().

◆ IntNotifyImeShowStatus()

VOID FASTCALL IntNotifyImeShowStatus ( PWND  pImeWnd)

Definition at line 2326 of file ime.c.

2327{
2328 PIMEUI pimeui;
2329 PWND pWnd;
2330 PTHREADINFO pti, ptiIME;
2331 BOOL bShow, bSendNotify = FALSE;
2332 IMEUI SafeImeUI;
2333
2334 if (!IS_IMM_MODE() || (pImeWnd->state2 & WNDS2_INDESTROY))
2335 return;
2336
2338 ptiIME = pImeWnd->head.pti;
2339
2340 // Attach to the process if necessary
2341 if (pti != ptiIME)
2342 KeAttachProcess(&(ptiIME->ppi->peProcess->Pcb));
2343
2344 // Get an IMEUI and check whether hwndIMC is valid and update fShowStatus
2345 _SEH2_TRY
2346 {
2347 ProbeForWrite(pImeWnd, sizeof(IMEWND), 1);
2348 pimeui = ((PIMEWND)pImeWnd)->pimeui;
2349 SafeImeUI = *pimeui;
2350
2351 bShow = (gfIMEShowStatus == TRUE) && SafeImeUI.fCtrlShowStatus;
2352
2353 pWnd = ValidateHwndNoErr(SafeImeUI.hwndIMC);
2354 if (!pWnd)
2355 pWnd = ptiIME->MessageQueue->spwndFocus;
2356
2357 if (pWnd)
2358 {
2359 bSendNotify = TRUE;
2360 pimeui->fShowStatus = bShow;
2361 }
2362 }
2364 {
2365 ERR("%p, %p\n", pImeWnd, pimeui);
2366
2367 if (pti != ptiIME)
2369
2370 _SEH2_YIELD(return);
2371 }
2372 _SEH2_END;
2373
2374 // Detach from the process if necessary
2375 if (pti != ptiIME)
2377
2378 if (bSendNotify)
2379 IntSendOpenStatusNotify(ptiIME, &SafeImeUI, pWnd, bShow);
2380
2381 if (!(pImeWnd->state2 & WNDS2_INDESTROY))
2382 IntCheckImeShowStatus(pImeWnd, NULL);
2383}
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:2307

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 143 of file window.c.

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

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

◆ IntShowOwnedPopups()

BOOL FASTCALL IntShowOwnedPopups ( PWND  owner,
BOOL  fShow 
)

Definition at line 4649 of file window.c.

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

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

◆ IntUnlinkWindow()

VOID FASTCALL IntUnlinkWindow ( PWND  Wnd)

Definition at line 1354 of file window.c.

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