ReactOS 0.4.16-dev-1475-g410db43
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 2048 of file ime.c.

2051{
2052 LARGE_UNICODE_STRING WindowName;
2053 UNICODE_STRING ClassName;
2054 PWND pImeWnd;
2055 PIMEUI pimeui;
2056 CREATESTRUCTW Cs;
2059 HANDLE pid = PsGetThreadProcessId(pti->pEThread);
2060
2061 if (!(pti->spDefaultImc) && pid == gpidLogon)
2063
2064 if (!(pti->spDefaultImc) || IS_WND_IMELIKE(pwndTarget) || !(pti->rpdesk->pheapDesktop))
2065 return NULL;
2066
2067 if (IS_WND_CHILD(pwndTarget) && !(pwndTarget->style & WS_VISIBLE) &&
2068 pwndTarget->spwndParent->head.pti->ppi != pti->ppi)
2069 {
2070 return NULL;
2071 }
2072
2073 RtlInitLargeUnicodeString(&WindowName, L"Default IME", 0);
2074
2076 ClassName.Length = 0;
2077 ClassName.MaximumLength = 0;
2078
2079 UserRefObjectCo(pwndTarget, &Ref);
2080
2081 RtlZeroMemory(&Cs, sizeof(Cs));
2082 Cs.style = WS_POPUP | WS_DISABLED;
2083 Cs.hInstance = hInst;
2084 Cs.hwndParent = UserHMGetHandle(pwndTarget);
2085 Cs.lpszName = WindowName.Buffer;
2086 Cs.lpszClass = ClassName.Buffer;
2087
2088 // NOTE: LARGE_UNICODE_STRING is compatible to LARGE_STRING.
2089 pImeWnd = co_UserCreateWindowEx(&Cs, &ClassName, (PLARGE_STRING)&WindowName, NULL, WINVER);
2090 if (pImeWnd)
2091 {
2092 pimeui = ((PIMEWND)pImeWnd)->pimeui;
2093 _SEH2_TRY
2094 {
2095 ProbeForWrite(pimeui, sizeof(IMEUI), 1);
2096 pimeui->fDefault = TRUE;
2097 if (IS_WND_CHILD(pwndTarget) && pwndTarget->spwndParent->head.pti != pti)
2098 pimeui->fChildThreadDef = TRUE;
2099 }
2101 {
2102 ERR("Exception in co_IntCreateDefaultImeWindow: %p\n", pimeui);
2103 }
2104 _SEH2_END;
2105 }
2106
2107 UserDerefObjectCo(pwndTarget);
2108 return pImeWnd;
2109}
#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
struct _IMEWND * PIMEWND
VOID NTAPI RtlInitLargeUnicodeString(IN OUT PLARGE_UNICODE_STRING, IN PCWSTR, IN INT)
Definition: rtlstr.c:42
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:90
PVOID NTAPI PsGetCurrentThreadWin32Thread(VOID)
Definition: thread.c:805
HANDLE NTAPI PsGetThreadProcessId(IN PETHREAD Thread)
Definition: thread.c:745
PIMC FASTCALL UserCreateInputContext(_In_ ULONG_PTR dwClientImcData)
Definition: ime.c:1635
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:82
#define _SEH2_END
Definition: pseh2_64.h:171
#define _SEH2_TRY
Definition: pseh2_64.h:71
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:3041
LPCWSTR lpszName
Definition: winuser.h:3040
HINSTANCE hInstance
Definition: winuser.h:3032
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:2180
#define IS_WND_IMELIKE(pWnd)
Definition: window.h:114
#define IS_WND_CHILD(pWnd)
Definition: window.h:108
_In_ ULONG_PTR _In_ ULONG _Out_ ULONG_PTR * pid
Definition: winddi.h:3837

Referenced by co_UserCreateWindowEx().

◆ co_UserCreateWindowEx()

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

Definition at line 2180 of file window.c.

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

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

◆ co_UserFreeWindow()

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

Definition at line 576 of file window.c.

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

4039{
4040 return (LONG)co_IntSetWindowLongPtr(hWnd, Index, NewValue, Ansi, sizeof(LONG), FALSE);
4041}
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:3841

Referenced by DesktopWindowProc(), and NtUserSetWindowWord().

◆ co_UserSetWindowLongPtr()

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

Definition at line 4044 of file window.c.

4045{
4046 return co_IntSetWindowLongPtr(hWnd, Index, NewValue, Ansi, sizeof(LONG_PTR), FALSE);
4047}
__int3264 LONG_PTR
Definition: mstsclib_h.h:276

◆ GetNCHitEx()

DWORD FASTCALL GetNCHitEx ( PWND  pWnd,
POINT  pt 
)

Definition at line 1985 of file nonclient.c.

