ReactOS 0.4.17-dev-37-g0bfb40d
window.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  tagWINDOWLIST
 

Macros

#define HAS_DLGFRAME(Style, ExStyle)
 
#define HAS_THICKFRAME(Style, ExStyle)
 
#define HAS_THINFRAME(Style, ExStyle)    (((Style) & WS_BORDER) || (!((Style) & (WS_CHILD | WS_POPUP))))
 
#define HAS_CLIENTFRAME(Style, ExStyle)    (((ExStyle) & WS_EX_CLIENTEDGE) || (!((Style) & (WS_CHILD | WS_POPUP))))
 
#define HAS_MENU(pWnd, style)   ((((style) & (WS_CHILD | WS_POPUP)) != WS_CHILD) && (pWnd->IDMenu) && IntIsMenu(UlongToHandle(pWnd->IDMenu)))
 
#define IntIsDesktopWindow(WndObj)    (WndObj->spwndParent == NULL)
 
#define IntIsBroadcastHwnd(hWnd)    (hWnd == HWND_BROADCAST || hWnd == HWND_TOPMOST)
 
#define IntWndBelongsToThread(WndObj, W32Thread)    ((WndObj->head.pti) && (WndObj->head.pti == W32Thread))
 
#define IntGetWndThreadId(WndObj)    PsGetThreadId(WndObj->head.pti->pEThread)
 
#define IntGetWndProcessId(WndObj)    PsGetProcessId(WndObj->head.pti->ppi->peProcess)
 
#define WINVER_WIN2K   _WIN32_WINNT_WIN2K
 
#define WINVER_WINNT4   _WIN32_WINNT_NT4
 
#define WINVER_WIN31   0x30A
 
#define HWND_TERMINATOR   ((HWND)UlongToHandle(1))
 
#define WL_IS_BAD(pwl)   ((pwl)->phwndEnd <= (pwl)->phwndLast)
 
#define WL_CAPACITY(pwl)   ((pwl)->phwndEnd - &((pwl)->ahwnd[0]))
 
#define IACE_LIST   0x0002
 
#define IS_WND_CHILD(pWnd)   ((pWnd)->style & WS_CHILD)
 
#define IS_WND_MENU(pWnd)   ((pWnd)->pcls->atomClassName == gpsi->atomSysClass[ICLS_MENU])
 
#define IS_WND_IMELIKE(pWnd)
 

Typedefs

typedef struct tagWINDOWLIST WINDOWLIST
 
typedef struct tagWINDOWLISTPWINDOWLIST
 

Functions

PWND FASTCALL ValidateHwndNoErr (HWND)
 
BOOL FASTCALL UserUpdateUiState (PWND Wnd, WPARAM wParam)
 
BOOL FASTCALL IntIsWindow (HWND hWnd)
 
HWND *FASTCALL IntWinListChildren (PWND Window)
 
HWND *FASTCALL IntWinListOwnedPopups (PWND Window)
 
VOID FASTCALL IntGetClientRect (PWND WindowObject, RECTL *Rect)
 
INT FASTCALL IntMapWindowPoints (PWND FromWnd, PWND ToWnd, LPPOINT lpPoints, UINT cPoints)
 
BOOL FASTCALL IntIsChildWindow (PWND Parent, PWND Child)
 
VOID FASTCALL IntUnlinkWindow (PWND Wnd)
 
VOID FASTCALL IntLinkHwnd (PWND Wnd, HWND hWndPrev)
 
PWND FASTCALL IntGetParent (PWND Wnd)
 
VOID FASTCALL IntGetWindowBorderMeasures (PWND WindowObject, UINT *cx, UINT *cy)
 
BOOL FASTCALL IntShowOwnedPopups (PWND owner, BOOL fShow)
 
LRESULT FASTCALL IntDefWindowProc (PWND Window, UINT Msg, WPARAM wParam, LPARAM lParam, BOOL Ansi)
 
VOID FASTCALL IntNotifyWinEvent (DWORD, PWND, LONG, LONG, DWORD)
 
PWND FASTCALL IntCreateWindow (CREATESTRUCTW *Cs, PLARGE_STRING WindowName, PCLS Class, PWND ParentWindow, PWND OwnerWindow, PVOID acbiBuffer, PDESKTOP pdeskCreated, DWORD dwVer)
 
PWND FASTCALL co_UserCreateWindowEx (CREATESTRUCTW *Cs, PUNICODE_STRING ClassName, PLARGE_STRING WindowName, PVOID acbiBuffer, DWORD dwVer)
 
BOOL FASTCALL IntEnableWindow (HWND, BOOL)
 
BOOL FASTCALL IntIsWindowVisible (PWND)
 
DWORD FASTCALL GetNCHitEx (PWND, POINT)
 
ULONG FASTCALL IntSetStyle (PWND, ULONG, ULONG)
 
PWND FASTCALL VerifyWnd (PWND)
 
PWND FASTCALL IntGetNonChildAncestor (PWND)
 
LONG FASTCALL co_UserSetWindowLong (HWND, DWORD, LONG, BOOL)
 
LONG_PTR FASTCALL co_UserSetWindowLongPtr (HWND, DWORD, LONG_PTR, BOOL)
 
HWND FASTCALL IntGetWindow (HWND, UINT)
 
LRESULT co_UserFreeWindow (PWND, PPROCESSINFO, PTHREADINFO, BOOLEAN)
 
PWINDOWLIST FASTCALL IntBuildHwndList (PWND pwnd, DWORD dwFlags, PTHREADINFO pti)
 
VOID FASTCALL IntFreeHwndList (PWINDOWLIST pwlTarget)
 
HWND FASTCALL IntFindWindow (PWND Parent, PWND ChildAfter, RTL_ATOM ClassAtom, PUNICODE_STRING WindowName)
 
BOOL FASTCALL IntWantImeWindow (_In_ PWND pwndTarget)
 
PWND FASTCALL co_IntCreateDefaultImeWindow (_In_ PWND pwndTarget, _In_ HINSTANCE hInst)
 
BOOL FASTCALL IntImeCanDestroyDefIMEforChild (_In_ PWND pImeWnd, _In_ PWND pwndTarget)
 
BOOL FASTCALL IntImeCanDestroyDefIME (_In_ PWND pImeWnd, _In_ PWND pwndTarget)
 
BOOL FASTCALL IntBroadcastImeShowStatusChange (_In_ PWND pImeWnd, _In_ BOOL bShow)
 
VOID FASTCALL IntNotifyImeShowStatus (_In_ PWND pImeWnd)
 
VOID FASTCALL IntCheckImeShowStatusInThread (_In_ PWND pImeWnd)
 
static VOID ReplaceWndPtr (_Inout_ PWND *ppwnd, _In_opt_ PWND pwndNew)
 
static VOID WndSetOwner (_Inout_ PWND pwnd, _In_opt_ PWND pwndOwner)
 
static VOID WndSetParent (_Inout_ PWND pwnd, _In_opt_ PWND pwndParent)
 
static VOID WndSetChild (_Inout_ PWND pwnd, _In_opt_ PWND pwndChild)
 
static VOID WndSetNext (_Inout_ PWND pwnd, _In_opt_ PWND pwndNext)
 
static VOID WndSetPrev (_Inout_ PWND pwnd, _In_opt_ PWND pwndPrev)
 
static VOID WndSetLastActive (_Inout_ PWND pwnd, _In_opt_ PWND pwndLastActive)
 

Variables

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

Macro Definition Documentation

◆ HAS_CLIENTFRAME

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

Definition at line 20 of file window.h.

◆ HAS_DLGFRAME

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

Definition at line 9 of file window.h.

◆ HAS_MENU

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

Definition at line 23 of file window.h.

◆ HAS_THICKFRAME

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

Definition at line 13 of file window.h.

◆ HAS_THINFRAME

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

Definition at line 17 of file window.h.

◆ HWND_TERMINATOR

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

Definition at line 83 of file window.h.

◆ IACE_LIST

#define IACE_LIST   0x0002

Definition at line 106 of file window.h.

◆ IntGetWndProcessId

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

Definition at line 38 of file window.h.

◆ IntGetWndThreadId

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

Definition at line 35 of file window.h.

◆ IntIsBroadcastHwnd

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

Definition at line 28 of file window.h.

◆ IntIsDesktopWindow

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

Definition at line 25 of file window.h.

◆ IntWndBelongsToThread

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

Definition at line 32 of file window.h.

◆ IS_WND_CHILD

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

Definition at line 108 of file window.h.

◆ IS_WND_IMELIKE

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

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 ( _In_ PWND  pwndTarget,
_In_ HINSTANCE  hInst 
)

Definition at line 2064 of file ime.c.

