ReactOS 0.4.15-dev-6068-g8061a6f
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 WndSetOwner (_Inout_ PWND pwnd, _In_opt_ PWND pwndOwner)
 

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:922
ATOM atomSysClass[ICLS_NOTUSED+1]
Definition: ntuser.h:1055
#define CS_IME
Definition: winuser.h:654

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:110
#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:34
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:689
DWORD style
Definition: ntuser.h:701
struct _WND * spwndParent
Definition: ntuser.h:708
LPCWSTR lpszClass
Definition: winuser.h:2955
LPCWSTR lpszName
Definition: winuser.h:2954
HINSTANCE hInstance
Definition: winuser.h:2946
UINT fDefault
Definition: ntuser.h:1247
UINT fChildThreadDef
Definition: ntuser.h:1248
#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:2158
#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 2158 of file window.c.

2163{
2164 ULONG style;
2165 PWND Window = NULL, ParentWindow = NULL, OwnerWindow;
2166 HWND hWnd, hWndParent, hWndOwner, hwndInsertAfter;
2167 PWINSTATION_OBJECT WinSta;
2168 PCLS Class = NULL;
2169 SIZE Size;
2170 POINT MaxSize, MaxPos, MinTrack, MaxTrack;
2171 CBT_CREATEWNDW * pCbtCreate;
2173 USER_REFERENCE_ENTRY ParentRef, Ref;
2174 PTHREADINFO pti;
2175 DWORD dwShowMode = SW_SHOW;
2176 CREATESTRUCTW *pCsw = NULL;
2177 PVOID pszClass = NULL, pszName = NULL;
2178 PWND ret = NULL;
2179
2180 /* Get the current window station and reference it */
2181 pti = GetW32ThreadInfo();
2182 if (pti == NULL || pti->rpdesk == NULL)
2183 {
2184 ERR("Thread is not attached to a desktop! Cannot create window!\n");
2185 return NULL; // There is nothing to cleanup.
2186 }
2187 WinSta = pti->rpdesk->rpwinstaParent;
2189
2190 pCsw = NULL;
2191 pCbtCreate = NULL;
2192
2193 /* Get the class and reference it */
2194 Class = IntGetAndReferenceClass(ClassName, Cs->hInstance, FALSE);
2195 if(!Class)
2196 {
2198 ERR("Failed to find class %wZ\n", ClassName);
2199 goto cleanup;
2200 }
2201
2202 /* Now find the parent and the owner window */
2203 hWndParent = pti->rpdesk->pDeskInfo->spwnd->head.h;
2204 hWndOwner = NULL;
2205
2206 if (Cs->hwndParent == HWND_MESSAGE)
2207 {
2208 Cs->hwndParent = hWndParent = pti->rpdesk->spwndMessage->head.h;
2209 }
2210 else if (Cs->hwndParent)
2211 {
2212 if ((Cs->style & (WS_CHILD|WS_POPUP)) != WS_CHILD)
2213 hWndOwner = Cs->hwndParent;
2214 else
2215 hWndParent = Cs->hwndParent;
2216 }
2217 else if ((Cs->style & (WS_CHILD|WS_POPUP)) == WS_CHILD)
2218 {
2219 ERR("Cannot create a child window without a parent!\n");
2221 goto cleanup; /* WS_CHILD needs a parent, but WS_POPUP doesn't */
2222 }
2224 (IS_INTRESOURCE(Cs->lpszClass) ||
2225 Cs->lpszClass != (LPCWSTR)MAKEINTATOM(gpsi->atomSysClass[ICLS_HWNDMESSAGE]) ||
2226 _wcsicmp(Cs->lpszClass, L"Message") != 0))
2227 {
2228 if (pti->ppi->dwLayout & LAYOUT_RTL)
2229 {
2231 }
2232 }
2233
2234 ParentWindow = hWndParent ? UserGetWindowObject(hWndParent): NULL;
2235 OwnerWindow = hWndOwner ? UserGetWindowObject(hWndOwner): NULL;
2236
2237 if (hWndParent && !ParentWindow)
2238 {
2239 ERR("Got invalid parent window handle\n");
2240 goto cleanup;
2241 }
2242 else if (hWndOwner && !OwnerWindow)
2243 {
2244 ERR("Got invalid owner window handle\n");
2245 ParentWindow = NULL;
2246 goto cleanup;
2247 }
2248
2249 if(OwnerWindow)
2250 {
2251 if (IntIsDesktopWindow(OwnerWindow)) OwnerWindow = NULL;
2252 else if (ParentWindow && !IntIsDesktopWindow(ParentWindow))
2253 {
2254 ERR("an owned window must be created as top-level\n");
2256 goto cleanup;
2257 }
2258 else /* owner must be a top-level window */
2259 {
2260 while ((OwnerWindow->style & (WS_POPUP|WS_CHILD)) == WS_CHILD && !IntIsDesktopWindow(OwnerWindow->spwndParent))
2261 OwnerWindow = OwnerWindow->spwndParent;
2262 }
2263 }
2264
2265 /* Fix the position and the size of the window */
2266 if (ParentWindow)
2267 {
2268 UserRefObjectCo(ParentWindow, &ParentRef);
2269 IntFixWindowCoordinates(Cs, ParentWindow, &dwShowMode);
2270 }
2271
2272 /* Allocate and initialize the new window */
2274 WindowName,
2275 Class,
2276 ParentWindow,
2277 OwnerWindow,
2278 acbiBuffer,
2279 NULL,
2280 dwVer );
2281 if(!Window)
2282 {
2283 ERR("IntCreateWindow failed!\n");
2284 goto cleanup;
2285 }
2286
2288 hwndInsertAfter = HWND_TOP;
2289
2290 UserRefObjectCo(Window, &Ref);
2292 ObDereferenceObject(WinSta);
2293
2294 /* NCCREATE, WM_NCCALCSIZE and Hooks need the original values */
2295 Cs->lpszName = (LPCWSTR) WindowName;
2296 Cs->lpszClass = (LPCWSTR) ClassName;
2297
2299 if ( ISITHOOKED(WH_CBT) || (pti->rpdesk->pDeskInfo->fsHooks & HOOKID_TO_FLAG(WH_CBT)) )
2300 {
2301 // Allocate the calling structures Justin Case this goes Global.
2304 if (!pCsw || !pCbtCreate)
2305 {
2306 ERR("UserHeapAlloc() failed!\n");
2307 goto cleanup;
2308 }
2309
2310 if (!IntMsgCreateStructW( Window, pCsw, Cs, &pszClass, &pszName ) )
2311 {
2312 ERR("IntMsgCreateStructW() failed!\n");
2313 goto cleanup;
2314 }
2315
2316 pCbtCreate->lpcs = pCsw;
2317 pCbtCreate->hwndInsertAfter = hwndInsertAfter;
2318
2321 if (Result != 0)
2322 {
2323 ERR("WH_CBT HCBT_CREATEWND hook failed! 0x%x\n", Result);
2324 goto cleanup;
2325 }
2326 // Write back changes.
2327 Cs->cx = pCsw->cx;
2328 Cs->cy = pCsw->cy;
2329 Cs->x = pCsw->x;
2330 Cs->y = pCsw->y;
2331 hwndInsertAfter = pCbtCreate->hwndInsertAfter;
2332 }
2333
2334 if ((Cs->style & (WS_CHILD|WS_POPUP)) == WS_CHILD)
2335 {
2336 if (ParentWindow != co_GetDesktopWindow(Window))
2337 {
2338 Cs->x += ParentWindow->rcClient.left;
2339 Cs->y += ParentWindow->rcClient.top;
2340 }
2341 }
2342
2343 /* Send the WM_GETMINMAXINFO message */
2344 Size.cx = Cs->cx;
2345 Size.cy = Cs->cy;
2346
2347 if ((Cs->style & WS_THICKFRAME) || !(Cs->style & (WS_POPUP | WS_CHILD)))
2348 {
2349 co_WinPosGetMinMaxInfo(Window, &MaxSize, &MaxPos, &MinTrack, &MaxTrack);
2350 if (Size.cx > MaxTrack.x) Size.cx = MaxTrack.x;
2351 if (Size.cy > MaxTrack.y) Size.cy = MaxTrack.y;
2352 if (Size.cx < MinTrack.x) Size.cx = MinTrack.x;
2353 if (Size.cy < MinTrack.y) Size.cy = MinTrack.y;
2354 }
2355
2356 Window->rcWindow.left = Cs->x;
2357 Window->rcWindow.top = Cs->y;
2358 Window->rcWindow.right = Cs->x + Size.cx;
2359 Window->rcWindow.bottom = Cs->y + Size.cy;
2360 /*
2361 if (0 != (Window->style & WS_CHILD) && ParentWindow)
2362 {
2363 ERR("co_UserCreateWindowEx(): Offset rcWindow\n");
2364 RECTL_vOffsetRect(&Window->rcWindow,
2365 ParentWindow->rcClient.left,
2366 ParentWindow->rcClient.top);
2367 }
2368 */
2369 /* correct child window coordinates if mirroring on parent is enabled */
2370 if (ParentWindow != NULL)
2371 {
2372 if ( ((Cs->style & WS_CHILD) == WS_CHILD) &&
2373 ((ParentWindow->ExStyle & WS_EX_LAYOUTRTL) == WS_EX_LAYOUTRTL))
2374 {
2375 Window->rcWindow.right = ParentWindow->rcClient.right - (Window->rcWindow.left - ParentWindow->rcClient.left);
2376 Window->rcWindow.left = Window->rcWindow.right - Size.cx;
2377 }
2378 }
2379
2380 Window->rcClient = Window->rcWindow;
2381
2382 if (Window->spwndNext || Window->spwndPrev)
2383 {
2384 ERR("Window 0x%p has been linked too early!\n", Window);
2385 }
2386
2387 if (!(Window->state2 & WNDS2_WIN31COMPAT))
2388 {
2389 if (Class->style & CS_PARENTDC && !(ParentWindow->style & WS_CLIPCHILDREN))
2390 Window->style &= ~(WS_CLIPSIBLINGS | WS_CLIPCHILDREN);
2391 }
2392
2393 if ((Window->style & (WS_CHILD | WS_POPUP)) == WS_CHILD)
2394 {
2396 {
2397 if (pti != ParentWindow->head.pti)
2398 {
2399 //ERR("CreateWindow Parent in.\n");
2400 UserAttachThreadInput(pti, ParentWindow->head.pti, TRUE);
2401 }
2402 }
2403 }
2404
2405 /* Send the NCCREATE message */
2407 if (!Result)
2408 {
2409 ERR("co_UserCreateWindowEx(): NCCREATE message failed\n");
2410 goto cleanup;
2411 }
2412
2413 /* Link the window */
2414 if (ParentWindow != NULL)
2415 {
2416 /* Link the window into the siblings list */
2417 if ((Cs->style & (WS_CHILD | WS_MAXIMIZE)) == WS_CHILD)
2419 else
2420 IntLinkHwnd(Window, hwndInsertAfter);
2421 }
2422
2423 /* Create the IME window for pWnd */
2425 {
2426 PWND pwndDefaultIme = co_IntCreateDefaultImeWindow(Window, Window->hModule);
2427 UserAssignmentLock((PVOID*)&pti->spwndDefaultIme, pwndDefaultIme);
2428
2429 if (pwndDefaultIme)
2430 {
2431 HWND hImeWnd;
2433 UserRefObjectCo(pwndDefaultIme, &Ref);
2434
2435 hImeWnd = UserHMGetHandle(pwndDefaultIme);
2436
2438
2439 if (pti->pClientInfo->CI_flags & CI_IMMACTIVATE)
2440 {
2441 HKL hKL = pti->KeyboardLayout->hkl;
2443 pti->pClientInfo->CI_flags &= ~CI_IMMACTIVATE;
2444 }
2445
2446 UserDerefObjectCo(pwndDefaultIme);
2447 }
2448 }
2449
2450 /* Send the WM_NCCALCSIZE message */
2451 {
2452 // RECT rc;
2453 MaxPos.x = Window->rcWindow.left;
2454 MaxPos.y = Window->rcWindow.top;
2455
2456 Result = co_WinPosGetNonClientSize(Window, &Window->rcWindow, &Window->rcClient);
2457 //rc = Window->rcWindow;
2458 //Result = co_IntSendMessageNoWait(Window->head.h, WM_NCCALCSIZE, FALSE, (LPARAM)&rc);
2459 //Window->rcClient = rc;
2460
2461 RECTL_vOffsetRect(&Window->rcWindow, MaxPos.x - Window->rcWindow.left,
2462 MaxPos.y - Window->rcWindow.top);
2463 }
2464
2465 /* Send the WM_CREATE message. */
2467 if (Result == (LRESULT)-1)
2468 {
2469 ERR("co_UserCreateWindowEx(): WM_CREATE message failed\n");
2470 goto cleanup;
2471 }
2472
2473 /* Send the EVENT_OBJECT_CREATE event */
2474 IntNotifyWinEvent(EVENT_OBJECT_CREATE, Window, OBJID_WINDOW, CHILDID_SELF, 0);
2475
2476 /* By setting the flag below it can be examined to determine if the window
2477 was created successfully and a valid pwnd was passed back to caller since
2478 from here the function has to succeed. */
2480
2481 /* Send the WM_SIZE and WM_MOVE messages. */
2482 if (!(Window->state & WNDS_SENDSIZEMOVEMSGS))
2483 {
2485 }
2486
2487 /* Show or maybe minimize or maximize the window. */
2488
2490 if (style & (WS_MINIMIZE | WS_MAXIMIZE))
2491 {
2492 RECTL NewPos;
2493 UINT SwFlag = (style & WS_MINIMIZE) ? SW_MINIMIZE : SW_MAXIMIZE;
2494
2495 SwFlag = co_WinPosMinMaximize(Window, SwFlag, &NewPos);
2496 SwFlag |= SWP_NOZORDER|SWP_FRAMECHANGED; /* Frame always gets changed */
2497 if (!(style & WS_VISIBLE) || (style & WS_CHILD) || UserGetActiveWindow() ||
2498 (Window->ExStyle & WS_EX_NOACTIVATE))
2499 {
2500 SwFlag |= SWP_NOACTIVATE;
2501 }
2502 co_WinPosSetWindowPos(Window, 0, NewPos.left, NewPos.top,
2503 NewPos.right, NewPos.bottom, SwFlag);
2504 }
2505
2506 /* Send the WM_PARENTNOTIFY message */
2508
2509 /* Notify the shell that a new window was created */
2510 if (Window->spwndOwner == NULL ||
2511 !(Window->spwndOwner->style & WS_VISIBLE) ||
2512 (Window->spwndOwner->ExStyle & WS_EX_TOOLWINDOW))
2513 {
2514 if (UserIsDesktopWindow(Window->spwndParent) &&
2515 (Window->style & WS_VISIBLE) &&
2516 (!(Window->ExStyle & WS_EX_TOOLWINDOW) ||
2517 (Window->ExStyle & WS_EX_APPWINDOW)))
2518 {
2520 }
2521 }
2522
2523 /* Initialize and show the window's scrollbars */
2524 if (Window->style & WS_VSCROLL)
2525 {
2527 }
2528 if (Window->style & WS_HSCROLL)
2529 {
2531 }
2532
2533 /* Show the new window */
2534 if (Cs->style & WS_VISIBLE)
2535 {
2536 if (Window->style & WS_MAXIMIZE)
2537 dwShowMode = SW_SHOW;
2538 else if (Window->style & WS_MINIMIZE)
2539 dwShowMode = SW_SHOWMINIMIZED;
2540
2541 co_WinPosShowWindow(Window, dwShowMode);
2542
2543 if (Window->ExStyle & WS_EX_MDICHILD)
2544 {
2545 ASSERT(ParentWindow);
2546 if(!ParentWindow)
2547 goto cleanup;
2549 /* ShowWindow won't activate child windows */
2551 }
2552 }
2553
2554 if (Class->atomClassName == gaGuiConsoleWndClass)
2555 {
2556 /* Count only console windows manually */
2558 }
2559
2560 TRACE("co_UserCreateWindowEx(): Created window %p\n", hWnd);
2561 ret = Window;
2562
2563cleanup:
2564 if (!ret)
2565 {
2566 TRACE("co_UserCreateWindowEx(): Error Created window!\n");
2567 /* If the window was created, the class will be dereferenced by co_UserDestroyWindow */
2568 if (Window)
2570 else if (Class)
2572 }
2573
2574 if (pCsw) ExFreePoolWithTag(pCsw, TAG_HOOK);
2575 if (pCbtCreate) ExFreePoolWithTag(pCbtCreate, TAG_HOOK);
2576 if (pszName) UserHeapFree(pszName);
2577 if (pszClass) UserHeapFree(pszClass);
2578
2579 if (Window)
2580 {
2582 }
2583 if (ParentWindow) UserDerefObjectCo(ParentWindow);
2584
2585 // See CORE-13717, not setting error on success.
2586 if (ret)
2588
2589 return ret;
2590}
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:1429
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:45
#define IMS_ACTIVATELAYOUT
Definition: immdev.h:40
#define WNDS2_WIN31COMPAT
Definition: ntuser.h:644
struct _THREADINFO * GetW32ThreadInfo(VOID)
Definition: misc.c:801
#define CI_IMMACTIVATE
Definition: ntuser.h:305
#define WNDS2_WMCREATEMSGPROCESSED
Definition: ntuser.h:665
#define IS_IMM_MODE()
Definition: ntuser.h:1232
#define ICLS_DESKTOP
Definition: ntuser.h:924
#define WNDS_SENDSIZEMOVEMSGS
Definition: ntuser.h:604
#define ASSERT(a)
Definition: mode.c:44
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
UINT_PTR HKL
Definition: msctf.idl:104
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:2416
BOOLEAN FASTCALL co_WinPosSetWindowPos(PWND Window, HWND WndInsertAfter, INT x, INT y, INT cx, INT cy, UINT flags)
Definition: winpos.c:1787
LRESULT FASTCALL co_WinPosGetNonClientSize(PWND Window, RECT *WindowRect, RECT *ClientRect)
Definition: winpos.c:2367
UINT FASTCALL co_WinPosGetMinMaxInfo(PWND Window, POINT *MaxSize, POINT *MaxPos, POINT *MinTrack, POINT *MaxTrack)
Definition: winpos.c:935
void FASTCALL co_WinPosSendSizeMove(PWND Wnd)
Definition: winpos.c:2382
BOOLEAN FASTCALL co_WinPosShowWindow(PWND Wnd, INT Cmd)
Definition: winpos.c:2567
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:561
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:2965
HWND hwndInsertAfter
Definition: winuser.h:2966
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:597
VOID IntDereferenceClass(IN OUT PCLS Class, IN PDESKTOPINFO Desktop, IN PPROCESSINFO pi)
Definition: class.c:815
PCLS IntGetAndReferenceClass(PUNICODE_STRING ClassName, HINSTANCE hInstance, BOOL bDesktopThread)
Definition: class.c:1437
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:1446
PVOID FASTCALL UserAssignmentLock(PVOID *ppvObj, PVOID pvNew)
Definition: object.c:840
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:1787
void FASTCALL IntFixWindowCoordinates(CREATESTRUCTW *Cs, PWND ParentWindow, DWORD *dwShowMode)
Definition: window.c:1697
BOOL FASTCALL IntIsTopLevelWindow(PWND pWnd)
Definition: window.c:359
BOOLEAN co_UserDestroyWindow(PVOID Object)
Definition: window.c:2838
VOID FASTCALL IntLinkHwnd(PWND Wnd, HWND hWndPrev)
Definition: window.c:977
static void IntSendParentNotify(PWND pWindow, UINT msg)
Definition: window.c:1678
#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:1451
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:28
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:1200
#define SWP_NOACTIVATE
Definition: winuser.h:1232
#define SWP_FRAMECHANGED
Definition: winuser.h:1230
#define WM_CREATE
Definition: winuser.h:1598
#define WS_EX_APPWINDOW
Definition: winuser.h:383
#define SW_MINIMIZE
Definition: winuser.h:770
#define HSHELL_WINDOWCREATED
Definition: winuser.h:1245
#define SB_VERT
Definition: winuser.h:553
#define SWP_NOMOVE
Definition: winuser.h:1234
#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:1235
#define WH_CBT
Definition: winuser.h:35
#define HCBT_CREATEWND
Definition: winuser.h:58
#define WM_NCCREATE
Definition: winuser.h:1673
#define WM_MDIREFRESHMENU
Definition: winuser.h:1816
#define SW_SHOWMINIMIZED
Definition: winuser.h:765
#define HWND_TOP
Definition: winuser.h:1197
#define WS_EX_MDICHILD
Definition: winuser.h:394
#define SWP_SHOWWINDOW
Definition: winuser.h:1238
#define SW_SHOW
Definition: winuser.h:769
#define SWP_NOZORDER
Definition: winuser.h:1237
#define SW_MAXIMIZE
Definition: winuser.h:766
#define CS_PARENTDC
Definition: winuser.h:651
#define HWND_BOTTOM
Definition: winuser.h:1195
#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:426
#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
597
598 /* remove the window already at this point from the thread window list so we
599 don't get into trouble when destroying the thread windows while we're still
600 in co_UserFreeWindow() */
601 RemoveEntryList(&Window->ThreadListEntry);
602
603 BelongsToThreadData = IntWndBelongsToThread(Window, ThreadData);
604
606
607 /* free child windows */
608 Children = IntWinListChildren(Window);
609 if (Children)
610 {
611 for (ChildHandle = Children; *ChildHandle; ++ChildHandle)
612 {
613 if ((Child = IntGetWindowObject(*ChildHandle)))
614 {
616 {
617 /* send WM_DESTROY messages to windows not belonging to the same thread */
619 }
620 else
621 co_UserFreeWindow(Child, ProcessData, ThreadData, SendMessages);
622
624 }
625 }
627 }
628
629 if (SendMessages)
630 {
631 /*
632 * Clear the update region to make sure no WM_PAINT messages will be
633 * generated for this window while processing the WM_NCDESTROY.
634 */
638 if (BelongsToThreadData)
640 }
641
643
645
646 /* Unregister hot keys */
648
649 /* flush the message queue */
651
652 /* from now on no messages can be sent to this window anymore */
653 Window->state |= WNDS_DESTROYED;
654 Window->fnid |= FNID_FREED;
655
656 /* don't remove the WINDOWSTATUS_DESTROYING bit */
657
658 /* reset shell window handles */
659 if (ThreadData->rpdesk)
660 {
661 if (Window->head.h == ThreadData->rpdesk->rpwinstaParent->ShellWindow)
662 ThreadData->rpdesk->rpwinstaParent->ShellWindow = NULL;
663
664 if (Window->head.h == ThreadData->rpdesk->rpwinstaParent->ShellListView)
665 ThreadData->rpdesk->rpwinstaParent->ShellListView = NULL;
666 }
667
668 if (ThreadData->spwndDefaultIme &&
669 ThreadData->spwndDefaultIme->spwndOwner == Window)
670 {
671 WndSetOwner(ThreadData->spwndDefaultIme, NULL);
672 }
673
674 if (IS_IMM_MODE() && Window == ThreadData->spwndDefaultIme)
675 {
676 UserAssignmentUnlock((PVOID*)&(ThreadData->spwndDefaultIme));
677 }
678
679 /* Fixes dialog test_focus breakage due to r66237. */
680 if (ThreadData->MessageQueue->spwndFocus == Window)
681 ThreadData->MessageQueue->spwndFocus = NULL;
682
683 if (ThreadData->MessageQueue->spwndActive == Window)
684 ThreadData->MessageQueue->spwndActive = NULL;
685
686 if (ThreadData->MessageQueue->spwndCapture == Window)
687 {
689 }
690
692 if ( Window->hrgnUpdate != NULL || Window->state & WNDS_INTERNALPAINT )
693 {
694 MsqDecPaintCountQueue(Window->head.pti);
695 if (Window->hrgnUpdate > HRGN_WINDOW && GreIsHandleValid(Window->hrgnUpdate))
696 {
698 GreDeleteObject(Window->hrgnUpdate);
699 }
700 Window->hrgnUpdate = NULL;
701 Window->state &= ~WNDS_INTERNALPAINT;
702 }
703
705 {
707 }
708
709 if ( ((Window->style & (WS_CHILD|WS_POPUP)) != WS_CHILD) &&
710 Window->IDMenu &&
711 (Menu = UserGetMenuObject((HMENU)Window->IDMenu)))
712 {
713 TRACE("UFW: IDMenu %p\n",Window->IDMenu);
715 Window->IDMenu = 0;
716 }
717
718 if (Window->SystemMenu
719 && (Menu = UserGetMenuObject(Window->SystemMenu)))
720 {
722 Window->SystemMenu = (HMENU)0;
723 }
724
725 DceFreeWindowDCE(Window); /* Always do this to catch orphaned DCs */
726
728
729 if (Window->PropListItems)
730 {
732 TRACE("Window->PropListItems %lu\n",Window->PropListItems);
733 ASSERT(Window->PropListItems==0);
734 }
735
738
740
741 if (Window->pcls->atomClassName == gaGuiConsoleWndClass)
742 {
743 /* Count only console windows manually */
745 }
746
747 /* dereference the class */
748 NT_ASSERT(Window->head.pti != NULL);
750 Window->head.pti->pDeskInfo,
751 Window->head.pti->ppi);
752 Window->pcls = NULL;
753
754 if (Window->hrgnClip)
755 {
757 GreDeleteObject(Window->hrgnClip);
758 Window->hrgnClip = NULL;
759 }
760 Window->head.pti->cWindows--;
761
762// ASSERT(Window != NULL);
763 UserFreeWindowInfo(Window->head.pti, Window);
764
767
768 return 0;
769}
unsigned char BOOLEAN
void FASTCALL DceFreeWindowDCE(PWND)
Definition: windc.c:686
#define RemoveEntryList(Entry)
Definition: env_spec_w32.h:986
BOOL FASTCALL IntReleaseCapture(VOID)
Definition: focus.c:1530
#define WNDS_DESTROYED
Definition: ntuser.h:631
#define WNDS_SENDNCPAINT
Definition: ntuser.h:611
#define WNDS_INTERNALPAINT
Definition: ntuser.h:612
@ TYPE_WINDOW
Definition: ntuser.h:41
#define WNDS2_INDESTROY
Definition: ntuser.h:643
#define FNID_FREED
Definition: ntuser.h:895
#define HRGN_WINDOW
Definition: ntuser.h:356
#define WNDS_SENDERASEBACKGROUND
Definition: ntuser.h:609
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
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:888
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:2475
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:319
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:861
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:1341
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:130
#define IntWndBelongsToThread(WndObj, W32Thread)
Definition: window.h:32
#define RDW_NOINTERNALPAINT
Definition: winuser.h:1207
#define RDW_NOCHILDREN
Definition: winuser.h:1212
#define WM_NCDESTROY
Definition: winuser.h:1674
#define RDW_NOFRAME
Definition: winuser.h:1206
#define RDW_NOERASE
Definition: winuser.h:1205
#define RDW_VALIDATE
Definition: winuser.h:1208
#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 4017 of file window.c.