1986{
1987 RECT rcWindow, rcClient;
1989
1990 if (!pWnd) return HTNOWHERE;
1991
1992 if (UserIsDesktopWindow(pWnd))
1993 {
1994 rcClient.left = rcClient.top = rcWindow.left = rcWindow.top = 0;
1999 }
2000 else
2001 {
2002 rcClient = pWnd->rcClient;
2003 rcWindow = pWnd->rcWindow;
2004 }
2005
2006 if (!RECTL_bPointInRect(&rcWindow, pt.x, pt.y)) return HTNOWHERE;
2007
2008 Style = pWnd->style;
2009 ExStyle = pWnd->ExStyle;
2010
2011 if (Style & WS_MINIMIZE) return HTCAPTION;
2012
2013 if (RECTL_bPointInRect( &rcClient, pt.x, pt.y )) return HTCLIENT;
2014
2015 /* Check borders */
2017 {
2019 if (!RECTL_bPointInRect(&rcWindow, pt.x, pt.y ))
2020 {
2021 /* Check top sizing border */
2022 if (pt.y < rcWindow.top)
2023 {
2024 if (pt.x < rcWindow.left+UserGetSystemMetrics(SM_CXSIZE)) return HTTOPLEFT;
2025 if (pt.x >= rcWindow.right-UserGetSystemMetrics(SM_CXSIZE)) return HTTOPRIGHT;
2026 return HTTOP;
2027 }
2028 /* Check bottom sizing border */
2029 if (pt.y >= rcWindow.bottom)
2030 {
2031 if (pt.x < rcWindow.left+UserGetSystemMetrics(SM_CXSIZE)) return HTBOTTOMLEFT;
2032 if (pt.x >= rcWindow.right-UserGetSystemMetrics(SM_CXSIZE)) return HTBOTTOMRIGHT;
2033 return HTBOTTOM;
2034 }
2035 /* Check left sizing border */
2036 if (pt.x < rcWindow.left)
2037 {
2038 if (pt.y < rcWindow.top+UserGetSystemMetrics(SM_CYSIZE)) return HTTOPLEFT;
2039 if (pt.y >= rcWindow.bottom-UserGetSystemMetrics(SM_CYSIZE)) return HTBOTTOMLEFT;
2040 return HTLEFT;
2041 }
2042 /* Check right sizing border */
2043 if (pt.x >= rcWindow.right)
2044 {
2045 if (pt.y < rcWindow.top+UserGetSystemMetrics(SM_CYSIZE)) return HTTOPRIGHT;
2046 if (pt.y >= rcWindow.bottom-UserGetSystemMetrics(SM_CYSIZE)) return HTBOTTOMRIGHT;
2047 return HTRIGHT;
2048 }
2049 }
2050 }
2051 else /* No thick frame */
2052 {
2053 if (HAS_DLGFRAME( Style, ExStyle ))
2055 else if (HAS_THINFRAME( Style, ExStyle ))
2057 else if (HAS_CLIENTFRAME( Style, ExStyle ))
2059 if (!RECTL_bPointInRect( &rcWindow, pt.x, pt.y )) return HTBORDER;
2060 }
2061
2062 /* Check caption */
2063
2064 if ((Style & WS_CAPTION) == WS_CAPTION)
2065 {
2067 rcWindow.top += UserGetSystemMetrics(SM_CYSMCAPTION) - 1;
2068 else
2069 rcWindow.top += UserGetSystemMetrics(SM_CYCAPTION) - 1;
2070 if (!RECTL_bPointInRect( &rcWindow, pt.x, pt.y ))
2071 {
2072 BOOL min_or_max_box = (Style & WS_SYSMENU) && (Style & (WS_MINIMIZEBOX|WS_MAXIMIZEBOX));
2074 {
2075 /* Check system menu */
2076 if ((Style & WS_SYSMENU) && !(ExStyle & WS_EX_TOOLWINDOW) && NC_IconForWindow(pWnd))
2077 {
2078 rcWindow.right -= UserGetSystemMetrics(SM_CYCAPTION) - 1;
2079 if (pt.x > rcWindow.right) return HTSYSMENU;
2080 }
2081
2082 /* Check close button */
2083 if (Style & WS_SYSMENU)
2084 {
2086 if (pt.x < rcWindow.left) return HTCLOSE;
2087 }
2088
2089 /* Check maximize box */
2090 /* In Win95 there is automatically a Maximize button when there is a minimize one */
2091 if (min_or_max_box && !(ExStyle & WS_EX_TOOLWINDOW))
2092 {
2093 rcWindow.left += UserGetSystemMetrics(SM_CXSIZE);
2094 if (pt.x < rcWindow.left) return HTMAXBUTTON;
2095 }
2096
2097 /* Check minimize box */
2098 if (min_or_max_box && !(ExStyle & WS_EX_TOOLWINDOW))
2099 {
2100 rcWindow.left += UserGetSystemMetrics(SM_CXSIZE);
2101 if (pt.x < rcWindow.left) return HTMINBUTTON;
2102 }
2103 }
2104 else
2105 {
2106 /* Check system menu */
2107 if ((Style & WS_SYSMENU) && !(ExStyle & WS_EX_TOOLWINDOW) && NC_IconForWindow(pWnd))
2108 {
2109 rcWindow.left += UserGetSystemMetrics(SM_CYCAPTION) - 1;
2110 if (pt.x < rcWindow.left) return HTSYSMENU;
2111 }
2112
2113 /* Check close button */
2114 if (Style & WS_SYSMENU)
2115 {
2117 if (pt.x > rcWindow.right) return HTCLOSE;
2118 }
2119
2120 /* Check maximize box */
2121 /* In Win95 there is automatically a Maximize button when there is a minimize one */
2122 if (min_or_max_box && !(ExStyle & WS_EX_TOOLWINDOW))
2123 {
2125 if (pt.x > rcWindow.right) return HTMAXBUTTON;
2126 }
2127
2128 /* Check minimize box */
2129 if (min_or_max_box && !(ExStyle & WS_EX_TOOLWINDOW))
2130 {
2132 if (pt.x > rcWindow.right) return HTMINBUTTON;
2133 }
2134 }
2135 return HTCAPTION;
2136 }
2137 }
2138
2139 /* Check menu bar */
2140
2141 if (HAS_MENU( pWnd, Style ) && (pt.y < rcClient.top) &&
2142 (pt.x >= rcClient.left) && (pt.x < rcClient.right))
2143 return HTMENU;
2144
2145 /* Check vertical scroll bar */
2146
2148 if (Style & WS_VSCROLL)
2149 {
2150 if((ExStyle & WS_EX_LEFTSCROLLBAR) != 0)
2152 else
2154 if (RECTL_bPointInRect( &rcClient, pt.x, pt.y )) return HTVSCROLL;
2155 }
2156
2157 /* Check horizontal scroll bar */
2158
2159 if (Style & WS_HSCROLL)
2160 {
2162 if (RECTL_bPointInRect( &rcClient, pt.x, pt.y ))
2163 {
2164 /* Check size box */
2165 if ((Style & WS_VSCROLL) &&
2166 ((((ExStyle & WS_EX_LEFTSCROLLBAR) != 0) && (pt.x <= rcClient.left + UserGetSystemMetrics(SM_CXVSCROLL))) ||
2167 (((ExStyle & WS_EX_LEFTSCROLLBAR) == 0) && (pt.x >= rcClient.right - UserGetSystemMetrics(SM_CXVSCROLL)))))
2168 return HTSIZE;
2169 return HTHSCROLL;
2170 }
2171 }
2172
2173 /* Has to return HTNOWHERE if nothing was found
2174 Could happen when a window has a customized non client area */
2175 return HTNOWHERE;
2176}
#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:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
#define HAS_MENU(hwnd, style)
Definition: uxthemep.h: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:210
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:2511
#define HTCLOSE
Definition: winuser.h:2518
#define SM_CYEDGE
Definition: winuser.h:1020
#define SM_CYSCREEN
Definition: winuser.h:971
#define HTCAPTION
Definition: winuser.h:2495
#define SM_CXEDGE
Definition: winuser.h:1019
#define HTTOPLEFT
Definition: winuser.h:2510
#define SM_CYSIZE
Definition: winuser.h:1003
#define SM_CXVSCROLL
Definition: winuser.h:972
#define HTBOTTOM
Definition: winuser.h:2512
#define HTBORDER
Definition: winuser.h:2516
#define SM_CXFRAME
Definition: winuser.h:1005
#define HTVSCROLL
Definition: winuser.h:2501
#define HTHSCROLL
Definition: winuser.h:2500
#define HTMAXBUTTON
Definition: winuser.h:2503
#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:2499
#define SM_CYBORDER
Definition: winuser.h:976
#define SM_CXBORDER
Definition: winuser.h:975
#define HTRIGHT
Definition: winuser.h:2508
#define HTCLIENT
Definition: winuser.h:2494
#define HTBOTTOMRIGHT
Definition: winuser.h:2514
#define HTNOWHERE
Definition: winuser.h:2493
#define SM_CXDLGFRAME
Definition: winuser.h:977
#define HTSIZE
Definition: winuser.h:2498
#define HTBOTTOMLEFT
Definition: winuser.h:2513
#define HTTOP
Definition: winuser.h:2509
#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:2502
#define HTSYSMENU
Definition: winuser.h:2496
#define HTLEFT
Definition: winuser.h:2506
#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 2491 of file ime.c.

2494{
2495 if (gfIMEShowStatus == bShow || !IS_IMM_MODE())
2496 return TRUE;
2497
2498 gfIMEShowStatus = bShow;
2499 IntNotifyImeShowStatus(pImeWnd);
2500 return TRUE;
2501}
VOID FASTCALL IntNotifyImeShowStatus(_In_ PWND pImeWnd)
Definition: ime.c:2430
BOOL gfIMEShowStatus
Definition: ime.c:29

Referenced by NtUserCallHwndParamLock().

◆ IntBuildHwndList()

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

Definition at line 1427 of file window.c.

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

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

◆ IntCheckImeShowStatusInThread()

VOID FASTCALL IntCheckImeShowStatusInThread ( _In_ PWND  pImeWnd)

Definition at line 2504 of file ime.c.

2505{
2506 if (IS_IMM_MODE() && !(pImeWnd->state2 & WNDS2_INDESTROY))
2507 IntCheckImeShowStatus(pImeWnd, pImeWnd->head.pti);
2508}
BOOL FASTCALL IntCheckImeShowStatus(_In_ PWND pwndIme, _In_ PTHREADINFO pti)
Definition: ime.c:2226

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

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

Referenced by co_UserCreateWindowEx(), and IntCreateDesktop().

◆ IntDefWindowProc()

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

Definition at line 638 of file defwnd.c.