2067{
2068 LARGE_UNICODE_STRING WindowName;
2069 UNICODE_STRING ClassName;
2070 PWND pImeWnd;
2071 PIMEUI pimeui;
2072 CREATESTRUCTW Cs;
2075 HANDLE pid = PsGetThreadProcessId(pti->pEThread);
2076
2077 if (!(pti->spDefaultImc) && pid == gpidLogon)
2079
2080 if (!(pti->spDefaultImc) || IS_WND_IMELIKE(pwndTarget) || !(pti->rpdesk->pheapDesktop))
2081 return NULL;
2082
2083 if (IS_WND_CHILD(pwndTarget) && !(pwndTarget->style & WS_VISIBLE) &&
2084 pwndTarget->spwndParent->head.pti->ppi != pti->ppi)
2085 {
2086 return NULL;
2087 }
2088
2089 RtlInitLargeUnicodeString(&WindowName, L"Default IME", 0);
2090
2092 ClassName.Length = 0;
2093 ClassName.MaximumLength = 0;
2094
2095 UserRefObjectCo(pwndTarget, &Ref);
2096
2097 RtlZeroMemory(&Cs, sizeof(Cs));
2098 Cs.style = WS_POPUP | WS_DISABLED;
2099 Cs.hInstance = hInst;
2100 Cs.hwndParent = UserHMGetHandle(pwndTarget);
2101 Cs.lpszName = WindowName.Buffer;
2102 Cs.lpszClass = ClassName.Buffer;
2103
2104 // NOTE: LARGE_UNICODE_STRING is compatible to LARGE_STRING.
2105 pImeWnd = co_UserCreateWindowEx(&Cs, &ClassName, (PLARGE_STRING)&WindowName, NULL, WINVER);
2106 if (pImeWnd)
2107 {
2108 pimeui = IntGetImeUIFromWnd(pImeWnd);
2109 ASSERT(pimeui);
2110 _SEH2_TRY
2111 {
2112 ProbeForWrite(pimeui, sizeof(*pimeui), 1);
2113 pimeui->fDefault = TRUE;
2114 if (IS_WND_CHILD(pwndTarget) && pwndTarget->spwndParent->head.pti != pti)
2115 pimeui->fChildThreadDef = TRUE;
2116 }
2118 {
2119 ERR("Exception in co_IntCreateDefaultImeWindow: %p\n", pimeui);
2120 }
2121 _SEH2_END;
2122 }
2123
2124 UserDerefObjectCo(pwndTarget);
2125 return pImeWnd;
2126}
#define ERR(fmt,...)
Definition: precomp.h:57
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define L(x)
Definition: resources.c:13
#define UlongToPtr(u)
Definition: config.h:106
HINSTANCE hInst
Definition: dxdiag.c:13
VOID NTAPI ProbeForWrite(IN PVOID Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:143
#define UserHMGetHandle(obj)
Definition: ntuser.h:230
VOID NTAPI RtlInitLargeUnicodeString(IN OUT PLARGE_UNICODE_STRING, IN PCWSTR, IN INT)
Definition: rtlstr.c:42
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:90
#define ASSERT(a)
Definition: mode.c:44
PVOID NTAPI PsGetCurrentThreadWin32Thread(VOID)
Definition: thread.c:805
HANDLE NTAPI PsGetThreadProcessId(IN PETHREAD Thread)
Definition: thread.c:745
PIMC FASTCALL UserCreateInputContext(_In_ ULONG_PTR dwClientImcData)
Definition: ime.c:1651
static PIMEUI FASTCALL IntGetImeUIFromWnd(_In_ PWND pWnd)
Definition: ime.c:38
static __inline VOID UserDerefObjectCo(PVOID obj)
Definition: object.h:43
static __inline VOID UserRefObjectCo(PVOID obj, PUSER_REFERENCE_ENTRY UserReferenceEntry)
Definition: object.h:27
#define WS_POPUP
Definition: pedump.c:616
#define WS_VISIBLE
Definition: pedump.c:620
#define WS_DISABLED
Definition: pedump.c:621
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:104
#define _SEH2_END
Definition: pseh2_64.h:194
#define _SEH2_TRY
Definition: pseh2_64.h:93
HANDLE gpidLogon
Definition: simplecall.c:15
PPROCESSINFO ppi
Definition: win32.h:88
struct tagIMC * spDefaultImc
Definition: win32.h:132
struct _DESKTOP * rpdesk
Definition: win32.h:92
USHORT MaximumLength
Definition: env_spec_w32.h:370
Definition: object.h:4
Definition: ntuser.h:694
LPCWSTR lpszClass
Definition: winuser.h:3073
LPCWSTR lpszName
Definition: winuser.h:3072
HINSTANCE hInstance
Definition: winuser.h:3064
UINT fDefault
Definition: ntuser.h:1230
UINT fChildThreadDef
Definition: ntuser.h:1231
#define WINVER
Definition: targetver.h:11
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
PWND FASTCALL co_UserCreateWindowEx(CREATESTRUCTW *Cs, PUNICODE_STRING ClassName, PLARGE_STRING WindowName, PVOID acbiBuffer, DWORD dwVer)
Definition: window.c:2177
_In_ ULONG_PTR _In_ ULONG _Out_ ULONG_PTR * pid
Definition: winddi.h:3837
#define IS_WND_IMELIKE(pWnd)
Definition: window.h:114
#define IS_WND_CHILD(pWnd)
Definition: window.h:108

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

2182{
2183 ULONG style;
2184 PWND Window = NULL, ParentWindow = NULL, OwnerWindow;
2185 HWND hWnd, hWndParent, hWndOwner, hwndInsertAfter;
2186 PWINSTATION_OBJECT WinSta;
2187 PCLS Class = NULL;
2188 SIZE Size;
2189 POINT MaxSize, MaxPos, MinTrack, MaxTrack;
2190 CBT_CREATEWNDW * pCbtCreate;
2192 USER_REFERENCE_ENTRY ParentRef, Ref;
2193 PTHREADINFO pti;
2194 DWORD dwShowMode = SW_SHOW;
2195 CREATESTRUCTW *pCsw = NULL;
2196 PVOID pszClass = NULL, pszName = NULL;
2197 PWND ret = NULL;
2198
2199 /* Get the current window station and reference it */
2200 pti = GetW32ThreadInfo();
2201 if (pti == NULL || pti->rpdesk == NULL)
2202 {
2203 ERR("Thread is not attached to a desktop! Cannot create window (%wZ)\n", ClassName);
2204 return NULL; // There is nothing to cleanup.
2205 }
2206 WinSta = pti->rpdesk->rpwinstaParent;
2208
2209 pCsw = NULL;
2210 pCbtCreate = NULL;
2211
2212 /* Get the class and reference it */
2213 Class = IntGetAndReferenceClass(ClassName, Cs->hInstance, FALSE);
2214 if(!Class)
2215 {
2217 ERR("Failed to find class %wZ\n", ClassName);
2218 goto cleanup;
2219 }
2220
2221 /* Now find the parent and the owner window */
2222 hWndParent = UserHMGetHandle(pti->rpdesk->pDeskInfo->spwnd);
2223 hWndOwner = NULL;
2224
2225 if (Cs->hwndParent == HWND_MESSAGE)
2226 {
2227 Cs->hwndParent = hWndParent = UserHMGetHandle(pti->rpdesk->spwndMessage);
2228 }
2229 else if (Cs->hwndParent)
2230 {
2231 if ((Cs->style & (WS_CHILD|WS_POPUP)) != WS_CHILD)
2232 hWndOwner = Cs->hwndParent;
2233 else
2234 hWndParent = Cs->hwndParent;
2235 }
2236 else if ((Cs->style & (WS_CHILD|WS_POPUP)) == WS_CHILD)
2237 {
2238 ERR("Cannot create a child window (%wZ) without a parent\n", ClassName);
2240 goto cleanup; /* WS_CHILD needs a parent, but WS_POPUP doesn't */
2241 }
2243 (IS_INTRESOURCE(Cs->lpszClass) ||
2244 Cs->lpszClass != (LPCWSTR)MAKEINTATOM(gpsi->atomSysClass[ICLS_HWNDMESSAGE]) ||
2245 _wcsicmp(Cs->lpszClass, L"Message") != 0))
2246 {
2247 if (pti->ppi->dwLayout & LAYOUT_RTL)
2248 {
2250 }
2251 }
2252
2253 ParentWindow = hWndParent ? UserGetWindowObject(hWndParent): NULL;
2254 OwnerWindow = hWndOwner ? UserGetWindowObject(hWndOwner): NULL;
2255
2256 if (hWndParent && !ParentWindow)
2257 {
2258 ERR("Got invalid parent window handle for %wZ\n", ClassName);
2259 goto cleanup;
2260 }
2261 else if (hWndOwner && !OwnerWindow)
2262 {
2263 ERR("Got invalid owner window handle for %wZ\n", ClassName);
2264 ParentWindow = NULL;
2265 goto cleanup;
2266 }
2267
2268 if(OwnerWindow)
2269 {
2270 if (IntIsDesktopWindow(OwnerWindow)) OwnerWindow = NULL;
2271 else if (ParentWindow && !IntIsDesktopWindow(ParentWindow))
2272 {
2273 ERR("an owned window must be created as top-level\n");
2275 goto cleanup;
2276 }
2277 else /* owner must be a top-level window */
2278 {
2279 while ((OwnerWindow->style & (WS_POPUP|WS_CHILD)) == WS_CHILD && !IntIsDesktopWindow(OwnerWindow->spwndParent))
2280 OwnerWindow = OwnerWindow->spwndParent;
2281 }
2282 }
2283
2284 /* Fix the position and the size of the window */
2285 if (ParentWindow)
2286 {
2287 UserRefObjectCo(ParentWindow, &ParentRef);
2288 IntFixWindowCoordinates(Cs, ParentWindow, &dwShowMode);
2289 }
2290
2291 /* Allocate and initialize the new window */
2293 WindowName,
2294 Class,
2295 ParentWindow,
2296 OwnerWindow,
2297 acbiBuffer,
2298 NULL,
2299 dwVer );
2300 if(!Window)
2301 {
2302 ERR("IntCreateWindow(%wZ) failed\n", ClassName);
2303 goto cleanup;
2304 }
2305
2307 hwndInsertAfter = HWND_TOP;
2308
2309 UserRefObjectCo(Window, &Ref);
2311 ObDereferenceObject(WinSta);
2312
2313 /* NCCREATE, WM_NCCALCSIZE and Hooks need the original values */
2314 Cs->lpszName = (LPCWSTR) WindowName;
2315 Cs->lpszClass = (LPCWSTR) ClassName;
2316
2318 if ( ISITHOOKED(WH_CBT) || (pti->rpdesk->pDeskInfo->fsHooks & HOOKID_TO_FLAG(WH_CBT)) )
2319 {
2320 // Allocate the calling structures Justin Case this goes Global.
2323 if (!pCsw || !pCbtCreate)
2324 {
2325 ERR("UserHeapAlloc() failed!\n");
2326 goto cleanup;
2327 }
2328
2329 if (!IntMsgCreateStructW( Window, pCsw, Cs, &pszClass, &pszName ) )
2330 {
2331 ERR("IntMsgCreateStructW() failed!\n");
2332 goto cleanup;
2333 }
2334
2335 pCbtCreate->lpcs = pCsw;
2336 pCbtCreate->hwndInsertAfter = hwndInsertAfter;
2337
2340 if (Result != 0)
2341 {
2342 ERR("WH_CBT HCBT_CREATEWND hook failed! 0x%x\n", Result);
2343 goto cleanup;
2344 }
2345 // Write back changes.
2346 Cs->cx = pCsw->cx;
2347 Cs->cy = pCsw->cy;
2348 Cs->x = pCsw->x;
2349 Cs->y = pCsw->y;
2350 hwndInsertAfter = pCbtCreate->hwndInsertAfter;
2351 }
2352
2353 if ((Cs->style & (WS_CHILD|WS_POPUP)) == WS_CHILD)
2354 {
2355 if (ParentWindow != co_GetDesktopWindow(Window))
2356 {
2357 Cs->x += ParentWindow->rcClient.left;
2358 Cs->y += ParentWindow->rcClient.top;
2359 }
2360 }
2361
2362 /* Send the WM_GETMINMAXINFO message */
2363 Size.cx = Cs->cx;
2364 Size.cy = Cs->cy;
2365
2366 if ((Cs->style & WS_THICKFRAME) || !(Cs->style & (WS_POPUP | WS_CHILD)))
2367 {
2368 co_WinPosGetMinMaxInfo(Window, &MaxSize, &MaxPos, &MinTrack, &MaxTrack);
2369 if (Size.cx > MaxTrack.x) Size.cx = MaxTrack.x;
2370 if (Size.cy > MaxTrack.y) Size.cy = MaxTrack.y;
2371 if (Size.cx < MinTrack.x) Size.cx = MinTrack.x;
2372 if (Size.cy < MinTrack.y) Size.cy = MinTrack.y;
2373 }
2374
2375 Window->rcWindow.left = Cs->x;
2376 Window->rcWindow.top = Cs->y;
2377 Window->rcWindow.right = Cs->x + Size.cx;
2378 Window->rcWindow.bottom = Cs->y + Size.cy;
2379 /*
2380 if (0 != (Window->style & WS_CHILD) && ParentWindow)
2381 {
2382 ERR("co_UserCreateWindowEx(): Offset rcWindow\n");
2383 RECTL_vOffsetRect(&Window->rcWindow,
2384 ParentWindow->rcClient.left,
2385 ParentWindow->rcClient.top);
2386 }
2387 */
2388 /* correct child window coordinates if mirroring on parent is enabled */
2389 if (ParentWindow != NULL)
2390 {
2391 if ( ((Cs->style & WS_CHILD) == WS_CHILD) &&
2392 ((ParentWindow->ExStyle & WS_EX_LAYOUTRTL) == WS_EX_LAYOUTRTL))
2393 {
2394 Window->rcWindow.right = ParentWindow->rcClient.right - (Window->rcWindow.left - ParentWindow->rcClient.left);
2395 Window->rcWindow.left = Window->rcWindow.right - Size.cx;
2396 }
2397 }
2398
2399 Window->rcClient = Window->rcWindow;
2400
2401 if (Window->spwndNext || Window->spwndPrev)
2402 {
2403 ERR("Window 0x%p has been linked too early!\n", Window);
2404 }
2405
2406 if (!(Window->state2 & WNDS2_WIN31COMPAT))
2407 {
2408 if (Class->style & CS_PARENTDC && !(ParentWindow->style & WS_CLIPCHILDREN))
2409 Window->style &= ~(WS_CLIPSIBLINGS | WS_CLIPCHILDREN);
2410 }
2411
2412 if ((Window->style & (WS_CHILD | WS_POPUP)) == WS_CHILD)
2413 {
2415 {
2416 if (pti != ParentWindow->head.pti)
2417 {
2418 //ERR("CreateWindow Parent in.\n");
2419 UserAttachThreadInput(pti, ParentWindow->head.pti, TRUE);
2420 }
2421 }
2422 }
2423
2424 /* Send the NCCREATE message */
2426 if (!Result)
2427 {
2428 ERR("co_UserCreateWindowEx(%wZ): NCCREATE message failed\n", ClassName);
2429 goto cleanup;
2430 }
2431
2432 /* Link the window */
2433 if (ParentWindow != NULL)
2434 {
2435 /* Link the window into the siblings list */
2436 if ((Cs->style & (WS_CHILD | WS_MAXIMIZE)) == WS_CHILD)
2438 else
2439 IntLinkHwnd(Window, hwndInsertAfter);
2440 }
2441
2442 /* Create the IME window for pWnd */
2444 {
2445 PWND pwndDefaultIme = co_IntCreateDefaultImeWindow(Window, Window->hModule);
2446 UserAssignmentLock((PVOID*)&pti->spwndDefaultIme, pwndDefaultIme);
2447
2448 if (pwndDefaultIme)
2449 {
2450 HWND hImeWnd;
2452 UserRefObjectCo(pwndDefaultIme, &Ref);
2453
2454 hImeWnd = UserHMGetHandle(pwndDefaultIme);
2455
2457
2458 if (pti->pClientInfo->CI_flags & CI_IMMACTIVATE)
2459 {
2460 HKL hKL = pti->KeyboardLayout->hkl;
2462 pti->pClientInfo->CI_flags &= ~CI_IMMACTIVATE;
2463 }
2464
2465 UserDerefObjectCo(pwndDefaultIme);
2466 }
2467 }
2468
2469 /* Send the WM_NCCALCSIZE message */
2470 {
2471 // RECT rc;
2472 MaxPos.x = Window->rcWindow.left;
2473 MaxPos.y = Window->rcWindow.top;
2474
2475 Result = co_WinPosGetNonClientSize(Window, &Window->rcWindow, &Window->rcClient);
2476 //rc = Window->rcWindow;
2477 //Result = co_IntSendMessageNoWait(UserHMGetHandle(Window), WM_NCCALCSIZE, FALSE, (LPARAM)&rc);
2478 //Window->rcClient = rc;
2479
2480 RECTL_vOffsetRect(&Window->rcWindow, MaxPos.x - Window->rcWindow.left,
2481 MaxPos.y - Window->rcWindow.top);
2482 }
2483
2484 /* Send the WM_CREATE message. */
2486 if (Result == (LRESULT)-1)
2487 {
2488 ERR("co_UserCreateWindowEx(%wZ): WM_CREATE message failed\n", ClassName);
2489 goto cleanup;
2490 }
2491
2492 /* Send the EVENT_OBJECT_CREATE event */
2493 IntNotifyWinEvent(EVENT_OBJECT_CREATE, Window, OBJID_WINDOW, CHILDID_SELF, 0);
2494
2495 /* By setting the flag below it can be examined to determine if the window
2496 was created successfully and a valid pwnd was passed back to caller since
2497 from here the function has to succeed. */
2499
2500 /* Send the WM_SIZE and WM_MOVE messages. */
2501 if (!(Window->state & WNDS_SENDSIZEMOVEMSGS))
2502 {
2504 }
2505
2506 /* Show or maybe minimize or maximize the window. */
2507
2509 if (style & (WS_MINIMIZE | WS_MAXIMIZE))
2510 {
2511 RECTL NewPos;
2512 UINT SwFlag = (style & WS_MINIMIZE) ? SW_MINIMIZE : SW_MAXIMIZE;
2513
2514 SwFlag = co_WinPosMinMaximize(Window, SwFlag, &NewPos);
2515 SwFlag |= SWP_NOZORDER|SWP_FRAMECHANGED; /* Frame always gets changed */
2516 if (!(style & WS_VISIBLE) || (style & WS_CHILD) || UserGetActiveWindow() ||
2517 (Window->ExStyle & WS_EX_NOACTIVATE))
2518 {
2519 SwFlag |= SWP_NOACTIVATE;
2520 }
2521 co_WinPosSetWindowPos(Window, 0, NewPos.left, NewPos.top,
2522 NewPos.right, NewPos.bottom, SwFlag);
2523 }
2524
2525 /* Send the WM_PARENTNOTIFY message */
2527
2528 /* Notify the shell that a new window was created */
2529 if (Window->spwndOwner == NULL ||
2530 !(Window->spwndOwner->style & WS_VISIBLE) ||
2531 (Window->spwndOwner->ExStyle & WS_EX_TOOLWINDOW))
2532 {
2533 if (UserIsDesktopWindow(Window->spwndParent) &&
2534 (Window->style & WS_VISIBLE) &&
2535 (!(Window->ExStyle & WS_EX_TOOLWINDOW) ||
2536 (Window->ExStyle & WS_EX_APPWINDOW)))
2537 {
2539 }
2540 }
2541
2542 /* Initialize and show the window's scrollbars */
2543 if (Window->style & WS_VSCROLL)
2544 {
2546 }
2547 if (Window->style & WS_HSCROLL)
2548 {
2550 }
2551
2552 /* Show the new window */
2553 if (Cs->style & WS_VISIBLE)
2554 {
2555 if (Window->style & WS_MAXIMIZE)
2556 dwShowMode = SW_SHOW;
2557 else if (Window->style & WS_MINIMIZE)
2558 dwShowMode = SW_SHOWMINIMIZED;
2559
2560 co_WinPosShowWindow(Window, dwShowMode);
2561
2562 if (Window->ExStyle & WS_EX_MDICHILD)
2563 {
2564 ASSERT(ParentWindow);
2565 if(!ParentWindow)
2566 goto cleanup;
2568 /* ShowWindow won't activate child windows */
2570 }
2571 }
2572
2573 if (Class->atomClassName == gaGuiConsoleWndClass)
2574 {
2575 /* Count only console windows manually */
2577 }
2578
2579 /* Set the hotkey */
2580 if (!(Window->style & (WS_POPUP | WS_CHILD)) || (Window->ExStyle & WS_EX_APPWINDOW))
2581 {
2582 if (pti->ppi->dwHotkey)
2583 {
2585 pti->ppi->dwHotkey = 0; /* Only the first suitable window gets the hotkey */
2586 }
2587 }
2588
2589 TRACE("co_UserCreateWindowEx(%wZ): Created window %p\n", ClassName, hWnd);
2590 ret = Window;
2591
2592cleanup:
2593 if (!ret)
2594 {
2595 TRACE("co_UserCreateWindowEx(): Error Created window!\n");
2596 /* If the window was created, the class will be dereferenced by co_UserDestroyWindow */
2597 if (Window)
2599 else if (Class)
2601 }
2602
2603 if (pCsw) ExFreePoolWithTag(pCsw, TAG_HOOK);
2604 if (pCbtCreate) ExFreePoolWithTag(pCbtCreate, TAG_HOOK);
2605 if (pszName) UserHeapFree(pszName);
2606 if (pszClass) UserHeapFree(pszClass);
2607
2608 if (Window)
2609 {
2611 }
2612 if (ParentWindow) UserDerefObjectCo(ParentWindow);
2613
2614 // See CORE-13717, not setting error on success.
2615 if (ret)
2617
2618 return ret;
2619}
Arabic default style
Definition: afstyles.h:94
HWND hWnd
Definition: settings.c:17
#define ERROR_SUCCESS
Definition: deptool.c:10
#define UserIsDesktopWindow(pWnd)
Definition: desktop.h:194
#define FALSE
Definition: types.h:117
static void cleanup(void)
Definition: main.c:1335
#define IS_INTRESOURCE(x)
Definition: loader.c:613
_ACRTIMP int __cdecl _wcsicmp(const wchar_t *, const wchar_t *)
Definition: wcs.c:159
return ret
Definition: mutex.c:146
#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:1426
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: imm32_undoc.h:68
#define IMS_ACTIVATELAYOUT
Definition: imm32_undoc.h:60
#define WM_IME_SYSTEM
Definition: imm32_undoc.h:32
#define WNDS2_WIN31COMPAT
Definition: ntuser.h:649
struct _THREADINFO * GetW32ThreadInfo(VOID)
Definition: misc.c:806
#define CI_IMMACTIVATE
Definition: ntuser.h:306
#define WNDS2_WMCREATEMSGPROCESSED
Definition: ntuser.h:670
#define IS_IMM_MODE()
Definition: ntuser.h:1212
#define ICLS_DESKTOP
Definition: ntuser.h:929
#define WNDS_SENDSIZEMOVEMSGS
Definition: ntuser.h:609
LONG_PTR LPARAM
Definition: minwindef.h:175
LONG_PTR LRESULT
Definition: minwindef.h:176
UINT_PTR WPARAM
Definition: minwindef.h:174
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
UINT_PTR HKL
Definition: msctf.idl:125
unsigned int UINT
Definition: ndis.h:50
#define KernelMode
Definition: asm.h:38
LRESULT APIENTRY co_HOOK_CallHooks(INT HookId, INT Code, WPARAM wParam, LPARAM lParam)
Definition: hook.c:1102
PWND FASTCALL co_IntCreateDefaultImeWindow(_In_ PWND pwndTarget, _In_ HINSTANCE hInst)
Definition: ime.c:2064
BOOL FASTCALL IntWantImeWindow(_In_ PWND pwndTarget)
Definition: ime.c:2024
UINT FASTCALL co_WinPosMinMaximize(PWND Wnd, UINT ShowFlag, RECT *NewPos)
Definition: winpos.c:2437
BOOLEAN FASTCALL co_WinPosSetWindowPos(PWND Window, HWND WndInsertAfter, INT x, INT y, INT cx, INT cy, UINT flags)
Definition: winpos.c:1792
LRESULT FASTCALL co_WinPosGetNonClientSize(PWND Window, RECT *WindowRect, RECT *ClientRect)
Definition: winpos.c:2388
UINT FASTCALL co_WinPosGetMinMaxInfo(PWND Window, POINT *MaxSize, POINT *MaxPos, POINT *MinTrack, POINT *MaxTrack)
Definition: winpos.c:940
void FASTCALL co_WinPosSendSizeMove(PWND Wnd)
Definition: winpos.c:2403
BOOLEAN FASTCALL co_WinPosShowWindow(PWND Wnd, INT Cmd)
Definition: winpos.c:2622
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:863
#define TRACE(s)
Definition: solgame.cpp:4
long bottom
Definition: polytest.cpp:53
long right
Definition: polytest.cpp:53
long top
Definition: polytest.cpp:53
long left
Definition: polytest.cpp:53
Definition: window.c:28
Definition: ntuser.h:566
DWORD dwHotkey
Definition: win32.h:270
DWORD dwLayout
Definition: win32.h:280
struct _DESKTOPINFO * pDeskInfo
Definition: win32.h:93
struct _CLIENTINFO * pClientInfo
Definition: win32.h:94
struct tagKL * KeyboardLayout
Definition: win32.h:90
struct _WND * spwndDefaultIme
Definition: win32.h:131
LPCREATESTRUCTW lpcs
Definition: winuser.h:3083
HWND hwndInsertAfter
Definition: winuser.h:3084
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
const uint16_t * LPCWSTR
Definition: typedefs.h:57
uint32_t ULONG
Definition: typedefs.h:59
#define STATUS_ACCESS_DENIED
Definition: udferr_usr.h:145
static __inline BOOL UserHeapFree(PVOID lpMem)
Definition: usrheap.h:44
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4539
POBJECT_TYPE ExWindowStationObjectType
Definition: win32k.c:21
FORCEINLINE VOID RECTL_vOffsetRect(_Inout_ RECTL *prcl, _In_ INT cx, _In_ INT cy)
Definition: rect.h:31
BOOL FASTCALL IntMsgCreateStructW(PWND, CREATESTRUCTW *, CREATESTRUCTW *, PVOID *, PVOID *)
Definition: message.c:646
VOID IntDereferenceClass(IN OUT PCLS Class, IN PDESKTOPINFO Desktop, IN PPROCESSINFO pi)
Definition: class.c:820
PCLS IntGetAndReferenceClass(PUNICODE_STRING ClassName, HINSTANCE hInstance, BOOL bDesktopThread)
Definition: class.c:1450
VOID co_IntShellHookNotify(WPARAM Message, WPARAM wParam, LPARAM lParam)
Definition: desktop.c:1704
PWND FASTCALL co_GetDesktopWindow(PWND pWnd)
Definition: desktop.c:1383
VOID FASTCALL IntNotifyWinEvent(DWORD Event, PWND pWnd, LONG idObject, LONG idChild, DWORD flags)
Definition: event.c:178
NTSTATUS FASTCALL UserAttachThreadInput(PTHREADINFO ptiFrom, PTHREADINFO ptiTo, BOOL fAttach)
Definition: input.c:495
LRESULT FASTCALL co_IntSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1495
PVOID FASTCALL UserAssignmentLock(PVOID *ppvObj, PVOID pvNew)
Definition: object.c:837
BOOL FASTCALL UserDereferenceObject(PVOID Object)
Definition: object.c:643
#define TAG_HOOK
Definition: tags.h:5
ULONG FASTCALL IntSetStyle(PWND pwnd, ULONG set_bits, ULONG clear_bits)
Definition: window.c:144
PWND FASTCALL UserGetWindowObject(HWND hWnd)
Definition: window.c:123
PWND FASTCALL IntCreateWindow(CREATESTRUCTW *Cs, PLARGE_STRING WindowName, PCLS Class, PWND ParentWindow, PWND OwnerWindow, PVOID acbiBuffer, PDESKTOP pdeskCreated, DWORD dwVer)
Definition: window.c:1805
void FASTCALL IntFixWindowCoordinates(CREATESTRUCTW *Cs, PWND ParentWindow, DWORD *dwShowMode)
Definition: window.c:1711
BOOL FASTCALL IntIsTopLevelWindow(PWND pWnd)
Definition: window.c:360
BOOLEAN co_UserDestroyWindow(PVOID Object)
Definition: window.c:2865
VOID FASTCALL IntLinkHwnd(PWND Wnd, HWND hWndPrev)
Definition: window.c:985
static void IntSendParentNotify(PWND pWindow, UINT msg)
Definition: window.c:1689
#define OBJID_WINDOW
Definition: winable.h:15
#define CHILDID_SELF
Definition: winable.h:14
#define MAKEINTATOM(i)
Definition: winbase.h:1220
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:21
#define IntIsDesktopWindow(WndObj)
Definition: window.h:25
#define ERROR_TLW_WITH_WSCHILD
Definition: winerror.h:1232
#define ERROR_CANNOT_FIND_WND_CLASS
Definition: winerror.h:1233
#define LAYOUT_RTL
Definition: wingdi.h:1371
#define WS_EX_LAYOUTRTL
Definition: winuser.h:390
#define HWND_MESSAGE
Definition: winuser.h:1221
#define SWP_NOACTIVATE
Definition: winuser.h:1253
#define SWP_FRAMECHANGED
Definition: winuser.h:1251
#define WM_SETHOTKEY
Definition: winuser.h:1680
#define WM_CREATE
Definition: winuser.h:1636
#define WS_EX_APPWINDOW
Definition: winuser.h:383
#define SW_MINIMIZE
Definition: winuser.h:787
#define HSHELL_WINDOWCREATED
Definition: winuser.h:1266
#define SB_VERT
Definition: winuser.h:553
#define SWP_NOMOVE
Definition: winuser.h:1255
#define WS_EX_NOACTIVATE
Definition: winuser.h:395
#define WS_EX_TOOLWINDOW
Definition: winuser.h:404
#define SWP_NOSIZE
Definition: winuser.h:1256
#define WH_CBT
Definition: winuser.h:35
#define HCBT_CREATEWND
Definition: winuser.h:58
#define WM_NCCREATE
Definition: winuser.h:1711
#define WM_MDIREFRESHMENU
Definition: winuser.h:1854
#define SW_SHOWMINIMIZED
Definition: winuser.h:782
#define HWND_TOP
Definition: winuser.h:1218
#define WS_EX_MDICHILD
Definition: winuser.h:394
#define SWP_SHOWWINDOW
Definition: winuser.h:1259
#define SW_SHOW
Definition: winuser.h:786
#define SWP_NOZORDER
Definition: winuser.h:1258
#define SW_MAXIMIZE
Definition: winuser.h:783
#define CS_PARENTDC
Definition: winuser.h:664
#define HWND_BOTTOM
Definition: winuser.h:1216
#define SB_HORZ
Definition: winuser.h:552
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:409
#define ObDereferenceObject
Definition: obfuncs.h:203

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