4018{
4019 return (LONG)co_IntSetWindowLongPtr(hWnd, Index, NewValue, Ansi, sizeof(LONG), FALSE);
4020}
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:3822

Referenced by DesktopWindowProc(), and NtUserSetWindowWord().

◆ co_UserSetWindowLongPtr()

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

Definition at line 4023 of file window.c.

4024{
4025 return co_IntSetWindowLongPtr(hWnd, Index, NewValue, Ansi, sizeof(LONG_PTR), FALSE);
4026}
__int3264 LONG_PTR
Definition: mstsclib_h.h:276

◆ GetNCHitEx()

DWORD FASTCALL GetNCHitEx ( PWND  pWnd,
POINT  pt 
)

Definition at line 1952 of file nonclient.c.

1953{
1954 RECT rcWindow, rcClient;
1956
1957 if (!pWnd) return HTNOWHERE;
1958
1959 if (UserIsDesktopWindow(pWnd))
1960 {
1961 rcClient.left = rcClient.top = rcWindow.left = rcWindow.top = 0;
1966 }
1967 else
1968 {
1969 rcClient = pWnd->rcClient;
1970 rcWindow = pWnd->rcWindow;
1971 }
1972
1973 if (!RECTL_bPointInRect(&rcWindow, pt.x, pt.y)) return HTNOWHERE;
1974
1975 Style = pWnd->style;
1976 ExStyle = pWnd->ExStyle;
1977
1978 if (Style & WS_MINIMIZE) return HTCAPTION;
1979
1980 if (RECTL_bPointInRect( &rcClient, pt.x, pt.y )) return HTCLIENT;
1981
1982 /* Check borders */
1984 {
1986 if (!RECTL_bPointInRect(&rcWindow, pt.x, pt.y ))
1987 {
1988 /* Check top sizing border */
1989 if (pt.y < rcWindow.top)
1990 {
1991 if (pt.x < rcWindow.left+UserGetSystemMetrics(SM_CXSIZE)) return HTTOPLEFT;
1992 if (pt.x >= rcWindow.right-UserGetSystemMetrics(SM_CXSIZE)) return HTTOPRIGHT;
1993 return HTTOP;
1994 }
1995 /* Check bottom sizing border */
1996 if (pt.y >= rcWindow.bottom)
1997 {
1998 if (pt.x < rcWindow.left+UserGetSystemMetrics(SM_CXSIZE)) return HTBOTTOMLEFT;
1999 if (pt.x >= rcWindow.right-UserGetSystemMetrics(SM_CXSIZE)) return HTBOTTOMRIGHT;
2000 return HTBOTTOM;
2001 }
2002 /* Check left sizing border */
2003 if (pt.x < rcWindow.left)
2004 {
2005 if (pt.y < rcWindow.top+UserGetSystemMetrics(SM_CYSIZE)) return HTTOPLEFT;
2006 if (pt.y >= rcWindow.bottom-UserGetSystemMetrics(SM_CYSIZE)) return HTBOTTOMLEFT;
2007 return HTLEFT;
2008 }
2009 /* Check right sizing border */
2010 if (pt.x >= rcWindow.right)
2011 {
2012 if (pt.y < rcWindow.top+UserGetSystemMetrics(SM_CYSIZE)) return HTTOPRIGHT;
2013 if (pt.y >= rcWindow.bottom-UserGetSystemMetrics(SM_CYSIZE)) return HTBOTTOMRIGHT;
2014 return HTRIGHT;
2015 }
2016 }
2017 }
2018 else /* No thick frame */
2019 {
2020 if (HAS_DLGFRAME( Style, ExStyle ))
2022 else if (HAS_THINFRAME( Style, ExStyle ))
2024 else if (HAS_CLIENTFRAME( Style, ExStyle ))
2026 if (!RECTL_bPointInRect( &rcWindow, pt.x, pt.y )) return HTBORDER;
2027 }
2028
2029 /* Check caption */
2030
2031 if ((Style & WS_CAPTION) == WS_CAPTION)
2032 {
2034 rcWindow.top += UserGetSystemMetrics(SM_CYSMCAPTION) - 1;
2035 else
2036 rcWindow.top += UserGetSystemMetrics(SM_CYCAPTION) - 1;
2037 if (!RECTL_bPointInRect( &rcWindow, pt.x, pt.y ))
2038 {
2039 BOOL min_or_max_box = (Style & WS_SYSMENU) && (Style & (WS_MINIMIZEBOX|WS_MAXIMIZEBOX));
2041 {
2042 /* Check system menu */
2043 if ((Style & WS_SYSMENU) && !(ExStyle & WS_EX_TOOLWINDOW) && NC_IconForWindow(pWnd))
2044 {
2045 rcWindow.right -= UserGetSystemMetrics(SM_CYCAPTION) - 1;
2046 if (pt.x > rcWindow.right) return HTSYSMENU;
2047 }
2048
2049 /* Check close button */
2050 if (Style & WS_SYSMENU)
2051 {
2053 if (pt.x < rcWindow.left) return HTCLOSE;
2054 }
2055
2056 /* Check maximize box */
2057 /* In Win95 there is automatically a Maximize button when there is a minimize one */
2058 if (min_or_max_box && !(ExStyle & WS_EX_TOOLWINDOW))
2059 {
2060 rcWindow.left += UserGetSystemMetrics(SM_CXSIZE);
2061 if (pt.x < rcWindow.left) return HTMAXBUTTON;
2062 }
2063
2064 /* Check minimize box */
2065 if (min_or_max_box && !(ExStyle & WS_EX_TOOLWINDOW))
2066 {
2067 rcWindow.left += UserGetSystemMetrics(SM_CXSIZE);
2068 if (pt.x < rcWindow.left) return HTMINBUTTON;
2069 }
2070 }
2071 else
2072 {
2073 /* Check system menu */
2074 if ((Style & WS_SYSMENU) && !(ExStyle & WS_EX_TOOLWINDOW) && NC_IconForWindow(pWnd))
2075 {
2076 rcWindow.left += UserGetSystemMetrics(SM_CYCAPTION) - 1;
2077 if (pt.x < rcWindow.left) return HTSYSMENU;
2078 }
2079
2080 /* Check close button */
2081 if (Style & WS_SYSMENU)
2082 {
2084 if (pt.x > rcWindow.right) return HTCLOSE;
2085 }
2086
2087 /* Check maximize box */
2088 /* In Win95 there is automatically a Maximize button when there is a minimize one */
2089 if (min_or_max_box && !(ExStyle & WS_EX_TOOLWINDOW))
2090 {
2092 if (pt.x > rcWindow.right) return HTMAXBUTTON;
2093 }
2094
2095 /* Check minimize box */
2096 if (min_or_max_box && !(ExStyle & WS_EX_TOOLWINDOW))
2097 {
2099 if (pt.x > rcWindow.right) return HTMINBUTTON;
2100 }
2101 }
2102 return HTCAPTION;
2103 }
2104 }
2105
2106 /* Check menu bar */
2107
2108 if (HAS_MENU( pWnd, Style ) && (pt.y < rcClient.top) &&
2109 (pt.x >= rcClient.left) && (pt.x < rcClient.right))
2110 return HTMENU;
2111
2112 /* Check vertical scroll bar */
2113
2115 if (Style & WS_VSCROLL)
2116 {
2117 if((ExStyle & WS_EX_LEFTSCROLLBAR) != 0)
2119 else
2121 if (RECTL_bPointInRect( &rcClient, pt.x, pt.y )) return HTVSCROLL;
2122 }
2123
2124 /* Check horizontal scroll bar */
2125
2126 if (Style & WS_HSCROLL)
2127 {
2129 if (RECTL_bPointInRect( &rcClient, pt.x, pt.y ))
2130 {
2131 /* Check size box */
2132 if ((Style & WS_VSCROLL) &&
2133 ((((ExStyle & WS_EX_LEFTSCROLLBAR) != 0) && (pt.x <= rcClient.left + UserGetSystemMetrics(SM_CXVSCROLL))) ||
2134 (((ExStyle & WS_EX_LEFTSCROLLBAR) == 0) && (pt.x >= rcClient.right - UserGetSystemMetrics(SM_CXVSCROLL)))))
2135 return HTSIZE;
2136 return HTHSCROLL;
2137 }
2138 }
2139
2140 /* Has to return HTNOWHERE if nothing was found
2141 Could happen when a window has a customized non client area */
2142 return HTNOWHERE;
2143}
#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:699
RECT rcClient
Definition: ntuser.h:712
RECT rcWindow
Definition: ntuser.h:711
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:222
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:208
PCURICON_OBJECT FASTCALL NC_IconForWindow(PWND pWnd)
Definition: nonclient.c:703
#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:2482
#define HTCLOSE
Definition: winuser.h:2489
#define SM_CYEDGE
Definition: winuser.h:1003
#define SM_CYSCREEN
Definition: winuser.h:954
#define HTCAPTION
Definition: winuser.h:2466
#define SM_CXEDGE
Definition: winuser.h:1002
#define HTTOPLEFT
Definition: winuser.h:2481
#define SM_CYSIZE
Definition: winuser.h:986
#define SM_CXVSCROLL
Definition: winuser.h:955
#define HTBOTTOM
Definition: winuser.h:2483
#define HTBORDER
Definition: winuser.h:2487
#define SM_CXFRAME
Definition: winuser.h:988
#define HTVSCROLL
Definition: winuser.h:2472
#define HTHSCROLL
Definition: winuser.h:2471
#define HTMAXBUTTON
Definition: winuser.h:2474
#define SM_CXSIZE
Definition: winuser.h:985
#define SM_CYFRAME
Definition: winuser.h:990
#define SM_CYHSCROLL
Definition: winuser.h:956
#define HTMENU
Definition: winuser.h:2470
#define SM_CYBORDER
Definition: winuser.h:959
#define SM_CXBORDER
Definition: winuser.h:958
#define HTRIGHT
Definition: winuser.h:2479
#define HTCLIENT
Definition: winuser.h:2465
#define HTBOTTOMRIGHT
Definition: winuser.h:2485
#define HTNOWHERE
Definition: winuser.h:2464
#define SM_CXDLGFRAME
Definition: winuser.h:960
#define HTSIZE
Definition: winuser.h:2469
#define HTBOTTOMLEFT
Definition: winuser.h:2484
#define HTTOP
Definition: winuser.h:2480
#define SM_CYSMCAPTION
Definition: winuser.h:1008
#define SM_CYDLGFRAME
Definition: winuser.h:962
#define WS_EX_LEFTSCROLLBAR
Definition: winuser.h:392
#define SM_CXSCREEN
Definition: winuser.h:953
#define HTMINBUTTON
Definition: winuser.h:2473
#define HTSYSMENU
Definition: winuser.h:2467
#define HTLEFT
Definition: winuser.h:2477
#define SM_CYCAPTION
Definition: winuser.h:957

