43 if (
Flags & ~(UISF_HIDEFOCUS | UISF_HIDEACCEL | UISF_ACTIVE))
56 if (
Flags & UISF_HIDEFOCUS)
58 if (
Flags & UISF_HIDEACCEL)
63 if (
Flags & UISF_HIDEFOCUS)
65 if (
Flags & UISF_HIDEACCEL)
145 ULONG styleOld, styleNew;
146 styleOld = pwnd->
style;
147 styleNew = (pwnd->
style | set_bits) & ~clear_bits;
148 if (styleNew == styleOld)
return styleNew;
149 pwnd->
style = styleNew;
194 if (!Temp)
return TRUE;
248 TRACE(
"IntEnableWindow SF NULL\n");
290 ERR(
"Failed to allocate memory for children array\n");
334 ERR(
"Failed to allocate memory for children array\n");
373 if (
Owner == Wnd)
break;
433 if (FoundWnd !=
NULL)
528 for (
i = 0; pWndArray[
i];
i++)
536 TRACE(
"destroyed itself while in WM_DESTROY!\n");
589 TRACE(
"Tried to call co_UserFreeWindow() twice\n");
593 Window->style &= ~WS_VISIBLE;
594 Window->head.pti->cVisWindows--;
610 for (ChildHandle = Children; *ChildHandle; ++ChildHandle)
637 if (BelongsToThreadData)
700 Window->state &= ~WNDS_INTERNALPAINT;
728 if (
Window->PropListItems)
731 TRACE(
"Window->PropListItems %lu\n",
Window->PropListItems);
755 Window->head.pti->pDeskInfo,
765 Window->head.pti->cWindows--;
836 return (gcpd ? gcpd : Ret);
883 pWnd->
state &= ~WNDS_ANSIWINDOWPROC;
893 pWnd->
state &= ~WNDS_ANSIWINDOWPROC;
896 pWnd->
state &= ~WNDS_SERVERSIDEWINDOWPROC;
914 pWnd->
lpfnWndProc = (chWndProc ? chWndProc : NewWndProc);
949 if (Wnd == WndInsertAfter)
951 ERR(
"Trying to link window 0x%p to itself\n", Wnd);
952 ASSERT(WndInsertAfter != Wnd);
989 Wnd->
ExStyle &= ~WS_EX_TOPMOST;
1001 while (WndInsertAfter && WndInsertAfter->
spwndNext)
1003 WndInsertAfter = WndInsertAfter->
spwndNext;
1007 Wnd->
ExStyle &= ~WS_EX_TOPMOST;
1018 PWND WndInsertBefore;
1034 WndInsertBefore = WndInsertBefore->
spwndNext;
1043 PWND WndInsertAfter;
1047 if (WndInsertAfter ==
NULL)
1054 if (Wnd == WndInsertAfter)
1056 ERR(
"Trying to link window 0x%p to itself\n", Wnd);
1057 ASSERT(WndInsertAfter != Wnd);
1068 Wnd->
ExStyle &= ~WS_EX_TOPMOST;
1087 if (Wnd->
head.pti != WndOldOwner->
head.pti)
1090 Wnd->
head.pti == WndNewOwner->
head.pti ||
1091 WndOldOwner->
head.pti != WndNewOwner->
head.pti )
1100 if (Wnd->
head.pti != WndNewOwner->
head.pti)
1103 WndOldOwner->
head.pti != WndNewOwner->
head.pti )
1117 PWND Wnd, WndOldOwner, WndNewOwner;
1129 if (!WndNewOwner && hWndNewOwner)
1158 PWND WndOldParent, pWndExam;
1177 TRACE(
"IntSetParent try to set a child as a parent.\n");
1182 pWndExam = WndNewParent;
1186 if (Wnd == pWndExam)
1188 TRACE(
"IntSetParent Failed Test for set parent to parent!\n");
1204 ERR(
"IntSetParent Window must belong to current process!\n");
1210 if ( WndOldParent &&
1221 if (WndNewParent != WndOldParent)
1234 ERR(
"SetParent Top Most from Pop up!\n");
1257 if (WndOldParent && (Wnd->
head.pti != WndOldParent->
head.pti))
1265 if (Wnd->
head.pti != WndNewParent->
head.pti)
1285 pt.x,
pt.y, 0, 0, swFlags);
1289 return WndOldParent;
1308 ERR(
"UserSetParent Access Denied!\n");
1317 ERR(
"UserSetParent Bad New Parent!\n");
1331 ERR(
"UserSetParent Bad Child!\n");
1345 hWndOldParent = WndOldParent->head.h;
1349 return( hWndOldParent);
1436#define INITIAL_COUNT 32
1476 if (*ppwl != pwlTarget)
1525 ULONG* pcHwndNeeded)
1530 if (pcHwndNeeded ==
NULL)
1577 if (dwCount++ < cHwnd && phwndList)
1582 *phwndList =
Window->head.h;
1595 if (
Window->spwndChild && bChildren)
1631 ERR(
"Thread Id is not valid!\n");
1638 TRACE(
"Tried to enumerate windows of a non gui thread\n");
1655 if (dwCount < cHwnd && phwndList)
1660 *phwndList =
Window->head.h;
1670 ERR(
"Failure to build window list!\n");
1683 *pcHwndNeeded = dwCount;
1713#define IS_DEFAULT(x) ((x) == CW_USEDEFAULT || (x) == (SHORT)0x8000)
1724 if(pMonitor ==
NULL)
1778 TRACE(
"Strange use of CW_USEDEFAULT in nHeight\n");
1814 BOOL bUnicodeWindow;
1860 pdeskCreated ? pdeskCreated : pti->
rpdesk,
1871 TRACE(
"Created window object with handle %p\n",
hWnd);
1876 TRACE(
"CreateWindow setting desktop.\n");
1922 pWnd->
head.pti->cWindows++;
2007 if ( !bUnicodeWindow &&
2023 pWnd->
state &= ~WNDS_ANSIWINDOWPROC;
2039 ERR(
"Warning: Unable to create CallProc for edit control. Control may not operate correctly! hwnd %p\n",
hWnd);
2085 pWnd->
ExStyle &= ~WS_EX_WINDOWEDGE;
2113 if (hMenu)
IntSetMenu(pWnd, hMenu, &MenuChanged);
2120 if ( ParentWindow &&
2121 ParentWindow != ParentWindow->
head.
rpdesk->spwndMessage &&
2122 ParentWindow != ParentWindow->
head.
rpdesk->pDeskInfo->spwnd )
2161 ERR(
"IntCreateWindow Allocation Error.\n");
2185 POINT MaxSize, MaxPos, MinTrack, MaxTrack;
2199 ERR(
"Thread is not attached to a desktop! Cannot create window (%wZ)\n", ClassName);
2202 WinSta = pti->
rpdesk->rpwinstaParent;
2213 ERR(
"Failed to find class %wZ\n", ClassName);
2234 ERR(
"Cannot create a child window (%wZ) without a parent\n", ClassName);
2254 ERR(
"Got invalid parent window handle for %wZ\n", ClassName);
2257 else if (hWndOwner && !OwnerWindow)
2259 ERR(
"Got invalid owner window handle for %wZ\n", ClassName);
2260 ParentWindow =
NULL;
2269 ERR(
"an owned window must be created as top-level\n");
2276 OwnerWindow = OwnerWindow->spwndParent;
2298 ERR(
"IntCreateWindow(%wZ) failed\n", ClassName);
2319 if (!pCsw || !pCbtCreate)
2321 ERR(
"UserHeapAlloc() failed!\n");
2327 ERR(
"IntMsgCreateStructW() failed!\n");
2331 pCbtCreate->
lpcs = pCsw;
2338 ERR(
"WH_CBT HCBT_CREATEWND hook failed! 0x%x\n",
Result);
2346 hwndInsertAfter = pCbtCreate->hwndInsertAfter;
2353 Cs->
x += ParentWindow->rcClient.left;
2354 Cs->
y += ParentWindow->rcClient.top;
2365 if (
Size.cx > MaxTrack.
x)
Size.cx = MaxTrack.
x;
2366 if (
Size.cy > MaxTrack.
y)
Size.cy = MaxTrack.
y;
2367 if (
Size.cx < MinTrack.
x)
Size.cx = MinTrack.
x;
2368 if (
Size.cy < MinTrack.
y)
Size.cy = MinTrack.
y;
2371 Window->rcWindow.left = Cs->
x;
2385 if (ParentWindow !=
NULL)
2390 Window->rcWindow.right = ParentWindow->rcClient.right - (
Window->rcWindow.left - ParentWindow->rcClient.left);
2399 ERR(
"Window 0x%p has been linked too early!\n",
Window);
2412 if (pti != ParentWindow->head.pti)
2424 ERR(
"co_UserCreateWindowEx(%wZ): NCCREATE message failed\n", ClassName);
2429 if (ParentWindow !=
NULL)
2468 MaxPos.
x =
Window->rcWindow.left;
2469 MaxPos.
y =
Window->rcWindow.top;
2477 MaxPos.
y -
Window->rcWindow.top);
2484 ERR(
"co_UserCreateWindowEx(%wZ): WM_CREATE message failed\n", ClassName);
2575 TRACE(
"co_UserCreateWindowEx(%wZ): Created window %p\n", ClassName,
hWnd);
2581 TRACE(
"co_UserCreateWindowEx(): Error Created window!\n");
2620 lstrTemp = *plstrUnsafe;
2629 if (lstrTemp.
Length != 0)
2654 plstrSafe->Buffer = pvBuffer;
2655 plstrSafe->Length = lstrTemp.
Length;
2656 plstrSafe->MaximumLength = lstrTemp.
Length;
2702 ERR(
"NtUserCreateWindowEx: Got an invalid menu handle!\n");
2712 ERR(
"NtUserCreateWindowEx: failed to capture plstrWindowName\n");
2717 plstrWindowName = &lstrWindowName;
2724 ustrClassName.
Length = 0;
2733 ERR(
"NtUserCreateWindowEx: failed to capture plstrClassName\n");
2750 ustrClsVersion.
Length = 0;
2759 ERR(
"NtUserCreateWindowEx: failed to capture plstrClsVersion\n");
2793 ERR(
"co_UserCreateWindowEx failed!\n");
2800 if (lstrWindowName.
Buffer)
2804 if (lstrClassName.
Buffer)
2808 if (lstrClsVersion.
Buffer)
2828 for (phWnd =
List; *phWnd; ++phWnd)
2845 ERR(
"IntWndBelongsToThread(0x%p) is FALSE, ignoring.\n", pWnd);
2868 TRACE(
"Tried to destroy a window twice\n");
2875 TRACE(
"co_UserDestroyWindow(Window = 0x%p, hWnd = 0x%p)\n",
Window,
hWnd);
2878 if (
Window->head.pti != ti)
2893 ERR(
"Destroy Window WH_CBT Call Hook return!\n");
2936 if ((pwndTemp =
Window->spwndOwner))
2957 if (
Window->head.pti->MessageQueue->spwndActive ==
Window)
2958 Window->head.pti->MessageQueue->spwndActive =
NULL;
2959 if (
Window->head.pti->MessageQueue->spwndFocus ==
Window)
2960 Window->head.pti->MessageQueue->spwndFocus =
NULL;
2961 if (
Window->head.pti->MessageQueue->spwndActivePrev ==
Window)
2962 Window->head.pti->MessageQueue->spwndActivePrev =
NULL;
2963 if (
Window->head.pti->MessageQueue->spwndCapture ==
Window)
2964 Window->head.pti->MessageQueue->spwndCapture =
NULL;
2974 ERR(
"Destroying the ShellWindow!\n");
3044 TRACE(
"Enter NtUserDestroyWindow\n");
3059 TRACE(
"Leave NtUserDestroyWindow, ret=%u\n", _ret_);
3071 BOOL CheckWindowName;
3078 CheckWindowName = WindowName->
Buffer != 0;
3086 while(*phWnd && (*(phWnd++) != ChildAfter->
head.h))
3102 if (!ClassAtom ||
Child->pcls->atomNVClassName == ClassAtom)
3108 if(!CheckWindowName ||
3109 (
Child->strName.Length < 0xFFFF &&
3112 Ret =
Child->head.h;
3149 HWND hwndChildAfter,
3161 TRACE(
"Enter NtUserFindWindowEx\n");
3164 if (ucClassName !=
NULL || ucWindowName !=
NULL)
3168 if (ucClassName !=
NULL)
3171 if (ClassName.
Length != 0)
3183 if (!IntGetAtomFromStringOrAtom(&ClassName,
3191 if (ucWindowName !=
NULL)
3194 if (WindowName.Length != 0)
3209 if (ucClassName !=
NULL)
3230 DoMessageWnd =
TRUE;
3253 PWND TopLevelWindow;
3268 while(*phWnd && (*(phWnd++) != ChildAfter->
head.h))
3272 CheckWindowName = WindowName.Buffer != 0;
3290 WindowMatches = !CheckWindowName ||
3293 ClassMatches = (ClassAtom == (
RTL_ATOM)0) ||
3296 if (WindowMatches && ClassMatches)
3298 Ret = TopLevelWindow->
head.h;
3306 Ret = TopLevelWindow->
head.h;
3316 TRACE(
"FindWindowEx: Not Desktop Parent!\n");
3320 if (Ret ==
NULL && DoMessageWnd)
3326 Ret =
IntFindWindow(MsgWindows, ChildAfter, ClassAtom, &WindowName);
3340 TRACE(
"Leave NtUserFindWindowEx, ret %p\n", _ret_);
3423 TRACE(
"Enter NtUserGetAncestor\n");
3437 TRACE(
"Leave NtUserGetAncestor, ret=%p\n", _ret_);
3459 INT fixedOwnerDrawHeight;
3472#define CBF_BUTTONDOWN 0x0002
3488 TRACE(
"Enter NtUserGetComboBoxInfo\n");
3519 NotSameppi = ppi != Wnd->
head.pti->ppi;
3550 TRACE(
"Leave NtUserGetComboBoxInfo, ret=%i\n",_ret_);
3597 TRACE(
"Enter NtUserGetListBoxInfo\n");
3612 NotSameppi = ppi != Wnd->
head.pti->ppi;
3622 Ret =
descr->page_size;
3635 TRACE(
"Leave NtUserGetListBoxInfo, ret=%lu\n", _ret_);
3662 TRACE(
"Enter NtUserSetParent\n");
3680 TRACE(
"Leave NtUserSetParent, ret=%p\n", _ret_);
3729 PWND WndShell, WndListView;
3735 TRACE(
"Enter NtUserSetShellWindowEx\n");
3805 ti->
pDeskInfo->hShellWindow = hwndShell;
3807 ti->
pDeskInfo->spwndBkGnd = WndListView;
3819 TRACE(
"Leave NtUserSetShellWindowEx, ret=%i\n",_ret_);
3888 ERR(
"NtUserSetWindowLong(): Index requires pointer size: %lu\n",
Index);
3899 Style.styleOld = OldValue;
3900 Style.styleNew = NewValue;
3907 WindowStation =
Window->head.pti->rpdesk->rpwinstaParent;
3911 Style.styleNew &= ~WS_EX_TOPMOST;
3931 Style.styleOld = OldValue;
3932 Style.styleNew = NewValue;
3945 Window->ExStyle &= ~WS_EX_WINDOWEDGE;
3952 ERR(
"IDMenu going null! %d\n",
Window->IDMenu);
3961 Window->state &= ~WNDS_HASMENU;
3964 ERR(
"IDMenu released 0x%p\n",pMenu);
4016 OldValue =
Window->dwUserData;
4017 Window->dwUserData = NewValue;
4021 ERR(
"NtUserSetWindowLong(): Unsupported index %lu\n",
Index);
4136 TRACE(
"Enter NtUserSetWindowWord\n");
4176 TRACE(
"Leave NtUserSetWindowWord, ret=%u\n", _ret_);
4202#define GWLP_CONSOLE_LEADER_PID 0
4203#define GWLP_CONSOLE_LEADER_TID 4
4206 PWND pWnd, pwndActive;
4210 TRACE(
"Enter NtUserQueryWindow\n");
4271 if (pWnd->
head.pti->spwndDefaultIme)
4278 if (pWnd->
head.pti->spDefaultImc)
4292 ptiActive = pwndActive->
head.pti;
4307 TRACE(
"Leave NtUserQueryWindow, ret=%u\n", _ret_);
4323 TRACE(
"Enter NtUserRegisterWindowMessage\n");
4326 if(MessageNameUnsafe ==
NULL)
4340 if (SafeMessageName.
Buffer)
4345 TRACE(
"Leave NtUserRegisterWindowMessage, ret=%u\n", _ret_);
4360 TRACE(
"Enter NtUserSetWindowFNID\n");
4378 if (fnID < FNID_FIRST || fnID >
FNID_GHOST ||
4390 TRACE(
"Leave NtUserSetWindowFNID\n");
4484 TRACE(
"Enter NtUserDefSetText\n");
4486 if (WindowText !=
NULL)
4490 SafeText = ProbeForReadLargeString(WindowText);
4533 if (!Ret)
goto Exit;