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)
92 if (!pWnd)
return NULL;
157 ULONG styleOld, styleNew;
158 styleOld = pwnd->
style;
159 styleNew = (pwnd->
style | set_bits) & ~clear_bits;
160 if (styleNew == styleOld)
return styleNew;
161 pwnd->
style = styleNew;
206 if (!Temp)
return TRUE;
260 TRACE(
"IntEnableWindow SF NULL\n");
302 ERR(
"Failed to allocate memory for children array\n");
346 ERR(
"Failed to allocate memory for children array\n");
385 if (
Owner == Wnd)
break;
445 if (FoundWnd !=
NULL)
540 for (
i = 0; pWndArray[
i];
i++)
548 TRACE(
"destroyed itself while in WM_DESTROY!\n");
601 TRACE(
"Tried to call co_UserFreeWindow() twice\n");
605 Window->style &= ~WS_VISIBLE;
606 Window->head.pti->cVisWindows--;
623 for (ChildHandle = Children; *ChildHandle; ++ChildHandle)
650 if (BelongsToThreadData)
713 Window->state &= ~WNDS_INTERNALPAINT;
741 if (
Window->PropListItems)
744 TRACE(
"Window->PropListItems %lu\n",
Window->PropListItems);
762 Window->head.pti->pDeskInfo,
772 Window->head.pti->cWindows--;
843 return (gcpd ? gcpd : Ret);
890 pWnd->
state &= ~WNDS_ANSIWINDOWPROC;
900 pWnd->
state &= ~WNDS_ANSIWINDOWPROC;
903 pWnd->
state &= ~WNDS_SERVERSIDEWINDOWPROC;
921 pWnd->
lpfnWndProc = (chWndProc ? chWndProc : NewWndProc);
956 if (Wnd == WndInsertAfter)
958 ERR(
"IntLinkWindow -- Trying to link window 0x%p to itself!!\n", Wnd);
995 Wnd->
ExStyle &= ~WS_EX_TOPMOST;
1004 PWND WndInsertAfter;
1007 while (WndInsertAfter && WndInsertAfter->
spwndNext)
1009 WndInsertAfter = WndInsertAfter->
spwndNext;
1013 Wnd->
ExStyle &= ~WS_EX_TOPMOST;
1024 PWND WndInsertBefore;
1040 WndInsertBefore = WndInsertBefore->
spwndNext;
1049 PWND WndInsertAfter;
1053 if (WndInsertAfter ==
NULL)
1060 if (Wnd == WndInsertAfter)
1061 ERR(
"IntLinkHwnd -- Trying to link window 0x%p to itself!!\n", Wnd);
1067 Wnd->
ExStyle &= ~WS_EX_TOPMOST;
1086 if (Wnd->
head.pti != WndOldOwner->
head.pti)
1089 Wnd->
head.pti == WndNewOwner->
head.pti ||
1090 WndOldOwner->
head.pti != WndNewOwner->
head.pti )
1099 if (Wnd->
head.pti != WndNewOwner->
head.pti)
1102 WndOldOwner->
head.pti != WndNewOwner->
head.pti )
1116 PWND Wnd, WndOldOwner, WndNewOwner;
1128 if (!WndNewOwner && hWndNewOwner)
1157 PWND WndOldParent, pWndExam;
1176 TRACE(
"IntSetParent try to set a child as a parent.\n");
1181 pWndExam = WndNewParent;
1185 if (Wnd == pWndExam)
1187 TRACE(
"IntSetParent Failed Test for set parent to parent!\n");
1203 ERR(
"IntSetParent Window must belong to current process!\n");
1209 if ( WndOldParent &&
1220 if (WndNewParent != WndOldParent)
1233 ERR(
"SetParent Top Most from Pop up!\n");
1256 if (WndOldParent && (Wnd->
head.pti != WndOldParent->
head.pti))
1264 if (Wnd->
head.pti != WndNewParent->
head.pti)
1284 pt.x,
pt.y, 0, 0, swFlags);
1288 return WndOldParent;
1307 ERR(
"UserSetParent Access Denied!\n");
1316 ERR(
"UserSetParent Bad New Parent!\n");
1330 ERR(
"UserSetParent Bad Child!\n");
1344 hWndOldParent = WndOldParent->head.h;
1348 return( hWndOldParent);
1434#define INITIAL_COUNT 32
1474 if (*ppwl != pwlTarget)
1523 ULONG* pcHwndNeeded)
1528 if (pcHwndNeeded ==
NULL)
1575 if (dwCount++ < cHwnd && phwndList)
1580 *phwndList =
Window->head.h;
1593 if (
Window->spwndChild && bChildren)
1629 ERR(
"Thread Id is not valid!\n");
1636 TRACE(
"Tried to enumerate windows of a non gui thread\n");
1653 if (dwCount < cHwnd && phwndList)
1658 *phwndList =
Window->head.h;
1668 ERR(
"Failure to build window list!\n");
1681 *pcHwndNeeded = dwCount;
1711#define IS_DEFAULT(x) ((x) == CW_USEDEFAULT || (x) == (SHORT)0x8000)
1722 if(pMonitor ==
NULL)
1776 TRACE(
"Strange use of CW_USEDEFAULT in nHeight\n");
1812 BOOL bUnicodeWindow;
1858 pdeskCreated ? pdeskCreated : pti->
rpdesk,
1869 TRACE(
"Created window object with handle %p\n",
hWnd);
1874 TRACE(
"CreateWindow setting desktop.\n");
1919 pWnd->
head.pti->cWindows++;
2004 if ( !bUnicodeWindow &&
2020 pWnd->
state &= ~WNDS_ANSIWINDOWPROC;
2036 ERR(
"Warning: Unable to create CallProc for edit control. Control may not operate correctly! hwnd %p\n",
hWnd);
2082 pWnd->
ExStyle &= ~WS_EX_WINDOWEDGE;
2110 if (hMenu)
IntSetMenu(pWnd, hMenu, &MenuChanged);
2117 if ( ParentWindow &&
2118 ParentWindow != ParentWindow->
head.
rpdesk->spwndMessage &&
2119 ParentWindow != ParentWindow->
head.
rpdesk->pDeskInfo->spwnd )
2158 ERR(
"IntCreateWindow Allocation Error.\n");
2182 POINT MaxSize, MaxPos, MinTrack, MaxTrack;
2196 ERR(
"Thread is not attached to a desktop! Cannot create window!\n");
2199 WinSta = pti->
rpdesk->rpwinstaParent;
2210 ERR(
"Failed to find class %wZ\n", ClassName);
2231 ERR(
"Cannot create a child window without a parent!\n");
2251 ERR(
"Got invalid parent window handle\n");
2254 else if (hWndOwner && !OwnerWindow)
2256 ERR(
"Got invalid owner window handle\n");
2257 ParentWindow =
NULL;
2266 ERR(
"an owned window must be created as top-level\n");
2273 OwnerWindow = OwnerWindow->spwndParent;
2295 ERR(
"IntCreateWindow failed!\n");
2316 if (!pCsw || !pCbtCreate)
2318 ERR(
"UserHeapAlloc() failed!\n");
2324 ERR(
"IntMsgCreateStructW() failed!\n");
2328 pCbtCreate->
lpcs = pCsw;
2335 ERR(
"WH_CBT HCBT_CREATEWND hook failed! 0x%x\n",
Result);
2343 hwndInsertAfter = pCbtCreate->hwndInsertAfter;
2350 Cs->
x += ParentWindow->rcClient.left;
2351 Cs->
y += ParentWindow->rcClient.top;
2362 if (
Size.cx > MaxTrack.
x)
Size.cx = MaxTrack.
x;
2363 if (
Size.cy > MaxTrack.
y)
Size.cy = MaxTrack.
y;
2364 if (
Size.cx < MinTrack.
x)
Size.cx = MinTrack.
x;
2365 if (
Size.cy < MinTrack.
y)
Size.cy = MinTrack.
y;
2368 Window->rcWindow.left = Cs->
x;
2382 if (ParentWindow !=
NULL)
2387 Window->rcWindow.right = ParentWindow->rcClient.right - (
Window->rcWindow.left - ParentWindow->rcClient.left);
2396 ERR(
"Window 0x%p has been linked too early!\n",
Window);
2409 if (pti != ParentWindow->head.pti)
2421 ERR(
"co_UserCreateWindowEx(): NCCREATE message failed\n");
2426 if (ParentWindow !=
NULL)
2465 MaxPos.
x =
Window->rcWindow.left;
2466 MaxPos.
y =
Window->rcWindow.top;
2474 MaxPos.
y -
Window->rcWindow.top);
2481 ERR(
"co_UserCreateWindowEx(): WM_CREATE message failed\n");
2572 TRACE(
"co_UserCreateWindowEx(): Created window %p\n",
hWnd);
2578 TRACE(
"co_UserCreateWindowEx(): Error Created window!\n");
2617 lstrTemp = *plstrUnsafe;
2626 if (lstrTemp.
Length != 0)
2651 plstrSafe->Buffer = pvBuffer;
2652 plstrSafe->Length = lstrTemp.
Length;
2653 plstrSafe->MaximumLength = lstrTemp.
Length;
2699 ERR(
"NtUserCreateWindowEx: Got an invalid menu handle!\n");
2709 ERR(
"NtUserCreateWindowEx: failed to capture plstrWindowName\n");
2714 plstrWindowName = &lstrWindowName;
2721 ustrClassName.
Length = 0;
2730 ERR(
"NtUserCreateWindowEx: failed to capture plstrClassName\n");
2747 ustrClsVersion.
Length = 0;
2756 ERR(
"NtUserCreateWindowEx: failed to capture plstrClsVersion\n");
2790 ERR(
"co_UserCreateWindowEx failed!\n");
2797 if (lstrWindowName.
Buffer)
2801 if (lstrClassName.
Buffer)
2805 if (lstrClsVersion.
Buffer)
2825 for (phWnd =
List; *phWnd; ++phWnd)
2842 ERR(
"IntWndBelongsToThread(0x%p) is FALSE, ignoring.\n", pWnd);
2863 TRACE(
"co_UserDestroyWindow(Window = 0x%p, hWnd = 0x%p)\n",
Window,
hWnd);
2866 if (
Window->head.pti != ti)
2881 ERR(
"Destroy Window WH_CBT Call Hook return!\n");
2924 if ((pwndTemp =
Window->spwndOwner))
2945 if (
Window->head.pti->MessageQueue->spwndActive ==
Window)
2946 Window->head.pti->MessageQueue->spwndActive =
NULL;
2947 if (
Window->head.pti->MessageQueue->spwndFocus ==
Window)
2948 Window->head.pti->MessageQueue->spwndFocus =
NULL;
2949 if (
Window->head.pti->MessageQueue->spwndActivePrev ==
Window)
2950 Window->head.pti->MessageQueue->spwndActivePrev =
NULL;
2951 if (
Window->head.pti->MessageQueue->spwndCapture ==
Window)
2952 Window->head.pti->MessageQueue->spwndCapture =
NULL;
2962 ERR(
"Destroying the ShellWindow!\n");
3032 TRACE(
"Enter NtUserDestroyWindow\n");
3047 TRACE(
"Leave NtUserDestroyWindow, ret=%u\n", _ret_);
3059 BOOL CheckWindowName;
3066 CheckWindowName = WindowName->
Buffer != 0;
3074 while(*phWnd && (*(phWnd++) != ChildAfter->
head.h))
3090 if (!ClassAtom ||
Child->pcls->atomNVClassName == ClassAtom)
3096 if(!CheckWindowName ||
3097 (
Child->strName.Length < 0xFFFF &&
3100 Ret =
Child->head.h;
3137 HWND hwndChildAfter,
3149 TRACE(
"Enter NtUserFindWindowEx\n");
3152 if (ucClassName !=
NULL || ucWindowName !=
NULL)
3156 if (ucClassName !=
NULL)
3159 if (ClassName.
Length != 0)
3171 if (!IntGetAtomFromStringOrAtom(&ClassName,
3179 if (ucWindowName !=
NULL)
3182 if (WindowName.Length != 0)
3197 if (ucClassName !=
NULL)
3218 DoMessageWnd =
TRUE;
3241 PWND TopLevelWindow;
3256 while(*phWnd && (*(phWnd++) != ChildAfter->
head.h))
3260 CheckWindowName = WindowName.Buffer != 0;
3278 WindowMatches = !CheckWindowName ||
3281 ClassMatches = (ClassAtom == (
RTL_ATOM)0) ||
3284 if (WindowMatches && ClassMatches)
3286 Ret = TopLevelWindow->
head.h;
3294 Ret = TopLevelWindow->
head.h;
3304 TRACE(
"FindWindowEx: Not Desktop Parent!\n");
3308 if (Ret ==
NULL && DoMessageWnd)
3314 Ret =
IntFindWindow(MsgWindows, ChildAfter, ClassAtom, &WindowName);
3328 TRACE(
"Leave NtUserFindWindowEx, ret %p\n", _ret_);
3411 TRACE(
"Enter NtUserGetAncestor\n");
3425 TRACE(
"Leave NtUserGetAncestor, ret=%p\n", _ret_);
3447 INT fixedOwnerDrawHeight;
3460#define CBF_BUTTONDOWN 0x0002
3476 TRACE(
"Enter NtUserGetComboBoxInfo\n");
3507 NotSameppi = ppi != Wnd->
head.pti->ppi;
3538 TRACE(
"Leave NtUserGetComboBoxInfo, ret=%i\n",_ret_);
3585 TRACE(
"Enter NtUserGetListBoxInfo\n");
3600 NotSameppi = ppi != Wnd->
head.pti->ppi;
3610 Ret =
descr->page_size;
3623 TRACE(
"Leave NtUserGetListBoxInfo, ret=%lu\n", _ret_);
3650 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");
4164 TRACE(
"Leave NtUserSetWindowWord, ret=%u\n", _ret_);
4190#define GWLP_CONSOLE_LEADER_PID 0
4191#define GWLP_CONSOLE_LEADER_TID 4
4194 PWND pWnd, pwndActive;
4198 TRACE(
"Enter NtUserQueryWindow\n");
4259 if (pWnd->
head.pti->spwndDefaultIme)
4266 if (pWnd->
head.pti->spDefaultImc)
4280 ptiActive = pwndActive->
head.pti;
4295 TRACE(
"Leave NtUserQueryWindow, ret=%u\n", _ret_);
4311 TRACE(
"Enter NtUserRegisterWindowMessage\n");
4314 if(MessageNameUnsafe ==
NULL)
4328 if (SafeMessageName.
Buffer)
4333 TRACE(
"Leave NtUserRegisterWindowMessage, ret=%u\n", _ret_);
4348 TRACE(
"Enter NtUserSetWindowFNID\n");
4366 if (fnID < FNID_FIRST || fnID >
FNID_GHOST ||
4378 TRACE(
"Leave NtUserSetWindowFNID\n");
4472 TRACE(
"Enter NtUserDefSetText\n");
4474 if (WindowText !=
NULL)
4478 SafeText = ProbeForReadLargeString(WindowText);
4521 if (!Ret)
goto Exit;
4586 TRACE(
"Leave NtUserDefSetText, ret=%i\n", Ret);