Referenced by DefWndStartSizeMove(), IntDefWindowProc(), MENU_PtMenu(), 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 1410 of file window.c.

1411{
1412 PWINDOWLIST pwl;
1413 DWORD cbWL;
1414
1415 if (gpwlCache)
1416 {
1417 pwl = gpwlCache;
1418 gpwlCache = NULL;
1419 }
1420 else
1421 {
1422#define INITIAL_COUNT 32
1423 cbWL = sizeof(WINDOWLIST) + (INITIAL_COUNT - 1) * sizeof(HWND);
1425 if (!pwl)
1426 return NULL;
1427
1428 pwl->phwndEnd = &pwl->ahwnd[INITIAL_COUNT];
1429#undef INITIAL_COUNT
1430 }
1431
1432 pwl->pti = pti;
1433 pwl->phwndLast = pwl->ahwnd;
1434 pwl = IntPopulateHwndList(pwl, pwnd, dwFlags);
1435 if (WL_IS_BAD(pwl))
1436 {
1438 return NULL;
1439 }
1440
1441 *(pwl->phwndLast) = HWND_TERMINATOR;
1442
1443 if (dwFlags & 0x8)
1444 {
1445 // TODO:
1446 }
1447
1448 pwl->pti = GetW32ThreadInfo();
1449 pwl->pNextList = gpwlList;
1450 gpwlList = pwl;
1451
1452 return pwl;
1453}
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:1380
#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:690
DWORD state2
Definition: ntuser.h:697
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 1787 of file window.c.