644{
646 LRESULT lResult = 0;
648
649 if (Msg > WM_USER) return 0;
650
651 switch (Msg)
652 {
653 case WM_DEVICECHANGE:
654 return TRUE;
655
656 case WM_GETTEXTLENGTH:
657 {
658 PWSTR buf;
659 ULONG len;
660
661 if (Wnd != NULL && Wnd->strName.Length != 0)
662 {
663 buf = Wnd->strName.Buffer;
664 if (buf != NULL &&
666 buf,
667 Wnd->strName.Length)))
668 {
669 lResult = (LRESULT) (Wnd->strName.Length / sizeof(WCHAR));
670 }
671 }
672
673 break;
674 }
675
676 case WM_GETTEXT: // FIXME: Handle Ansi
677 {
678 PWSTR buf = NULL;
679 PWSTR outbuf = (PWSTR)lParam;
680
681 if (Wnd != NULL && wParam != 0)
682 {
683 if (Wnd->strName.Buffer != NULL)
684 buf = Wnd->strName.Buffer;
685 else
686 outbuf[0] = L'\0';
687
688 if (buf != NULL)
689 {
690 if (Wnd->strName.Length != 0)
691 {
692 lResult = min(Wnd->strName.Length / sizeof(WCHAR), wParam - 1);
693 RtlCopyMemory(outbuf,
694 buf,
695 lResult * sizeof(WCHAR));
696 outbuf[lResult] = L'\0';
697 }
698 else
699 outbuf[0] = L'\0';
700 }
701 }
702 break;
703 }
704
705 case WM_SETTEXT: // FIXME: Handle Ansi
706 {
707 DefSetText(Wnd, (PCWSTR)lParam);
708
709 if ((Wnd->style & WS_CAPTION) == WS_CAPTION)
711 IntNotifyWinEvent(EVENT_OBJECT_NAMECHANGE, Wnd, OBJID_WINDOW, CHILDID_SELF, 0);
712 lResult = 1;
713 break;
714 }
715
716 case WM_SYSCOMMAND:
717 {
718 TRACE("hwnd %p WM_SYSCOMMAND %lx %lx\n", UserHMGetHandle(Wnd), wParam, lParam );
719 lResult = DefWndHandleSysCommand(Wnd, wParam, lParam);
720 break;
721 }
722
723 case WM_SHOWWINDOW:
724 {
725 if ((Wnd->style & WS_VISIBLE) && wParam) break;
726 if (!(Wnd->style & WS_VISIBLE) && !wParam) break;
727 if (!Wnd->spwndOwner) break;
728 if (LOWORD(lParam))
729 {
731 }
732 break;
733 }
734
736 return IntClientShutdown(Wnd, wParam, lParam);
737
738 case WM_APPCOMMAND:
739 if ( (Wnd->style & (WS_POPUP|WS_CHILD)) != WS_CHILD &&
740 Wnd != co_GetDesktopWindow(Wnd) )
741 {
742 if (!co_HOOK_CallHooks(WH_SHELL, HSHELL_APPCOMMAND, wParam, lParam))
743 co_IntShellHookNotify(HSHELL_APPCOMMAND, wParam, lParam);
744 break;
745 }
746 UserRefObjectCo(Wnd->spwndParent, &Ref);
747 lResult = co_IntSendMessage(UserHMGetHandle(Wnd->spwndParent), WM_APPCOMMAND, wParam, lParam);
748 UserDerefObjectCo(Wnd->spwndParent);
749 break;
750
752 /* This is an undocumented message used by the windows taskbar to
753 display the system menu of windows that belong to other processes. */
755 break;
756
757 case WM_KEYF1:
758 {
759 HELPINFO hi;
760 HMENU hMenu = UlongToHandle(Wnd->IDMenu);
761 PWND pwndActive = MENU_IsMenuActive();
762 hi.cbSize = sizeof(HELPINFO);
763 hi.MousePos = gpsi->ptCursor;
765 hi.hItemHandle = pwndActive ? UserHMGetHandle(pwndActive) : UserHMGetHandle(Wnd);
766 hi.iCtrlId = (Wnd->style & (WS_POPUP|WS_CHILD)) == WS_CHILD ? IntMenuItemFromPoint(Wnd, hMenu, hi.MousePos) : 0;
768
769 co_IntSendMessage( UserHMGetHandle(Wnd), WM_HELP, 0, (LPARAM)&hi );
770 break;
771 }
772
773 case WM_SETICON:
774 {
775 return DefWndSetIcon(Wnd, wParam, lParam);
776 }
777
778 case WM_GETICON:
779 {
780 return DefWndGetIcon(Wnd, wParam, lParam);
781 }
782
783 case WM_HELP:
784 {
785 PWND Parent = IntGetParent(Wnd);
787 break;
788 }
789
790 case WM_LBUTTONDOWN:
791 case WM_RBUTTONDOWN:
792 case WM_MBUTTONDOWN:
794 break;
795
796 case WM_NCLBUTTONDOWN:
798
799 case WM_NCRBUTTONDOWN:
801
802 case WM_LBUTTONDBLCLK:
804
807
808 case WM_RBUTTONUP:
809 {
810 POINT Pt;
811
812 Pt.x = GET_X_LPARAM(lParam);
813 Pt.y = GET_Y_LPARAM(lParam);
814 IntClientToScreen(Wnd, &Pt);
815 lParam = MAKELPARAM(Pt.x, Pt.y);
817 break;
818 }
819
820 case WM_NCRBUTTONUP:
821 /*
822 * FIXME : we must NOT send WM_CONTEXTMENU on a WM_NCRBUTTONUP (checked
823 * in Windows), but what _should_ we do? According to MSDN :
824 * "If it is appropriate to do so, the system sends the WM_SYSCOMMAND
825 * message to the window". When is it appropriate?
826 */
827 ERR("WM_NCRBUTTONUP\n");
828 break;
829
830 case WM_XBUTTONUP:
831 case WM_NCXBUTTONUP:
832 if (HIWORD(wParam) == XBUTTON1 || HIWORD(wParam) == XBUTTON2)
833 {
835 MAKELPARAM(LOWORD(wParam), FAPPCOMMAND_MOUSE | HIWORD(wParam)));
836 }
837 break;
838
839
840 case WM_CONTEXTMENU:
841 {
842 if (Wnd->style & WS_CHILD)
843 {
845 }
846 else
847 {
848 POINT Pt;
850 LONG HitCode;
851
852 Style = Wnd->style;
853
854 Pt.x = GET_X_LPARAM(lParam);
855 Pt.y = GET_Y_LPARAM(lParam);
856 if (Style & WS_CHILD)
857 {
859 }
860
861 HitCode = GetNCHitEx(Wnd, Pt);
862
863 if (HitCode == HTCAPTION || HitCode == HTSYSMENU)
864 {
865 PMENU SystemMenu;
866 UINT Flags;
867
868 if((SystemMenu = IntGetSystemMenu(Wnd, FALSE)))
869 {
870 MENU_InitSysMenuPopup(SystemMenu, Wnd->style, Wnd->pcls->style, HitCode);
871
872 if(HitCode == HTCAPTION)
874 else
876
877 IntTrackPopupMenuEx(SystemMenu, Flags|TPM_SYSTEM_MENU, Pt.x, Pt.y, Wnd, NULL);
878 }
879 }
880 if (HitCode == HTHSCROLL || HitCode == HTVSCROLL)
881 {
882 WARN("Scroll Menu Not Supported\n");
883 }
884 }
885 break;
886 }
887
888 case WM_KEYDOWN:
889 if (wParam == VK_F10)
890 {
891 pti->MessageQueue->QF_flags |= QF_FF10STATUS;
892
893 if (UserGetKeyState(VK_SHIFT) & 0x8000)
894 {
896 }
897 }
899 {
900 HWND hwndTop = UserGetForegroundWindow();
901 PWND topWnd = UserGetWindowObject(hwndTop);
902 BOOL allowSnap;
903
904 // MS Doc: foreground window can be NULL, e.g. when window is losing activation
905 if (!topWnd)
906 return 0;
907
908 allowSnap = IntIsSnapAllowedForWindow(topWnd);
909 /* Allow the minimize action if it has a minimize button, even if the window cannot be snapped (e.g. Calc.exe) */
910 if (!allowSnap && (topWnd->style & (WS_MINIMIZEBOX|WS_THICKFRAME)) == WS_MINIMIZEBOX)
911 allowSnap = wParam == VK_DOWN;
912
913 if (allowSnap)
914 {
915 UINT snapped = IntGetWindowSnapEdge(topWnd);
916
917 if (wParam == VK_DOWN)
918 {
919 if (topWnd->style & WS_MAXIMIZE)
921 else if (snapped)
922 co_IntUnsnapWindow(topWnd);
923 else
925 }
926 else if (wParam == VK_UP)
927 {
928 if (topWnd->style & WS_MINIMIZE)
930 else
932 }
933 else if (wParam == VK_LEFT || wParam == VK_RIGHT)
934 {
935 UINT edge = wParam == VK_LEFT ? HTLEFT : HTRIGHT;
936 UINT otherEdge = edge == HTLEFT ? HTRIGHT : HTLEFT;
937
938 if (topWnd->style & WS_MAXIMIZE)
939 {
940 /* SC_RESTORE + Snap causes the window to visually move twice, place it manually in the snap position */
941 RECT normalRect = topWnd->InternalPos.NormalRect;
942 co_IntCalculateSnapPosition(topWnd, edge, &topWnd->InternalPos.NormalRect); /* Calculate edge position */
943 IntSetSnapEdge(topWnd, edge); /* Tell everyone the edge we are snapped to */
945 IntSetSnapInfo(topWnd, edge, &normalRect); /* Reset the real place to unsnap to */
946 snapped = HTNOWHERE; /* Force snap */
947 }
948#if 0 /* Windows 8 does this but is it a good feature? */
949 else if (snapped == edge)
950 {
951 /* Already snapped to this edge, snap to the opposite side */
952 edge = otherEdge;
953 }
954#endif
955
956 if (snapped == otherEdge)
957 co_IntUnsnapWindow(topWnd);
958 else
959 co_IntSnapWindow(topWnd, edge);
960 }
961 }
962 }
963 break;
964
965 case WM_SYSKEYDOWN:
966 {
967 if (HIWORD(lParam) & KF_ALTDOWN)
968 { /* Previous state, if the key was down before this message,
969 this is a cheap way to ignore autorepeat keys. */
970 if ( !(HIWORD(lParam) & KF_REPEAT) )
971 {
972 if ( ( wParam == VK_MENU ||
973 wParam == VK_LMENU ||
974 wParam == VK_RMENU ) && !(pti->MessageQueue->QF_flags & QF_FMENUSTATUS)) //iMenuSysKey )
975 pti->MessageQueue->QF_flags |= QF_FMENUSTATUS; //iMenuSysKey = 1;
976 else
977 pti->MessageQueue->QF_flags &= ~QF_FMENUSTATUS; //iMenuSysKey = 0;
978 }
979
980 pti->MessageQueue->QF_flags &= ~QF_FF10STATUS; //iF10Key = 0;
981
982 if (wParam == VK_F4) /* Try to close the window */
983 {
985 if (!(top->pcls->style & CS_NOCLOSE))
987 }
988 else if (wParam == VK_SNAPSHOT) // Alt-VK_SNAPSHOT?
989 {
990 PWND pwnd = Wnd;
991 while (IntGetParent(pwnd) != NULL)
992 {
993 pwnd = IntGetParent(pwnd);
994 }
995 ERR("DefWndScreenshot\n");
996 DefWndScreenshot(pwnd);
997 }
998 else if ( wParam == VK_ESCAPE || wParam == VK_TAB ) // Alt-Tab/ESC Alt-Shift-Tab/ESC
999 {
1000 WPARAM wParamTmp;
1001 HWND Active = UserGetActiveWindow(); // Noticed MDI problem.
1002 if (!Active)
1003 {
1004 FIXME("WM_SYSKEYDOWN VK_ESCAPE no active\n");
1005 break;
1006 }
1007 wParamTmp = UserGetKeyState(VK_SHIFT) & 0x8000 ? SC_PREVWINDOW : SC_NEXTWINDOW;
1009 }
1010 }
1011 else if( wParam == VK_F10 )
1012 {
1013 if (UserGetKeyState(VK_SHIFT) & 0x8000)
1015 pti->MessageQueue->QF_flags |= QF_FF10STATUS; //iF10Key = 1;
1016 }
1017 else if( wParam == VK_ESCAPE && (UserGetKeyState(VK_SHIFT) & 0x8000))
1019 break;
1020 }
1021
1022 case WM_KEYUP:
1023 case WM_SYSKEYUP:
1024 {
1025 /* Press and release F10 or ALT */
1026 if (((wParam == VK_MENU || wParam == VK_LMENU || wParam == VK_RMENU)
1027 && (pti->MessageQueue->QF_flags & (QF_FMENUSTATUS|QF_FMENUSTATUSBREAK)) == QF_FMENUSTATUS /*iMenuSysKey*/) ||
1028 ((wParam == VK_F10) && pti->MessageQueue->QF_flags & QF_FF10STATUS /*iF10Key*/))
1030 pti->MessageQueue->QF_flags &= ~(QF_FMENUSTATUS|QF_FMENUSTATUSBREAK|QF_FF10STATUS); //iMenuSysKey = iF10Key = 0;
1031 break;
1032 }
1033
1034 case WM_SYSCHAR:
1035 {
1036 pti->MessageQueue->QF_flags &= ~(QF_FMENUSTATUS|QF_FMENUSTATUSBREAK); //iMenuSysKey = 0;
1037 if (wParam == VK_RETURN && (Wnd->style & WS_MINIMIZE) != 0)
1038 {
1040 break;
1041 }
1042 if ((HIWORD(lParam) & KF_ALTDOWN) && wParam)
1043 {
1044 if (wParam == VK_TAB || wParam == VK_ESCAPE) break;
1045 if (wParam == VK_SPACE && Wnd->style & WS_CHILD)
1047 else
1049 }
1050 else /* check for Ctrl-Esc */
1051 if (wParam != VK_ESCAPE) UserPostMessage(hwndSAS, WM_LOGONNOTIFY, LN_MESSAGE_BEEP, 0); //MessageBeep(0);
1052 break;
1053 }
1054
1055 case WM_CANCELMODE:
1056 {
1057 pti->MessageQueue->QF_flags &= ~(QF_FMENUSTATUS|QF_FMENUSTATUSBREAK);
1058
1059 MENU_EndMenu( Wnd );
1061 {
1063 }
1064 break;
1065 }
1066
1067 case WM_CLOSE:
1069 break;
1070
1071 case WM_CTLCOLORMSGBOX:
1072 case WM_CTLCOLOREDIT:
1073 case WM_CTLCOLORLISTBOX:
1074 case WM_CTLCOLORBTN:
1075 case WM_CTLCOLORDLG:
1076 case WM_CTLCOLORSTATIC:
1079
1080 case WM_CTLCOLOR:
1082
1083 case WM_SETCURSOR:
1084 {
1085 if (Wnd->style & WS_CHILD)
1086 {
1087 /* with the exception of the border around a resizable wnd,
1088 * give the parent first chance to set the cursor */
1090 {
1091 PWND parent = Wnd->spwndParent;//IntGetParent( Wnd );
1092 if (parent != UserGetDesktopWindow() &&
1094 return TRUE;
1095 }
1096 }
1097 return DefWndHandleSetCursor(Wnd, wParam, lParam);
1098 }
1099
1100 case WM_MOUSEACTIVATE:
1101 if (Wnd->style & WS_CHILD)
1102 {
1104 PWND pwndParent = IntGetParent(Wnd);
1105 hwndParent = pwndParent ? UserHMGetHandle(pwndParent) : NULL;
1106 if (hwndParent)
1107 {
1109 if (lResult)
1110 break;
1111 }
1112 }
1114
1115 case WM_ACTIVATE:
1116 /* The default action in Windows is to set the keyboard focus to
1117 * the window, if it's being activated and not minimized */
1118 if (LOWORD(wParam) != WA_INACTIVE &&
1119 !(Wnd->style & WS_MINIMIZE))
1120 {
1121 //ERR("WM_ACTIVATE %p\n",hWnd);
1122 co_UserSetFocus(Wnd);
1123 }
1124 break;
1125
1126 case WM_MOUSEWHEEL:
1127 if (Wnd->style & WS_CHILD)
1128 {
1130 PWND pwndParent = IntGetParent(Wnd);
1131 hwndParent = pwndParent ? UserHMGetHandle(pwndParent) : NULL;
1133 }
1134 break;
1135
1136 case WM_ERASEBKGND:
1137 case WM_ICONERASEBKGND:
1138 {
1139 RECT Rect;
1140 HBRUSH hBrush = Wnd->pcls->hbrBackground;
1141 if (!hBrush) return 0;
1142 if (hBrush <= (HBRUSH)COLOR_MENUBAR)
1143 {
1144 hBrush = IntGetSysColorBrush(HandleToUlong(hBrush));
1145 }
1146 if (Wnd->pcls->style & CS_PARENTDC)
1147 {
1148 /* can't use GetClipBox with a parent DC or we fill the whole parent */
1149 IntGetClientRect(Wnd, &Rect);
1151 }
1152 else
1153 {
1154 GdiGetClipBox((HDC)wParam, &Rect);
1155 }
1156 FillRect((HDC)wParam, &Rect, hBrush);
1157 return (1);
1158 }
1159
1160 case WM_GETHOTKEY:
1161 //ERR("WM_GETHOTKEY\n");
1162 return DefWndGetHotKey(Wnd);
1163 case WM_SETHOTKEY:
1164 //ERR("WM_SETHOTKEY\n");
1165 return DefWndSetHotKey(Wnd, wParam);
1166
1167 case WM_NCHITTEST:
1168 {
1169 POINT Point;
1172 return GetNCHitEx(Wnd, Point);
1173 }
1174
1175 case WM_PRINT:
1176 {
1177 DefWndPrint(Wnd, (HDC)wParam, lParam);
1178 return (0);
1179 }
1180
1181 case WM_SYSCOLORCHANGE:
1182 {
1183 /* force to redraw non-client area */
1184 UserPaintCaption(Wnd, DC_NC);
1185 /* Use InvalidateRect to redraw client area, enable
1186 * erase to redraw all subcontrols otherwise send the
1187 * WM_SYSCOLORCHANGE to child windows/controls is required
1188 */
1190 return (0);
1191 }
1192
1193 case WM_PAINTICON:
1194 case WM_PAINT:
1195 {
1196 PAINTSTRUCT Ps;
1197 HDC hDC;
1198
1199 /* If already in Paint and Client area is not empty just return. */
1200 if (Wnd->state2 & WNDS2_STARTPAINT && !RECTL_bIsEmptyRect(&Wnd->rcClient))
1201 {
1202 ERR("In Paint and Client area is not empty!\n");
1203 return 0;
1204 }
1205
1206 hDC = IntBeginPaint(Wnd, &Ps);
1207 if (hDC)
1208 {
1209 if (((Wnd->style & WS_MINIMIZE) != 0) && (Wnd->pcls->spicn))
1210 {
1211 RECT ClientRect;
1212 INT x, y;
1213
1214 ERR("Doing Paint and Client area is empty!\n");
1215 IntGetClientRect(Wnd, &ClientRect);
1216 x = (ClientRect.right - ClientRect.left - UserGetSystemMetrics(SM_CXICON)) / 2;
1217 y = (ClientRect.bottom - ClientRect.top - UserGetSystemMetrics(SM_CYICON)) / 2;
1218 UserReferenceObject(Wnd->pcls->spicn);
1219 UserDrawIconEx(hDC, x, y, Wnd->pcls->spicn, 0, 0, 0, 0, DI_NORMAL | DI_COMPAT | DI_DEFAULTSIZE);
1220 UserDereferenceObject(Wnd->pcls->spicn);
1221 }
1222
1223 IntEndPaint(Wnd, &Ps);
1224 }
1225 return (0);
1226 }
1227
1228 case WM_SYNCPAINT:
1229 {
1230 HRGN hRgn;
1231 Wnd->state &= ~WNDS_SYNCPAINTPENDING;
1232 TRACE("WM_SYNCPAINT\n");
1233 hRgn = NtGdiCreateRectRgn(0, 0, 0, 0);
1234 if (hRgn)
1235 {
1237 {
1238 PREGION pRgn = REGION_LockRgn(hRgn);
1239 if (pRgn) REGION_UnlockRgn(pRgn);
1240 if (!wParam)
1242 co_UserRedrawWindow(Wnd, NULL, pRgn, wParam);
1243 }
1245 }
1246 return 0;
1247 }
1248
1249 case WM_SETREDRAW:
1250 if (wParam)
1251 {
1252 if (!(Wnd->style & WS_VISIBLE))
1253 {
1254 IntSetStyle( Wnd, WS_VISIBLE, 0 );
1255 Wnd->state |= WNDS_SENDNCPAINT;
1256 }
1257 }
1258 else
1259 {
1260 if (Wnd->style & WS_VISIBLE)
1261 {
1263 IntSetStyle( Wnd, 0, WS_VISIBLE );
1264 }
1265 }
1266 return 0;
1267
1269 {
1271 }
1272
1274 {
1276 }
1277
1278 case WM_NCCALCSIZE:
1279 {
1280 return NC_HandleNCCalcSize( Wnd, wParam, (RECTL *)lParam, FALSE );
1281 }
1282
1283 case WM_NCACTIVATE:
1284 {
1285 return NC_HandleNCActivate( Wnd, wParam, lParam );
1286 }
1287
1288 //
1289 // NC Paint mode.
1290 //
1291 case WM_NCPAINT:
1292 {
1294 Wnd->state |= WNDS_FORCEMENUDRAW;
1295 NC_DoNCPaint(Wnd, hDC, -1);
1296 Wnd->state &= ~WNDS_FORCEMENUDRAW;
1297 UserReleaseDC(Wnd, hDC, FALSE);
1298 return 0;
1299 }
1300 //
1301 // Draw Caption mode.
1302 //
1303 // wParam are DC_* flags.
1304 //
1306 {
1308 TRACE("WM_NCUAHDRAWCAPTION: wParam DC_ flags %08x\n",wParam);
1309 UserDrawCaptionBar(Wnd, hDC, wParam | DC_FRAME); // Include DC_FRAME to comp for drawing glitch.
1310 UserReleaseDC(Wnd, hDC, FALSE);
1311 return 0;
1312 }
1313 //
1314 // Draw Frame mode.
1315 //
1316 // wParam is HDC, lParam are DC_ACTIVE and or DC_REDRAWHUNGWND.
1317 //
1318 case WM_NCUAHDRAWFRAME:
1319 {
1320 TRACE("WM_NCUAHDRAWFRAME: wParam hDC %p lParam DC_ flags %08x\n",wParam,lParam);
1322 return 0;
1323 }
1324
1325 /* ReactOS only. */
1326 case WM_CBT:
1327 {
1328 switch (wParam)
1329 {
1330 case HCBT_MOVESIZE:
1331 {
1332 RECTL rt;
1333
1334 if (lParam)
1335 {
1336 _SEH2_TRY
1337 {
1339 sizeof(RECT),
1340 1);
1341
1342 RtlCopyMemory(&rt,
1343 (PVOID)lParam,
1344 sizeof(RECT));
1345 }
1347 {
1348 lResult = 1;
1349 }
1350 _SEH2_END;
1351 }
1352 if (!lResult)
1354
1355 break;
1356 }
1357 }
1358 break;
1359 }
1360 }
1361 return lResult;
1362}
static HDC hDC
Definition: 3dtext.c:33
#define DCX_USESTYLE
Definition: GetDCEx.c:10
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn UINT32 *TableIdx UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER void *Data ACPI_OBJECT_HANDLER void **Data ACPI_STRING ACPI_OBJECT_LIST ACPI_BUFFER *ReturnObjectBuffer ACPI_DEVICE_INFO **ReturnBuffer ACPI_HANDLE Parent
Definition: acpixf.h:732
#define FIXME(fmt,...)
Definition: precomp.h:53
#define WARN(fmt,...)
Definition: precomp.h:61
#define UlongToHandle(ul)
Definition: basetsd.h:97
#define HandleToUlong(h)
Definition: basetsd.h:79
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
struct @1766 Msg[]
BOOL FASTCALL GreDPtoLP(HDC, LPPOINT, INT)
Definition: dcutil.c:7
static HWND hwndParent
Definition: cryptui.c:300
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
r parent
Definition: btrfs.c:3010
VOID NTAPI ProbeForRead(IN CONST VOID *Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:102
HWND FASTCALL co_UserSetFocus(PWND Window)
Definition: focus.c:1317
HWND FASTCALL IntGetCaptureWindow(VOID)
Definition: focus.c:34
HWND FASTCALL UserGetForegroundWindow(VOID)
Definition: focus.c:1424
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLenum GLsizei len
Definition: glext.h:6722
#define WNDS_FORCEMENUDRAW
Definition: ntuser.h:620
#define WNDS2_STARTPAINT
Definition: ntuser.h:643
HGDIOBJ FASTCALL IntGetSysColorBrush(INT Object)
Definition: stockobj.c:317
static HDC
Definition: imagelist.c:88
static HRGN hRgn
Definition: mapping.c:33
#define WM_KEYF1
Definition: msg.c:47
#define min(a, b)
Definition: monoChain.cc:55
DWORD FASTCALL UserGetKeyState(DWORD dwKey)
Definition: msgqueue.c:221
#define QF_FMENUSTATUSBREAK
Definition: msgqueue.h:96
#define QF_FMENUSTATUS
Definition: msgqueue.h:97
#define QF_FF10STATUS
Definition: msgqueue.h:98
_Use_decl_annotations_ NTSTATUS NTAPI RtlUnicodeToMultiByteSize(_Out_ PULONG MbSize, _In_ PCWCH UnicodeString, _In_ ULONG UnicodeSize)
Definition: nlsboot.c:145
__kernel_entry W32KAPI HRGN APIENTRY NtGdiCreateRectRgn(_In_ INT xLeft, _In_ INT yTop, _In_ INT xRight, _In_ INT yBottom)
LRESULT FASTCALL DefWndHandleWindowPosChanged(PWND pWnd, WINDOWPOS *Pos)
Definition: defwnd.c:95
LRESULT DefWndHandleSetCursor(PWND pWnd, WPARAM wParam, LPARAM lParam)
Definition: defwnd.c:243
LRESULT FASTCALL DefWndGetIcon(PWND pWnd, WPARAM wParam, LPARAM lParam)
Definition: defwnd.c:476
VOID FASTCALL DefWndScreenshot(PWND pWnd)
Definition: defwnd.c:551
LRESULT FASTCALL DefWndHandleWindowPosChanging(PWND pWnd, WINDOWPOS *Pos)
Definition: defwnd.c:68
VOID FASTCALL DefWndPrint(PWND pwnd, HDC hdc, ULONG uFlags)
Definition: defwnd.c:365
LRESULT FASTCALL DefWndHandleSysCommand(PWND pWnd, WPARAM wParam, LPARAM lParam)
Definition: defwnd.c:125
BOOL UserPaintCaption(PWND pWnd, INT Flags)
Definition: defwnd.c:398
LRESULT FASTCALL DefWndSetIcon(PWND pWnd, WPARAM wParam, LPARAM lParam)
Definition: defwnd.c:437
static BOOL co_UserTrackSystemMenu(_In_ PWND pWnd, _In_ LONG nClickPos, _In_opt_ PUINT puCmdType)
Definition: defwnd.c:585
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:4014
VOID FASTCALL co_IntSnapWindow(PWND Wnd, UINT Edge)
Definition: winpos.c:3942
VOID FASTCALL co_IntCalculateSnapPosition(PWND Wnd, UINT Edge, OUT RECT *Pos)
Definition: winpos.c:3912
BOOL FASTCALL IntScreenToClient(PWND Wnd, LPPOINT lpPoint)
Definition: winpos.c:213
UINT FASTCALL IntGetWindowSnapEdge(PWND Wnd)
Definition: winpos.c:3904
VOID FASTCALL IntSetSnapEdge(PWND Wnd, UINT Edge)
Definition: winpos.c:3989
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:3393
int iCtrlId
Definition: winuser.h:3390
DWORD_PTR dwContextId
Definition: winuser.h:3392
HANDLE hItemHandle
Definition: winuser.h:3391
int iContextType
Definition: winuser.h:3389
UINT cbSize
Definition: winuser.h:3388
#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:1442
BOOL FASTCALL IntEndPaint(PWND Wnd, PPAINTSTRUCT Ps)
Definition: painting.c:1539
INT FASTCALL co_UserGetUpdateRgn(PWND Window, HRGN hRgn, BOOL bErase)
Definition: painting.c:1791
DWORD FASTCALL IntGetWindowContextHelpId(PWND pWnd)
Definition: window.c:440
PWND FASTCALL UserGetWindowObject(HWND hWnd)
Definition: window.c:124
PWND FASTCALL UserGetAncestor(PWND Wnd, UINT Type)
BOOLEAN co_UserDestroyWindow(PVOID Object)
Definition: window.c:2870
INT FASTCALL UserReleaseDC(PWND Window, HDC hDc, BOOL EndPaint)
Definition: windc.c:918
BOOL APIENTRY DefSetText(PWND Wnd, PCWSTR WindowText)
Definition: window.c:4390
HDC FASTCALL UserGetDCEx(PWND Window OPTIONAL, HANDLE ClipRegion, ULONG Flags)
FORCEINLINE BOOL RECTL_bIsEmptyRect(_In_ const RECTL *prcl)
Definition: rect.h:44
PREGION FASTCALL REGION_LockRgn(_In_ HRGN hrgn)
Definition: region.c:2358
VOID FASTCALL REGION_UnlockRgn(_In_ PREGION prgn)
Definition: region.c:2373
BOOL UserDrawIconEx(HDC hDc, INT xLeft, INT yTop, PCURICON_OBJECT pIcon, INT cxWidth, INT cyHeight, UINT istepIfAniCur, HBRUSH hbrFlickerFreeDraw, UINT diFlags)
Definition: cursoricon.c:1689
PWND FASTCALL UserGetDesktopWindow(VOID)
Definition: desktop.c:1403
UINT FASTCALL DefWndGetHotKey(PWND pWnd)
Definition: hotkey.c:338
INT FASTCALL DefWndSetHotKey(PWND pWnd, WPARAM wParam)
Definition: hotkey.c:365
BYTE gafAsyncKeyState[256 *2/8]
Definition: keyboard.c:13
#define IS_KEY_DOWN(ks, vk)
Definition: input.h:103
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:1575
VOID UserDrawCaptionBar(PWND pWnd, HDC hDC, INT Flags)
Definition: nonclient.c:955
DWORD FASTCALL GetNCHitEx(PWND pWnd, POINT pt)
Definition: nonclient.c:1985
LRESULT NC_HandleNCActivate(PWND Wnd, WPARAM wParam, LPARAM lParam)
Definition: nonclient.c:1438
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:1304
LRESULT NC_HandleNCRButtonDown(PWND pwnd, WPARAM wParam, LPARAM lParam)
Definition: nonclient.c:1725
LRESULT NC_HandleNCLButtonDblClk(PWND pWnd, WPARAM wParam, LPARAM lParam)
Definition: nonclient.c:1667
VOID FASTCALL UserReferenceObject(PVOID obj)
Definition: object.c:731
LRESULT IntClientShutdown(IN PWND pWindow, IN WPARAM wParam, IN LPARAM lParam)
Definition: shutdown.c:22
BOOL g_bWindowSnapEnabled
Definition: sysparams.c:20
PWND FASTCALL IntGetParent(PWND Wnd)
Definition: window.c:206
VOID FASTCALL IntGetClientRect(PWND WindowObject, RECTL *Rect)
Definition: winpos.c:92
#define GET_Y_LPARAM(lp)
Definition: windowsx.h:300
#define WM_CTLCOLOR
Definition: windowsx.h:29
#define GET_X_LPARAM(lp)
Definition: windowsx.h:299
#define DI_COMPAT
Definition: wingdi.h:68
#define NULLREGION
Definition: wingdi.h:361
#define DI_NORMAL
Definition: wingdi.h:72
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
#define DI_DEFAULTSIZE
Definition: wingdi.h:69
FORCEINLINE VOID co_IntUnsnapWindow(PWND Wnd)
Definition: winpos.h:89
FORCEINLINE BOOLEAN IntIsSnapAllowedForWindow(PWND Wnd)
Definition: winpos.h:101
#define WM_PAINT
Definition: winuser.h:1639
#define WM_ERASEBKGND
Definition: winuser.h:1644
#define WM_GETHOTKEY
Definition: winuser.h:1672
#define WM_CTLCOLORSTATIC
Definition: winuser.h:1791
#define WM_GETTEXTLENGTH
Definition: winuser.h:1638
#define SW_HIDE
Definition: winuser.h:779
#define WM_CLOSE
Definition: winuser.h:1640
#define VK_SNAPSHOT
Definition: winuser.h:2250
#define WM_SYSCOMMAND
Definition: winuser.h:1760
#define SC_KEYMENU
Definition: winuser.h:2615
#define VK_TAB
Definition: winuser.h:2218
#define GA_ROOT
Definition: winuser.h:2865
#define MAKELPARAM(l, h)
Definition: winuser.h:4084
#define WM_KEYUP
Definition: winuser.h:1735
#define DCX_WINDOW
Definition: winuser.h:2132
#define HELPINFO_MENUITEM
Definition: winuser.h:1182
#define VK_F10
Definition: winuser.h:2283
#define WM_WINDOWPOSCHANGING
Definition: winuser.h:1680
#define TPM_RIGHTBUTTON
Definition: winuser.h:2399
#define WM_SYNCPAINT
Definition: winuser.h:1709
#define SC_PREVWINDOW
Definition: winuser.h:2610
#define VK_SPACE
Definition: winuser.h:2238
#define WM_CANCELMODE
Definition: winuser.h:1654
#define WM_LBUTTONDBLCLK
Definition: winuser.h:1797
#define KF_ALTDOWN
Definition: winuser.h:2468
#define MA_ACTIVATE
Definition: winuser.h:2520
#define WM_APPCOMMAND
Definition: winuser.h:1901
#define WM_NCHITTEST
Definition: winuser.h:1705
#define WM_RBUTTONUP
Definition: winuser.h:1799
#define VK_UP
Definition: winuser.h:2244
#define SW_SHOWNOACTIVATE
Definition: winuser.h:785
#define WH_SHELL
Definition: winuser.h:40
#define WM_GETTEXT
Definition: winuser.h:1637
#define RDW_ERASE
Definition: winuser.h:1222
#define WM_CTLCOLORSCROLLBAR
Definition: winuser.h:1790
#define WA_INACTIVE
Definition: winuser.h:2641
#define MA_NOACTIVATE
Definition: winuser.h:2522
#define WM_LBUTTONDOWN
Definition: winuser.h:1795
#define WM_DEVICECHANGE
Definition: winuser.h:1830
#define WM_SYSCOLORCHANGE
Definition: winuser.h:1645
#define WM_CTLCOLORMSGBOX
Definition: winuser.h:1785
#define WM_NCLBUTTONDBLCLK
Definition: winuser.h:1713
#define WM_ACTIVATE
Definition: winuser.h:1631
#define WM_SHOWWINDOW
Definition: winuser.h:1647
#define WM_RBUTTONDOWN
Definition: winuser.h:1798
#define SC_MINIMIZE
Definition: winuser.h:2605
#define WM_CTLCOLORBTN
Definition: winuser.h:1788
#define WM_SETTEXT
Definition: winuser.h:1636
#define SC_NEXTWINDOW
Definition: winuser.h:2609
#define DC_NC
Definition: winuser.h:440
#define DCX_INTERSECTRGN
Definition: winuser.h:2141
#define WM_NCACTIVATE
Definition: winuser.h:1707
#define WM_SYSCHAR
Definition: winuser.h:1740
#define VK_RETURN
Definition: winuser.h:2220
#define SM_CYICON
Definition: winuser.h:984
#define VK_RMENU
Definition: winuser.h:2306
#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:1739
#define HCBT_MOVESIZE
Definition: winuser.h:55
#define SC_CLOSE
Definition: winuser.h:2611
#define DC_TEXT
Definition: winuser.h:430
#define VK_LWIN
Definition: winuser.h:2254
struct tagHELPINFO HELPINFO
#define WM_MOUSEACTIVATE
Definition: winuser.h:1656
#define TPM_LEFTBUTTON
Definition: winuser.h:2398
#define VK_F4
Definition: winuser.h:2277
#define VK_LEFT
Definition: winuser.h:2243
#define VK_RIGHT
Definition: winuser.h:2245
#define VK_DOWN
Definition: winuser.h:2246
#define WM_SETCURSOR
Definition: winuser.h:1655
#define KF_REPEAT
Definition: winuser.h:2469
#define WM_USER
Definition: winuser.h:1914
#define WM_CTLCOLORLISTBOX
Definition: winuser.h:1787
#define VK_SHIFT
Definition: winuser.h:2221
#define WM_NCRBUTTONUP
Definition: winuser.h:1715
#define WM_KEYDOWN
Definition: winuser.h:1734
#define WM_ICONERASEBKGND
Definition: winuser.h:1661
#define WM_PRINT
Definition: winuser.h:1899
#define WM_NCCALCSIZE
Definition: winuser.h:1704
#define SM_CXICON
Definition: winuser.h:983
#define WM_CTLCOLOREDIT
Definition: winuser.h:1786
#define VK_ESCAPE
Definition: winuser.h:2233
#define WM_WINDOWPOSCHANGED
Definition: winuser.h:1681
#define SC_RESTORE
Definition: winuser.h:2617
#define WM_CTLCOLORDLG
Definition: winuser.h:1789
#define CS_NOCLOSE
Definition: winuser.h:662
#define WM_SYSKEYDOWN
Definition: winuser.h:1738
#define WM_NCLBUTTONDOWN
Definition: winuser.h:1711
#define RDW_INVALIDATE
Definition: winuser.h:1225
#define WM_PAINTICON
Definition: winuser.h:1660
#define WM_MBUTTONDOWN
Definition: winuser.h:1801
#define VK_RWIN
Definition: winuser.h:2255
#define SC_MAXIMIZE
Definition: winuser.h:2607
#define VK_LMENU
Definition: winuser.h:2305
#define VK_MENU
Definition: winuser.h:2223
#define WM_NCPAINT
Definition: winuser.h:1706
#define WM_NCRBUTTONDOWN
Definition: winuser.h:1714
#define WM_SETREDRAW
Definition: winuser.h:1635
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
_In_ ULONG _In_ BOOLEAN Active
Definition: potypes.h:561

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

◆ IntEnableWindow()

BOOL FASTCALL IntEnableWindow ( HWND  hWnd,
BOOL  bEnable 
)

Definition at line 222 of file window.c.

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

Referenced by NtUserCallTwoParam(), and NtUserEnableScrollBar().

◆ IntFindWindow()

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

Definition at line 3078 of file window.c.

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

Referenced by NtUserFindWindowEx().

◆ IntFreeHwndList()

VOID FASTCALL IntFreeHwndList ( PWINDOWLIST  pwlTarget)

Definition at line 1473 of file window.c.

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

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

◆ IntGetClientRect()

VOID FASTCALL IntGetClientRect ( PWND  Wnd,
RECTL Rect 
)

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

Note
Does not check the validity of the parameters

Definition at line 92 of file winpos.c.

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

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

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

◆ IntGetParent()

PWND FASTCALL IntGetParent ( PWND  Wnd)

◆ IntGetWindow()

HWND FASTCALL IntGetWindow ( HWND  hWnd,
UINT  uCmd 
)

Definition at line 383 of file window.c.

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

2163{
2164 PWND pwndNode;
2165 PIMEUI pimeui;
2166 IMEUI SafeImeUI;
2167
2168 pimeui = ((PIMEWND)pImeWnd)->pimeui;
2169 if (!pimeui || (LONG_PTR)pimeui == (LONG_PTR)-1)
2170 return FALSE;
2171
2172 // Check IMEUI.fDestroy
2173 _SEH2_TRY
2174 {
2175 ProbeForRead(pimeui, sizeof(IMEUI), 1);
2176 SafeImeUI = *pimeui;
2177 if (SafeImeUI.fDestroy)
2178 return FALSE;
2179 }
2181 {
2182 ERR("Exception in IntImeCanDestroyDefIME: %p\n", pimeui);
2183 }
2184 _SEH2_END;
2185
2186 // Any ancestor of pImeWnd is pwndTarget?
2187 if (pImeWnd->spwndOwner)
2188 {
2189 for (pwndNode = pImeWnd->spwndOwner; pwndNode; pwndNode = pwndNode->spwndOwner)
2190 {
2191 if (pwndNode == pwndTarget)
2192 break;
2193 }
2194
2195 if (!pwndNode)
2196 return FALSE;
2197 }
2198
2199 // Any ancestor of pwndTarget is IME-like?
2200 for (pwndNode = pwndTarget; pwndNode; pwndNode = pwndNode->spwndOwner)
2201 {
2202 if (IS_WND_IMELIKE(pwndNode))
2203 return FALSE;
2204 }
2205
2206 // Adjust the ordering and top-mode status
2207 IntImeSetFutureOwner(pImeWnd, pwndTarget);
2208 for (pwndNode = pImeWnd->spwndOwner; pwndNode; pwndNode = pwndNode->spwndNext)
2209 {
2210 if (pwndNode == pImeWnd)
2211 break;
2212 }
2213 if (pwndNode == pImeWnd)
2214 IntImeCheckTopmost(pImeWnd);
2215
2216 // Is the owner of pImeWnd NULL or pwndTarget?
2217 if (pImeWnd->spwndOwner && pwndTarget != pImeWnd->spwndOwner)
2218 return FALSE;
2219
2220 WndSetOwner(pImeWnd, NULL);
2221 return TRUE;
2222}
static VOID FASTCALL IntImeCheckTopmost(_In_ PWND pImeWnd)
Definition: ime.c:1414
VOID FASTCALL IntImeSetFutureOwner(PWND pImeWnd, PWND pwndOwner)
Definition: ime.c:1230
UINT fDestroy
Definition: ntuser.h:1229
#define LONG_PTR
Definition: treelist.c:79

Referenced by co_UserDestroyWindow().

◆ IntImeCanDestroyDefIMEforChild()

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

Definition at line 2113 of file ime.c.

2116{
2117 PWND pwndNode;
2118 PIMEUI pimeui;
2119 IMEUI SafeImeUI;
2120
2121 pimeui = ((PIMEWND)pImeWnd)->pimeui;
2122 if (!pimeui || (LONG_PTR)pimeui == (LONG_PTR)-1)
2123 return FALSE;
2124
2125 // Check IMEUI.fChildThreadDef
2126 _SEH2_TRY
2127 {
2128 ProbeForRead(pimeui, sizeof(IMEUI), 1);
2129 SafeImeUI = *pimeui;
2130 if (!SafeImeUI.fChildThreadDef)
2131 return FALSE;
2132 }
2134 {
2135 ERR("Exception in IntImeCanDestroyDefIMEforChild: %p\n", pimeui);
2136 }
2137 _SEH2_END;
2138
2139 // The parent of pwndTarget is NULL or of the same thread of pwndTarget?
2140 if (pwndTarget->spwndParent == NULL ||
2141 pwndTarget->head.pti == pwndTarget->spwndParent->head.pti)
2142 {
2143 return FALSE;
2144 }
2145
2146 for (pwndNode = pwndTarget; pwndNode; pwndNode = pwndNode->spwndParent)
2147 {
2148 if (pwndNode == pwndNode->head.rpdesk->pDeskInfo->spwnd)
2149 break;
2150
2151 if (IntFindNonImeRelatedWndOfSameThread(pwndNode->spwndParent, pwndTarget))
2152 return FALSE;
2153 }
2154
2155 return TRUE;
2156}
BOOL IntFindNonImeRelatedWndOfSameThread(PWND pwndParent, PWND pwndTarget)
Definition: ime.c:1932

Referenced by co_UserDestroyWindow().

◆ IntIsChildWindow()

BOOL FASTCALL IntIsChildWindow ( PWND  Parent,
PWND  Child 
)

Definition at line 930 of file window.c.

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

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

◆ IntIsWindow()

◆ IntIsWindowVisible()

BOOL FASTCALL IntIsWindowVisible ( PWND  Wnd)

Definition at line 191 of file window.c.

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

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

◆ IntLinkHwnd()

VOID FASTCALL IntLinkHwnd ( PWND  Wnd,
HWND  hWndPrev 
)

Definition at line 986 of file window.c.

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

Referenced by DefWndDoSizeMove(), and DefWndHandleWindowPosChanged().

◆ IntNotifyImeShowStatus()

VOID FASTCALL IntNotifyImeShowStatus ( _In_ PWND  pImeWnd)

Definition at line 2430 of file ime.c.

2431{
2432 PIMEUI pimeui;
2433 PWND pWnd;
2434 PTHREADINFO pti, ptiIME;
2435 BOOL bShow, bSendNotify = FALSE;
2436 IMEUI SafeImeUI;
2437
2438 if (!IS_IMM_MODE() || (pImeWnd->state2 & WNDS2_INDESTROY))
2439 return;
2440
2442 ptiIME = pImeWnd->head.pti;
2443
2444 // Attach to the process if necessary
2445 if (pti != ptiIME)
2446 KeAttachProcess(&(ptiIME->ppi->peProcess->Pcb));
2447
2448 // Get an IMEUI and check whether hwndIMC is valid and update fShowStatus
2449 _SEH2_TRY
2450 {
2451 ProbeForWrite(pImeWnd, sizeof(IMEWND), 1);
2452 pimeui = ((PIMEWND)pImeWnd)->pimeui;
2453 SafeImeUI = *pimeui;
2454
2455 bShow = (gfIMEShowStatus == TRUE) && SafeImeUI.fCtrlShowStatus;
2456
2457 pWnd = ValidateHwndNoErr(SafeImeUI.hwndIMC);
2458 if (!pWnd)
2459 pWnd = ptiIME->MessageQueue->spwndFocus;
2460
2461 if (pWnd)
2462 {
2463 bSendNotify = TRUE;
2464 pimeui->fShowStatus = bShow;
2465 }
2466 }
2468 {
2469 ERR("Exception in IntNotifyImeShowStatus: %p, %p, %p, %d, %d\n",
2470 pImeWnd, pimeui, ptiIME, SafeImeUI.fCtrlShowStatus, gfIMEShowStatus);
2471
2472 if (pti != ptiIME)
2474
2475 _SEH2_YIELD(return);
2476 }
2477 _SEH2_END;
2478
2479 // Detach from the process if necessary
2480 if (pti != ptiIME)
2482
2483 if (bSendNotify)
2484 IntSendOpenStatusNotify(ptiIME, &SafeImeUI, pWnd, bShow);
2485
2486 if (!(pImeWnd->state2 & WNDS2_INDESTROY))
2487 IntCheckImeShowStatus(pImeWnd, NULL);
2488}
VOID FASTCALL IntSendOpenStatusNotify(PTHREADINFO ptiIME, PIMEUI pimeui, PWND pWnd, BOOL bOpen)
Definition: ime.c:2410
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:184
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:85
#define EngGetTickCount32()
Definition: eng.h:43
GLbitfield flags
Definition: glext.h:7161
#define WEF_SETBYWNDPTI
Definition: ntuser.h:236
#define NtCurrentTeb
HANDLE UniqueThread
Definition: compat.h:826
Definition: typedefs.h:120
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
struct _THREADINFO * pti
Definition: ntuser.h:188
DWORD idThread
Definition: hook.h:22
WINEVENTPROC Proc
Definition: hook.h:23
ULONG_PTR offPfn
Definition: hook.h:25
INT_PTR ihmod
Definition: hook.h:26
UINT eventMin
Definition: hook.h:19
THROBJHEAD head
Definition: hook.h:17
ULONG Flags
Definition: hook.h:24
DWORD idProcess
Definition: hook.h:21
UINT Counts
Definition: hook.h:32
LIST_ENTRY Events
Definition: hook.h:31
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
LRESULT APIENTRY co_IntCallEventProc(HWINEVENTHOOK hook, DWORD event, HWND hWnd, LONG idObject, LONG idChild, DWORD dwEventThread, DWORD dwmsEventTime, WINEVENTPROC Proc, INT Mod, ULONG_PTR offPfn)
Definition: callback.c:838
static PEVENTTABLE GlobalEvents
Definition: event.c:19
static LRESULT FASTCALL IntCallLowLevelEvent(PEVENTHOOK pEH, DWORD event, HWND hwnd, LONG idObject, LONG idChild, LONG idThread)
Definition: event.c:97
#define WINEVENT_INCONTEXT
Definition: winable.h:35
#define WINEVENT_SKIPOWNPROCESS
Definition: winable.h:34
#define WINEVENT_SKIPOWNTHREAD
Definition: winable.h:33
_Out_ PCLIENT_ID ClientId
Definition: kefuncs.h:1151

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

◆ IntSetStyle()

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

Definition at line 145 of file window.c.

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

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

◆ IntShowOwnedPopups()

BOOL FASTCALL IntShowOwnedPopups ( PWND  owner,
BOOL  fShow 
)

Definition at line 4667 of file window.c.

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

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

◆ IntUnlinkWindow()

VOID FASTCALL IntUnlinkWindow ( PWND  Wnd)

Definition at line 1357 of file window.c.

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

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

◆ IntWantImeWindow()

BOOL FASTCALL IntWantImeWindow ( _In_ PWND  pwndTarget)

Definition at line 2008 of file ime.c.

2009{
2010 PDESKTOP rpdesk;
2011 PWINSTATION_OBJECT rpwinstaParent;
2012 PWND pwndNode, pwndParent = pwndTarget->spwndParent;
2013
2015 return FALSE;
2016
2017 if (IS_WND_IMELIKE(pwndTarget))
2018 return FALSE;
2019
2020 if (pwndTarget->fnid == FNID_DESKTOP || pwndTarget->fnid == FNID_MESSAGEWND)
2021 return FALSE;
2022
2023 if (pwndTarget->state & WNDS_SERVERSIDEWINDOWPROC)
2024 return FALSE;
2025
2026 rpdesk = pwndTarget->head.rpdesk;
2027 if (!rpdesk)
2028 return FALSE;
2029
2030 rpwinstaParent = rpdesk->rpwinstaParent;
2031 if (!rpwinstaParent || (rpwinstaParent->Flags & WSS_NOIO))
2032 return FALSE;
2033
2034 for (pwndNode = pwndParent; pwndNode; pwndNode = pwndNode->spwndParent)
2035 {
2036 if (rpdesk != pwndNode->head.rpdesk)
2037 break;
2038
2039 if (pwndNode == rpdesk->spwndMessage)
2040 return FALSE;
2041 }
2042
2043 return TRUE;
2044}
#define TIF_DISABLEIME
Definition: ntuser.h:288
#define FNID_MESSAGEWND
Definition: ntuser.h:864
PTHREADINFO gptiCurrent
Definition: ntuser.c:15
struct _WINSTATION_OBJECT * rpwinstaParent
Definition: desktop.h:11
PWND spwndMessage
Definition: desktop.h:20
FLONG TIF_flags
Definition: win32.h:95
#define WSS_NOIO
Definition: winsta.h:9

Referenced by co_UserCreateWindowEx().

◆ IntWinListChildren()

HWND *FASTCALL IntWinListChildren ( PWND  Window)

Definition at line 276 of file window.c.

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

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

◆ IntWinListOwnedPopups()

HWND *FASTCALL IntWinListOwnedPopups ( PWND  Window)

Definition at line 317 of file window.c.

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

Referenced by IntDestroyOwnedWindows(), and IntShowOwnedPopups().

◆ ReplaceWndPtr()

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

Definition at line 130 of file window.h.

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

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

◆ UserUpdateUiState()

BOOL FASTCALL UserUpdateUiState ( PWND  Wnd,
WPARAM  wParam 
)

Definition at line 40 of file window.c.

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

Referenced by NtUserCallTwoParam().

◆ ValidateHwndNoErr()

PWND FASTCALL ValidateHwndNoErr ( HWND  hWnd)

Definition at line 108 of file window.c.

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

◆ VerifyWnd()

PWND FASTCALL VerifyWnd ( PWND  pWnd)

Definition at line 88 of file window.c.

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

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

◆ WndSetChild()

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

Definition at line 164 of file window.h.

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

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

◆ WndSetLastActive()

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

Definition at line 185 of file window.h.

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

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

◆ WndSetNext()

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

Definition at line 171 of file window.h.

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

Referenced by IntLinkWindow(), and IntUnlinkWindow().

◆ WndSetOwner()

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

◆ WndSetParent()

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

Definition at line 157 of file window.h.

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

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

◆ WndSetPrev()

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

Definition at line 178 of file window.h.

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

Referenced by IntLinkWindow(), and IntUnlinkWindow().

Variable Documentation

◆ AtomFlashWndState

ATOM AtomFlashWndState
extern

Definition at line 22 of file ntuser.c.

Referenced by InitUserAtoms(), and IntFlashWindowEx().

◆ AtomLayer

◆ AtomMessage

ATOM AtomMessage
extern

Definition at line 19 of file ntuser.c.

Referenced by InitUserAtoms().

◆ AtomWndObj

ATOM AtomWndObj
extern

Definition at line 20 of file ntuser.c.

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

◆ g_bWindowSnapEnabled

BOOL g_bWindowSnapEnabled
extern

◆ gfIMEShowStatus

BOOL gfIMEShowStatus
extern

◆ gpwlCache

PWINDOWLIST gpwlCache
extern

Definition at line 19 of file window.c.

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

◆ gpwlList

PWINDOWLIST gpwlList
extern

Definition at line 18 of file window.c.

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