◆ co_UserFreeWindow()

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

Definition at line 575 of file window.c.

579{
580 HWND *Children;
581 HWND *ChildHandle;
582 PWND Child;
583 PMENU Menu;
584 BOOLEAN BelongsToThreadData;
586
587 ASSERT(Window);
588
589 if(Window->state2 & WNDS2_INDESTROY)
590 {
591 TRACE("Tried to call co_UserFreeWindow() twice\n");
592 return 0;
593 }
594 Window->state2 |= WNDS2_INDESTROY;
595 Window->style &= ~WS_VISIBLE;
596 Window->head.pti->cVisWindows--;
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 if (!IsListEmpty(&Window->ThreadListEntry))
602 RemoveEntryList(&Window->ThreadListEntry);
603
604 BelongsToThreadData = IntWndBelongsToThread(Window, ThreadData);
605
607
608 /* free child windows */
609 Children = IntWinListChildren(Window);
610 if (Children)
611 {
612 for (ChildHandle = Children; *ChildHandle; ++ChildHandle)
613 {
614 if ((Child = IntGetWindowObject(*ChildHandle)))
615 {
617 {
618 /* send WM_DESTROY messages to windows not belonging to the same thread */
620 }
621 else
622 co_UserFreeWindow(Child, ProcessData, ThreadData, SendMessages);
623
625 }
626 }
628 }
629
630 if (SendMessages)
631 {
632 /*
633 * Clear the update region to make sure no WM_PAINT messages will be
634 * generated for this window while processing the WM_NCDESTROY.
635 */
639 if (BelongsToThreadData)
641 }
642
644
646
647 /* Unregister hot keys */
649
650 /* flush the message queue */
652
653 /* from now on no messages can be sent to this window anymore */
654 Window->state |= WNDS_DESTROYED;
655 Window->fnid |= FNID_FREED;
656
657 /* don't remove the WINDOWSTATUS_DESTROYING bit */
658
659 /* reset shell window handles */
660 if (ThreadData->rpdesk)
661 {
662 if (UserHMGetHandle(Window) == ThreadData->rpdesk->rpwinstaParent->ShellWindow)
663 ThreadData->rpdesk->rpwinstaParent->ShellWindow = NULL;
664
665 if (UserHMGetHandle(Window) == ThreadData->rpdesk->rpwinstaParent->ShellListView)
666 ThreadData->rpdesk->rpwinstaParent->ShellListView = NULL;
667 }
668
669 if (ThreadData->spwndDefaultIme &&
670 ThreadData->spwndDefaultIme->spwndOwner == Window)
671 {
672 WndSetOwner(ThreadData->spwndDefaultIme, NULL);
673 }
674
675 if (IS_IMM_MODE() && Window == ThreadData->spwndDefaultIme)
676 {
677 UserAssignmentUnlock((PVOID*)&(ThreadData->spwndDefaultIme));
678 }
679
680 /* Fixes dialog test_focus breakage due to r66237. */
681 if (ThreadData->MessageQueue->spwndFocus == Window)
682 ThreadData->MessageQueue->spwndFocus = NULL;
683
684 if (ThreadData->MessageQueue->spwndActive == Window)
685 ThreadData->MessageQueue->spwndActive = NULL;
686
687 if (ThreadData->MessageQueue->spwndCapture == Window)
688 {
690 }
691
693 if ( Window->hrgnUpdate != NULL || Window->state & WNDS_INTERNALPAINT )
694 {
695 MsqDecPaintCountQueue(Window->head.pti);
696 if (Window->hrgnUpdate > HRGN_WINDOW && GreIsHandleValid(Window->hrgnUpdate))
697 {
699 GreDeleteObject(Window->hrgnUpdate);
700 }
701 Window->hrgnUpdate = NULL;
702 Window->state &= ~WNDS_INTERNALPAINT;
703 }
704
706 {
708 }
709
710 if ( ((Window->style & (WS_CHILD|WS_POPUP)) != WS_CHILD) &&
711 Window->IDMenu &&
712 (Menu = UserGetMenuObject((HMENU)Window->IDMenu)))
713 {
714 TRACE("UFW: IDMenu %p\n",Window->IDMenu);
716 Window->IDMenu = 0;
717 }
718
719 if (Window->SystemMenu
720 && (Menu = UserGetMenuObject(Window->SystemMenu)))
721 {
723 Window->SystemMenu = (HMENU)0;
724 }
725
726 DceFreeWindowDCE(Window); /* Always do this to catch orphaned DCs */
727
729
730 if (Window->PropListItems)
731 {
733 TRACE("Window->PropListItems %lu\n",Window->PropListItems);
734 ASSERT(Window->PropListItems==0);
735 }
736
737 /* Kill any reference to linked windows. Prev & Next are taken care of in IntUnlinkWindow */
742
743 UserRefObjectCo(Window, &Ref);
745
747
748 if (Window->pcls->atomClassName == gaGuiConsoleWndClass)
749 {
750 /* Count only console windows manually */
752 }
753
754 /* dereference the class */
755 NT_ASSERT(Window->head.pti != NULL);
757 Window->head.pti->pDeskInfo,
758 Window->head.pti->ppi);
759 Window->pcls = NULL;
760
761 if (Window->hrgnClip)
762 {
764 GreDeleteObject(Window->hrgnClip);
765 Window->hrgnClip = NULL;
766 }
767 Window->head.pti->cWindows--;
768
769// ASSERT(Window != NULL);
770 UserFreeWindowInfo(Window->head.pti, Window);
771
774
775 return 0;
776}
unsigned char BOOLEAN
Definition: actypes.h:127
void FASTCALL DceFreeWindowDCE(PWND)
Definition: windc.c:686
#define RemoveEntryList(Entry)
Definition: env_spec_w32.h:986
#define IsListEmpty(ListHead)
Definition: env_spec_w32.h:954
BOOL FASTCALL IntReleaseCapture(VOID)
Definition: focus.c:1525
#define WNDS_DESTROYED
Definition: ntuser.h:636
#define WNDS_SENDNCPAINT
Definition: ntuser.h:616
#define WNDS_INTERNALPAINT
Definition: ntuser.h:617
@ TYPE_WINDOW
Definition: ntuser.h:41
#define WNDS2_INDESTROY
Definition: ntuser.h:648
#define FNID_FREED
Definition: ntuser.h:900
#define HRGN_WINDOW
Definition: ntuser.h:361
#define WNDS_SENDERASEBACKGROUND
Definition: ntuser.h:614
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c: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:810
BOOL FASTCALL co_UserRedrawWindow(PWND Window, const RECTL *UpdateRect, PREGION UpdateRgn, ULONG Flags)
Definition: painting.c:895
FORCEINLINE PMENU UserGetMenuObject(HMENU hMenu)
Definition: userfuncs.h:3
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFDEVICE Child
Definition: wdffdo.h:536
BOOL NTAPI GreDeleteObject(HGDIOBJ hobj)
Definition: gdiobj.c:1165
BOOL NTAPI GreIsHandleValid(HGDIOBJ hobj)
Definition: gdiobj.c:1153
BOOL FASTCALL IntGdiSetRegionOwner(HRGN hRgn, DWORD OwnerMask)
Definition: region.c:2459
VOID FASTCALL UserClipboardFreeWindow(PWND pWindow)
Definition: clipboard.c:414
BOOL IntDeRegisterShellHookWindow(HWND hWnd)
Definition: desktop.c:1798
VOID FASTCALL UnregisterWindowHotKeys(PWND pWnd)
Definition: hotkey.c:105
BOOL FASTCALL IntDestroyMenuObject(PMENU Menu, BOOL bRecurse)
Definition: menu.c:317
BOOL FASTCALL UserMarkObjectDestroy(PVOID Object)
Definition: object.c:620
BOOL FASTCALL UserDeleteObject(HANDLE h, HANDLE_TYPE type)
Definition: object.c:716
PVOID FASTCALL UserAssignmentUnlock(PVOID *ppvObj)
Definition: object.c:857
VOID FASTCALL UserRemoveWindowProps(_In_ PWND Window)
Definition: prop.c:115
#define USERTAG_WINDOWLIST
Definition: tags.h:298
BOOL FASTCALL DestroyTimersForWindow(PTHREADINFO pti, PWND Window)
Definition: timer.c:528
HWND *FASTCALL IntWinListChildren(PWND Window)
Definition: window.c:275
static VOID UserFreeWindowInfo(PTHREADINFO ti, PWND Wnd)
Definition: window.c:542
PWND FASTCALL IntGetWindowObject(HWND hWnd)
Definition: window.c:75
VOID FASTCALL IntUnlinkWindow(PWND Wnd)
Definition: window.c:1355
LRESULT co_UserFreeWindow(PWND Window, PPROCESSINFO ProcessData, PTHREADINFO ThreadData, BOOLEAN SendMessages)
Definition: window.c:575
static VOID WndSetOwner(_Inout_ PWND pwnd, _In_opt_ PWND pwndOwner)
Definition: window.h:150
static VOID WndSetChild(_Inout_ PWND pwnd, _In_opt_ PWND pwndChild)
Definition: window.h:164
#define IntWndBelongsToThread(WndObj, W32Thread)
Definition: window.h:32
static VOID WndSetParent(_Inout_ PWND pwnd, _In_opt_ PWND pwndParent)
Definition: window.h:157
static VOID WndSetLastActive(_Inout_ PWND pwnd, _In_opt_ PWND pwndLastActive)
Definition: window.h:185
#define RDW_NOINTERNALPAINT
Definition: winuser.h:1228
#define RDW_NOCHILDREN
Definition: winuser.h:1233
#define WM_NCDESTROY
Definition: winuser.h:1712
#define RDW_NOFRAME
Definition: winuser.h:1227
#define RDW_NOERASE
Definition: winuser.h:1226
#define RDW_VALIDATE
Definition: winuser.h:1229
#define NT_ASSERT
Definition: rtlfuncs.h:3327

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