1795{
1796 PWND pWnd = NULL;
1797 HWND hWnd;
1798 PTHREADINFO pti;
1799 BOOL MenuChanged;
1800 BOOL bUnicodeWindow;
1801 PCALLPROCDATA pcpd;
1802
1803 pti = pdeskCreated ? gptiDesktopThread : GetW32ThreadInfo();
1804
1805 if (!(Cs->dwExStyle & WS_EX_LAYOUTRTL))
1806 { // Need both here for wine win.c test_CreateWindow.
1807 //if (Cs->hwndParent && ParentWindow)
1808 if (ParentWindow) // It breaks more tests..... WIP.
1809 {
1810 if ( (Cs->style & (WS_CHILD|WS_POPUP)) == WS_CHILD &&
1811 ParentWindow->ExStyle & WS_EX_LAYOUTRTL &&
1812 !(ParentWindow->ExStyle & WS_EX_NOINHERITLAYOUT) )
1814 }
1815 else
1816 { /*
1817 * Note from MSDN <http://msdn.microsoft.com/en-us/library/aa913269.aspx>:
1818 *
1819 * Dialog boxes and message boxes do not inherit layout, so you must
1820 * set the layout explicitly.
1821 */
1822 if ( Class->fnid != FNID_DIALOG )
1823 {
1824 if (pti->ppi->dwLayout & LAYOUT_RTL)
1825 {
1827 }
1828 }
1829 }
1830 }
1831
1832 /* Automatically add WS_EX_WINDOWEDGE */
1833 if ((Cs->dwExStyle & WS_EX_DLGMODALFRAME) ||
1834 ((!(Cs->dwExStyle & WS_EX_STATICEDGE)) &&
1835 (Cs->style & (WS_DLGFRAME | WS_THICKFRAME))))
1837 else
1838 Cs->dwExStyle &= ~WS_EX_WINDOWEDGE;
1839
1840 /* Is it a unicode window? */
1841 bUnicodeWindow =!(Cs->dwExStyle & WS_EX_SETANSICREATOR);
1842 Cs->dwExStyle &= ~WS_EX_SETANSICREATOR;
1843
1844 /* Allocate the new window */
1846 pdeskCreated ? pdeskCreated : pti->rpdesk,
1847 pti,
1848 (PHANDLE)&hWnd,
1850 sizeof(WND) + Class->cbwndExtra);
1851
1852 if (!pWnd)
1853 {
1854 goto AllocError;
1855 }
1856
1857 TRACE("Created window object with handle %p\n", hWnd);
1858
1859 if (pdeskCreated && pdeskCreated->DesktopWindow == NULL )
1860 { /* HACK: Helper for win32csr/desktopbg.c */
1861 /* If there is no desktop window yet, we must be creating it */
1862 TRACE("CreateWindow setting desktop.\n");
1863 pdeskCreated->DesktopWindow = hWnd;
1864 pdeskCreated->pDeskInfo->spwnd = pWnd;
1865 }
1866
1867 /*
1868 * Fill out the structure describing it.
1869 */
1870 /* Remember, pWnd->head is setup in object.c ... */
1871 pWnd->spwndParent = ParentWindow;
1872 WndSetOwner(pWnd, OwnerWindow);
1873 pWnd->fnid = 0;
1874 pWnd->spwndLastActive = pWnd;
1875 // Ramp up compatible version sets.
1876 if ( dwVer >= WINVER_WIN31 )
1877 {
1878 pWnd->state2 |= WNDS2_WIN31COMPAT;
1879 if ( dwVer >= WINVER_WINNT4 )
1880 {
1881 pWnd->state2 |= WNDS2_WIN40COMPAT;
1882 if ( dwVer >= WINVER_WIN2K )
1883 {
1884 pWnd->state2 |= WNDS2_WIN50COMPAT;
1885 }
1886 }
1887 }
1888 pWnd->pcls = Class;
1889 pWnd->hModule = Cs->hInstance;
1890 pWnd->style = Cs->style & ~WS_VISIBLE;
1891 pWnd->ExStyle = Cs->dwExStyle;
1892 pWnd->cbwndExtra = pWnd->pcls->cbwndExtra;
1893 pWnd->pActCtx = acbiBuffer;
1894
1895 if (pti->spDefaultImc && Class->atomClassName != gpsi->atomSysClass[ICLS_BUTTON])
1896 pWnd->hImc = UserHMGetHandle(pti->spDefaultImc);
1897
1898 pWnd->InternalPos.MaxPos.x = pWnd->InternalPos.MaxPos.y = -1;
1899 pWnd->InternalPos.IconPos.x = pWnd->InternalPos.IconPos.y = -1;
1900
1901 if (pWnd->spwndParent != NULL && Cs->hwndParent != 0)
1902 {
1903 pWnd->HideFocus = pWnd->spwndParent->HideFocus;
1904 pWnd->HideAccel = pWnd->spwndParent->HideAccel;
1905 }
1906
1907 pWnd->head.pti->cWindows++;
1908
1909 if (Class->spicn && !Class->spicnSm)
1910 {
1911 HICON IconSmHandle = NULL;
1912 if((Class->spicn->CURSORF_flags & (CURSORF_LRSHARED | CURSORF_FROMRESOURCE))
1914 {
1915 IconSmHandle = co_IntCopyImage(
1916 UserHMGetHandle(Class->spicn),
1917 IMAGE_ICON,
1921 }
1922 if (!IconSmHandle)
1923 {
1924 /* Retry without copying from resource */
1925 IconSmHandle = co_IntCopyImage(
1926 UserHMGetHandle(Class->spicn),
1927 IMAGE_ICON,
1930 0);
1931 }
1932
1933 if (IconSmHandle)
1934 {
1935 Class->spicnSm = UserGetCurIconObject(IconSmHandle);
1936 Class->CSF_flags |= CSF_CACHEDSMICON;
1937 }
1938 }
1939
1940 if (pWnd->pcls->CSF_flags & CSF_SERVERSIDEPROC)
1942
1943 /* BugBoy Comments: Comment below say that System classes are always created
1944 as UNICODE. In windows, creating a window with the ANSI version of CreateWindow
1945 sets the window to ansi as verified by testing with IsUnicodeWindow API.
1946
1947 No where can I see in code or through testing does the window change back
1948 to ANSI after being created as UNICODE in ROS. I didnt do more testing to
1949 see what problems this would cause. */
1950
1951 // Set WndProc from Class.
1952 if (IsCallProcHandle(pWnd->pcls->lpfnWndProc))
1953 {
1955 if (pcpd)
1956 pWnd->lpfnWndProc = pcpd->pfnClientPrevious;
1957 }
1958 else
1959 {
1960 pWnd->lpfnWndProc = pWnd->pcls->lpfnWndProc;
1961 }
1962
1963 // GetWindowProc, test for non server side default classes and set WndProc.
1964 if ( pWnd->pcls->fnid <= FNID_GHOST && pWnd->pcls->fnid >= FNID_BUTTON )
1965 {
1966 if (bUnicodeWindow)
1967 {
1968 if (GETPFNCLIENTA(pWnd->pcls->fnid) == pWnd->lpfnWndProc)
1969 pWnd->lpfnWndProc = GETPFNCLIENTW(pWnd->pcls->fnid);
1970 }
1971 else
1972 {
1973 if (GETPFNCLIENTW(pWnd->pcls->fnid) == pWnd->lpfnWndProc)
1974 pWnd->lpfnWndProc = GETPFNCLIENTA(pWnd->pcls->fnid);
1975 }
1976 }
1977
1978 // If not an Unicode caller, set Ansi creator bit.
1979 if (!bUnicodeWindow) pWnd->state |= WNDS_ANSICREATOR;
1980
1981 // Clone Class Ansi/Unicode proc type.
1982 if (pWnd->pcls->CSF_flags & CSF_ANSIPROC)
1983 {
1984 pWnd->state |= WNDS_ANSIWINDOWPROC;
1985 pWnd->Unicode = FALSE;
1986 }
1987 else
1988 { /*
1989 * It seems there can be both an Ansi creator and Unicode Class Window
1990 * WndProc, unless the following overriding conditions occur:
1991 */
1992 if ( !bUnicodeWindow &&
1993 ( Class->atomClassName == gpsi->atomSysClass[ICLS_BUTTON] ||
1994 Class->atomClassName == gpsi->atomSysClass[ICLS_COMBOBOX] ||
1995 Class->atomClassName == gpsi->atomSysClass[ICLS_COMBOLBOX] ||
1996 Class->atomClassName == gpsi->atomSysClass[ICLS_DIALOG] ||
1997 Class->atomClassName == gpsi->atomSysClass[ICLS_EDIT] ||
1998 Class->atomClassName == gpsi->atomSysClass[ICLS_IME] ||
1999 Class->atomClassName == gpsi->atomSysClass[ICLS_LISTBOX] ||
2000 Class->atomClassName == gpsi->atomSysClass[ICLS_MDICLIENT] ||
2001 Class->atomClassName == gpsi->atomSysClass[ICLS_STATIC] ) )
2002 { // Override Class and set the window Ansi WndProc.
2003 pWnd->state |= WNDS_ANSIWINDOWPROC;
2004 pWnd->Unicode = FALSE;
2005 }
2006 else
2007 { // Set the window Unicode WndProc.
2008 pWnd->state &= ~WNDS_ANSIWINDOWPROC;
2009 pWnd->Unicode = TRUE;
2010 }
2011 }
2012
2013 /* BugBoy Comments: if the window being created is a edit control, ATOM 0xCxxx,
2014 then my testing shows that windows (2k and XP) creates a CallProc for it immediately
2015 Dont understand why it does this. */
2016 if (Class->atomClassName == gpsi->atomSysClass[ICLS_EDIT])
2017 {
2018 PCALLPROCDATA CallProc;
2019 CallProc = CreateCallProc(pWnd->head.rpdesk, pWnd->lpfnWndProc, pWnd->Unicode , pWnd->head.pti->ppi);
2020
2021 if (!CallProc)
2022 {
2024 ERR("Warning: Unable to create CallProc for edit control. Control may not operate correctly! hwnd %p\n", hWnd);
2025 }
2026 else
2027 {
2028 UserAddCallProcToClass(pWnd->pcls, CallProc);
2029 }
2030 }
2031
2033 pWnd->PropListItems = 0;
2034
2035 if ( WindowName->Buffer != NULL && WindowName->Length > 0 )
2036 {
2038 WindowName->Length + sizeof(UNICODE_NULL));
2039 if (pWnd->strName.Buffer == NULL)
2040 {
2041 goto AllocError;
2042 }
2043
2044 RtlCopyMemory(pWnd->strName.Buffer, WindowName->Buffer, WindowName->Length);
2045 pWnd->strName.Buffer[WindowName->Length / sizeof(WCHAR)] = L'\0';
2046 pWnd->strName.Length = WindowName->Length;
2047 pWnd->strName.MaximumLength = WindowName->Length + sizeof(UNICODE_NULL);
2048 }
2049
2050 /* Correct the window style. */
2051 if ((pWnd->style & (WS_CHILD | WS_POPUP)) != WS_CHILD)
2052 {
2053 pWnd->style |= WS_CLIPSIBLINGS;
2054 if (!(pWnd->style & WS_POPUP))
2055 {
2056 pWnd->style |= WS_CAPTION;
2057 }
2058 }
2059
2060 /* WS_EX_WINDOWEDGE depends on some other styles */
2061 if (pWnd->ExStyle & WS_EX_DLGMODALFRAME)
2062 pWnd->ExStyle |= WS_EX_WINDOWEDGE;
2063 else if (pWnd->style & (WS_DLGFRAME | WS_THICKFRAME))
2064 {
2065 if (!((pWnd->ExStyle & WS_EX_STATICEDGE) &&
2066 (pWnd->style & (WS_CHILD | WS_POPUP))))
2067 pWnd->ExStyle |= WS_EX_WINDOWEDGE;
2068 }
2069 else
2070 pWnd->ExStyle &= ~WS_EX_WINDOWEDGE;
2071
2072 if (!(pWnd->style & (WS_CHILD | WS_POPUP)))
2074
2075 /* Set the window menu */
2076 if ((Cs->style & (WS_CHILD | WS_POPUP)) != WS_CHILD)
2077 {
2078 if (Cs->hMenu)
2079 {
2080 IntSetMenu(pWnd, Cs->hMenu, &MenuChanged);
2081 }
2082 else if (pWnd->pcls->lpszMenuName) // Take it from the parent.
2083 {
2084 UNICODE_STRING MenuName;
2085 HMENU hMenu;
2086
2087 if (IS_INTRESOURCE(pWnd->pcls->lpszMenuName))
2088 {
2089 MenuName.Length = 0;
2090 MenuName.MaximumLength = 0;
2091 MenuName.Buffer = pWnd->pcls->lpszMenuName;
2092 }
2093 else
2094 {
2095 RtlInitUnicodeString( &MenuName, pWnd->pcls->lpszMenuName);
2096 }
2097 hMenu = co_IntCallLoadMenu( pWnd->pcls->hModule, &MenuName);
2098 if (hMenu) IntSetMenu(pWnd, hMenu, &MenuChanged);
2099 }
2100 }
2101 else // Not a child
2102 pWnd->IDMenu = (UINT_PTR)Cs->hMenu;
2103
2104
2105 if ( ParentWindow &&
2106 ParentWindow != ParentWindow->head.rpdesk->spwndMessage &&
2107 ParentWindow != ParentWindow->head.rpdesk->pDeskInfo->spwnd )
2108 {
2109 PWND Owner = IntGetNonChildAncestor(ParentWindow);
2110
2111 if (!IntValidateOwnerDepth(pWnd, Owner))
2112 {
2114 goto Error;
2115 }
2116 if ( pWnd->spwndOwner &&
2117 pWnd->spwndOwner->ExStyle & WS_EX_TOPMOST )
2118 {
2119 pWnd->ExStyle |= WS_EX_TOPMOST;
2120 }
2121 if ( pWnd->spwndOwner &&
2122 Class->atomClassName != gpsi->atomSysClass[ICLS_IME] &&
2123 pti != pWnd->spwndOwner->head.pti)
2124 {
2125 //ERR("CreateWindow Owner in.\n");
2126 UserAttachThreadInput(pti, pWnd->spwndOwner->head.pti, TRUE);
2127 }
2128 }
2129
2130 /* Insert the window into the thread's window list. */
2132
2133 /* Handle "CS_CLASSDC", it is tested first. */
2134 if ( (pWnd->pcls->style & CS_CLASSDC) && !(pWnd->pcls->pdce) )
2135 { /* One DCE per class to have CLASS. */
2136 pWnd->pcls->pdce = DceAllocDCE( pWnd, DCE_CLASS_DC );
2137 }
2138 else if ( pWnd->pcls->style & CS_OWNDC)
2139 { /* Allocate a DCE for this window. */
2141 }
2142
2143 return pWnd;
2144
2145AllocError:
2146 ERR("IntCreateWindow Allocation Error.\n");
2148Error:
2149 if(pWnd)
2151 return NULL;
2152}
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:925
#define ICLS_LISTBOX
Definition: ntuser.h:910
#define WNDS2_WIN40COMPAT
Definition: ntuser.h:645
#define ICLS_EDIT
Definition: ntuser.h:908
#define CURSORF_LRSHARED
Definition: ntuser.h:1196
#define ICLS_COMBOBOX
Definition: ntuser.h:912
#define ICLS_STATIC
Definition: ntuser.h:909
#define GETPFNCLIENTW(fnid)
Definition: ntuser.h:901
#define GETPFNCLIENTA(fnid)
Definition: ntuser.h:899
#define CSF_ANSIPROC
Definition: ntuser.h:552
#define WNDS_SERVERSIDEWINDOWPROC
Definition: ntuser.h:618
#define FNID_BUTTON
Definition: ntuser.h:861
#define CSF_CACHEDSMICON
Definition: ntuser.h:557
struct _WND * PWND
#define FNID_DIALOG
Definition: ntuser.h:864
#define ICLS_COMBOLBOX
Definition: ntuser.h:914
#define ICLS_BUTTON
Definition: ntuser.h:907
struct _WND WND
@ TYPE_CALLPROC
Definition: ntuser.h:47
#define CURSORF_FROMRESOURCE
Definition: ntuser.h:1194
#define CSF_SERVERSIDEPROC
Definition: ntuser.h:551
#define WNDS_ANSICREATOR
Definition: ntuser.h:629
#define FNID_GHOST
Definition: ntuser.h:870
#define ICLS_MDICLIENT
Definition: ntuser.h:913
#define WNDS2_WIN50COMPAT
Definition: ntuser.h:646
#define WNDS_ANSIWINDOWPROC
Definition: ntuser.h:619
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:547
PWSTR lpszMenuName
Definition: ntuser.h:583
WNDPROC lpfnWndProc
Definition: ntuser.h:576
INT cbwndExtra
Definition: ntuser.h:578
DWORD CSF_flags
Definition: ntuser.h:568
UINT style
Definition: ntuser.h:575
HINSTANCE hModule
Definition: ntuser.h:579
DWORD fnid
Definition: ntuser.h:565
PVOID pdce
Definition: ntuser.h:567
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:759
PCLS pcls
Definition: ntuser.h:715
struct _WND::@4899 InternalPos
struct _WND * spwndOwner
Definition: ntuser.h:710
UINT Unicode
Definition: ntuser.h:751
struct _WND * spwndLastActive
Definition: ntuser.h:734
ULONG PropListItems
Definition: ntuser.h:719
PVOID pActCtx
Definition: ntuser.h:737
DWORD fnid
Definition: ntuser.h:704
UINT HideFocus
Definition: ntuser.h:753
UINT HideAccel
Definition: ntuser.h:754
LIST_ENTRY PropListHead
Definition: ntuser.h:718
HIMC hImc
Definition: ntuser.h:735
LARGE_UNICODE_STRING strName
Definition: ntuser.h:731
DWORD state
Definition: ntuser.h:696
UINT_PTR IDMenu
Definition: ntuser.h:726
WNDPROC lpfnWndProc
Definition: ntuser.h:713
HINSTANCE hModule
Definition: ntuser.h:703
ULONG cbwndExtra
Definition: ntuser.h:733
#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(NTSTATUS Status)
Definition: error.c:37
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:423
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:5459
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:1093
#define SM_CYSMICON
Definition: winuser.h:1007
#define SM_CXSMICON
Definition: winuser.h:1006
#define WS_EX_WINDOWEDGE
Definition: winuser.h:407
#define CS_OWNDC
Definition: winuser.h:650
#define CS_CLASSDC
Definition: winuser.h:645
#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 536 of file defwnd.c.

