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 &&
1235 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");
1349 return hWndOldParent;
1436#define INITIAL_COUNT 32
1476 if (*ppwl != pwlTarget)
1525 ULONG* pcHwndNeeded)
1530 if (pcHwndNeeded ==
NULL)
1577 if (dwCount++ < cHwnd && phwndList)
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)
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");
3043 TRACE(
"Enter NtUserDestroyWindow\n");
3054 TRACE(
"Leave NtUserDestroyWindow, ret=%u\n",
ret);
3066 BOOL CheckWindowName;
3073 CheckWindowName = WindowName->
Buffer != 0;
3097 if (!ClassAtom ||
Child->pcls->atomNVClassName == ClassAtom)
3103 if(!CheckWindowName ||
3104 (
Child->strName.Length < 0xFFFF &&
3144 HWND hwndChildAfter,
3155 TRACE(
"Enter NtUserFindWindowEx\n");
3158 if (ucClassName !=
NULL || ucWindowName !=
NULL)
3162 if (ucClassName !=
NULL)
3165 if (ClassName.
Length != 0)
3177 if (!IntGetAtomFromStringOrAtom(&ClassName,
3185 if (ucWindowName !=
NULL)
3188 if (WindowName.Length != 0)
3203 if (ucClassName !=
NULL)
3224 DoMessageWnd =
TRUE;
3247 PWND TopLevelWindow;
3266 CheckWindowName = WindowName.Buffer != 0;
3284 WindowMatches = !CheckWindowName ||
3287 ClassMatches = (ClassAtom == (
RTL_ATOM)0) ||
3290 if (WindowMatches && ClassMatches)
3310 TRACE(
"FindWindowEx: Not Desktop Parent!\n");
3314 if (Ret ==
NULL && DoMessageWnd)
3320 Ret =
IntFindWindow(MsgWindows, ChildAfter, ClassAtom, &WindowName);
3332 TRACE(
"Leave NtUserFindWindowEx, ret %p\n", Ret);
3415 TRACE(
"Enter NtUserGetAncestor\n");
3427 TRACE(
"Leave NtUserGetAncestor, ret=%p\n", Ret);
3449 INT fixedOwnerDrawHeight;
3462#define CBF_BUTTONDOWN 0x0002
3477 TRACE(
"Enter NtUserGetComboBoxInfo\n");
3512 NotSameppi = ppi != Wnd->
head.pti->ppi;
3541 TRACE(
"Leave NtUserGetComboBoxInfo, ret=%i\n", Ret);
3587 TRACE(
"Enter NtUserGetListBoxInfo\n");
3603 NotSameppi = ppi != Wnd->
head.pti->ppi;
3613 Ret =
descr->page_size;
3624 TRACE(
"Leave NtUserGetListBoxInfo, ret=%lu\n", Ret);
3651 TRACE(
"Enter NtUserSetParent\n");
3668 TRACE(
"Leave NtUserSetParent, ret=%p\n", Ret);
3717 PWND WndShell, WndListView;
3723 TRACE(
"Enter NtUserSetShellWindowEx\n");
3793 ti->
pDeskInfo->hShellWindow = hwndShell;
3795 ti->
pDeskInfo->spwndBkGnd = WndListView;
3807 TRACE(
"Leave NtUserSetShellWindowEx, ret=%i\n", Ret);
3876 ERR(
"NtUserSetWindowLong(): Index requires pointer size: %lu\n",
Index);
3887 Style.styleOld = OldValue;
3888 Style.styleNew = NewValue;
3895 WindowStation =
Window->head.pti->rpdesk->rpwinstaParent;
3899 Style.styleNew &= ~WS_EX_TOPMOST;
3919 Style.styleOld = OldValue;
3920 Style.styleNew = NewValue;
3933 Window->ExStyle &= ~WS_EX_WINDOWEDGE;
3940 ERR(
"IDMenu going null! %d\n",
Window->IDMenu);
3949 Window->state &= ~WNDS_HASMENU;
3952 ERR(
"IDMenu released 0x%p\n",pMenu);
4004 OldValue =
Window->dwUserData;
4005 Window->dwUserData = NewValue;
4009 ERR(
"NtUserSetWindowLong(): Unsupported index %lu\n",
Index);
4124 TRACE(
"Enter NtUserSetWindowWord\n");
4166 TRACE(
"Leave NtUserSetWindowWord, ret=%u\n", Ret);
4192#define GWLP_CONSOLE_LEADER_PID 0
4193#define GWLP_CONSOLE_LEADER_TID 4
4196 PWND pWnd, pwndActive;
4199 TRACE(
"Enter NtUserQueryWindow\n");
4260 if (pWnd->
head.pti->spwndDefaultIme)
4265 if (pWnd->
head.pti->spDefaultImc)
4276 ptiActive = pwndActive->
head.pti;
4285 TRACE(
"Leave NtUserQueryWindow, ret=%u\n",
Result);
4300 TRACE(
"Enter NtUserRegisterWindowMessage\n");
4303 if(MessageNameUnsafe ==
NULL)
4317 if (SafeMessageName.
Buffer)
4321 TRACE(
"Leave NtUserRegisterWindowMessage, ret=%u\n", Ret);
4336 TRACE(
"Enter NtUserSetWindowFNID\n");
4354 if (fnID < FNID_FIRST || fnID >
FNID_GHOST ||
4366 TRACE(
"Leave NtUserSetWindowFNID\n");
4460 TRACE(
"Enter NtUserDefSetText\n");
4462 if (WindowText !=
NULL)
4466 SafeText = ProbeForReadLargeString(WindowText);
4509 if (!Ret)
goto Exit;
4574 TRACE(
"Leave NtUserDefSetText, ret=%i\n", Ret);
4593 TRACE(
"Enter NtUserInternalGetWindowText\n");