◆ co_UserSetWindowLong()

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

Definition at line 4033 of file window.c.

4034{
4035 return (LONG)co_IntSetWindowLongPtr(hWnd, Index, NewValue, Ansi, sizeof(LONG), FALSE);
4036}
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:3836

Referenced by DesktopWindowProc(), and NtUserSetWindowWord().

◆ co_UserSetWindowLongPtr()

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

Definition at line 4039 of file window.c.

4040{
4041 return co_IntSetWindowLongPtr(hWnd, Index, NewValue, Ansi, sizeof(LONG_PTR), FALSE);
4042}
__int3264 LONG_PTR
Definition: mstsclib_h.h:276

◆ GetNCHitEx()

DWORD FASTCALL GetNCHitEx ( PWND  pWnd,
POINT  pt 
)

Definition at line 1984 of file nonclient.c.

1985{
1986 RECT rcWindow, rcClient;
1988
1989 if (!pWnd) return HTNOWHERE;
1990
1991 if (UserIsDesktopWindow(pWnd))
1992 {
1993 rcClient.left = rcClient.top = rcWindow.left = rcWindow.top = 0;
1998 }
1999 else
2000 {
2001 rcClient = pWnd->rcClient;
2002 rcWindow = pWnd->rcWindow;
2003 }
2004
2005 if (!RECTL_bPointInRect(&rcWindow, pt.x, pt.y)) return HTNOWHERE;
2006
2007 Style = pWnd->style;
2008 ExStyle = pWnd->ExStyle;
2009
2010 if (Style & WS_MINIMIZE) return HTCAPTION;
2011
2012 if (RECTL_bPointInRect( &rcClient, pt.x, pt.y )) return HTCLIENT;
2013
2014 /* Check borders */
2016 {
2018 if (!RECTL_bPointInRect(&rcWindow, pt.x, pt.y ))
2019 {
2020 /* Check top sizing border */
2021 if (pt.y < rcWindow.top)
2022 {
2023 if (pt.x < rcWindow.left+UserGetSystemMetrics(SM_CXSIZE)) return HTTOPLEFT;
2024 if (pt.x >= rcWindow.right-UserGetSystemMetrics(SM_CXSIZE)) return HTTOPRIGHT;
2025 return HTTOP;
2026 }
2027 /* Check bottom sizing border */
2028 if (pt.y >= rcWindow.bottom)
2029 {
2030 if (pt.x < rcWindow.left+UserGetSystemMetrics(SM_CXSIZE)) return HTBOTTOMLEFT;
2031 if (pt.x >= rcWindow.right-UserGetSystemMetrics(SM_CXSIZE)) return HTBOTTOMRIGHT;
2032 return HTBOTTOM;
2033 }
2034 /* Check left sizing border */
2035 if (pt.x < rcWindow.left)
2036 {
2037 if (pt.y < rcWindow.top+UserGetSystemMetrics(SM_CYSIZE)) return HTTOPLEFT;
2038 if (pt.y >= rcWindow.bottom-UserGetSystemMetrics(SM_CYSIZE)) return HTBOTTOMLEFT;
2039 return HTLEFT;
2040 }
2041 /* Check right sizing border */
2042 if (pt.x >= rcWindow.right)
2043 {
2044 if (pt.y < rcWindow.top+UserGetSystemMetrics(SM_CYSIZE)) return HTTOPRIGHT;
2045 if (pt.y >= rcWindow.bottom-UserGetSystemMetrics(SM_CYSIZE)) return HTBOTTOMRIGHT;
2046 return HTRIGHT;
2047 }
2048 }
2049 }
2050 else /* No thick frame */
2051 {
2052 if (HAS_DLGFRAME( Style, ExStyle ))
2054 else if (HAS_THINFRAME( Style, ExStyle ))
2056 else if (HAS_CLIENTFRAME( Style, ExStyle ))
2058 if (!RECTL_bPointInRect( &rcWindow, pt.x, pt.y )) return HTBORDER;
2059 }
2060
2061 /* Check caption */
2062
2063 if ((Style & WS_CAPTION) == WS_CAPTION)
2064 {
2066 rcWindow.top += UserGetSystemMetrics(SM_CYSMCAPTION) - 1;
2067 else
2068 rcWindow.top += UserGetSystemMetrics(SM_CYCAPTION) - 1;
2069 if (!RECTL_bPointInRect( &rcWindow, pt.x, pt.y ))
2070 {
2071 BOOL min_or_max_box = (Style & WS_SYSMENU) && (Style & (WS_MINIMIZEBOX|WS_MAXIMIZEBOX));
2073 {
2074 /* Check system menu */
2075 if ((Style & WS_SYSMENU) && !(ExStyle & WS_EX_TOOLWINDOW) && NC_IconForWindow(pWnd))
2076 {
2077 rcWindow.right -= UserGetSystemMetrics(SM_CYCAPTION) - 1;
2078 if (pt.x > rcWindow.right) return HTSYSMENU;
2079 }
2080
2081 /* Check close button */
2082 if (Style & WS_SYSMENU)
2083 {
2085 if (pt.x < rcWindow.left) return HTCLOSE;
2086 }
2087
2088 /* Check maximize box */
2089 /* In Win95 there is automatically a Maximize button when there is a minimize one */
2090 if (min_or_max_box && !(ExStyle & WS_EX_TOOLWINDOW))
2091 {
2092 rcWindow.left += UserGetSystemMetrics(SM_CXSIZE);
2093 if (pt.x < rcWindow.left) return HTMAXBUTTON;
2094 }
2095
2096 /* Check minimize box */
2097 if (min_or_max_box && !(ExStyle & WS_EX_TOOLWINDOW))
2098 {
2099 rcWindow.left += UserGetSystemMetrics(SM_CXSIZE);
2100 if (pt.x < rcWindow.left) return HTMINBUTTON;
2101 }
2102 }
2103 else
2104 {
2105 /* Check system menu */
2106 if ((Style & WS_SYSMENU) && !(ExStyle & WS_EX_TOOLWINDOW) && NC_IconForWindow(pWnd))
2107 {
2108 rcWindow.left += UserGetSystemMetrics(SM_CYCAPTION) - 1;
2109 if (pt.x < rcWindow.left) return HTSYSMENU;
2110 }
2111
2112 /* Check close button */
2113 if (Style & WS_SYSMENU)
2114 {
2116 if (pt.x > rcWindow.right) return HTCLOSE;
2117 }
2118
2119 /* Check maximize box */
2120 /* In Win95 there is automatically a Maximize button when there is a minimize one */
2121 if (min_or_max_box && !(ExStyle & WS_EX_TOOLWINDOW))
2122 {
2124 if (pt.x > rcWindow.right) return HTMAXBUTTON;
2125 }
2126
2127 /* Check minimize box */
2128 if (min_or_max_box && !(ExStyle & WS_EX_TOOLWINDOW))
2129 {
2131 if (pt.x > rcWindow.right) return HTMINBUTTON;
2132 }
2133 }
2134 return HTCAPTION;
2135 }
2136 }
2137
2138 /* Check menu bar */
2139
2140 if (HAS_MENU( pWnd, Style ) && (pt.y < rcClient.top) &&
2141 (pt.x >= rcClient.left) && (pt.x < rcClient.right))
2142 return HTMENU;
2143
2144 /* Check vertical scroll bar */
2145
2147 if (Style & WS_VSCROLL)
2148 {
2149 if((ExStyle & WS_EX_LEFTSCROLLBAR) != 0)
2151 else
2153 if (RECTL_bPointInRect( &rcClient, pt.x, pt.y )) return HTVSCROLL;
2154 }
2155
2156 /* Check horizontal scroll bar */
2157
2158 if (Style & WS_HSCROLL)
2159 {
2161 if (RECTL_bPointInRect( &rcClient, pt.x, pt.y ))
2162 {
2163 /* Check size box */
2164 if ((Style & WS_VSCROLL) &&
2165 ((((ExStyle & WS_EX_LEFTSCROLLBAR) != 0) && (pt.x <= rcClient.left + UserGetSystemMetrics(SM_CXVSCROLL))) ||
2166 (((ExStyle & WS_EX_LEFTSCROLLBAR) == 0) && (pt.x >= rcClient.right - UserGetSystemMetrics(SM_CXVSCROLL)))))
2167 return HTSIZE;
2168 return HTHSCROLL;
2169 }
2170 }
2171
2172 /* Has to return HTNOWHERE if nothing was found
2173 Could happen when a window has a customized non client area */
2174 return HTNOWHERE;
2175}
#define pt(x, y)
Definition: drawing.c:79
unsigned int BOOL
Definition: ntddk_ex.h:94
#define WS_CAPTION
Definition: pedump.c:624
#define WS_MAXIMIZEBOX
Definition: pedump.c:632
#define WS_SYSMENU
Definition: pedump.c:629
#define WS_MINIMIZEBOX
Definition: pedump.c:631
DWORD ExStyle
Definition: ntuser.h:704
DWORD style
Definition: ntuser.h:706
RECT rcClient
Definition: ntuser.h:717
RECT rcWindow
Definition: ntuser.h:716
LONG right
Definition: windef.h:108
LONG bottom
Definition: windef.h:109
LONG top
Definition: windef.h:107
LONG left
Definition: windef.h:106
#define HAS_MENU(hwnd, style)
Definition: uxthemep.h:248
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:209
PCURICON_OBJECT FASTCALL NC_IconForWindow(PWND pWnd)
Definition: nonclient.c:736
#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:2528
#define HTCLOSE
Definition: winuser.h:2535
#define SM_CYEDGE
Definition: winuser.h:1020
#define SM_CYSCREEN
Definition: winuser.h:971
#define HTCAPTION
Definition: winuser.h:2512
#define SM_CXEDGE
Definition: winuser.h:1019
#define HTTOPLEFT
Definition: winuser.h:2527
#define SM_CYSIZE
Definition: winuser.h:1003
#define SM_CXVSCROLL
Definition: winuser.h:972
#define HTBOTTOM
Definition: winuser.h:2529
#define HTBORDER
Definition: winuser.h:2533
#define SM_CXFRAME
Definition: winuser.h:1005
#define HTVSCROLL
Definition: winuser.h:2518
#define HTHSCROLL
Definition: winuser.h:2517
#define HTMAXBUTTON
Definition: winuser.h:2520
#define SM_CXSIZE
Definition: winuser.h:1002
#define SM_CYFRAME
Definition: winuser.h:1007
#define SM_CYHSCROLL
Definition: winuser.h:973
#define HTMENU
Definition: winuser.h:2516
#define SM_CYBORDER
Definition: winuser.h:976
#define SM_CXBORDER
Definition: winuser.h:975
#define HTRIGHT
Definition: winuser.h:2525
#define HTCLIENT
Definition: winuser.h:2511
#define HTBOTTOMRIGHT
Definition: winuser.h:2531
#define HTNOWHERE
Definition: winuser.h:2510
#define SM_CXDLGFRAME
Definition: winuser.h:977
#define HTSIZE
Definition: winuser.h:2515
#define HTBOTTOMLEFT
Definition: winuser.h:2530
#define HTTOP
Definition: winuser.h:2526
#define SM_CYSMCAPTION
Definition: winuser.h:1025
#define SM_CYDLGFRAME
Definition: winuser.h:979
#define WS_EX_LEFTSCROLLBAR
Definition: winuser.h:392
#define SM_CXSCREEN
Definition: winuser.h:970
#define HTMINBUTTON
Definition: winuser.h:2519
#define HTSYSMENU
Definition: winuser.h:2513
#define HTLEFT
Definition: winuser.h:2523
#define SM_CYCAPTION
Definition: winuser.h:974

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