542{
544 LRESULT lResult = 0;
546
547 if (Msg > WM_USER) return 0;
548
549 switch (Msg)
550 {
551 case WM_DEVICECHANGE:
552 return TRUE;
553
554 case WM_GETTEXTLENGTH:
555 {
556 PWSTR buf;
557 ULONG len;
558
559 if (Wnd != NULL && Wnd->strName.Length != 0)
560 {
561 buf = Wnd->strName.Buffer;
562 if (buf != NULL &&
564 buf,
565 Wnd->strName.Length)))
566 {
567 lResult = (LRESULT) (Wnd->strName.Length / sizeof(WCHAR));
568 }
569 }
570 else lResult = 0L;
571
572 break;
573 }
574
575 case WM_GETTEXT: // FIXME: Handle Ansi
576 {
577 PWSTR buf = NULL;
578 PWSTR outbuf = (PWSTR)lParam;
579
580 if (Wnd != NULL && wParam != 0)
581 {
582 if (Wnd->strName.Buffer != NULL)
583 buf = Wnd->strName.Buffer;
584 else
585 outbuf[0] = L'\0';
586
587 if (buf != NULL)
588 {
589 if (Wnd->strName.Length != 0)
590 {
591 lResult = min(Wnd->strName.Length / sizeof(WCHAR), wParam - 1);
592 RtlCopyMemory(outbuf,
593 buf,
594 lResult * sizeof(WCHAR));
595 outbuf[lResult] = L'\0';
596 }
597 else
598 outbuf[0] = L'\0';
599 }
600 }
601 break;
602 }
603
604 case WM_SETTEXT: // FIXME: Handle Ansi
605 {
606 DefSetText(Wnd, (PCWSTR)lParam);
607
608 if ((Wnd->style & WS_CAPTION) == WS_CAPTION)
610 IntNotifyWinEvent(EVENT_OBJECT_NAMECHANGE, Wnd, OBJID_WINDOW, CHILDID_SELF, 0);
611 lResult = 1;
612 break;
613 }
614
615 case WM_SYSCOMMAND:
616 {
617 TRACE("hwnd %p WM_SYSCOMMAND %lx %lx\n", Wnd->head.h, wParam, lParam );
618 lResult = DefWndHandleSysCommand(Wnd, wParam, lParam);
619 break;
620 }
621
622 case WM_SHOWWINDOW:
623 {
624 if ((Wnd->style & WS_VISIBLE) && wParam) break;
625 if (!(Wnd->style & WS_VISIBLE) && !wParam) break;
626 if (!Wnd->spwndOwner) break;
627 if (LOWORD(lParam))
628 {
630 }
631 break;
632 }
633
635 return IntClientShutdown(Wnd, wParam, lParam);
636
637 case WM_APPCOMMAND:
638 if ( (Wnd->style & (WS_POPUP|WS_CHILD)) != WS_CHILD &&
639 Wnd != co_GetDesktopWindow(Wnd) )
640 {
641 if (!co_HOOK_CallHooks(WH_SHELL, HSHELL_APPCOMMAND, wParam, lParam))
642 co_IntShellHookNotify(HSHELL_APPCOMMAND, wParam, lParam);
643 break;
644 }
645 UserRefObjectCo(Wnd->spwndParent, &Ref);
646 lResult = co_IntSendMessage(UserHMGetHandle(Wnd->spwndParent), WM_APPCOMMAND, wParam, lParam);
647 UserDerefObjectCo(Wnd->spwndParent);
648 break;
649
650 case WM_KEYF1:
651 {
652 HELPINFO hi;
653 HMENU hMenu = UlongToHandle(Wnd->IDMenu);
654 PWND pwndActive = MENU_IsMenuActive();
655 hi.cbSize = sizeof(HELPINFO);
656 hi.MousePos = gpsi->ptCursor;
658 hi.hItemHandle = pwndActive ? UserHMGetHandle(pwndActive) : UserHMGetHandle(Wnd);
659 hi.iCtrlId = (Wnd->style & (WS_POPUP|WS_CHILD)) == WS_CHILD ? IntMenuItemFromPoint(Wnd, hMenu, hi.MousePos) : 0;
661
662 co_IntSendMessage( UserHMGetHandle(Wnd), WM_HELP, 0, (LPARAM)&hi );
663 break;
664 }
665
666 case WM_SETICON:
667 {
668 return DefWndSetIcon(Wnd, wParam, lParam);
669 }
670
671 case WM_GETICON:
672 {
673 return DefWndGetIcon(Wnd, wParam, lParam);
674 }
675
676 case WM_HELP:
677 {
678 PWND Parent = IntGetParent(Wnd);
680 break;
681 }
682
683 case WM_LBUTTONDOWN:
684 case WM_RBUTTONDOWN:
685 case WM_MBUTTONDOWN:
687 break;
688
689 case WM_NCLBUTTONDOWN:
691
692 case WM_NCRBUTTONDOWN:
694
695 case WM_LBUTTONDBLCLK:
697
700
701 case WM_RBUTTONUP:
702 {
703 POINT Pt;
704
705 Pt.x = GET_X_LPARAM(lParam);
706 Pt.y = GET_Y_LPARAM(lParam);
707 IntClientToScreen(Wnd, &Pt);
708 lParam = MAKELPARAM(Pt.x, Pt.y);
710 break;
711 }
712
713 case WM_NCRBUTTONUP:
714 /*
715 * FIXME : we must NOT send WM_CONTEXTMENU on a WM_NCRBUTTONUP (checked
716 * in Windows), but what _should_ we do? According to MSDN :
717 * "If it is appropriate to do so, the system sends the WM_SYSCOMMAND
718 * message to the window". When is it appropriate?
719 */
720 ERR("WM_NCRBUTTONUP\n");
721 break;
722
723 case WM_XBUTTONUP:
724 case WM_NCXBUTTONUP:
725 if (HIWORD(wParam) == XBUTTON1 || HIWORD(wParam) == XBUTTON2)
726 {
728 MAKELPARAM(LOWORD(wParam), FAPPCOMMAND_MOUSE | HIWORD(wParam)));
729 }
730 break;
731
732
733 case WM_CONTEXTMENU:
734 {
735 if (Wnd->style & WS_CHILD)
736 {
738 }
739 else
740 {
741 POINT Pt;
743 LONG HitCode;
744
745 Style = Wnd->style;
746
747 Pt.x = GET_X_LPARAM(lParam);
748 Pt.y = GET_Y_LPARAM(lParam);
749 if (Style & WS_CHILD)
750 {
752 }
753
754 HitCode = GetNCHitEx(Wnd, Pt);
755
756 if (HitCode == HTCAPTION || HitCode == HTSYSMENU)
757 {
758 PMENU SystemMenu;
759 UINT Flags;
760
761 if((SystemMenu = IntGetSystemMenu(Wnd, FALSE)))
762 {
763 MENU_InitSysMenuPopup(SystemMenu, Wnd->style, Wnd->pcls->style, HitCode);
764
765 if(HitCode == HTCAPTION)
767 else
769
770 IntTrackPopupMenuEx(SystemMenu, Flags|TPM_SYSTEM_MENU, Pt.x, Pt.y, Wnd, NULL);
771 }
772 }
773 if (HitCode == HTHSCROLL || HitCode == HTVSCROLL)
774 {
775 WARN("Scroll Menu Not Supported\n");
776 }
777 }
778 break;
779 }
780
781 case WM_KEYDOWN:
782 if (wParam == VK_F10)
783 {
784 pti->MessageQueue->QF_flags |= QF_FF10STATUS;
785
786 if (UserGetKeyState(VK_SHIFT) & 0x8000)
787 {
789 }
790 }
792 {
793 BOOL IsTaskBar;
794 DWORD StyleTB;
795 DWORD ExStyleTB;
796 HWND hwndTop = UserGetForegroundWindow();
797 PWND topWnd = UserGetWindowObject(hwndTop);
798
799 // MS Doc: foreground window can be NULL, e.g. when window is losing activation
800 if (!topWnd)
801 return 0;
802
803 // We want to forbid snapping operations on the TaskBar
804 // We use a heuristic for detecting the TaskBar Wnd by its typical Style & ExStyle Values
805 ExStyleTB = (topWnd->ExStyle & WS_EX_TOOLWINDOW);
806 StyleTB = (topWnd->style & (WS_POPUP | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN));
807 IsTaskBar = (StyleTB == (WS_POPUP | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN))
808 && (ExStyleTB == WS_EX_TOOLWINDOW);
809 TRACE("ExStyle=%x Style=%x IsTaskBar=%d\n", ExStyleTB, StyleTB, IsTaskBar);
810
811 if (!IsTaskBar)
812 {
813 if ((topWnd->style & WS_THICKFRAME) == 0)
814 return 0;
815
816 if (wParam == VK_DOWN)
817 {
818 if (topWnd->style & WS_MAXIMIZE)
819 {
821
822 /* "Normal size" must be erased after restoring, otherwise it will block next side snap actions */
823 RECTL_vSetEmptyRect(&topWnd->InternalPos.NormalRect);
824 }
825 else
826 {
828 }
829 }
830 else if (wParam == VK_UP)
831 {
832 RECT currentRect;
833 if ((topWnd->InternalPos.NormalRect.right == topWnd->InternalPos.NormalRect.left) ||
834 (topWnd->InternalPos.NormalRect.top == topWnd->InternalPos.NormalRect.bottom))
835 {
836 currentRect = topWnd->rcWindow;
837 }
838 else
839 {
840 currentRect = topWnd->InternalPos.NormalRect;
841 }
843
844 // save normal rect if maximazing snapped window
845 topWnd->InternalPos.NormalRect = currentRect;
846 }
847 else if (wParam == VK_LEFT || wParam == VK_RIGHT)
848 {
849 RECT snapRect, normalRect, windowRect;
850 BOOL snapped;
851 normalRect = topWnd->InternalPos.NormalRect;
852 snapped = (normalRect.left != 0 && normalRect.right != 0 &&
853 normalRect.top != 0 && normalRect.bottom != 0);
854
855 if (topWnd->style & WS_MAXIMIZE)
856 {
858 snapped = FALSE;
859 }
860 windowRect = topWnd->rcWindow;
861
862 UserSystemParametersInfo(SPI_GETWORKAREA, 0, &snapRect, 0);
863 if (wParam == VK_LEFT)
864 {
865 snapRect.right = (snapRect.left + snapRect.right) / 2;
866 }
867 else // VK_RIGHT
868 {
869 snapRect.left = (snapRect.left + snapRect.right) / 2;
870 }
871
872 if (snapped)
873 {
874 // if window was snapped but moved to other location - restore normal size
875 if (!IntEqualRect(&snapRect, &windowRect))
876 {
877 RECT empty = {0, 0, 0, 0};
879 0,
880 normalRect.left,
881 normalRect.top,
882 normalRect.right - normalRect.left,
883 normalRect.bottom - normalRect.top,
884 0);
885 topWnd->InternalPos.NormalRect = empty;
886 }
887 }
888 else
889 {
891 0,
892 snapRect.left,
893 snapRect.top,
894 snapRect.right - snapRect.left,
895 snapRect.bottom - snapRect.top,
896 0);
897 topWnd->InternalPos.NormalRect = windowRect;
898 }
899 }
900 }
901 }
902 break;
903
904 case WM_SYSKEYDOWN:
905 {
906 if (HIWORD(lParam) & KF_ALTDOWN)
907 { /* Previous state, if the key was down before this message,
908 this is a cheap way to ignore autorepeat keys. */
909 if ( !(HIWORD(lParam) & KF_REPEAT) )
910 {
911 if ( ( wParam == VK_MENU ||
912 wParam == VK_LMENU ||
913 wParam == VK_RMENU ) && !(pti->MessageQueue->QF_flags & QF_FMENUSTATUS)) //iMenuSysKey )
914 pti->MessageQueue->QF_flags |= QF_FMENUSTATUS; //iMenuSysKey = 1;
915 else
916 pti->MessageQueue->QF_flags &= ~QF_FMENUSTATUS; //iMenuSysKey = 0;
917 }
918
919 pti->MessageQueue->QF_flags &= ~QF_FF10STATUS; //iF10Key = 0;
920
921 if (wParam == VK_F4) /* Try to close the window */
922 {
924 if (!(top->style & CS_NOCLOSE))
926 }
927 else if (wParam == VK_SNAPSHOT) // Alt-VK_SNAPSHOT?
928 {
929 PWND pwnd = Wnd;
930 while (IntGetParent(pwnd) != NULL)
931 {
932 pwnd = IntGetParent(pwnd);
933 }
934 ERR("DefWndScreenshot\n");
935 DefWndScreenshot(pwnd);
936 }
937 else if ( wParam == VK_ESCAPE || wParam == VK_TAB ) // Alt-Tab/ESC Alt-Shift-Tab/ESC
938 {
939 WPARAM wParamTmp;
940 HWND Active = UserGetActiveWindow(); // Noticed MDI problem.
941 if (!Active)
942 {
943 FIXME("WM_SYSKEYDOWN VK_ESCAPE no active\n");
944 break;
945 }
946 wParamTmp = UserGetKeyState(VK_SHIFT) & 0x8000 ? SC_PREVWINDOW : SC_NEXTWINDOW;
948 }
949 else if (wParam == VK_SHIFT) // Alt+Shift
950 {
951 RTL_ATOM ClassAtom = 0;
952 UNICODE_STRING ustrClass, ustrWindow;
953 HWND hwndSwitch;
954
955 RtlInitUnicodeString(&ustrClass, L"kbswitcher");
956 RtlInitUnicodeString(&ustrWindow, L"");
957
958 IntGetAtomFromStringOrAtom(&ustrClass, &ClassAtom);
959
960 hwndSwitch = IntFindWindow(UserGetDesktopWindow(), NULL, ClassAtom, &ustrWindow);
961 if (hwndSwitch)
962 {
963#define ID_NEXTLAYOUT 10003
965 }
966 }
967 }
968 else if( wParam == VK_F10 )
969 {
970 if (UserGetKeyState(VK_SHIFT) & 0x8000)
972 pti->MessageQueue->QF_flags |= QF_FF10STATUS; //iF10Key = 1;
973 }
974 else if( wParam == VK_ESCAPE && (UserGetKeyState(VK_SHIFT) & 0x8000))
976 break;
977 }
978
979 case WM_KEYUP:
980 case WM_SYSKEYUP:
981 {
982 /* Press and release F10 or ALT */
983 if (((wParam == VK_MENU || wParam == VK_LMENU || wParam == VK_RMENU)
984 && (pti->MessageQueue->QF_flags & (QF_FMENUSTATUS|QF_FMENUSTATUSBREAK)) == QF_FMENUSTATUS /*iMenuSysKey*/) ||
985 ((wParam == VK_F10) && pti->MessageQueue->QF_flags & QF_FF10STATUS /*iF10Key*/))
987 pti->MessageQueue->QF_flags &= ~(QF_FMENUSTATUS|QF_FMENUSTATUSBREAK|QF_FF10STATUS); //iMenuSysKey = iF10Key = 0;
988 break;
989 }
990
991 case WM_SYSCHAR:
992 {
993 pti->MessageQueue->QF_flags &= ~(QF_FMENUSTATUS|QF_FMENUSTATUSBREAK); //iMenuSysKey = 0;
994 if (wParam == VK_RETURN && (Wnd->style & WS_MINIMIZE) != 0)
995 {
997 break;
998 }
999 if ((HIWORD(lParam) & KF_ALTDOWN) && wParam)
1000 {
1001 if (wParam == VK_TAB || wParam == VK_ESCAPE) break;
1002 if (wParam == VK_SPACE && Wnd->style & WS_CHILD)
1004 else
1006 }
1007 else /* check for Ctrl-Esc */
1008 if (wParam != VK_ESCAPE) UserPostMessage(hwndSAS, WM_LOGONNOTIFY, LN_MESSAGE_BEEP, 0); //MessageBeep(0);
1009 break;
1010 }
1011
1012 case WM_CANCELMODE:
1013 {
1014 pti->MessageQueue->QF_flags &= ~(QF_FMENUSTATUS|QF_FMENUSTATUSBREAK);
1015
1016 MENU_EndMenu( Wnd );
1018 {
1020 }
1021 break;
1022 }
1023
1024 case WM_CLOSE:
1026 break;
1027
1028 case WM_CTLCOLORMSGBOX:
1029 case WM_CTLCOLOREDIT:
1030 case WM_CTLCOLORLISTBOX:
1031 case WM_CTLCOLORBTN:
1032 case WM_CTLCOLORDLG:
1033 case WM_CTLCOLORSTATIC:
1036
1037 case WM_CTLCOLOR:
1039
1040 case WM_SETCURSOR:
1041 {
1042 if (Wnd->style & WS_CHILD)
1043 {
1044 /* with the exception of the border around a resizable wnd,
1045 * give the parent first chance to set the cursor */
1047 {
1048 PWND parent = Wnd->spwndParent;//IntGetParent( Wnd );
1049 if (parent != UserGetDesktopWindow() &&
1051 return TRUE;
1052 }
1053 }
1054 return DefWndHandleSetCursor(Wnd, wParam, lParam);
1055 }
1056
1057 case WM_MOUSEACTIVATE:
1058 if (Wnd->style & WS_CHILD)
1059 {
1060 LONG Ret;
1062 PWND pwndParent = IntGetParent(Wnd);
1063 hwndParent = pwndParent ? UserHMGetHandle(pwndParent) : NULL;
1065 if (Ret) return (Ret);
1066 }
1068
1069 case WM_ACTIVATE:
1070 /* The default action in Windows is to set the keyboard focus to
1071 * the window, if it's being activated and not minimized */
1072 if (LOWORD(wParam) != WA_INACTIVE &&
1073 !(Wnd->style & WS_MINIMIZE))
1074 {
1075 //ERR("WM_ACTIVATE %p\n",hWnd);
1076 co_UserSetFocus(Wnd);
1077 }
1078 break;
1079
1080 case WM_MOUSEWHEEL:
1081 if (Wnd->style & WS_CHILD)
1082 {
1084 PWND pwndParent = IntGetParent(Wnd);
1085 hwndParent = pwndParent ? UserHMGetHandle(pwndParent) : NULL;
1087 }
1088 break;
1089
1090 case WM_ERASEBKGND:
1091 case WM_ICONERASEBKGND:
1092 {
1093 RECT Rect;
1094 HBRUSH hBrush = Wnd->pcls->hbrBackground;
1095 if (!hBrush) return 0;
1096 if (hBrush <= (HBRUSH)COLOR_MENUBAR)
1097 {
1098 hBrush = IntGetSysColorBrush(HandleToUlong(hBrush));
1099 }
1100 if (Wnd->pcls->style & CS_PARENTDC)
1101 {
1102 /* can't use GetClipBox with a parent DC or we fill the whole parent */
1103 IntGetClientRect(Wnd, &Rect);
1105 }
1106 else
1107 {
1108 GdiGetClipBox((HDC)wParam, &Rect);
1109 }
1110 FillRect((HDC)wParam, &Rect, hBrush);
1111 return (1);
1112 }
1113
1114 case WM_GETHOTKEY:
1115 //ERR("WM_GETHOTKEY\n");
1116 return DefWndGetHotKey(Wnd);
1117 case WM_SETHOTKEY:
1118 //ERR("WM_SETHOTKEY\n");
1119 return DefWndSetHotKey(Wnd, wParam);
1120
1121 case WM_NCHITTEST:
1122 {
1123 POINT Point;
1126 return GetNCHitEx(Wnd, Point);
1127 }
1128
1129 case WM_PRINT:
1130 {
1131 DefWndPrint(Wnd, (HDC)wParam, lParam);
1132 return (0);
1133 }
1134
1135 case WM_SYSCOLORCHANGE:
1136 {
1137 /* force to redraw non-client area */
1138 UserPaintCaption(Wnd, DC_NC);
1139 /* Use InvalidateRect to redraw client area, enable
1140 * erase to redraw all subcontrols otherwise send the
1141 * WM_SYSCOLORCHANGE to child windows/controls is required
1142 */
1144 return (0);
1145 }
1146
1147 case WM_PAINTICON:
1148 case WM_PAINT:
1149 {
1150 PAINTSTRUCT Ps;
1151 HDC hDC;
1152
1153 /* If already in Paint and Client area is not empty just return. */
1154 if (Wnd->state2 & WNDS2_STARTPAINT && !RECTL_bIsEmptyRect(&Wnd->rcClient))
1155 {
1156 ERR("In Paint and Client area is not empty!\n");
1157 return 0;
1158 }
1159
1160 hDC = IntBeginPaint(Wnd, &Ps);
1161 if (hDC)
1162 {
1163 if (((Wnd->style & WS_MINIMIZE) != 0) && (Wnd->pcls->spicn))
1164 {
1165 RECT ClientRect;
1166 INT x, y;
1167
1168 ERR("Doing Paint and Client area is empty!\n");
1169 IntGetClientRect(Wnd, &ClientRect);
1170 x = (ClientRect.right - ClientRect.left - UserGetSystemMetrics(SM_CXICON)) / 2;
1171 y = (ClientRect.bottom - ClientRect.top - UserGetSystemMetrics(SM_CYICON)) / 2;
1172 UserReferenceObject(Wnd->pcls->spicn);
1173 UserDrawIconEx(hDC, x, y, Wnd->pcls->spicn, 0, 0, 0, 0, DI_NORMAL | DI_COMPAT | DI_DEFAULTSIZE);
1174 UserDereferenceObject(Wnd->pcls->spicn);
1175 }
1176
1177 IntEndPaint(Wnd, &Ps);
1178 }
1179 return (0);
1180 }
1181
1182 case WM_SYNCPAINT:
1183 {
1184 HRGN hRgn;
1185 Wnd->state &= ~WNDS_SYNCPAINTPENDING;
1186 TRACE("WM_SYNCPAINT\n");
1187 hRgn = NtGdiCreateRectRgn(0, 0, 0, 0);
1188 if (hRgn)
1189 {
1191 {
1192 PREGION pRgn = REGION_LockRgn(hRgn);
1193 if (pRgn) REGION_UnlockRgn(pRgn);
1194 if (!wParam)
1196 co_UserRedrawWindow(Wnd, NULL, pRgn, wParam);
1197 }
1199 }
1200 return 0;
1201 }
1202
1203 case WM_SETREDRAW:
1204 if (wParam)
1205 {
1206 if (!(Wnd->style & WS_VISIBLE))
1207 {
1208 IntSetStyle( Wnd, WS_VISIBLE, 0 );
1209 Wnd->state |= WNDS_SENDNCPAINT;
1210 }
1211 }
1212 else
1213 {
1214 if (Wnd->style & WS_VISIBLE)
1215 {
1217 IntSetStyle( Wnd, 0, WS_VISIBLE );
1218 }
1219 }
1220 return 0;
1221
1223 {
1225 }
1226
1228 {
1230 }
1231
1232 case WM_NCCALCSIZE:
1233 {
1234 return NC_HandleNCCalcSize( Wnd, wParam, (RECTL *)lParam, FALSE );
1235 }
1236
1237 case WM_NCACTIVATE:
1238 {
1239 return NC_HandleNCActivate( Wnd, wParam, lParam );
1240 }
1241
1242 //
1243 // NC Paint mode.
1244 //
1245 case WM_NCPAINT:
1246 {
1248 Wnd->state |= WNDS_FORCEMENUDRAW;
1249 NC_DoNCPaint(Wnd, hDC, -1);
1250 Wnd->state &= ~WNDS_FORCEMENUDRAW;
1251 UserReleaseDC(Wnd, hDC, FALSE);
1252 return 0;
1253 }
1254 //
1255 // Draw Caption mode.
1256 //
1257 // wParam are DC_* flags.
1258 //
1260 {
1262 TRACE("WM_NCUAHDRAWCAPTION: wParam DC_ flags %08x\n",wParam);
1263 UserDrawCaptionBar(Wnd, hDC, wParam | DC_FRAME); // Include DC_FRAME to comp for drawing glitch.
1264 UserReleaseDC(Wnd, hDC, FALSE);
1265 return 0;
1266 }
1267 //
1268 // Draw Frame mode.
1269 //
1270 // wParam is HDC, lParam are DC_ACTIVE and or DC_REDRAWHUNGWND.
1271 //
1272 case WM_NCUAHDRAWFRAME:
1273 {
1274 TRACE("WM_NCUAHDRAWFRAME: wParam hDC %p lParam DC_ flags %08x\n",wParam,lParam);
1276 return 0;
1277 }
1278
1279 /* ReactOS only. */
1280 case WM_CBT:
1281 {
1282 switch (wParam)
1283 {
1284 case HCBT_MOVESIZE:
1285 {
1286 RECTL rt;
1287
1288 if (lParam)
1289 {
1290 _SEH2_TRY
1291 {
1293 sizeof(RECT),
1294 1);
1295
1296 RtlCopyMemory(&rt,
1297 (PVOID)lParam,
1298 sizeof(RECT));
1299 }
1301 {
1302 lResult = 1;
1303 }
1304 _SEH2_END;
1305 }
1306 if (!lResult)
1307 lResult = co_HOOK_CallHooks(WH_CBT, HCBT_MOVESIZE, (WPARAM)Wnd->head.h, lParam ? (LPARAM)&rt : 0);
1308 }
1309 break;
1310 }
1311 break;
1312 }
1313 break;
1314 }
1315 return lResult;
1316}
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:111
#define WARN(fmt,...)
Definition: debug.h:112
WPARAM wParam
Definition: combotst.c:138
struct @1609 Msg[]
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:1314
HWND FASTCALL IntGetCaptureWindow(VOID)
Definition: focus.c:34
HWND FASTCALL UserGetForegroundWindow(VOID)
Definition: focus.c:1421
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:615
#define WNDS2_STARTPAINT
Definition: ntuser.h:638
HGDIOBJ FASTCALL IntGetSysColorBrush(INT Object)
Definition: stockobj.c:317
static HDC
Definition: imagelist.c:92
static HRGN hRgn
Definition: mapping.c:33
unsigned short RTL_ATOM
Definition: atom.c:42
#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
#define ID_NEXTLAYOUT
HBRUSH FASTCALL DefWndControlColor(HDC hDC, UINT ctlType)
Definition: defwnd.c:32
BOOL FASTCALL IntClientToScreen(PWND Wnd, LPPOINT lpPoint)
Definition: winpos.c:200
BOOL FASTCALL IntScreenToClient(PWND Wnd, LPPOINT lpPoint)
Definition: winpos.c:214
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:3307
int iCtrlId
Definition: winuser.h:3304
DWORD_PTR dwContextId
Definition: winuser.h:3306
HANDLE hItemHandle
Definition: winuser.h:3305
int iContextType
Definition: winuser.h:3303
UINT cbSize
Definition: winuser.h:3302
#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:1435
BOOL FASTCALL IntEndPaint(PWND Wnd, PPAINTSTRUCT Ps)
Definition: painting.c:1532
INT FASTCALL co_UserGetUpdateRgn(PWND Window, HRGN hRgn, BOOL bErase)
Definition: painting.c:1785
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:3334
BOOLEAN co_UserDestroyWindow(PVOID Object)
Definition: window.c:2838
INT FASTCALL UserReleaseDC(PWND Window, HDC hDc, BOOL EndPaint)
Definition: windc.c:918
BOOL APIENTRY DefSetText(PWND Wnd, PCWSTR WindowText)
Definition: window.c:4381
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:2374
VOID FASTCALL REGION_UnlockRgn(_In_ PREGION prgn)
Definition: region.c:2389
BOOL UserDrawIconEx(HDC hDc, INT xLeft, INT yTop, PCURICON_OBJECT pIcon, INT cxWidth, INT cyHeight, UINT istepIfAniCur, HBRUSH hbrFlickerFreeDraw, UINT diFlags)
Definition: cursoricon.c:1688
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:99
PMENU FASTCALL IntGetSystemMenu(PWND Window, BOOL bRevert)
Definition: menu.c:5383
INT FASTCALL IntMenuItemFromPoint(PWND pWnd, HMENU hMenu, POINT ptScreen)
Definition: menu.c:1520
PWND MENU_IsMenuActive(VOID)
Definition: menu.c:2652
void MENU_EndMenu(PWND pwnd)
Definition: menu.c:2664
void FASTCALL MENU_InitSysMenuPopup(PMENU menu, DWORD style, DWORD clsStyle, LONG HitTest)
Definition: menu.c:1364
BOOL WINAPI IntTrackPopupMenuEx(PMENU menu, UINT wFlags, int x, int y, PWND pWnd, LPTPMPARAMS lpTpm)
Definition: menu.c:4561
BOOL FASTCALL UserPostMessage(HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1346
LRESULT NC_HandleNCLButtonDown(PWND pWnd, WPARAM wParam, LPARAM lParam)
Definition: nonclient.c:1542
VOID UserDrawCaptionBar(PWND pWnd, HDC hDC, INT Flags)
Definition: nonclient.c:922
DWORD FASTCALL GetNCHitEx(PWND pWnd, POINT pt)
Definition: nonclient.c:1952
LRESULT NC_HandleNCActivate(PWND Wnd, WPARAM wParam, LPARAM lParam)
Definition: nonclient.c:1405
LRESULT NC_DoNCPaint(PWND pWnd, HDC hDC, INT Flags)
Definition: nonclient.c:1064
LRESULT NC_HandleNCCalcSize(PWND Wnd, WPARAM wparam, RECTL *Rect, BOOL Suspended)
Definition: nonclient.c:1271
LRESULT NC_HandleNCRButtonDown(PWND pwnd, WPARAM wParam, LPARAM lParam)
Definition: nonclient.c:1692
LRESULT NC_HandleNCLButtonDblClk(PWND pWnd, WPARAM wParam, LPARAM lParam)
Definition: nonclient.c:1634
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:2104
PWND FASTCALL IntGetParent(PWND Wnd)
Definition: window.c:204
HWND FASTCALL IntFindWindow(PWND Parent, PWND ChildAfter, RTL_ATOM ClassAtom, PUNICODE_STRING WindowName)
Definition: window.c:3051
VOID FASTCALL IntGetClientRect(PWND WindowObject, RECTL *Rect)
Definition: winpos.c:93
#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:1610
#define WM_ERASEBKGND
Definition: winuser.h:1615
#define WM_GETHOTKEY
Definition: winuser.h:1643
#define WM_CTLCOLORSTATIC
Definition: winuser.h:1762
#define WM_GETTEXTLENGTH
Definition: winuser.h:1609
#define SW_HIDE
Definition: winuser.h:762
#define WM_CLOSE
Definition: winuser.h:1611
#define VK_SNAPSHOT
Definition: winuser.h:2221
#define WM_SYSCOMMAND
Definition: winuser.h:1731
#define SC_KEYMENU
Definition: winuser.h:2586
#define VK_TAB
Definition: winuser.h:2189
#define GA_ROOT
Definition: winuser.h:2779
#define MAKELPARAM(l, h)
Definition: winuser.h:3998
#define WM_KEYUP
Definition: winuser.h:1706
#define DCX_WINDOW
Definition: winuser.h:2103
#define HELPINFO_MENUITEM
Definition: winuser.h:1161
#define VK_F10
Definition: winuser.h:2254
#define WM_SETHOTKEY
Definition: winuser.h:1642
#define WM_WINDOWPOSCHANGING
Definition: winuser.h:1651
#define TPM_RIGHTBUTTON
Definition: winuser.h:2370
#define WM_SYNCPAINT
Definition: winuser.h:1680
#define SC_PREVWINDOW
Definition: winuser.h:2581
#define VK_SPACE
Definition: winuser.h:2209
#define WM_CANCELMODE
Definition: winuser.h:1625
#define WM_LBUTTONDBLCLK
Definition: winuser.h:1768
#define WM_COMMAND
Definition: winuser.h:1730
#define KF_ALTDOWN
Definition: winuser.h:2439
#define MA_ACTIVATE
Definition: winuser.h:2491
#define WM_APPCOMMAND
Definition: winuser.h:1872
#define WM_NCHITTEST
Definition: winuser.h:1676
#define WM_RBUTTONUP
Definition: winuser.h:1770
#define VK_UP
Definition: winuser.h:2215
#define SW_SHOWNOACTIVATE
Definition: winuser.h:768
#define WH_SHELL
Definition: winuser.h:40
#define WM_GETTEXT
Definition: winuser.h:1608
#define RDW_ERASE
Definition: winuser.h:1201
#define WM_CTLCOLORSCROLLBAR
Definition: winuser.h:1761
#define WA_INACTIVE
Definition: winuser.h:2612
#define MA_NOACTIVATE
Definition: winuser.h:2493
#define WM_LBUTTONDOWN
Definition: winuser.h:1766
#define WM_DEVICECHANGE
Definition: winuser.h:1801
#define WM_SYSCOLORCHANGE
Definition: winuser.h:1616
#define WM_CTLCOLORMSGBOX
Definition: winuser.h:1756
#define WM_NCLBUTTONDBLCLK
Definition: winuser.h:1684
#define WM_ACTIVATE
Definition: winuser.h:1602
#define WM_SHOWWINDOW
Definition: winuser.h:1618
#define WM_RBUTTONDOWN
Definition: winuser.h:1769
#define SC_MINIMIZE
Definition: winuser.h:2576
#define WM_CTLCOLORBTN
Definition: winuser.h:1759
#define WM_SETTEXT
Definition: winuser.h:1607
#define SC_NEXTWINDOW
Definition: winuser.h:2580
#define DC_NC
Definition: winuser.h:440
#define DCX_INTERSECTRGN
Definition: winuser.h:2112
#define WM_NCACTIVATE
Definition: winuser.h:1678
#define WM_SYSCHAR
Definition: winuser.h:1711
#define VK_RETURN
Definition: winuser.h:2191
#define SM_CYICON
Definition: winuser.h:967
#define VK_RMENU
Definition: winuser.h:2277
#define RDW_ALLCHILDREN
Definition: winuser.h:1211
#define RDW_ERASENOW
Definition: winuser.h:1209
#define RDW_FRAME
Definition: winuser.h:1202
#define WM_SYSKEYUP
Definition: winuser.h:1710
#define HCBT_MOVESIZE
Definition: winuser.h:55
#define SC_CLOSE
Definition: winuser.h:2582
#define DC_TEXT
Definition: winuser.h:430
#define VK_LWIN
Definition: winuser.h:2225
struct tagHELPINFO HELPINFO
#define WM_MOUSEACTIVATE
Definition: winuser.h:1627
#define TPM_LEFTBUTTON
Definition: winuser.h:2369
#define VK_F4
Definition: winuser.h:2248
#define VK_LEFT
Definition: winuser.h:2214
#define VK_RIGHT
Definition: winuser.h:2216
#define VK_DOWN
Definition: winuser.h:2217
#define WM_SETCURSOR
Definition: winuser.h:1626
#define KF_REPEAT
Definition: winuser.h:2440
#define WM_USER
Definition: winuser.h:1885
#define WM_CTLCOLORLISTBOX
Definition: winuser.h:1758
#define VK_SHIFT
Definition: winuser.h:2192
#define WM_NCRBUTTONUP
Definition: winuser.h:1686
#define WM_KEYDOWN
Definition: winuser.h:1705
#define WM_ICONERASEBKGND
Definition: winuser.h:1632
#define WM_PRINT
Definition: winuser.h:1870
#define WM_NCCALCSIZE
Definition: winuser.h:1675
#define SM_CXICON
Definition: winuser.h:966
#define WM_CTLCOLOREDIT
Definition: winuser.h:1757
#define VK_ESCAPE
Definition: winuser.h:2204
#define WM_WINDOWPOSCHANGED
Definition: winuser.h:1652
#define SC_RESTORE
Definition: winuser.h:2588
#define WM_CTLCOLORDLG
Definition: winuser.h:1760
#define CS_NOCLOSE
Definition: winuser.h:649
#define WM_SYSKEYDOWN
Definition: winuser.h:1709
#define WM_NCLBUTTONDOWN
Definition: winuser.h:1682
#define RDW_INVALIDATE
Definition: winuser.h:1204
#define WM_PAINTICON
Definition: winuser.h:1631
#define WM_MBUTTONDOWN
Definition: winuser.h:1772
#define VK_RWIN
Definition: winuser.h:2226
#define SC_MAXIMIZE
Definition: winuser.h:2578
#define VK_LMENU
Definition: winuser.h:2276
#define VK_MENU
Definition: winuser.h:2194
#define WM_NCPAINT
Definition: winuser.h:1677
#define WM_NCRBUTTONDOWN
Definition: winuser.h:1685
#define WM_SETREDRAW
Definition: winuser.h:1606
_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:1605

Referenced by NtUserCallTwoParam(), and NtUserEnableScrollBar().

◆ IntFindWindow()

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

Definition at line 3051 of file window.c.

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

◆ IntFreeHwndList()

VOID FASTCALL IntFreeHwndList ( PWINDOWLIST  pwlTarget)

Definition at line 1456 of file window.c.

1457{
1458 PWINDOWLIST pwl, *ppwl;
1459
1460 for (ppwl = &gpwlList; *ppwl; ppwl = &(*ppwl)->pNextList)
1461 {
1462 if (*ppwl != pwlTarget)
1463 continue;
1464
1465 *ppwl = pwlTarget->pNextList;
1466
1467 if (gpwlCache)
1468 {
1469 if (WL_CAPACITY(pwlTarget) > WL_CAPACITY(gpwlCache))
1470 {
1471 pwl = gpwlCache;
1472 gpwlCache = pwlTarget;
1474 }
1475 else
1476 {
1478 }
1479 }
1480 else
1481 {
1482 gpwlCache = pwlTarget;
1483 }
1484
1485 break;
1486 }
1487}
#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 93 of file winpos.c.

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

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:707
struct _WND * spwndChild
Definition: ntuser.h:709
struct _WND * spwndNext
Definition: ntuser.h:706
#define GW_OWNER
Definition: winuser.h:761
#define GW_HWNDFIRST
Definition: winuser.h:759
#define GW_HWNDLAST
Definition: winuser.h:760
#define GW_HWNDNEXT
Definition: winuser.h:756
#define GW_HWNDPREV
Definition: winuser.h:757
#define GW_CHILD
Definition: winuser.h:758

Referenced by WinPosFixupFlags().

◆ IntGetWindowBorderMeasures()

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

Definition at line 862 of file winpos.c.

863{
864 if(HAS_DLGFRAME(Wnd->style, Wnd->ExStyle) && !(Wnd->style & WS_MINIMIZE))
865 {
868 }
869 else
870 {
871 if(HAS_THICKFRAME(Wnd->style, Wnd->ExStyle)&& !(Wnd->style & WS_MINIMIZE))
872 {
875 }
876 else if(HAS_THINFRAME(Wnd->style, Wnd->ExStyle))
877 {
880 }
881 else
882 {
883 *cx = *cy = 0;
884 }
885 }
886}
_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:1246
#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 922 of file window.c.

923{
925 do
926 {
927 if ( Window == NULL || (Window->style & (WS_POPUP|WS_CHILD)) != WS_CHILD )
928 return FALSE;
929
930 Window = Window->spwndParent;
931 }
932 while(Parent != Window);
933 return TRUE;
934}
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:857

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

◆ IntLinkHwnd()

VOID FASTCALL IntLinkHwnd ( PWND  Wnd,
HWND  hWndPrev 
)

Definition at line 977 of file window.c.

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

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

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

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

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

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

◆ IntUnlinkWindow()

VOID FASTCALL IntUnlinkWindow ( PWND  Wnd)

Definition at line 1341 of file window.c.

1342{
1343 ASSERT(Wnd != Wnd->spwndNext);
1344 ASSERT(Wnd != Wnd->spwndPrev);
1345
1346 if (Wnd->spwndNext)
1347 Wnd->spwndNext->spwndPrev = Wnd->spwndPrev;
1348
1349 if (Wnd->spwndPrev)
1350 Wnd->spwndPrev->spwndNext = Wnd->spwndNext;
1351
1352 if (Wnd->spwndParent && Wnd->spwndParent->spwndChild == Wnd)
1353 Wnd->spwndParent->spwndChild = Wnd->spwndNext;
1354
1355 Wnd->spwndPrev = Wnd->spwndNext = NULL;
1356}

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

◆ IntWantImeWindow()

BOOL FASTCALL IntWantImeWindow ( PWND  pwndTarget)

Definition at line 1917 of file ime.c.

1918{
1919 PDESKTOP rpdesk;
1920 PWINSTATION_OBJECT rpwinstaParent;
1921 PWND pwndNode, pwndParent = pwndTarget->spwndParent;
1922
1924 return FALSE;
1925
1926 if (IS_WND_IMELIKE(pwndTarget))
1927 return FALSE;
1928
1929 if (pwndTarget->fnid == FNID_DESKTOP || pwndTarget->fnid == FNID_MESSAGEWND)
1930 return FALSE;
1931
1932 if (pwndTarget->state & WNDS_SERVERSIDEWINDOWPROC)
1933 return FALSE;
1934
1935 rpdesk = pwndTarget->head.rpdesk;
1936 if (!rpdesk)
1937 return FALSE;
1938
1939 rpwinstaParent = rpdesk->rpwinstaParent;
1940 if (!rpwinstaParent || (rpwinstaParent->Flags &