◆ IntBroadcastImeShowStatusChange()

BOOL FASTCALL IntBroadcastImeShowStatusChange ( _In_ PWND  pImeWnd,
_In_ BOOL  bShow 
)

Definition at line 2514 of file ime.c.

2517{
2518 if (gfIMEShowStatus == bShow || !IS_IMM_MODE())
2519 return TRUE;
2520
2521 gfIMEShowStatus = bShow;
2522 IntNotifyImeShowStatus(pImeWnd);
2523 return TRUE;
2524}
VOID FASTCALL IntNotifyImeShowStatus(_In_ PWND pImeWnd)
Definition: ime.c:2447
BOOL gfIMEShowStatus
Definition: ime.c:24

Referenced by NtUserCallHwndParamLock().

◆ IntBuildHwndList()

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

Definition at line 1422 of file window.c.

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

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

◆ IntCheckImeShowStatusInThread()

VOID FASTCALL IntCheckImeShowStatusInThread ( _In_ PWND  pImeWnd)

Definition at line 2527 of file ime.c.

2528{
2529 if (IS_IMM_MODE() && !(pImeWnd->state2 & WNDS2_INDESTROY))
2530 IntCheckImeShowStatus(pImeWnd, pImeWnd->head.pti);
2531}
BOOL FASTCALL IntCheckImeShowStatus(_In_ PWND pwndIme, _In_ PTHREADINFO pti)
Definition: ime.c:2243

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

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

Referenced by co_UserCreateWindowEx(), and IntCreateDesktop().

◆ IntDefWindowProc()

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

Definition at line 633 of file defwnd.c.

639{
641 LRESULT lResult = 0;
643
644 if (Msg > WM_USER) return 0;
645
646 switch (Msg)
647 {
648 case WM_DEVICECHANGE:
649 return TRUE;
650
651 case WM_GETTEXTLENGTH:
652 {
653 PWSTR buf;
654 ULONG len;
655
656 if (Wnd != NULL && Wnd->strName.Length != 0)
657 {
658 buf = Wnd->strName.Buffer;
659 if (buf != NULL &&
661 buf,
662 Wnd->strName.Length)))
663 {
664 lResult = (LRESULT) (Wnd->strName.Length / sizeof(WCHAR));
665 }
666 }
667
668 break;
669 }
670
671 case WM_GETTEXT: // FIXME: Handle Ansi
672 {
673 PWSTR buf = NULL;
674 PWSTR outbuf = (PWSTR)lParam;
675
676 if (Wnd != NULL && wParam != 0)
677 {
678 if (Wnd->strName.Buffer != NULL)
679 buf = Wnd->strName.Buffer;
680 else
681 outbuf[0] = L'\0';
682
683 if (buf != NULL)
684 {
685 if (Wnd->strName.Length != 0)
686 {
687 lResult = min(Wnd->strName.Length / sizeof(WCHAR), wParam - 1);
688 RtlCopyMemory(outbuf,
689 buf,
690 lResult * sizeof(WCHAR));
691 outbuf[lResult] = L'\0';
692 }
693 else
694 outbuf[0] = L'\0';
695 }
696 }
697 break;
698 }
699
700 case WM_SETTEXT: // FIXME: Handle Ansi
701 {
702 DefSetText(Wnd, (PCWSTR)lParam);
703
704 if ((Wnd->style & WS_CAPTION) == WS_CAPTION)
706 IntNotifyWinEvent(EVENT_OBJECT_NAMECHANGE, Wnd, OBJID_WINDOW, CHILDID_SELF, 0);
707 lResult = 1;
708 break;
709 }
710
711 case WM_SYSCOMMAND:
712 {
713 TRACE("hwnd %p WM_SYSCOMMAND %lx %lx\n", UserHMGetHandle(Wnd), wParam, lParam );
714 lResult = DefWndHandleSysCommand(Wnd, wParam, lParam);
715 break;
716 }
717
718 case WM_SHOWWINDOW:
719 {
720 if ((Wnd->style & WS_VISIBLE) && wParam) break;
721 if (!(Wnd->style & WS_VISIBLE) && !wParam) break;
722 if (!Wnd->spwndOwner) break;
723 if (LOWORD(lParam))
724 {
726 }
727 break;
728 }
729
731 return IntClientShutdown(Wnd, wParam, lParam);
732
733 case WM_APPCOMMAND:
734 {
735 PWND Parent;
736 if ( (Wnd->style & (WS_POPUP|WS_CHILD)) != WS_CHILD &&
737 Wnd != co_GetDesktopWindow(Wnd) )
738 {
739 if (!co_HOOK_CallHooks(WH_SHELL, HSHELL_APPCOMMAND, wParam, lParam))
740 co_IntShellHookNotify(HSHELL_APPCOMMAND, wParam, lParam);
741 break;
742 }
743 Parent = Wnd->spwndParent;
744 UserRefObjectCo(Parent, &Ref);
747 break;
748 }
749
751 /* This is an undocumented message used by the windows taskbar to
752 display the system menu of windows that belong to other processes. */
754 break;
755
756 case WM_KEYF1:
757 {
758 HELPINFO hi;
759 HMENU hMenu = UlongToHandle(Wnd->IDMenu);
760 PWND pwndActive = MENU_IsMenuActive();
761 hi.cbSize = sizeof(HELPINFO);
762 hi.MousePos = gpsi->ptCursor;
764 hi.hItemHandle = pwndActive ? UserHMGetHandle(pwndActive) : UserHMGetHandle(Wnd);
765 hi.iCtrlId = (Wnd->style & (WS_POPUP|WS_CHILD)) == WS_CHILD ? IntMenuItemFromPoint(Wnd, hMenu, hi.MousePos) : 0;
767
768 co_IntSendMessage( UserHMGetHandle(Wnd), WM_HELP, 0, (LPARAM)&hi );
769 break;
770 }
771
772 case WM_SETICON:
773 {
774 return DefWndSetIcon(Wnd, wParam, lParam);
775 }
776
777 case WM_GETICON:
778 {
779 return DefWndGetIcon(Wnd, wParam, lParam);
780 }
781
782 case WM_HELP:
783 {
784 PWND Parent = IntGetParent(Wnd);
786 break;
787 }
788
789 case WM_LBUTTONDOWN:
790 case WM_RBUTTONDOWN:
791 case WM_MBUTTONDOWN:
793 break;
794
795 case WM_NCLBUTTONDOWN:
797
798 case WM_NCRBUTTONDOWN:
800
801 case WM_LBUTTONDBLCLK:
803
806
807 case WM_RBUTTONUP:
808 {
809 POINT Pt;
810
811 Pt.x = GET_X_LPARAM(lParam);
812 Pt.y = GET_Y_LPARAM(lParam);
813 IntClientToScreen(Wnd, &Pt);
814 lParam = MAKELPARAM(Pt.x, Pt.y);
816 break;
817 }
818
819 case WM_NCRBUTTONUP:
820 /*
821 * FIXME : we must NOT send WM_CONTEXTMENU on a WM_NCRBUTTONUP (checked
822 * in Windows), but what _should_ we do? According to MSDN :
823 * "If it is appropriate to do so, the system sends the WM_SYSCOMMAND
824 * message to the window". When is it appropriate?
825 */
826 ERR("WM_NCRBUTTONUP\n");
827 break;
828
829 case WM_XBUTTONUP:
830 case WM_NCXBUTTONUP:
831 if (HIWORD(wParam) == XBUTTON1 || HIWORD(wParam) == XBUTTON2)
832 {
834 MAKELPARAM(LOWORD(wParam), FAPPCOMMAND_MOUSE | HIWORD(wParam)));
835 }
836 break;
837
838
839 case WM_CONTEXTMENU:
840 {
841 if (Wnd->style & WS_CHILD)
842 {
844 }
845 else
846 {
847 POINT Pt;
849 LONG HitCode;
850
851 Style = Wnd->style;
852
853 Pt.x = GET_X_LPARAM(lParam);
854 Pt.y = GET_Y_LPARAM(lParam);
855 if (Style & WS_CHILD)
856 {
858 }
859
860 HitCode = GetNCHitEx(Wnd, Pt);
861
862 if (HitCode == HTCAPTION || HitCode == HTSYSMENU)
863 {
864 PMENU SystemMenu;
865 UINT Flags;
866
867 if((SystemMenu = IntGetSystemMenu(Wnd, FALSE)))
868 {
869 MENU_InitSysMenuPopup(SystemMenu, Wnd->style, Wnd->pcls->style, HitCode);
870
871 if(HitCode == HTCAPTION)
873 else
875
876 IntTrackPopupMenuEx(SystemMenu, Flags|TPM_SYSTEM_MENU, Pt.x, Pt.y, Wnd, NULL);
877 }
878 }
879 if (HitCode == HTHSCROLL || HitCode == HTVSCROLL)
880 {
881 WARN("Scroll Menu Not Supported\n");
882 }
883 }
884 break;
885 }
886
887 case WM_KEYDOWN:
888 if (wParam == VK_F10)
889 {
890 pti->MessageQueue->QF_flags |= QF_FF10STATUS;
891
892 if (UserGetKeyState(VK_SHIFT) & 0x8000)
893 {
895 }
896 }
898 {
899 HWND hwndTop = UserGetForegroundWindow();
900 PWND topWnd = UserGetWindowObject(hwndTop);
901 BOOL allowSnap;
902
903 // MS Doc: foreground window can be NULL, e.g. when window is losing activation
904 if (!topWnd)
905 return 0;
906
907 allowSnap = IntIsSnapAllowedForWindow(topWnd);
908 /* Allow the minimize action if it has a minimize button, even if the window cannot be snapped (e.g. Calc.exe) */
909 if (!allowSnap && (topWnd->style & (WS_MINIMIZEBOX|WS_THICKFRAME)) == WS_MINIMIZEBOX)
910 allowSnap = wParam == VK_DOWN;
911
912 if (allowSnap)
913 {
914 UINT snapped = IntGetWindowSnapEdge(topWnd);
915
916 if (wParam == VK_DOWN)
917 {
918 if (topWnd->style & WS_MAXIMIZE)
920 else if (snapped)
921 co_IntUnsnapWindow(topWnd);
922 else
924 }
925 else if (wParam == VK_UP)
926 {
927 if (topWnd->style & WS_MINIMIZE)
929 else
931 }
932 else if (wParam == VK_LEFT || wParam == VK_RIGHT)
933 {
934 UINT edge = wParam == VK_LEFT ? HTLEFT : HTRIGHT;
935 UINT otherEdge = edge == HTLEFT ? HTRIGHT : HTLEFT;
936
937 if (topWnd->style & WS_MAXIMIZE)
938 {
939 /* SC_RESTORE + Snap causes the window to visually move twice, place it manually in the snap position */
940 RECT normalRect = topWnd->InternalPos.NormalRect;
941 co_IntCalculateSnapPosition(topWnd, edge, &topWnd->InternalPos.NormalRect); /* Calculate edge position */
942 IntSetSnapEdge(topWnd, edge); /* Tell everyone the edge we are snapped to */
944 IntSetSnapInfo(topWnd, edge, &normalRect); /* Reset the real place to unsnap to */
945 snapped = HTNOWHERE; /* Force snap */
946 }
947#if 0 /* Windows 8 does this but is it a good feature? */
948 else if (snapped == edge)
949 {
950 /* Already snapped to this edge, snap to the opposite side */
951 edge = otherEdge;
952 }
953#endif
954
955 if (snapped == otherEdge)
956 co_IntUnsnapWindow(topWnd);
957 else
958 co_IntSnapWindow(topWnd, edge);
959 }
960 }
961 }
962 break;
963
964 case WM_SYSKEYDOWN:
965 {
966 if (HIWORD(lParam) & KF_ALTDOWN)
967 { /* Previous state, if the key was down before this message,
968 this is a cheap way to ignore autorepeat keys. */
969 if ( !(HIWORD(lParam) & KF_REPEAT) )
970 {
971 if ( ( wParam == VK_MENU ||
972 wParam == VK_LMENU ||
973 wParam == VK_RMENU ) && !(pti->MessageQueue->QF_flags & QF_FMENUSTATUS)) //iMenuSysKey )
974 pti->MessageQueue->QF_flags |= QF_FMENUSTATUS; //iMenuSysKey = 1;
975 else
976 pti->MessageQueue->QF_flags &= ~QF_FMENUSTATUS; //iMenuSysKey = 0;
977 }
978
979 pti->MessageQueue->QF_flags &= ~QF_FF10STATUS; //iF10Key = 0;
980
981 if (wParam == VK_F4) /* Try to close the window */
982 {
984 if (!(top->pcls->style & CS_NOCLOSE))
986 }
987 else if (wParam == VK_SNAPSHOT) // Alt-VK_SNAPSHOT?
988 {
989 PWND pwnd = Wnd;
990 while (IntGetParent(pwnd) != NULL)
991 {
992 pwnd = IntGetParent(pwnd);
993 }
994 ERR("DefWndScreenshot\n");
995 DefWndScreenshot(pwnd);
996 }
997 else if ( wParam == VK_ESCAPE || wParam == VK_TAB ) // Alt-Tab/ESC Alt-Shift-Tab/ESC
998 {
999 WPARAM wParamTmp;
1000 HWND Active = UserGetActiveWindow(); // Noticed MDI problem.
1001 if (!Active)
1002 {
1003 FIXME("WM_SYSKEYDOWN VK_ESCAPE no active\n");
1004 break;
1005 }
1006 wParamTmp = UserGetKeyState(VK_SHIFT) & 0x8000 ? SC_PREVWINDOW : SC_NEXTWINDOW;
1008 }
1009 }
1010 else if( wParam == VK_F10 )
1011 {
1012 if (UserGetKeyState(VK_SHIFT) & 0x8000)
1014 pti->MessageQueue->QF_flags |= QF_FF10STATUS; //iF10Key = 1;
1015 }
1016 else if( wParam == VK_ESCAPE && (UserGetKeyState(VK_SHIFT) & 0x8000))
1018 break;
1019 }
1020
1021 case WM_KEYUP:
1022 case WM_SYSKEYUP:
1023 {
1024 /* Press and release F10 or ALT */
1025 if (((wParam == VK_MENU || wParam == VK_LMENU || wParam == VK_RMENU)
1026 && (pti->MessageQueue->QF_flags & (QF_FMENUSTATUS|QF_FMENUSTATUSBREAK)) == QF_FMENUSTATUS /*iMenuSysKey*/) ||
1027 ((wParam == VK_F10) && pti->MessageQueue->QF_flags & QF_FF10STATUS /*iF10Key*/))
1029 pti->MessageQueue->QF_flags &= ~(QF_FMENUSTATUS|QF_FMENUSTATUSBREAK|QF_FF10STATUS); //iMenuSysKey = iF10Key = 0;
1030 break;
1031 }
1032
1033 case WM_SYSCHAR:
1034 {
1035 pti->MessageQueue->QF_flags &= ~(QF_FMENUSTATUS|QF_FMENUSTATUSBREAK); //iMenuSysKey = 0;
1036 if (wParam == VK_RETURN && (Wnd->style & WS_MINIMIZE) != 0)
1037 {
1039 break;
1040 }
1041 if ((HIWORD(lParam) & KF_ALTDOWN) && wParam)
1042 {
1043 if (wParam == VK_TAB || wParam == VK_ESCAPE) break;
1044 if (wParam == VK_SPACE && Wnd->style & WS_CHILD)
1046 else
1048 }
1049 else /* check for Ctrl-Esc */
1050 if (wParam != VK_ESCAPE) UserPostMessage(hwndSAS, WM_LOGONNOTIFY, LN_MESSAGE_BEEP, 0); //MessageBeep(0);
1051 break;
1052 }
1053
1054 case WM_CANCELMODE:
1055 {
1056 pti->MessageQueue->QF_flags &= ~(QF_FMENUSTATUS|QF_FMENUSTATUSBREAK);
1057
1058 MENU_EndMenu( Wnd );
1060 {
1062 }
1063 break;
1064 }
1065
1066 case WM_CLOSE:
1068 break;
1069
1070 case WM_CTLCOLORMSGBOX:
1071 case WM_CTLCOLOREDIT:
1072 case WM_CTLCOLORLISTBOX:
1073 case WM_CTLCOLORBTN:
1074 case WM_CTLCOLORDLG:
1075 case WM_CTLCOLORSTATIC:
1078
1079 case WM_CTLCOLOR:
1081
1082 case WM_SETCURSOR:
1083 {
1084 if (Wnd->style & WS_CHILD)
1085 {
1086 /* with the exception of the border around a resizable wnd,
1087 * give the parent first chance to set the cursor */
1089 {
1090 PWND parent = Wnd->spwndParent;//IntGetParent( Wnd );
1091 if (parent != UserGetDesktopWindow() &&
1093 return TRUE;
1094 }
1095 }
1096 return DefWndHandleSetCursor(Wnd, wParam, lParam);
1097 }
1098
1099 case WM_MOUSEACTIVATE:
1100 if (Wnd->style & WS_CHILD)
1101 {
1103 PWND pwndParent = IntGetParent(Wnd);
1104 hwndParent = pwndParent ? UserHMGetHandle(pwndParent) : NULL;
1105 if (hwndParent)
1106 {
1108 if (lResult)
1109 break;
1110 }
1111 }
1113
1114 case WM_ACTIVATE:
1115 /* The default action in Windows is to set the keyboard focus to
1116 * the window, if it's being activated and not minimized */
1117 if (LOWORD(wParam) != WA_INACTIVE &&
1118 !(Wnd->style & WS_MINIMIZE))
1119 {
1120 //ERR("WM_ACTIVATE %p\n",hWnd);
1121 co_UserSetFocus(Wnd);
1122 }
1123 break;
1124
1125 case WM_MOUSEWHEEL:
1126 if (Wnd->style & WS_CHILD)
1127 {
1129 PWND pwndParent = IntGetParent(Wnd);
1130 hwndParent = pwndParent ? UserHMGetHandle(pwndParent) : NULL;
1132 }
1133 break;
1134
1135 case WM_ERASEBKGND:
1136 case WM_ICONERASEBKGND:
1137 {
1138 RECT Rect;
1139 HBRUSH hBrush = Wnd->pcls->hbrBackground;
1140 if (!hBrush) return 0;
1141 if (hBrush <= (HBRUSH)COLOR_MENUBAR)
1142 {
1143 hBrush = IntGetSysColorBrush(HandleToUlong(hBrush));
1144 }
1145 if (Wnd->pcls->style & CS_PARENTDC)
1146 {
1147 /* can't use GetClipBox with a parent DC or we fill the whole parent */
1148 IntGetClientRect(Wnd, &Rect);
1150 }
1151 else
1152 {
1153 GdiGetClipBox((HDC)wParam, &Rect);
1154 }
1155 FillRect((HDC)wParam, &Rect, hBrush);
1156 return (1);
1157 }
1158
1159 case WM_GETHOTKEY:
1160 //ERR("WM_GETHOTKEY\n");
1161 return DefWndGetHotKey(Wnd);
1162 case WM_SETHOTKEY:
1163 //ERR("WM_SETHOTKEY\n");
1164 return DefWndSetHotKey(Wnd, wParam);
1165
1166 case WM_NCHITTEST:
1167 {
1168 POINT Point;
1171 return GetNCHitEx(Wnd, Point);
1172 }
1173
1174 case WM_PRINT:
1175 {
1176 DefWndPrint(Wnd, (HDC)wParam, lParam);
1177 return (0);
1178 }
1179
1180 case WM_SYSCOLORCHANGE:
1181 {
1182 /* force to redraw non-client area */
1183 UserPaintCaption(Wnd, DC_NC);
1184 /* Use InvalidateRect to redraw client area, enable
1185 * erase to redraw all subcontrols otherwise send the
1186 * WM_SYSCOLORCHANGE to child windows/controls is required
1187 */
1189 return (0);
1190 }
1191
1192 case WM_PAINTICON:
1193 case WM_PAINT:
1194 {
1195 PAINTSTRUCT Ps;
1196 HDC hDC;
1197
1198 /* If already in Paint and Client area is not empty just return. */
1199 if (Wnd->state2 & WNDS2_STARTPAINT && !RECTL_bIsEmptyRect(&Wnd->rcClient))
1200 {
1201 ERR("In Paint and Client area is not empty!\n");
1202 return 0;
1203 }
1204
1205 hDC = IntBeginPaint(Wnd, &Ps);
1206 if (hDC)
1207 {
1208 if (((Wnd->style & WS_MINIMIZE) != 0) && (Wnd->pcls->spicn))
1209 {
1210 RECT ClientRect;
1211 INT x, y;
1212
1213 ERR("Doing Paint and Client area is empty!\n");
1214 IntGetClientRect(Wnd, &ClientRect);
1215 x = (ClientRect.right - ClientRect.left - UserGetSystemMetrics(SM_CXICON)) / 2;
1216 y = (ClientRect.bottom - ClientRect.top - UserGetSystemMetrics(SM_CYICON)) / 2;
1217 UserReferenceObject(Wnd->pcls->spicn);
1218 UserDrawIconEx(hDC, x, y, Wnd->pcls->spicn, 0, 0, 0, 0, DI_NORMAL | DI_COMPAT | DI_DEFAULTSIZE);
1219 UserDereferenceObject(Wnd->pcls->spicn);
1220 }
1221
1222 IntEndPaint(Wnd, &Ps);
1223 }
1224 return (0);
1225 }
1226
1227 case WM_SYNCPAINT:
1228 {
1229 HRGN hRgn;
1230 Wnd->state &= ~WNDS_SYNCPAINTPENDING;
1231 TRACE("WM_SYNCPAINT\n");
1232 hRgn = NtGdiCreateRectRgn(0, 0, 0, 0);
1233 if (hRgn)
1234 {
1236 {
1237 PREGION pRgn = REGION_LockRgn(hRgn);
1238 if (pRgn) REGION_UnlockRgn(pRgn);
1239 if (!wParam)
1241 co_UserRedrawWindow(Wnd, NULL, pRgn, wParam);
1242 }
1244 }
1245 return 0;
1246 }
1247
1248 case WM_SETREDRAW:
1249 if (wParam)
1250 {
1251 if (!(Wnd->style & WS_VISIBLE))
1252 {
1253 IntSetStyle( Wnd, WS_VISIBLE, 0 );
1254 Wnd->state |= WNDS_SENDNCPAINT;
1255 }
1256 }
1257 else
1258 {
1259 if (Wnd->style & WS_VISIBLE)
1260 {
1262 IntSetStyle( Wnd, 0, WS_VISIBLE );
1263 }
1264 }
1265 return 0;
1266
1268 {
1270 }
1271
1273 {
1275 }
1276
1277 case WM_NCCALCSIZE:
1278 {
1279 return NC_HandleNCCalcSize( Wnd, wParam, (RECTL *)lParam, FALSE );
1280 }
1281
1282 case WM_NCACTIVATE:
1283 {
1284 return NC_HandleNCActivate( Wnd, wParam, lParam );
1285 }
1286
1287 //
1288 // NC Paint mode.
1289 //
1290 case WM_NCPAINT:
1291 {
1293 Wnd->state |= WNDS_FORCEMENUDRAW;
1294 NC_DoNCPaint(Wnd, hDC, -1);
1295 Wnd->state &= ~WNDS_FORCEMENUDRAW;
1296 UserReleaseDC(Wnd, hDC, FALSE);
1297 return 0;
1298 }
1299 //
1300 // Draw Caption mode.
1301 //
1302 // wParam are DC_* flags.
1303 //
1305 {
1307 TRACE("WM_NCUAHDRAWCAPTION: wParam DC_ flags %08x\n",wParam);
1308 UserDrawCaptionBar(Wnd, hDC, wParam | DC_FRAME); // Include DC_FRAME to comp for drawing glitch.
1309 UserReleaseDC(Wnd, hDC, FALSE);
1310 return 0;
1311 }
1312 //
1313 // Draw Frame mode.
1314 //
1315 // wParam is HDC, lParam are DC_ACTIVE and or DC_REDRAWHUNGWND.
1316 //
1317 case WM_NCUAHDRAWFRAME:
1318 {
1319 TRACE("WM_NCUAHDRAWFRAME: wParam hDC %p lParam DC_ flags %08x\n",wParam,lParam);
1321 return 0;
1322 }
1323
1324 /* ReactOS only. */
1325 case WM_CBT:
1326 {
1327 switch (wParam)
1328 {
1329 case HCBT_MOVESIZE:
1330 {
1331 RECTL rt;
1332
1333 if (lParam)
1334 {
1335 _SEH2_TRY
1336 {
1338 sizeof(RECT),
1339 1);
1340
1341 RtlCopyMemory(&rt,
1342 (PVOID)lParam,
1343 sizeof(RECT));
1344 }
1346 {
1347 lResult = 1;
1348 }
1349 _SEH2_END;
1350 }
1351 if (!lResult)
1353
1354 break;
1355 }
1356 }
1357 break;
1358 }
1359 }
1360 return lResult;
1361}
static HDC hDC
Definition: 3dtext.c:33
#define DCX_USESTYLE
Definition: GetDCEx.c:10
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn UINT32 *TableIdx UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER void *Data ACPI_OBJECT_HANDLER void **Data ACPI_STRING ACPI_OBJECT_LIST ACPI_BUFFER *ReturnObjectBuffer ACPI_DEVICE_INFO **ReturnBuffer ACPI_HANDLE Parent
Definition: acpixf.h:732
#define FIXME(fmt,...)
Definition: precomp.h:53
#define WARN(fmt,...)
Definition: precomp.h:61
#define UlongToHandle(ul)
Definition: basetsd.h:91
#define HandleToUlong(h)
Definition: basetsd.h:73
struct @1767 Msg[]
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
BOOL FASTCALL GreDPtoLP(HDC, LPPOINT, INT)
Definition: dcutil.c:7
static HWND hwndParent
Definition: cryptui.c:300
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
r parent
Definition: btrfs.c:3010
VOID NTAPI ProbeForRead(IN CONST VOID *Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:102
HWND FASTCALL co_UserSetFocus(PWND Window)
Definition: focus.c:1311
HWND FASTCALL IntGetCaptureWindow(VOID)
Definition: focus.c:34
HWND FASTCALL UserGetForegroundWindow(VOID)
Definition: focus.c:1418
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLenum GLsizei len
Definition: glext.h:6722
#define WNDS_FORCEMENUDRAW
Definition: ntuser.h:620
#define WNDS2_STARTPAINT
Definition: ntuser.h:643
HGDIOBJ FASTCALL IntGetSysColorBrush(INT Object)
Definition: stockobj.c:317
static HDC
Definition: imagelist.c:88
static HRGN hRgn
Definition: mapping.c:33
#define WM_KEYF1
Definition: msg.c:49
#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:146
__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:94
LRESULT DefWndHandleSetCursor(PWND pWnd, WPARAM wParam, LPARAM lParam)
Definition: defwnd.c:241
LRESULT FASTCALL DefWndGetIcon(PWND pWnd, WPARAM wParam, LPARAM lParam)
Definition: defwnd.c:471
VOID FASTCALL DefWndScreenshot(PWND pWnd)
Definition: defwnd.c:546
LRESULT FASTCALL DefWndHandleWindowPosChanging(PWND pWnd, WINDOWPOS *Pos)
Definition: defwnd.c:68
VOID FASTCALL DefWndPrint(PWND pwnd, HDC hdc, ULONG uFlags)
Definition: defwnd.c:362
LRESULT FASTCALL DefWndHandleSysCommand(PWND pWnd, WPARAM wParam, LPARAM lParam)
Definition: defwnd.c:123
BOOL UserPaintCaption(PWND pWnd, INT Flags)
Definition: defwnd.c:395
LRESULT FASTCALL DefWndSetIcon(PWND pWnd, WPARAM wParam, LPARAM lParam)
Definition: defwnd.c:433
static BOOL co_UserTrackSystemMenu(_In_ PWND pWnd, _In_ LONG nClickPos, _In_opt_ PUINT puCmdType)
Definition: defwnd.c:580
HBRUSH FASTCALL DefWndControlColor(HDC hDC, UINT ctlType)
Definition: defwnd.c:32
BOOL FASTCALL IntClientToScreen(PWND Wnd, LPPOINT lpPoint)
Definition: winpos.c:199
VOID FASTCALL IntSetSnapInfo(PWND Wnd, UINT Edge, IN const RECT *Pos OPTIONAL)
Definition: winpos.c:4041
VOID FASTCALL co_IntSnapWindow(PWND Wnd, UINT Edge)
Definition: winpos.c:3969
VOID FASTCALL co_IntCalculateSnapPosition(PWND Wnd, UINT Edge, OUT RECT *Pos)
Definition: winpos.c:3939
BOOL FASTCALL IntScreenToClient(PWND Wnd, LPPOINT lpPoint)
Definition: winpos.c:213
UINT FASTCALL IntGetWindowSnapEdge(PWND Wnd)
Definition: winpos.c:3931
VOID FASTCALL IntSetSnapEdge(PWND Wnd, UINT Edge)
Definition: winpos.c:4016
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:3425
int iCtrlId
Definition: winuser.h:3422
DWORD_PTR dwContextId
Definition: winuser.h:3424
HANDLE hItemHandle
Definition: winuser.h:3423
int iContextType
Definition: winuser.h:3421
UINT cbSize
Definition: winuser.h:3420
#define WM_MOUSEWHEEL
Definition: treelist.c:96
uint16_t * PWSTR
Definition: typedefs.h:56
const uint16_t * PCWSTR
Definition: typedefs.h:57
int32_t INT
Definition: typedefs.h:58
#define MAKELONG(a, b)
Definition: typedefs.h:249
#define HIWORD(l)
Definition: typedefs.h:247
#define DCX_KEEPCLIPRGN
Definition: undocuser.h:69
#define TPM_SYSTEM_MENU
Definition: undocuser.h:74
#define WM_NCUAHDRAWCAPTION
Definition: undocuser.h:48
#define DC_FRAME
Definition: undocuser.h:150
#define WM_LOGONNOTIFY
Definition: undocuser.h:39
#define LN_MESSAGE_BEEP
Definition: undocuser.h:121
#define WM_CLIENTSHUTDOWN
Definition: undocuser.h:37
#define WM_POPUPSYSTEMMENU
Definition: undocuser.h:62
#define WM_CBT
Definition: undocuser.h:64
#define WM_NCUAHDRAWFRAME
Definition: undocuser.h:49
HDC FASTCALL IntBeginPaint(PWND Window, PPAINTSTRUCT Ps)
Definition: painting.c:1441
BOOL FASTCALL IntEndPaint(PWND Wnd, PPAINTSTRUCT Ps)
Definition: painting.c:1537
INT FASTCALL co_UserGetUpdateRgn(PWND Window, HRGN hRgn, BOOL bErase)
Definition: painting.c:1788
DWORD FASTCALL IntGetWindowContextHelpId(PWND pWnd)
Definition: window.c:439
PWND FASTCALL UserGetWindowObject(HWND hWnd)
Definition: window.c:123
PWND FASTCALL UserGetAncestor(PWND Wnd, UINT Type)
BOOLEAN co_UserDestroyWindow(PVOID Object)
Definition: window.c:2865
INT FASTCALL UserReleaseDC(PWND Window, HDC hDc, BOOL EndPaint)
Definition: windc.c:918
BOOL APIENTRY DefSetText(PWND Wnd, PCWSTR WindowText)
Definition: window.c:4385
HDC FASTCALL UserGetDCEx(PWND Window OPTIONAL, HANDLE ClipRegion, ULONG Flags)
FORCEINLINE BOOL RECTL_bIsEmptyRect(_In_ const RECTL *prcl)
Definition: rect.h:44
PREGION FASTCALL REGION_LockRgn(_In_ HRGN hrgn)
Definition: region.c:2358
VOID FASTCALL REGION_UnlockRgn(_In_ PREGION prgn)
Definition: region.c:2373
BOOL UserDrawIconEx(HDC hDc, INT xLeft, INT yTop, PCURICON_OBJECT pIcon, INT cxWidth, INT cyHeight, UINT istepIfAniCur, HBRUSH hbrFlickerFreeDraw, UINT diFlags)
Definition: cursoricon.c:1691
PWND FASTCALL UserGetDesktopWindow(VOID)
Definition: desktop.c:1402
UINT FASTCALL DefWndGetHotKey(PWND pWnd)
Definition: hotkey.c:336
INT FASTCALL DefWndSetHotKey(PWND pWnd, WPARAM wParam)
Definition: hotkey.c:361
BYTE gafAsyncKeyState[256 *2/8]
Definition: keyboard.c:13
#define IS_KEY_DOWN(ks, vk)
Definition: input.h:102
PMENU FASTCALL IntGetSystemMenu(PWND Window, BOOL bRevert)
Definition: menu.c:5409
INT FASTCALL IntMenuItemFromPoint(PWND pWnd, HMENU hMenu, POINT ptScreen)
Definition: menu.c:1518
PWND MENU_IsMenuActive(VOID)
Definition: menu.c:2650
void MENU_EndMenu(PWND pwnd)
Definition: menu.c:2662
void FASTCALL MENU_InitSysMenuPopup(PMENU menu, DWORD style, DWORD clsStyle, LONG HitTest)
Definition: menu.c:1362
BOOL FASTCALL IntTrackPopupMenuEx(_Inout_ PMENU menu, _In_ UINT wFlags, _In_ INT x, _In_ INT y, _In_ PWND pWnd, _In_opt_ const TPMPARAMS *lpTpm)
Definition: menu.c:4575
BOOL FASTCALL UserPostMessage(HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1395
LRESULT NC_HandleNCLButtonDown(PWND pWnd, WPARAM wParam, LPARAM lParam)
Definition: nonclient.c:1574
VOID UserDrawCaptionBar(PWND pWnd, HDC hDC, INT Flags)
Definition: nonclient.c:955
DWORD FASTCALL GetNCHitEx(PWND pWnd, POINT pt)
Definition: nonclient.c:1984
LRESULT NC_HandleNCActivate(PWND Wnd, WPARAM wParam, LPARAM lParam)
Definition: nonclient.c:1437
LRESULT NC_DoNCPaint(PWND pWnd, HDC hDC, INT Flags)
Definition: nonclient.c:1097
LRESULT NC_HandleNCCalcSize(PWND Wnd, WPARAM wparam, RECTL *Rect, BOOL Suspended)
Definition: nonclient.c:1303
LRESULT NC_HandleNCRButtonDown(PWND pwnd, WPARAM wParam, LPARAM lParam)
Definition: nonclient.c:1724
LRESULT NC_HandleNCLButtonDblClk(PWND pWnd, WPARAM wParam, LPARAM lParam)
Definition: nonclient.c:1666
VOID FASTCALL UserReferenceObject(PVOID obj)
Definition: object.c:730
LRESULT IntClientShutdown(IN PWND pWindow, IN WPARAM wParam, IN LPARAM lParam)
Definition: shutdown.c:22
BOOL g_bWindowSnapEnabled
Definition: sysparams.c:20
PWND FASTCALL IntGetParent(PWND Wnd)
Definition: window.c:205
VOID FASTCALL IntGetClientRect(PWND WindowObject, RECTL *Rect)
Definition: winpos.c:92
#define GET_Y_LPARAM(lp)
Definition: windowsx.h:300
#define WM_CTLCOLOR
Definition: windowsx.h:29
#define GET_X_LPARAM(lp)
Definition: windowsx.h:299
#define DI_COMPAT
Definition: wingdi.h:68
#define NULLREGION
Definition: wingdi.h:361
#define DI_NORMAL
Definition: wingdi.h:72
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
#define DI_DEFAULTSIZE
Definition: wingdi.h:69
FORCEINLINE VOID co_IntUnsnapWindow(PWND Wnd)
Definition: winpos.h:89
FORCEINLINE BOOLEAN IntIsSnapAllowedForWindow(PWND Wnd)
Definition: winpos.h:101
#define WM_PAINT
Definition: winuser.h:1648
#define WM_ERASEBKGND
Definition: winuser.h:1653
#define WM_GETHOTKEY
Definition: winuser.h:1681
#define WM_CTLCOLORSTATIC
Definition: winuser.h:1800
#define WM_GETTEXTLENGTH
Definition: winuser.h:1647
#define SW_HIDE
Definition: winuser.h:779
#define WM_CLOSE
Definition: winuser.h:1649
#define VK_SNAPSHOT
Definition: winuser.h:2267
#define WM_SYSCOMMAND
Definition: winuser.h:1769
#define SC_KEYMENU
Definition: winuser.h:2632
#define VK_TAB
Definition: winuser.h:2235
#define GA_ROOT
Definition: winuser.h:2893
#define MAKELPARAM(l, h)
Definition: winuser.h:4116
#define WM_KEYUP
Definition: winuser.h:1744
#define DCX_WINDOW
Definition: winuser.h:2149
#define HELPINFO_MENUITEM
Definition: winuser.h:1182
#define VK_F10
Definition: winuser.h:2300
#define WM_WINDOWPOSCHANGING
Definition: winuser.h:1689
#define TPM_RIGHTBUTTON
Definition: winuser.h:2416
#define WM_SYNCPAINT
Definition: winuser.h:1718
#define SC_PREVWINDOW
Definition: winuser.h:2627
#define VK_SPACE
Definition: winuser.h:2255
#define WM_CANCELMODE
Definition: winuser.h:1663
#define WM_LBUTTONDBLCLK
Definition: winuser.h:1806
#define KF_ALTDOWN
Definition: winuser.h:2485
#define MA_ACTIVATE
Definition: winuser.h:2537
#define WM_APPCOMMAND
Definition: winuser.h:1910
#define WM_NCHITTEST
Definition: winuser.h:1714
#define WM_RBUTTONUP
Definition: winuser.h:1808
#define VK_UP
Definition: winuser.h:2261
#define SW_SHOWNOACTIVATE
Definition: winuser.h:785
#define WH_SHELL
Definition: winuser.h:40
#define WM_GETTEXT
Definition: winuser.h:1646
#define RDW_ERASE
Definition: winuser.h:1222
#define WM_CTLCOLORSCROLLBAR
Definition: winuser.h:1799
#define WA_INACTIVE
Definition: winuser.h:2664
#define MA_NOACTIVATE
Definition: winuser.h:2539
#define WM_LBUTTONDOWN
Definition: winuser.h:1804
#define WM_DEVICECHANGE
Definition: winuser.h:1839
#define WM_SYSCOLORCHANGE
Definition: winuser.h:1654
#define WM_CTLCOLORMSGBOX
Definition: winuser.h:1794
#define WM_NCLBUTTONDBLCLK
Definition: winuser.h:1722
#define WM_ACTIVATE
Definition: winuser.h:1640
#define WM_SHOWWINDOW
Definition: winuser.h:1656
#define WM_RBUTTONDOWN
Definition: winuser.h:1807
#define SC_MINIMIZE
Definition: winuser.h:2622
#define WM_CTLCOLORBTN
Definition: winuser.h:1797
#define WM_SETTEXT
Definition: winuser.h:1645
#define SC_NEXTWINDOW
Definition: winuser.h:2626
#define DC_NC
Definition: winuser.h:440
#define DCX_INTERSECTRGN
Definition: winuser.h:2158
#define WM_NCACTIVATE
Definition: winuser.h:1716
#define WM_SYSCHAR
Definition: winuser.h:1749
#define VK_RETURN
Definition: winuser.h:2237
#define SM_CYICON
Definition: winuser.h:984
#define VK_RMENU
Definition: winuser.h:2323
#define RDW_ALLCHILDREN
Definition: winuser.h:1232
#define RDW_ERASENOW
Definition: winuser.h:1230
#define RDW_FRAME
Definition: winuser.h:1223
#define WM_SYSKEYUP
Definition: winuser.h:1748
#define HCBT_MOVESIZE
Definition: winuser.h:55
#define SC_CLOSE
Definition: winuser.h:2628
#define DC_TEXT
Definition: winuser.h:430
#define VK_LWIN
Definition: winuser.h:2271
struct tagHELPINFO HELPINFO
#define WM_MOUSEACTIVATE
Definition: winuser.h:1665
#define TPM_LEFTBUTTON
Definition: winuser.h:2415
#define VK_F4
Definition: winuser.h:2294
#define VK_LEFT
Definition: winuser.h:2260
#define VK_RIGHT
Definition: winuser.h:2262
#define VK_DOWN
Definition: winuser.h:2263
#define WM_SETCURSOR
Definition: winuser.h:1664
#define KF_REPEAT
Definition: winuser.h:2486
#define WM_USER
Definition: winuser.h:1923
#define WM_CTLCOLORLISTBOX
Definition: winuser.h:1796
#define VK_SHIFT
Definition: winuser.h:2238
#define WM_NCRBUTTONUP
Definition: winuser.h:1724
#define WM_KEYDOWN
Definition: winuser.h:1743
#define WM_ICONERASEBKGND
Definition: winuser.h:1670
#define WM_PRINT
Definition: winuser.h:1908
#define WM_NCCALCSIZE
Definition: winuser.h:1713
#define SM_CXICON
Definition: winuser.h:983
#define WM_CTLCOLOREDIT
Definition: winuser.h:1795
#define VK_ESCAPE
Definition: winuser.h:2250
#define WM_WINDOWPOSCHANGED
Definition: winuser.h:1690
#define SC_RESTORE
Definition: winuser.h:2634
#define WM_CTLCOLORDLG
Definition: winuser.h:1798
#define CS_NOCLOSE
Definition: winuser.h:662
#define WM_SYSKEYDOWN
Definition: winuser.h:1747
#define WM_NCLBUTTONDOWN
Definition: winuser.h:1720
#define RDW_INVALIDATE
Definition: winuser.h:1225
#define WM_PAINTICON
Definition: winuser.h:1669
#define WM_MBUTTONDOWN
Definition: winuser.h:1810
#define VK_RWIN
Definition: winuser.h:2272
#define SC_MAXIMIZE
Definition: winuser.h:2624
#define VK_LMENU
Definition: winuser.h:2322
#define VK_MENU
Definition: winuser.h:2240
#define WM_NCPAINT
Definition: winuser.h:1715
#define WM_NCRBUTTONDOWN
Definition: winuser.h:1723
#define WM_SETREDRAW
Definition: winuser.h:1644
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
_In_ ULONG _In_ BOOLEAN Active
Definition: potypes.h:564

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

◆ IntEnableWindow()

BOOL FASTCALL IntEnableWindow ( HWND  hWnd,
BOOL  bEnable 
)

Definition at line 221 of file window.c.

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

Referenced by NtUserCallTwoParam(), and NtUserEnableScrollBar().

◆ IntFindWindow()

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

Definition at line 3073 of file window.c.

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

Referenced by NtUserFindWindowEx().

◆ IntFreeHwndList()

VOID FASTCALL IntFreeHwndList ( PWINDOWLIST  pwlTarget)

Definition at line 1467 of file window.c.

1468{
1469 PWINDOWLIST pwl, *ppwl;
1470
1471 for (ppwl = &gpwlList; *ppwl; ppwl = &(*ppwl)->pNextList)
1472 {
1473 if (*ppwl != pwlTarget)
1474 continue;
1475
1476 *ppwl = pwlTarget->pNextList;
1477
1478 if (gpwlCache)
1479 {
1480 if (WL_CAPACITY(pwlTarget) > WL_CAPACITY(gpwlCache))
1481 {
1482 pwl = gpwlCache;
1483 gpwlCache = pwlTarget;
1485 }
1486 else
1487 {
1489 }
1490 }
1491 else
1492 {
1493 gpwlCache = pwlTarget;
1494 }
1495
1496 break;
1497 }
1498}
#define WL_CAPACITY(pwl)
Definition: window.h:98

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

◆ IntGetClientRect()

VOID FASTCALL IntGetClientRect ( PWND  Wnd,
RECTL Rect 
)

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

Note
Does not check the validity of the parameters

Definition at line 92 of file winpos.c.

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

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

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

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

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

Referenced by WinPosFixupFlags().

◆ IntGetWindowBorderMeasures()

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

Definition at line 867 of file winpos.c.

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

◆ IntImeCanDestroyDefIME()

BOOL FASTCALL IntImeCanDestroyDefIME ( _In_ PWND  pImeWnd,
_In_ PWND  pwndTarget 
)

Definition at line 2177 of file ime.c.

2180{
2181 PWND pwndNode;
2182 PIMEUI pimeui;
2183 IMEUI SafeImeUI;
2184
2185 pimeui = IntGetImeUIFromWnd(pImeWnd);
2186 if (!pimeui)
2187 return FALSE;
2188
2189 // Check IMEUI.fDestroy
2190 _SEH2_TRY
2191 {
2192 ProbeForRead(pimeui, sizeof(IMEUI), 1);
2193 SafeImeUI = *pimeui;
2194 if (SafeImeUI.fDestroy)
2195 return FALSE;
2196 }
2198 {
2199 ERR("Exception in IntImeCanDestroyDefIME: %p\n", pimeui);
2200 }
2201 _SEH2_END;
2202
2203 // Any ancestor of pImeWnd is pwndTarget?
2204 if (pImeWnd->spwndOwner)
2205 {
2206 for (pwndNode = pImeWnd->spwndOwner; pwndNode; pwndNode = pwndNode->spwndOwner)
2207 {
2208 if (pwndNode == pwndTarget)
2209 break;
2210 }
2211
2212 if (!pwndNode)
2213 return FALSE;
2214 }
2215
2216 // Any ancestor of pwndTarget is IME-like?
2217 for (pwndNode = pwndTarget; pwndNode; pwndNode = pwndNode->spwndOwner)
2218 {
2219 if (IS_WND_IMELIKE(pwndNode))
2220 return FALSE;
2221 }
2222
2223 // Adjust the ordering and top-mode status
2224 IntImeSetFutureOwner(pImeWnd, pwndTarget);
2225 for (pwndNode = pImeWnd->spwndOwner; pwndNode; pwndNode = pwndNode->spwndNext)
2226 {
2227 if (pwndNode == pImeWnd)
2228 break;
2229 }
2230 if (pwndNode == pImeWnd)
2231 IntImeCheckTopmost(pImeWnd);
2232
2233 // Is the owner of pImeWnd NULL or pwndTarget?
2234 if (pImeWnd->spwndOwner && pwndTarget != pImeWnd->spwndOwner)
2235 return FALSE;
2236
2237 WndSetOwner(pImeWnd, NULL);
2238 return TRUE;
2239}
static VOID FASTCALL IntImeCheckTopmost(_In_ PWND pImeWnd)
Definition: ime.c:1430
VOID FASTCALL IntImeSetFutureOwner(PWND pImeWnd, PWND pwndOwner)
Definition: ime.c:1246
UINT fDestroy
Definition: ntuser.h:1229

Referenced by co_UserDestroyWindow().

◆ IntImeCanDestroyDefIMEforChild()

BOOL FASTCALL IntImeCanDestroyDefIMEforChild ( _In_ PWND  pImeWnd,
_In_ PWND  pwndTarget 
)

Definition at line 2130 of file ime.c.

2133{
2134 PWND pwndNode;
2135 PIMEUI pimeui;
2136 IMEUI SafeImeUI;
2137
2138 pimeui = IntGetImeUIFromWnd(pImeWnd);
2139 if (!pimeui)
2140 return FALSE;
2141
2142 // Check IMEUI.fChildThreadDef
2143 _SEH2_TRY
2144 {
2145 ProbeForRead(pimeui, sizeof(IMEUI), 1);
2146 SafeImeUI = *pimeui;
2147 if (!SafeImeUI.fChildThreadDef)
2148 return FALSE;
2149 }
2151 {
2152 ERR("Exception in IntImeCanDestroyDefIMEforChild: %p\n", pimeui);
2153 }
2154 _SEH2_END;
2155
2156 // The parent of pwndTarget is NULL or of the same thread of pwndTarget?
2157 if (pwndTarget->spwndParent == NULL ||
2158 pwndTarget->head.pti == pwndTarget->spwndParent->head.pti)
2159 {
2160 return FALSE;
2161 }
2162
2163 for (pwndNode = pwndTarget; pwndNode; pwndNode = pwndNode->spwndParent)
2164 {
2165 if (pwndNode == pwndNode->head.rpdesk->pDeskInfo->spwnd)
2166 break;
2167
2168 if (IntFindNonImeRelatedWndOfSameThread(pwndNode->spwndParent, pwndTarget))
2169 return FALSE;
2170 }
2171
2172 return TRUE;
2173}
BOOL IntFindNonImeRelatedWndOfSameThread(PWND pwndParent, PWND pwndTarget)
Definition: ime.c:1948

Referenced by co_UserDestroyWindow().

◆ IntIsChildWindow()

BOOL FASTCALL IntIsChildWindow ( PWND  Parent,
PWND  Child 
)

Definition at line 929 of file window.c.

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

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

◆ IntIsWindow()

◆ IntIsWindowVisible()

BOOL FASTCALL IntIsWindowVisible ( PWND  Wnd)

Definition at line 190 of file window.c.

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

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

◆ IntLinkHwnd()

VOID FASTCALL IntLinkHwnd ( PWND  Wnd,
HWND  hWndPrev 
)

Definition at line 985 of file window.c.

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

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

◆ IntMapWindowPoints()

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

Definition at line 144 of file winpos.c.

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

Referenced by DefWndDoSizeMove(), and DefWndHandleWindowPosChanged().

◆ IntNotifyImeShowStatus()

VOID FASTCALL IntNotifyImeShowStatus ( _In_ PWND  pImeWnd)

Definition at line 2447 of file ime.c.

2448{
2449 PIMEUI pimeui;
2450 PWND pWnd;
2451 PTHREADINFO pti, ptiIME;
2452 BOOL bShow, bSendNotify = FALSE;
2453 IMEUI SafeImeUI;
2454
2455 if (!IS_IMM_MODE() || (pImeWnd->state2 & WNDS2_INDESTROY))
2456 return;
2457
2459 ptiIME = pImeWnd->head.pti;
2460
2461 pimeui = IntGetImeUIFromWnd(pImeWnd);
2462 if (!pimeui)
2463 {
2464 ERR("Invalid IMEWND %p\n", pImeWnd);
2465 return;
2466 }
2467
2468 // Attach to the process if necessary
2469 if (pti != ptiIME)
2470 KeAttachProcess(&(ptiIME->ppi->peProcess->Pcb));
2471
2472 // Get an IMEUI and check whether hwndIMC is valid and update fShowStatus
2473 _SEH2_TRY
2474 {
2475 ProbeForWrite(pimeui, sizeof(*pimeui), 1);
2476 SafeImeUI = *pimeui;
2477
2478 bShow = (gfIMEShowStatus == TRUE) && SafeImeUI.fCtrlShowStatus;
2479
2480 pWnd = ValidateHwndNoErr(SafeImeUI.hwndIMC);
2481 if (!pWnd)
2482 pWnd = ptiIME->MessageQueue->spwndFocus;
2483
2484 if (pWnd)
2485 {
2486 bSendNotify = TRUE;
2487 pimeui->fShowStatus = bShow;
2488 }
2489 }
2491 {
2492 ERR("Exception in IntNotifyImeShowStatus: %p, %p, %p, %d, %d\n",
2493 pImeWnd, pimeui, ptiIME, SafeImeUI.fCtrlShowStatus, gfIMEShowStatus);
2494
2495 if (pti != ptiIME)
2497
2498 _SEH2_YIELD(return);
2499 }
2500 _SEH2_END;
2501
2502 // Detach from the process if necessary
2503 if (pti != ptiIME)
2505
2506 if (bSendNotify)
2507 IntSendOpenStatusNotify(ptiIME, &SafeImeUI, pWnd, bShow);
2508
2509 if (!(pImeWnd->state2 & WNDS2_INDESTROY))
2510 IntCheckImeShowStatus(pImeWnd, NULL);
2511}
VOID FASTCALL IntSendOpenStatusNotify(PTHREADINFO ptiIME, PIMEUI pimeui, PWND pWnd, BOOL bOpen)
Definition: ime.c:2427
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:207
UINT fCtrlShowStatus
Definition: ntuser.h:1232
HWND hwndIMC
Definition: ntuser.h:1222
UINT fShowStatus
Definition: ntuser.h:1227

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:79
#define EngGetTickCount32()
Definition: eng.h:43
GLbitfield flags
Definition: glext.h:7161
#define WEF_SETBYWNDPTI
Definition: ntuser.h:236
#define NtCurrentTeb
HANDLE UniqueThread
Definition: compat.h:826
Definition: typedefs.h:120
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
struct _THREADINFO * pti
Definition: ntuser.h:188
DWORD idThread
Definition: hook.h:22
WINEVENTPROC Proc
Definition: hook.h:23
ULONG_PTR offPfn
Definition: hook.h:25
INT_PTR ihmod
Definition: hook.h:26
UINT eventMin
Definition: hook.h:19
THROBJHEAD head
Definition: hook.h:17
ULONG Flags
Definition: hook.h:24
DWORD idProcess
Definition: hook.h:21
UINT Counts
Definition: hook.h:32
LIST_ENTRY Events
Definition: hook.h:31
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
LRESULT APIENTRY co_IntCallEventProc(HWINEVENTHOOK hook, DWORD event, HWND hWnd, LONG idObject, LONG idChild, DWORD dwEventThread, DWORD dwmsEventTime, WINEVENTPROC Proc, INT Mod, ULONG_PTR offPfn)
Definition: callback.c:838
static PEVENTTABLE GlobalEvents
Definition: event.c:19
static LRESULT FASTCALL IntCallLowLevelEvent(PEVENTHOOK pEH, DWORD event, HWND hwnd, LONG idObject, LONG idChild, LONG idThread)
Definition: event.c:97
#define WINEVENT_INCONTEXT
Definition: winable.h:35
#define WINEVENT_SKIPOWNPROCESS
Definition: winable.h:34
#define WINEVENT_SKIPOWNTHREAD
Definition: winable.h:33
_Out_ PCLIENT_ID ClientId
Definition: kefuncs.h:1151

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

◆ IntSetStyle()

ULONG FASTCALL IntSetStyle ( PWND  pwnd,
ULONG  set_bits,
ULONG  clear_bits 
)

Definition at line 144 of file window.c.

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

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

◆ IntShowOwnedPopups()

BOOL FASTCALL IntShowOwnedPopups ( PWND  owner,
BOOL  fShow 
)

Definition at line 4662 of file window.c.

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

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

◆ IntUnlinkWindow()

VOID FASTCALL IntUnlinkWindow ( PWND  Wnd)

Definition at line 1355 of file window.c.

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

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

◆ IntWantImeWindow()

BOOL FASTCALL IntWantImeWindow ( _In_ PWND  pwndTarget)

Definition at line 2024 of file ime.c.

2025{
2026 PDESKTOP rpdesk;
2027 PWINSTATION_OBJECT rpwinstaParent;
2028 PWND pwndNode, pwndParent = pwndTarget->spwndParent;
2029
2031 return FALSE;
2032
2033 if (IS_WND_IMELIKE(pwndTarget))
2034 return FALSE;
2035
2036 if (pwndTarget->fnid == FNID_DESKTOP || pwndTarget->fnid == FNID_MESSAGEWND)
2037 return FALSE;
2038
2039 if (pwndTarget->state & WNDS_SERVERSIDEWINDOWPROC)
2040 return FALSE;
2041
2042 rpdesk = pwndTarget->head.rpdesk;
2043 if (!rpdesk)
2044 return FALSE;
2045
2046 rpwinstaParent = rpdesk->rpwinstaParent;
2047 if (!rpwinstaParent || (rpwinstaParent->Flags & WSS_NOIO))
2048 return FALSE;
2049
2050 for (pwndNode = pwndParent; pwndNode; pwndNode = pwndNode->spwndParent)
2051 {
2052 if (rpdesk != pwndNode->head.rpdesk)
2053 break;
2054
2055 if (pwndNode == rpdesk->spwndMessage)
2056 return FALSE;
2057 }
2058
2059 return TRUE;
2060}
#define TIF_DISABLEIME
Definition: ntuser.h:288
#define FNID_MESSAGEWND
Definition: ntuser.h:864
PTHREADINFO gptiCurrent
Definition: ntuser.c:15
struct _WINSTATION_OBJECT * rpwinstaParent
Definition: desktop.h:11
PWND spwndMessage
Definition: desktop.h:20
FLONG TIF_flags
Definition: win32.h:95
#define WSS_NOIO
Definition: winsta.h:9

Referenced by co_UserCreateWindowEx().

◆ IntWinListChildren()

HWND *FASTCALL IntWinListChildren ( PWND  Window)

Definition at line 275 of file window.c.

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

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

◆ IntWinListOwnedPopups()

HWND *FASTCALL IntWinListOwnedPopups ( PWND  Window)

Definition at line 316 of file window.c.

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

Referenced by IntDestroyOwnedWindows(), and IntShowOwnedPopups().

◆ ReplaceWndPtr()

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

Definition at line 130 of file window.h.

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

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

◆ UserUpdateUiState()

BOOL FASTCALL UserUpdateUiState ( PWND  Wnd,
WPARAM  wParam 
)

Definition at line 40 of file window.c.

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

Referenced by NtUserCallTwoParam().

◆ ValidateHwndNoErr()

PWND FASTCALL ValidateHwndNoErr ( HWND  hWnd)

Definition at line 108 of file window.c.

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

◆ VerifyWnd()

PWND FASTCALL VerifyWnd ( PWND  pWnd)

Definition at line 88 of file window.c.

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

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

◆ WndSetChild()

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

Definition at line 164 of file window.h.

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

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

◆ WndSetLastActive()

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

Definition at line 185 of file window.h.

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

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

◆ WndSetNext()

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

Definition at line 171 of file window.h.

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

Referenced by IntLinkWindow(), and IntUnlinkWindow().

◆ WndSetOwner()

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

◆ WndSetParent()

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

Definition at line 157 of file window.h.

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

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

◆ WndSetPrev()

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

Definition at line 178 of file window.h.

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

Referenced by IntLinkWindow(), and IntUnlinkWindow().

Variable Documentation

◆ AtomFlashWndState

ATOM AtomFlashWndState
extern

Definition at line 22 of file ntuser.c.

Referenced by InitUserAtoms(), and IntFlashWindowEx().

◆ AtomLayer

◆ AtomMessage

ATOM AtomMessage
extern

Definition at line 19 of file ntuser.c.

Referenced by InitUserAtoms().

◆ AtomWndObj

ATOM AtomWndObj
extern

Definition at line 20 of file ntuser.c.

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

◆ g_bWindowSnapEnabled

BOOL g_bWindowSnapEnabled
extern

◆ gfIMEShowStatus

BOOL gfIMEShowStatus
extern

◆ gpwlCache

PWINDOWLIST gpwlCache
extern

Definition at line 19 of file window.c.

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

◆ gpwlList

PWINDOWLIST gpwlList
extern

Definition at line 18 of file window.c.

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