ReactOS 0.4.17-dev-444-g71ee754
window.c
Go to the documentation of this file.
1/*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS Win32k subsystem
4 * PURPOSE: Windows
5 * FILE: win32ss/user/ntuser/window.c
6 * PROGRAMERS: Casper S. Hornstrup (chorns@users.sourceforge.net)
7 * Katayama Hirofumi MZ (katayama.hirofumi.mz@gmail.com)
8 */
9
10#include <win32k.h>
11#include <immdev.h>
12#include <unaligned.h>
13
15
17
20
21/* HELPER FUNCTIONS ***********************************************************/
22
26 PVOID pOld,
27 SIZE_T cbOld,
28 SIZE_T cbNew,
29 ULONG Tag)
30{
32 if (!pNew)
33 return NULL;
34
35 RtlCopyMemory(pNew, pOld, min(cbOld, cbNew));
37 return pNew;
38}
39
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}
74
76{
78
79 if (!hWnd) return NULL;
80
82 if (Window)
83 Window->head.cLockObj++;
84
85 return Window;
86}
87
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}
107
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}
121
122/* Temp HACK */
124{
125 PWND Window;
126
127 if (!hWnd)
128 {
130 return NULL;
131 }
132
134 if (!Window || 0 != (Window->state & WNDS_DESTROYED))
135 {
137 return NULL;
138 }
139
140 return Window;
141}
142
144IntSetStyle( PWND pwnd, ULONG set_bits, ULONG clear_bits )
145{
146 ULONG styleOld, styleNew;
147 styleOld = pwnd->style;
148 styleNew = (pwnd->style | set_bits) & ~clear_bits;
149 if (styleNew == styleOld) return styleNew;
150 pwnd->style = styleNew;
151 if ((styleOld ^ styleNew) & WS_VISIBLE) // State Change.
152 {
153 if (styleOld & WS_VISIBLE) pwnd->head.pti->cVisWindows--;
154 if (styleNew & WS_VISIBLE) pwnd->head.pti->cVisWindows++;
155 DceResetActiveDCEs( pwnd );
156 }
157 return styleOld;
158}
159
160/*
161 * IntIsWindow
162 *
163 * The function determines whether the specified window handle identifies
164 * an existing window.
165 *
166 * Parameters
167 * hWnd
168 * Handle to the window to test.
169 *
170 * Return Value
171 * If the window handle identifies an existing window, the return value
172 * is TRUE. If the window handle does not identify an existing window,
173 * the return value is FALSE.
174 */
175
178{
179 PWND Window;
180
182 {
183 return FALSE;
184 }
185
186 return TRUE;
187}
188
191{
192 PWND Temp = Wnd;
193 for (;;)
194 {
195 if (!Temp) return TRUE;
196 if (!(Temp->style & WS_VISIBLE)) break;
197 if (Temp->style & WS_MINIMIZE && Temp != Wnd) break;
198 if (Temp->fnid == FNID_DESKTOP) return TRUE;
199 Temp = Temp->spwndParent;
200 }
201 return FALSE;
202}
203
206{
207 if (Wnd->style & WS_POPUP)
208 {
209 return Wnd->spwndOwner;
210 }
211 else if (Wnd->style & WS_CHILD)
212 {
213 return Wnd->spwndParent;
214 }
215
216 return NULL;
217}
218
219BOOL
222{
223 BOOL Update;
224 PWND pWnd;
225 UINT bIsDisabled;
226
227 if(!(pWnd = UserGetWindowObject(hWnd)))
228 {
229 return FALSE;
230 }
231
232 /* check if updating is needed */
233 bIsDisabled = !!(pWnd->style & WS_DISABLED);
234 Update = bIsDisabled;
235
236 if (bEnable)
237 {
238 IntSetStyle( pWnd, 0, WS_DISABLED );
239 }
240 else
241 {
242 Update = !bIsDisabled;
243
245
246 /* Remove keyboard focus from that window if it had focus */
248 {
249 TRACE("IntEnableWindow SF NULL\n");
251 }
252 IntSetStyle( pWnd, WS_DISABLED, 0 );
253 }
254
255 if (Update)
256 {
257 IntNotifyWinEvent(EVENT_OBJECT_STATECHANGE, pWnd, OBJID_WINDOW, CHILDID_SELF, 0);
259 }
260 // Return nonzero if it was disabled, or zero if it wasn't:
261 return bIsDisabled;
262}
263
264/*
265 * IntWinListChildren
266 *
267 * Compile a list of all child window handles from given window.
268 *
269 * Remarks
270 * This function is similar to Wine WIN_ListChildren. The caller
271 * must free the returned list with ExFreePool.
272 */
273
276{
277 PWND Child;
278 HWND *List;
279 UINT Index, NumChildren = 0;
280
281 if (!Window) return NULL;
282
283 for (Child = Window->spwndChild; Child; Child = Child->spwndNext)
284 {
285 ++NumChildren;
286 }
287
288 List = ExAllocatePoolWithTag(PagedPool, (NumChildren + 1) * sizeof(HWND), USERTAG_WINDOWLIST);
289 if(!List)
290 {
291 ERR("Failed to allocate memory for children array\n");
293 return NULL;
294 }
295
296 Index = 0;
297 for (Child = Window->spwndChild; Child; Child = Child->spwndNext)
298 {
300 }
301 List[Index] = NULL;
302
303 return List;
304}
305
306static BOOL
308{
309 PTHREADINFO pti = Window->head.pti;
310
311 return (IS_IMM_MODE() && !(pti->TIF_flags & TIF_INCLEANUP) &&
312 Window == pti->spwndDefaultIme);
313}
314
317{
319 HWND *List;
320 UINT Index, NumOwned = 0;
321
323 if (!Desktop)
324 return NULL;
325
326 for (Child = Desktop->spwndChild; Child; Child = Child->spwndNext)
327 {
328 if (Child->spwndOwner == Window && !IntWndIsDefaultIme(Child))
329 ++NumOwned;
330 }
331
332 List = ExAllocatePoolWithTag(PagedPool, (NumOwned + 1) * sizeof(HWND), USERTAG_WINDOWLIST);
333 if (!List)
334 {
335 ERR("Failed to allocate memory for children array\n");
337 return NULL;
338 }
339
340 Index = 0;
341 for (Child = Desktop->spwndChild; Child; Child = Child->spwndNext)
342 {
343 if (Child->spwndOwner == Window && !IntWndIsDefaultIme(Child))
345 }
346 List[Index] = NULL;
347
348 return List;
349}
350
353{
354 while(pWnd && (pWnd->style & (WS_CHILD | WS_POPUP)) == WS_CHILD)
355 pWnd = pWnd->spwndParent;
356 return pWnd;
357}
358
361{
362 if ( pWnd->spwndParent &&
363 pWnd->spwndParent == co_GetDesktopWindow(pWnd) ) return TRUE;
364 return FALSE;
365}
366
369{
370 INT Depth = 1;
371 for (;;)
372 {
373 if ( !Owner ) return gNestedWindowLimit >= Depth;
374 if (Owner == Wnd) break;
375 Owner = Owner->spwndOwner;
376 Depth++;
377 }
378 return FALSE;
379}
380
383 UINT uCmd)
384{
385 PWND Wnd, FoundWnd;
386 HWND Ret = NULL;
387
388 Wnd = ValidateHwndNoErr(hWnd);
389 if (!Wnd)
390 return NULL;
391
392 FoundWnd = NULL;
393 switch (uCmd)
394 {
395 case GW_OWNER:
396 if (Wnd->spwndOwner != NULL)
397 FoundWnd = Wnd->spwndOwner;
398 break;
399
400 case GW_HWNDFIRST:
401 if(Wnd->spwndParent != NULL)
402 {
403 FoundWnd = Wnd->spwndParent;
404 if (FoundWnd->spwndChild != NULL)
405 FoundWnd = FoundWnd->spwndChild;
406 }
407 break;
408 case GW_HWNDNEXT:
409 if (Wnd->spwndNext != NULL)
410 FoundWnd = Wnd->spwndNext;
411 break;
412
413 case GW_HWNDPREV:
414 if (Wnd->spwndPrev != NULL)
415 FoundWnd = Wnd->spwndPrev;
416 break;
417
418 case GW_CHILD:
419 if (Wnd->spwndChild != NULL)
420 FoundWnd = Wnd->spwndChild;
421 break;
422
423 case GW_HWNDLAST:
424 FoundWnd = Wnd;
425 while ( FoundWnd->spwndNext != NULL)
426 FoundWnd = FoundWnd->spwndNext;
427 break;
428
429 default:
431 break;
432 }
433
434 if (FoundWnd != NULL)
435 Ret = UserHMGetHandle(FoundWnd);
436 return Ret;
437}
438
440{
441 DWORD HelpId;
442
443 do
444 {
446 if (!HelpId) break;
447 pWnd = IntGetParent(pWnd);
448 }
449 while (pWnd && pWnd->fnid != FNID_DESKTOP);
450 return HelpId;
451}
452
453
454VOID
457 PDESKTOP pDesk);
458
459/***********************************************************************
460 * IntSendDestroyMsg
461 */
463{
464 PTHREADINFO ti;
465 PWND Window;
466
469
470 if (Window)
471 {
472 /*
473 * Look whether the focus is within the tree of windows
474 * we will be destroying.
475 */
476 // Rule #1
477 if ( ti->MessageQueue->spwndActive == Window || // Fixes CORE-106 RegSvr32 exit and return focus to CMD.
478 (ti->MessageQueue->spwndActive == NULL && ti->MessageQueue == IntGetFocusMessageQueue()) )
479 {
481 }
482
483 /* Fixes CMD properties closing and returning focus to CMD */
484 if (ti->MessageQueue->spwndFocus == Window)
485 {
486 if ((Window->style & (WS_CHILD | WS_POPUP)) == WS_CHILD)
487 {
488 co_UserSetFocus(Window->spwndParent);
489 }
490 else
491 {
493 }
494 }
495
496 if (ti->MessageQueue->CaretInfo.hWnd == UserHMGetHandle(Window))
497 {
499 }
500
501 /* If the window being destroyed is currently tracked... */
502 if (ti->rpdesk && ti->rpdesk->spwndTrack == Window)
503 {
505 }
506 }
507
508 /* If the window being destroyed is the current clipboard owner... */
509 if (ti->ppi->prpwinsta != NULL && Window == ti->ppi->prpwinsta->spwndClipOwner)
510 {
511 /* ... make it release the clipboard */
513 }
514
515 /* Send the WM_DESTROY to the window */
517
518 /*
519 * This WM_DESTROY message can trigger re-entrant calls to DestroyWindow
520 * make sure that the window still exists when we come back.
521 */
522 if (IntIsWindow(hWnd))
523 {
524 HWND* pWndArray;
525 int i;
526
527 if (!(pWndArray = IntWinListChildren( Window ))) return;
528
529 for (i = 0; pWndArray[i]; i++)
530 {
531 if (IntIsWindow( pWndArray[i] )) IntSendDestroyMsg( pWndArray[i] );
532 }
534 }
535 else
536 {
537 TRACE("destroyed itself while in WM_DESTROY!\n");
538 }
539}
540
541static VOID
543{
545
546 if (!Wnd) return;
547
548 if (ClientInfo->CallbackWnd.pWnd == DesktopHeapAddressToUser(Wnd))
549 {
550 ClientInfo->CallbackWnd.hWnd = NULL;
551 ClientInfo->CallbackWnd.pWnd = NULL;
552 }
553
554 if (Wnd->strName.Buffer != NULL)
555 {
556 Wnd->strName.Length = 0;
557 Wnd->strName.MaximumLength = 0;
559 Wnd->strName.Buffer);
560 Wnd->strName.Buffer = NULL;
561 }
562
563// DesktopHeapFree(Wnd->head.rpdesk, Wnd);
564// WindowObject->hWnd = NULL;
565}
566
567/***********************************************************************
568 * co_UserFreeWindow
569 *
570 * Destroy storage associated to a window. "Internals" p.358
571 *
572 * This is the "functional" DestroyWindows function i.e. all stuff
573 * done in CreateWindow is undone here and not in DestroyWindow :-P
574 */
576 PPROCESSINFO ProcessData,
578 BOOLEAN SendMessages)
579{
580 HWND *Children;
581 HWND *ChildHandle;
582 PWND Child;
583 PMENU Menu;
584 BOOLEAN BelongsToThreadData;
586
587 ASSERT(Window);
588
589 if(Window->state2 & WNDS2_INDESTROY)
590 {
591 TRACE("Tried to call co_UserFreeWindow() twice\n");
592 return 0;
593 }
594 Window->state2 |= WNDS2_INDESTROY;
595 Window->style &= ~WS_VISIBLE;
596 Window->head.pti->cVisWindows--;
597
598 /* remove the window already at this point from the thread window list so we
599 don't get into trouble when destroying the thread windows while we're still
600 in co_UserFreeWindow() */
601 if (!IsListEmpty(&Window->ThreadListEntry))
602 RemoveEntryList(&Window->ThreadListEntry);
603
604 BelongsToThreadData = IntWndBelongsToThread(Window, ThreadData);
605
607
608 /* free child windows */
609 Children = IntWinListChildren(Window);
610 if (Children)
611 {
612 for (ChildHandle = Children; *ChildHandle; ++ChildHandle)
613 {
614 if ((Child = IntGetWindowObject(*ChildHandle)))
615 {
617 {
618 /* send WM_DESTROY messages to windows not belonging to the same thread */
620 }
621 else
622 co_UserFreeWindow(Child, ProcessData, ThreadData, SendMessages);
623
625 }
626 }
628 }
629
630 if (SendMessages)
631 {
632 /*
633 * Clear the update region to make sure no WM_PAINT messages will be
634 * generated for this window while processing the WM_NCDESTROY.
635 */
639 if (BelongsToThreadData)
641 }
642
644
646
647 /* Unregister hot keys */
649
650 /* flush the message queue */
652
653 /* from now on no messages can be sent to this window anymore */
654 Window->state |= WNDS_DESTROYED;
655 Window->fnid |= FNID_FREED;
656
657 /* don't remove the WINDOWSTATUS_DESTROYING bit */
658
659 /* reset shell window handles */
660 if (ThreadData->rpdesk)
661 {
662 if (UserHMGetHandle(Window) == ThreadData->rpdesk->rpwinstaParent->ShellWindow)
663 ThreadData->rpdesk->rpwinstaParent->ShellWindow = NULL;
664
665 if (UserHMGetHandle(Window) == ThreadData->rpdesk->rpwinstaParent->ShellListView)
666 ThreadData->rpdesk->rpwinstaParent->ShellListView = NULL;
667 }
668
669 if (ThreadData->spwndDefaultIme &&
670 ThreadData->spwndDefaultIme->spwndOwner == Window)
671 {
672 WndSetOwner(ThreadData->spwndDefaultIme, NULL);
673 }
674
675 if (IS_IMM_MODE() && Window == ThreadData->spwndDefaultIme)
676 {
677 UserAssignmentUnlock((PVOID*)&(ThreadData->spwndDefaultIme));
678 }
679
680 /* Fixes dialog test_focus breakage due to r66237. */
681 if (ThreadData->MessageQueue->spwndFocus == Window)
682 ThreadData->MessageQueue->spwndFocus = NULL;
683
684 if (ThreadData->MessageQueue->spwndActive == Window)
685 ThreadData->MessageQueue->spwndActive = NULL;
686
687 if (ThreadData->MessageQueue->spwndCapture == Window)
688 {
690 }
691
693 if ( Window->hrgnUpdate != NULL || Window->state & WNDS_INTERNALPAINT )
694 {
695 MsqDecPaintCountQueue(Window->head.pti);
696 if (Window->hrgnUpdate > HRGN_WINDOW && GreIsHandleValid(Window->hrgnUpdate))
697 {
699 GreDeleteObject(Window->hrgnUpdate);
700 }
701 Window->hrgnUpdate = NULL;
702 Window->state &= ~WNDS_INTERNALPAINT;
703 }
704
706 {
708 }
709
710 if ( ((Window->style & (WS_CHILD|WS_POPUP)) != WS_CHILD) &&
711 Window->IDMenu &&
712 (Menu = UserGetMenuObject((HMENU)Window->IDMenu)))
713 {
714 TRACE("UFW: IDMenu %p\n",Window->IDMenu);
716 Window->IDMenu = 0;
717 }
718
719 if (Window->SystemMenu
720 && (Menu = UserGetMenuObject(Window->SystemMenu)))
721 {
723 Window->SystemMenu = (HMENU)0;
724 }
725
726 DceFreeWindowDCE(Window); /* Always do this to catch orphaned DCs */
727
729
730 if (Window->PropListItems)
731 {
733 TRACE("Window->PropListItems %lu\n",Window->PropListItems);
734 ASSERT(Window->PropListItems==0);
735 }
736
737 /* Kill any reference to linked windows. Prev & Next are taken care of in IntUnlinkWindow */
742
743 UserRefObjectCo(Window, &Ref);
745
747
748 if (Window->pcls->atomClassName == gaGuiConsoleWndClass)
749 {
750 /* Count only console windows manually */
752 }
753
754 /* dereference the class */
755 NT_ASSERT(Window->head.pti != NULL);
757 Window->head.pti->pDeskInfo,
758 Window->head.pti->ppi);
759 Window->pcls = NULL;
760
761 if (Window->hrgnClip)
762 {
764 GreDeleteObject(Window->hrgnClip);
765 Window->hrgnClip = NULL;
766 }
767 Window->head.pti->cWindows--;
768
769// ASSERT(Window != NULL);
770 UserFreeWindowInfo(Window->head.pti, Window);
771
774
775 return 0;
776}
777
778//
779// Same as User32:IntGetWndProc.
780//
783 BOOL Ansi)
784{
785 INT i;
786 PCLS Class;
787 WNDPROC gcpd, Ret = 0;
788
790
791 Class = pWnd->pcls;
792
794 {
795 for ( i = FNID_FIRST; i <= FNID_SWITCH; i++)
796 {
797 if (GETPFNSERVER(i) == pWnd->lpfnWndProc)
798 {
799 if (Ansi)
800 Ret = GETPFNCLIENTA(i);
801 else
802 Ret = GETPFNCLIENTW(i);
803 }
804 }
805 return Ret;
806 }
807
808 if (Class->fnid == FNID_EDIT)
809 Ret = pWnd->lpfnWndProc;
810 else
811 {
812 Ret = pWnd->lpfnWndProc;
813
814 if (Class->fnid <= FNID_GHOST && Class->fnid >= FNID_BUTTON)
815 {
816 if (Ansi)
817 {
818 if (GETPFNCLIENTW(Class->fnid) == pWnd->lpfnWndProc)
819 Ret = GETPFNCLIENTA(Class->fnid);
820 }
821 else
822 {
823 if (GETPFNCLIENTA(Class->fnid) == pWnd->lpfnWndProc)
824 Ret = GETPFNCLIENTW(Class->fnid);
825 }
826 }
827 if ( Ret != pWnd->lpfnWndProc)
828 return Ret;
829 }
830 if ( Ansi == !!(pWnd->state & WNDS_ANSIWINDOWPROC) )
831 return Ret;
832
833 gcpd = (WNDPROC)UserGetCPD(
834 pWnd,
836 (ULONG_PTR)Ret);
837
838 return (gcpd ? gcpd : Ret);
839}
840
841static WNDPROC
843 WNDPROC NewWndProc,
844 BOOL Ansi)
845{
846 INT i;
847 PCALLPROCDATA CallProc;
848 PCLS Class;
849 WNDPROC Ret, chWndProc = NULL;
850
851 // Retrieve previous window proc.
852 Ret = IntGetWindowProc(pWnd, Ansi);
853
854 Class = pWnd->pcls;
855
856 if (IsCallProcHandle(NewWndProc))
857 {
858 CallProc = UserGetObject(gHandleTable, NewWndProc, TYPE_CALLPROC);
859 if (CallProc)
860 { // Reset new WndProc.
861 NewWndProc = CallProc->pfnClientPrevious;
862 // Reset Ansi from CallProc handle. This is expected with wine "deftest".
863 Ansi = !!(CallProc->wType & UserGetCPDU2A);
864 }
865 }
866 // Switch from Client Side call to Server Side call if match. Ref: "deftest".
867 for ( i = FNID_FIRST; i <= FNID_SWITCH; i++)
868 {
869 if (GETPFNCLIENTW(i) == NewWndProc)
870 {
871 chWndProc = GETPFNSERVER(i);
872 break;
873 }
874 if (GETPFNCLIENTA(i) == NewWndProc)
875 {
876 chWndProc = GETPFNSERVER(i);
877 break;
878 }
879 }
880 // If match, set/reset to Server Side and clear ansi.
881 if (chWndProc)
882 {
883 pWnd->lpfnWndProc = chWndProc;
884 pWnd->Unicode = TRUE;
885 pWnd->state &= ~WNDS_ANSIWINDOWPROC;
887 }
888 else
889 {
890 pWnd->Unicode = !Ansi;
891 // Handle the state change in here.
892 if (Ansi)
893 pWnd->state |= WNDS_ANSIWINDOWPROC;
894 else
895 pWnd->state &= ~WNDS_ANSIWINDOWPROC;
896
898 pWnd->state &= ~WNDS_SERVERSIDEWINDOWPROC;
899
900 if (!NewWndProc) NewWndProc = pWnd->lpfnWndProc;
901
902 if (Class->fnid <= FNID_GHOST && Class->fnid >= FNID_BUTTON)
903 {
904 if (Ansi)
905 {
906 if (GETPFNCLIENTW(Class->fnid) == NewWndProc)
907 chWndProc = GETPFNCLIENTA(Class->fnid);
908 }
909 else
910 {
911 if (GETPFNCLIENTA(Class->fnid) == NewWndProc)
912 chWndProc = GETPFNCLIENTW(Class->fnid);
913 }
914 }
915 // Now set the new window proc.
916 pWnd->lpfnWndProc = (chWndProc ? chWndProc : NewWndProc);
917 }
918 return Ret;
919}
920
921
922/* INTERNAL ******************************************************************/
923
925// This fixes a check for children messages that need paint while searching the parents messages!
926// Fixes wine msg:test_paint_messages:WmParentErasePaint ..
930{
932 do
933 {
934 if ( Window == NULL || (Window->style & (WS_POPUP|WS_CHILD)) != WS_CHILD )
935 return FALSE;
936
937 Window = Window->spwndParent;
938 }
939 while(Parent != Window);
940 return TRUE;
941}
943
944/* Link the window into siblings list. Children and parent are kept in place. */
947 PWND Wnd,
948 PWND WndInsertAfter /* Set to NULL if top sibling */
949)
950{
951 if (Wnd == WndInsertAfter)
952 {
953 ERR("Trying to link window 0x%p to itself\n", Wnd);
954 ASSERT(WndInsertAfter != Wnd);
955 return;
956 }
957
958 WndSetPrev(Wnd, WndInsertAfter);
959 if (Wnd->spwndPrev)
960 {
961 /* Link after WndInsertAfter */
962 ASSERT(Wnd != WndInsertAfter->spwndNext);
963 WndSetNext(Wnd, WndInsertAfter->spwndNext);
964 if (Wnd->spwndNext)
965 WndSetPrev(Wnd->spwndNext, Wnd);
966
967 ASSERT(Wnd != Wnd->spwndPrev);
968 WndSetNext(Wnd->spwndPrev, Wnd);
969 }
970 else
971 {
972 /* Link at the top */
973 ASSERT(Wnd != Wnd->spwndParent->spwndChild);
974 WndSetNext(Wnd, Wnd->spwndParent->spwndChild);
975 if (Wnd->spwndNext)
976 WndSetPrev(Wnd->spwndNext, Wnd);
977
978 WndSetChild(Wnd->spwndParent, Wnd);
979 }
980}
981
982/*
983 Note: Wnd->spwndParent can be null if it is the desktop.
984*/
986{
987 if (hWndPrev == HWND_NOTOPMOST)
988 {
989 if (!(Wnd->ExStyle & WS_EX_TOPMOST) && (Wnd->ExStyle2 & WS_EX2_LINKED))
990 return; /* nothing to do */
991 Wnd->ExStyle &= ~WS_EX_TOPMOST;
992 hWndPrev = HWND_TOP; /* fallback to the HWND_TOP case */
993 }
994
995 IntUnlinkWindow(Wnd); /* unlink it from the previous location */
996
997 if (hWndPrev == HWND_BOTTOM)
998 {
999 /* Link in the bottom of the list */
1000 PWND WndInsertAfter;
1001
1002 WndInsertAfter = Wnd->spwndParent->spwndChild;
1003 while (WndInsertAfter && WndInsertAfter->spwndNext)
1004 {
1005 WndInsertAfter = WndInsertAfter->spwndNext;
1006 }
1007
1008 IntLinkWindow(Wnd, WndInsertAfter);
1009 Wnd->ExStyle &= ~WS_EX_TOPMOST;
1010 }
1011 else if (hWndPrev == HWND_TOPMOST)
1012 {
1013 /* Link in the top of the list */
1014 IntLinkWindow(Wnd, NULL);
1015 Wnd->ExStyle |= WS_EX_TOPMOST;
1016 }
1017 else if (hWndPrev == HWND_TOP)
1018 {
1019 /* Link it after the last topmost window */
1020 PWND WndInsertBefore;
1021
1022 WndInsertBefore = Wnd->spwndParent->spwndChild;
1023
1024 if (!(Wnd->ExStyle & WS_EX_TOPMOST)) /* put it above the first non-topmost window */
1025 {
1026 while (WndInsertBefore != NULL && WndInsertBefore->spwndNext != NULL)
1027 {
1028 if (!(WndInsertBefore->ExStyle & WS_EX_TOPMOST))
1029 break;
1030
1031 if (WndInsertBefore == Wnd->spwndOwner) /* keep it above owner */
1032 {
1033 Wnd->ExStyle |= WS_EX_TOPMOST;
1034 break;
1035 }
1036 WndInsertBefore = WndInsertBefore->spwndNext;
1037 }
1038 }
1039
1040 IntLinkWindow(Wnd, WndInsertBefore ? WndInsertBefore->spwndPrev : NULL);
1041 }
1042 else
1043 {
1044 /* Link it after hWndPrev */
1045 PWND WndInsertAfter;
1046
1047 WndInsertAfter = UserGetWindowObject(hWndPrev);
1048 /* Are we called with an erroneous handle */
1049 if (WndInsertAfter == NULL)
1050 {
1051 /* Link in a default position */
1052 IntLinkHwnd(Wnd, HWND_TOP);
1053 return;
1054 }
1055
1056 if (Wnd == WndInsertAfter)
1057 {
1058 ERR("Trying to link window 0x%p to itself\n", Wnd);
1059 ASSERT(WndInsertAfter != Wnd);
1060 // FIXME: IntUnlinkWindow(Wnd) was already called. Continuing as is seems wrong!
1061 }
1062 else
1063 {
1064 IntLinkWindow(Wnd, WndInsertAfter);
1065 }
1066
1067 /* Fix the WS_EX_TOPMOST flag */
1068 if (!(WndInsertAfter->ExStyle & WS_EX_TOPMOST))
1069 {
1070 Wnd->ExStyle &= ~WS_EX_TOPMOST;
1071 }
1072 else
1073 {
1074 if (WndInsertAfter->spwndNext &&
1075 (WndInsertAfter->spwndNext->ExStyle & WS_EX_TOPMOST))
1076 {
1077 Wnd->ExStyle |= WS_EX_TOPMOST;
1078 }
1079 }
1080 }
1081 Wnd->ExStyle2 |= WS_EX2_LINKED;
1082}
1083
1085IntProcessOwnerSwap(PWND Wnd, PWND WndNewOwner, PWND WndOldOwner)
1086{
1087 if (WndOldOwner)
1088 {
1089 if (Wnd->head.pti != WndOldOwner->head.pti)
1090 {
1091 if (!WndNewOwner ||
1092 Wnd->head.pti == WndNewOwner->head.pti ||
1093 WndOldOwner->head.pti != WndNewOwner->head.pti )
1094 {
1095 //ERR("ProcessOwnerSwap Old out.\n");
1096 UserAttachThreadInput(Wnd->head.pti, WndOldOwner->head.pti, FALSE);
1097 }
1098 }
1099 }
1100 if (WndNewOwner)
1101 {
1102 if (Wnd->head.pti != WndNewOwner->head.pti)
1103 {
1104 if (!WndOldOwner ||
1105 WndOldOwner->head.pti != WndNewOwner->head.pti )
1106 {
1107 //ERR("ProcessOwnerSwap New in.\n");
1108 UserAttachThreadInput(Wnd->head.pti, WndNewOwner->head.pti, TRUE);
1109 }
1110 }
1111 }
1112 // FIXME: System Tray checks.
1113}
1114
1115static
1118{
1119 PWND Wnd, WndOldOwner, WndNewOwner;
1120 HWND ret;
1121
1122 Wnd = IntGetWindowObject(hWnd);
1123 if(!Wnd)
1124 return NULL;
1125
1126 WndOldOwner = Wnd->spwndOwner;
1127
1128 ret = WndOldOwner ? UserHMGetHandle(WndOldOwner) : 0;
1129 WndNewOwner = UserGetWindowObject(hWndNewOwner);
1130
1131 if (!WndNewOwner && hWndNewOwner)
1132 {
1134 ret = NULL;
1135 goto Error;
1136 }
1137
1138 /* if parent belongs to a different thread and the window isn't */
1139 /* top-level, attach the two threads */
1140 IntProcessOwnerSwap(Wnd, WndNewOwner, WndOldOwner);
1141
1142 if (IntValidateOwnerDepth(Wnd, WndNewOwner))
1143 {
1144 WndSetOwner(Wnd, WndNewOwner);
1145 }
1146 else
1147 {
1148 IntProcessOwnerSwap(Wnd, WndOldOwner, WndNewOwner);
1150 ret = NULL;
1151 }
1152Error:
1154 return ret;
1155}
1156
1158co_IntSetParent(PWND Wnd, PWND WndNewParent)
1159{
1160 PWND WndOldParent, pWndExam;
1161 BOOL WasVisible;
1162 POINT pt;
1163 int swFlags = SWP_NOSIZE|SWP_NOZORDER;
1164
1165 ASSERT(Wnd);
1166 ASSERT(WndNewParent);
1167 ASSERT_REFS_CO(Wnd);
1168 ASSERT_REFS_CO(WndNewParent);
1169
1170 if (Wnd == Wnd->head.rpdesk->spwndMessage)
1171 {
1173 return NULL;
1174 }
1175
1176 /* Some applications try to set a child as a parent */
1177 if (IntIsChildWindow(Wnd, WndNewParent))
1178 {
1179 TRACE("IntSetParent try to set a child as a parent.\n");
1181 return NULL;
1182 }
1183
1184 pWndExam = WndNewParent; // Load parent Window to examine.
1185 // Now test for set parent to parent hit.
1186 while (pWndExam)
1187 {
1188 if (Wnd == pWndExam)
1189 {
1190 TRACE("IntSetParent Failed Test for set parent to parent!\n");
1192 return NULL;
1193 }
1194 pWndExam = pWndExam->spwndParent;
1195 }
1196
1197 /*
1198 * Windows hides the window first, then shows it again
1199 * including the WM_SHOWWINDOW messages and all
1200 */
1201 WasVisible = co_WinPosShowWindow(Wnd, SW_HIDE);
1202
1203 /* Window must belong to current process */
1204 if (Wnd->head.pti->ppi != PsGetCurrentProcessWin32Process())
1205 {
1206 ERR("IntSetParent Window must belong to current process!\n");
1207 return NULL;
1208 }
1209
1210 WndOldParent = Wnd->spwndParent;
1211
1212 if ( WndOldParent &&
1213 WndOldParent->ExStyle & WS_EX_LAYOUTRTL)
1214 pt.x = Wnd->rcWindow.right;
1215 else
1216 pt.x = Wnd->rcWindow.left;
1217 pt.y = Wnd->rcWindow.top;
1218
1219 IntScreenToClient(WndOldParent, &pt);
1220
1221 if (WndOldParent) UserReferenceObject(WndOldParent); /* Caller must deref */
1222
1223 /* Even if WndNewParent == WndOldParent continue because the
1224 * child window (Wnd) should be moved to the top of the z-order */
1225
1226 /* Unlink the window from the siblings list */
1227 IntUnlinkWindow(Wnd);
1228 Wnd->ExStyle2 &= ~WS_EX2_LINKED;
1229
1230 /* Set the new parent */
1231 WndSetParent(Wnd, WndNewParent);
1232
1233 if (Wnd->style & WS_CHILD &&
1234 Wnd->spwndOwner &&
1235 Wnd->spwndOwner->ExStyle & WS_EX_TOPMOST)
1236 {
1237 ERR("SetParent Top Most from Pop up\n");
1238 Wnd->ExStyle |= WS_EX_TOPMOST;
1239 }
1240
1241 /* Link the window with its new siblings */
1242 IntLinkHwnd(Wnd,
1243 ((0 == (Wnd->ExStyle & WS_EX_TOPMOST) &&
1244 UserIsDesktopWindow(WndNewParent)) ? HWND_TOP : HWND_TOPMOST));
1245
1246 if ( WndNewParent == co_GetDesktopWindow(Wnd) &&
1247 !(Wnd->style & WS_CLIPSIBLINGS) )
1248 {
1249 Wnd->style |= WS_CLIPSIBLINGS;
1250 DceResetActiveDCEs(Wnd);
1251 }
1252
1253 /* if parent belongs to a different thread and the window isn't */
1254 /* top-level, attach the two threads */
1255 if ((Wnd->style & (WS_CHILD|WS_POPUP)) == WS_CHILD)
1256 {
1257 if ( Wnd->spwndParent != co_GetDesktopWindow(Wnd))
1258 {
1259 if (WndOldParent && (Wnd->head.pti != WndOldParent->head.pti))
1260 {
1261 //ERR("SetParent Old out.\n");
1262 UserAttachThreadInput(Wnd->head.pti, WndOldParent->head.pti, FALSE);
1263 }
1264 }
1265 if ( WndNewParent != co_GetDesktopWindow(Wnd))
1266 {
1267 if (Wnd->head.pti != WndNewParent->head.pti)
1268 {
1269 //ERR("SetParent New in.\n");
1270 UserAttachThreadInput(Wnd->head.pti, WndNewParent->head.pti, TRUE);
1271 }
1272 }
1273 }
1274
1275 if (UserIsMessageWindow(WndOldParent) || UserIsMessageWindow(WndNewParent))
1276 swFlags |= SWP_NOACTIVATE;
1277
1278 IntNotifyWinEvent(EVENT_OBJECT_PARENTCHANGE, Wnd ,OBJID_WINDOW, CHILDID_SELF, WEF_SETBYWNDPTI);
1279 /*
1280 * SetParent additionally needs to make hwnd the top window
1281 * in the z-order and send the expected WM_WINDOWPOSCHANGING and
1282 * WM_WINDOWPOSCHANGED notification messages.
1283 */
1284 //ERR("IntSetParent SetWindowPos 1\n");
1286 (0 == (Wnd->ExStyle & WS_EX_TOPMOST) ? HWND_TOP : HWND_TOPMOST),
1287 pt.x, pt.y, 0, 0, swFlags);
1288 //ERR("IntSetParent SetWindowPos 2 X %d Y %d\n",pt.x, pt.y);
1289 if (WasVisible) co_WinPosShowWindow(Wnd, SW_SHOWNORMAL);
1290
1291 return WndOldParent;
1292}
1293
1296{
1297 PWND Wnd = NULL, WndParent = NULL, WndOldParent;
1298 HWND hWndOldParent = NULL;
1299 USER_REFERENCE_ENTRY Ref, ParentRef;
1300
1301 if (IntIsBroadcastHwnd(hWndChild) || IntIsBroadcastHwnd(hWndNewParent))
1302 {
1304 return NULL;
1305 }
1306
1308 {
1309 ERR("UserSetParent Access Denied!\n");
1311 return NULL;
1312 }
1313
1314 if (hWndNewParent)
1315 {
1316 if (!(WndParent = UserGetWindowObject(hWndNewParent)))
1317 {
1318 ERR("UserSetParent Bad New Parent!\n");
1319 return NULL;
1320 }
1321 }
1322 else
1323 {
1324 if (!(WndParent = UserGetWindowObject(IntGetDesktopWindow())))
1325 {
1326 return NULL;
1327 }
1328 }
1329
1330 if (!(Wnd = UserGetWindowObject(hWndChild)))
1331 {
1332 ERR("UserSetParent Bad Child!\n");
1333 return NULL;
1334 }
1335
1336 UserRefObjectCo(Wnd, &Ref);
1337 UserRefObjectCo(WndParent, &ParentRef);
1338 //ERR("Enter co_IntSetParent\n");
1339 WndOldParent = co_IntSetParent(Wnd, WndParent);
1340 //ERR("Leave co_IntSetParent\n");
1341 UserDerefObjectCo(WndParent);
1342 UserDerefObjectCo(Wnd);
1343
1344 if (WndOldParent)
1345 {
1346 hWndOldParent = UserHMGetHandle(WndOldParent);
1347 UserDereferenceObject(WndOldParent);
1348 }
1349
1350 return hWndOldParent;
1351}
1352
1353/* Unlink the window from siblings. Children and parent are kept in place. */
1356{
1357 ASSERT(Wnd != Wnd->spwndNext);
1358 ASSERT(Wnd != Wnd->spwndPrev);
1359
1360 if (Wnd->spwndNext)
1361 WndSetPrev(Wnd->spwndNext, Wnd->spwndPrev);
1362
1363 if (Wnd->spwndPrev)
1364 WndSetNext(Wnd->spwndPrev, Wnd->spwndNext);
1365
1366 if (Wnd->spwndParent && Wnd->spwndParent->spwndChild == Wnd)
1367 WndSetChild(Wnd->spwndParent, Wnd->spwndNext);
1368
1369 WndSetPrev(Wnd, NULL);
1370 WndSetNext(Wnd, NULL);
1371}
1372
1374{
1375 PWINDOWLIST pwlOld, pwlNew;
1376 SIZE_T ibOld, ibNew;
1377
1378#define GROW_COUNT 8
1379 pwlOld = *ppwl;
1380 ibOld = (LPBYTE)pwlOld->phwndLast - (LPBYTE)pwlOld;
1381 ibNew = ibOld + GROW_COUNT * sizeof(HWND);
1382#undef GROW_COUNT
1383 pwlNew = IntReAllocatePoolWithTag(PagedPool, pwlOld, ibOld, ibNew, USERTAG_WINDOWLIST);
1384 if (!pwlNew)
1385 return FALSE;
1386
1387 pwlNew->phwndLast = (HWND *)((LPBYTE)pwlNew + ibOld);
1388 pwlNew->phwndEnd = (HWND *)((LPBYTE)pwlNew + ibNew);
1389 *ppwl = pwlNew;
1390 return TRUE;
1391}
1392
1394{
1395 ASSERT(!WL_IS_BAD(pwl));
1396
1397 for (; pwnd; pwnd = pwnd->spwndNext)
1398 {
1399 if (!pwl->pti || pwl->pti == pwnd->head.pti)
1400 {
1401 *(pwl->phwndLast) = UserHMGetHandle(pwnd);
1402 ++(pwl->phwndLast);
1403
1404 if (pwl->phwndLast == pwl->phwndEnd && !IntGrowHwndList(&pwl))
1405 break;
1406 }
1407
1408 if ((dwFlags & IACE_CHILDREN) && pwnd->spwndChild)
1409 {
1410 pwl = IntPopulateHwndList(pwl, pwnd->spwndChild, IACE_CHILDREN | IACE_LIST);
1411 if (WL_IS_BAD(pwl))
1412 break;
1413 }
1414
1415 if (!(dwFlags & IACE_LIST))
1416 break;
1417 }
1418
1419 return pwl;
1420}
1421
1423{
1424 PWINDOWLIST pwl;
1425 DWORD cbWL;
1426
1427 if (gpwlCache)
1428 {
1429 pwl = gpwlCache;
1430 gpwlCache = NULL;
1431 }
1432 else
1433 {
1434#define INITIAL_COUNT 32
1435 cbWL = sizeof(WINDOWLIST) + (INITIAL_COUNT - 1) * sizeof(HWND);
1437 if (!pwl)
1438 return NULL;
1439
1440 pwl->phwndEnd = &pwl->ahwnd[INITIAL_COUNT];
1441#undef INITIAL_COUNT
1442 }
1443
1444 pwl->pti = pti;
1445 pwl->phwndLast = pwl->ahwnd;
1446 pwl = IntPopulateHwndList(pwl, pwnd, dwFlags);
1447 if (WL_IS_BAD(pwl))
1448 {
1450 return NULL;
1451 }
1452
1453 *(pwl->phwndLast) = HWND_TERMINATOR;
1454
1455 if (dwFlags & 0x8)
1456 {
1457 // TODO:
1458 }
1459
1460 pwl->pti = GetW32ThreadInfo();
1461 pwl->pNextList = gpwlList;
1462 gpwlList = pwl;
1463
1464 return pwl;
1465}
1466
1468{
1469 PWINDOWLIST pwl, *ppwl;
1470
1471 for (ppwl = &gpwlList; *ppwl; ppwl = &(*ppwl)->pNextList)
1472 {
1473 if (*ppwl != pwlTarget)
1474 continue;
1475
1476 *ppwl = pwlTarget->pNextList;
1477
1478 if (gpwlCache)
1479 {
1480 if (WL_CAPACITY(pwlTarget) > WL_CAPACITY(gpwlCache))
1481 {
1482 pwl = gpwlCache;
1483 gpwlCache = pwlTarget;
1485 }
1486 else
1487 {
1489 }
1490 }
1491 else
1492 {
1493 gpwlCache = pwlTarget;
1494 }
1495
1496 break;
1497 }
1498}
1499
1500/* FUNCTIONS *****************************************************************/
1501
1502/*
1503 * As best as I can figure, this function is used by EnumWindows,
1504 * EnumChildWindows, EnumDesktopWindows, & EnumThreadWindows.
1505 *
1506 * It's supposed to build a list of HWNDs to return to the caller.
1507 * We can figure out what kind of list by what parameters are
1508 * passed to us.
1509 */
1510/*
1511 * @implemented
1512 */
1514NTAPI
1516 HDESK hDesktop,
1518 BOOLEAN bChildren,
1520 ULONG cHwnd,
1521 HWND* phwndList,
1522 ULONG* pcHwndNeeded)
1523{
1525 ULONG dwCount = 0;
1526
1527 if (pcHwndNeeded == NULL)
1529
1531
1532 if (hwndParent || !dwThreadId)
1533 {
1536
1537 if(!hwndParent)
1538 {
1539 if(hDesktop == NULL && !(Desktop = IntGetActiveDesktop()))
1540 {
1542 goto Quit;
1543 }
1544
1545 if(hDesktop)
1546 {
1548 UserMode,
1549 0,
1550 &Desktop);
1551 if(!NT_SUCCESS(Status))
1552 {
1554 goto Quit;
1555 }
1556 }
1557 hwndParent = Desktop->DesktopWindow;
1558 }
1559 else
1560 {
1561 hDesktop = 0;
1562 }
1563
1565 (Window = Parent->spwndChild))
1566 {
1567 BOOL bGoDown = TRUE;
1568
1570 while(TRUE)
1571 {
1572 if (bGoDown)
1573 {
1574 if (dwCount++ < cHwnd && phwndList)
1575 {
1576 _SEH2_TRY
1577 {
1578 ProbeForWrite(phwndList, sizeof(HWND), 1);
1579 *phwndList = UserHMGetHandle(Window);
1580 phwndList++;
1581 }
1583 {
1585 }
1586 _SEH2_END
1587 if(!NT_SUCCESS(Status))
1588 {
1589 break;
1590 }
1591 }
1592 if (Window->spwndChild && bChildren)
1593 {
1594 Window = Window->spwndChild;
1595 continue;
1596 }
1597 bGoDown = FALSE;
1598 }
1599 if (Window->spwndNext)
1600 {
1601 Window = Window->spwndNext;
1602 bGoDown = TRUE;
1603 continue;
1604 }
1605 Window = Window->spwndParent;
1606 if (Window == Parent)
1607 {
1608 break;
1609 }
1610 }
1611 }
1612
1613 if(hDesktop)
1614 {
1616 }
1617 }
1618 else // Build EnumThreadWindows list!
1619 {
1621 PTHREADINFO W32Thread;
1622 PWND Window;
1623 HWND *List = NULL;
1624
1626 if (!NT_SUCCESS(Status))
1627 {
1628 ERR("Thread Id is not valid!\n");
1630 goto Quit;
1631 }
1632 if (!(W32Thread = (PTHREADINFO)Thread->Tcb.Win32Thread))
1633 {
1635 TRACE("Tried to enumerate windows of a non gui thread\n");
1637 goto Quit;
1638 }
1639
1640 // Do not use Thread link list due to co_UserFreeWindow!!!
1641 // Current = W32Thread->WindowListHead.Flink;
1642 // Fixes Api:CreateWindowEx tests!!!
1644 if (List)
1645 {
1646 int i;
1647 for (i = 0; List[i]; i++)
1648 {
1650 if (Window && Window->head.pti == W32Thread)
1651 {
1652 if (dwCount < cHwnd && phwndList)
1653 {
1654 _SEH2_TRY
1655 {
1656 ProbeForWrite(phwndList, sizeof(HWND), 1);
1657 *phwndList = UserHMGetHandle(Window);
1658 phwndList++;
1659 }
1661 {
1663 }
1664 _SEH2_END
1665 if (!NT_SUCCESS(Status))
1666 {
1667 ERR("Failure to build window list!\n");
1668 break;
1669 }
1670 }
1671 dwCount++;
1672 }
1673 }
1675 }
1676
1678 }
1679
1680 *pcHwndNeeded = dwCount;
1682
1683Quit:
1685 UserLeave();
1686 return Status;
1687}
1688
1689static void IntSendParentNotify( PWND pWindow, UINT msg )
1690{
1691 PWND Parent;
1692
1693 if ( (pWindow->style & (WS_CHILD | WS_POPUP)) == WS_CHILD &&
1694 !(pWindow->ExStyle & WS_EX_NOPARENTNOTIFY))
1695 {
1696 Parent = pWindow->spwndParent;
1698 {
1700 UserRefObjectCo(Parent, &Ref);
1703 MAKEWPARAM( msg, pWindow->IDMenu),
1704 (LPARAM)UserHMGetHandle(pWindow) );
1706 }
1707 }
1708}
1709
1710void FASTCALL
1711IntFixWindowCoordinates(CREATESTRUCTW* Cs, PWND ParentWindow, DWORD* dwShowMode)
1712{
1713#define IS_DEFAULT(x) ((x) == CW_USEDEFAULT || (x) == (SHORT)0x8000)
1714
1715 /* default positioning for overlapped windows */
1716 if(!(Cs->style & (WS_POPUP | WS_CHILD)))
1717 {
1718 PMONITOR pMonitor = NULL;
1719 PRTL_USER_PROCESS_PARAMETERS ProcessParams;
1721
1722 if (ppi && ppi->hMonitor)
1723 pMonitor = UserGetMonitorObject(ppi->hMonitor);
1724 if (!pMonitor)
1725 pMonitor = UserGetPrimaryMonitor();
1726
1727 /* Check if we don't have a monitor attached yet */
1728 if (pMonitor == NULL)
1729 {
1730 Cs->x = Cs->y = 0;
1731 Cs->cx = 800;
1732 Cs->cy = 600;
1733 return;
1734 }
1735
1736 ProcessParams = PsGetCurrentProcess()->Peb->ProcessParameters;
1737
1738 if (IS_DEFAULT(Cs->x))
1739 {
1740 if (!IS_DEFAULT(Cs->y)) *dwShowMode = Cs->y;
1741
1742 if(ProcessParams->WindowFlags & STARTF_USEPOSITION)
1743 {
1744 Cs->x = ProcessParams->StartingX;
1745 Cs->y = ProcessParams->StartingY;
1746 }
1747 else
1748 {
1751 if (Cs->x > ((pMonitor->rcWork.right - pMonitor->rcWork.left) / 4) ||
1752 Cs->y > ((pMonitor->rcWork.bottom - pMonitor->rcWork.top) / 4))
1753 {
1754 /* reset counter and position */
1755 Cs->x = 0;
1756 Cs->y = 0;
1757 pMonitor->cWndStack = 0;
1758 }
1759 pMonitor->cWndStack++;
1760 }
1761 }
1762
1763 if (IS_DEFAULT(Cs->cx))
1764 {
1765 if (ProcessParams->WindowFlags & STARTF_USEPOSITION)
1766 {
1767 Cs->cx = ProcessParams->CountX;
1768 Cs->cy = ProcessParams->CountY;
1769 }
1770 else
1771 {
1772 Cs->cx = (pMonitor->rcWork.right - pMonitor->rcWork.left) * 3 / 4;
1773 Cs->cy = (pMonitor->rcWork.bottom - pMonitor->rcWork.top) * 3 / 4;
1774 }
1775 }
1776 /* neither x nor cx are default. Check the y values .
1777 * In the trace we see Outlook and Outlook Express using
1778 * cy set to CW_USEDEFAULT when opening the address book.
1779 */
1780 else if (IS_DEFAULT(Cs->cy))
1781 {
1782 TRACE("Strange use of CW_USEDEFAULT in nHeight\n");
1783 Cs->cy = (pMonitor->rcWork.bottom - pMonitor->rcWork.top) * 3 / 4;
1784 }
1785 }
1786 else
1787 {
1788 /* if CW_USEDEFAULT is set for non-overlapped windows, both values are set to zero */
1789 if(IS_DEFAULT(Cs->x))
1790 {
1791 Cs->x = 0;
1792 Cs->y = 0;
1793 }
1794 if(IS_DEFAULT(Cs->cx))
1795 {
1796 Cs->cx = 0;
1797 Cs->cy = 0;
1798 }
1799 }
1800
1801#undef IS_DEFAULT
1802}
1803
1804/* Allocates and initializes a window */
1806 PLARGE_STRING WindowName,
1807 PCLS Class,
1808 PWND ParentWindow,
1809 PWND OwnerWindow,
1810 PVOID acbiBuffer,
1811 PDESKTOP pdeskCreated,
1812 DWORD dwVer )
1813{
1814 PWND pWnd = NULL;
1815 HWND hWnd;
1816 PTHREADINFO pti;
1817 BOOL MenuChanged;
1818 BOOL bUnicodeWindow;
1819 PCALLPROCDATA pcpd;
1820
1821 pti = pdeskCreated ? gptiDesktopThread : GetW32ThreadInfo();
1822
1823 if (!(Cs->dwExStyle & WS_EX_LAYOUTRTL))
1824 { // Need both here for wine win.c test_CreateWindow.
1825 //if (Cs->hwndParent && ParentWindow)
1826 if (ParentWindow) // It breaks more tests..... WIP.
1827 {
1828 if ( (Cs->style & (WS_CHILD|WS_POPUP)) == WS_CHILD &&
1829 ParentWindow->ExStyle & WS_EX_LAYOUTRTL &&
1830 !(ParentWindow->ExStyle & WS_EX_NOINHERITLAYOUT) )
1832 }
1833 else
1834 { /*
1835 * Note from MSDN <https://learn.microsoft.com/en-us/previous-versions/aa913269(v=msdn.10)>:
1836 *
1837 * Dialog boxes and message boxes do not inherit layout, so you must
1838 * set the layout explicitly.
1839 */
1840 if ( Class->fnid != FNID_DIALOG )
1841 {
1842 if (pti->ppi->dwLayout & LAYOUT_RTL)
1843 {
1845 }
1846 }
1847 }
1848 }
1849
1850 /* Automatically add WS_EX_WINDOWEDGE */
1851 if ((Cs->dwExStyle & WS_EX_DLGMODALFRAME) ||
1852 ((!(Cs->dwExStyle & WS_EX_STATICEDGE)) &&
1853 (Cs->style & (WS_DLGFRAME | WS_THICKFRAME))))
1855 else
1856 Cs->dwExStyle &= ~WS_EX_WINDOWEDGE;
1857
1858 /* Is it a unicode window? */
1859 bUnicodeWindow =!(Cs->dwExStyle & WS_EX_SETANSICREATOR);
1860 Cs->dwExStyle &= ~WS_EX_SETANSICREATOR;
1861
1862 /* Allocate the new window */
1864 pdeskCreated ? pdeskCreated : pti->rpdesk,
1865 pti,
1866 (PHANDLE)&hWnd,
1868 sizeof(WND) + Class->cbwndExtra);
1869
1870 if (!pWnd)
1871 {
1872 goto AllocError;
1873 }
1874
1875 TRACE("Created window object with handle %p\n", hWnd);
1876
1877 /*
1878 * Fill out the structure describing it.
1879 */
1880 /* Remember, pWnd->head is setup in object.c ... */
1881 WndSetParent(pWnd, ParentWindow);
1882 WndSetOwner(pWnd, OwnerWindow);
1883 pWnd->fnid = 0;
1884 WndSetLastActive(pWnd, pWnd);
1885 // Ramp up compatible version sets.
1886 if ( dwVer >= WINVER_WIN31 )
1887 {
1888 pWnd->state2 |= WNDS2_WIN31COMPAT;
1889 if ( dwVer >= WINVER_WINNT4 )
1890 {
1891 pWnd->state2 |= WNDS2_WIN40COMPAT;
1892 if ( dwVer >= WINVER_WIN2K )
1893 {
1894 pWnd->state2 |= WNDS2_WIN50COMPAT;
1895 }
1896 }
1897 }
1898 pWnd->pcls = Class;
1899 pWnd->hModule = Cs->hInstance;
1900 pWnd->style = Cs->style & ~WS_VISIBLE;
1901 pWnd->ExStyle = Cs->dwExStyle;
1902 pWnd->cbwndExtra = pWnd->pcls->cbwndExtra;
1903 pWnd->pActCtx = acbiBuffer;
1904
1905 if (pti->spDefaultImc && Class->atomClassName != gpsi->atomSysClass[ICLS_BUTTON])
1906 pWnd->hImc = UserHMGetHandle(pti->spDefaultImc);
1907
1908 pWnd->InternalPos.MaxPos.x = pWnd->InternalPos.MaxPos.y = -1;
1909 pWnd->InternalPos.IconPos.x = pWnd->InternalPos.IconPos.y = -1;
1910
1911 if (pWnd->spwndParent != NULL && Cs->hwndParent != 0)
1912 {
1913 pWnd->HideFocus = pWnd->spwndParent->HideFocus;
1914 pWnd->HideAccel = pWnd->spwndParent->HideAccel;
1915 }
1916
1918 pWnd->head.pti->cWindows++;
1919
1920 if (Class->spicn && !Class->spicnSm)
1921 {
1922 HICON IconSmHandle = NULL;
1923 if((Class->spicn->CURSORF_flags & (CURSORF_LRSHARED | CURSORF_FROMRESOURCE))
1925 {
1926 IconSmHandle = co_IntCopyImage(
1927 UserHMGetHandle(Class->spicn),
1928 IMAGE_ICON,
1932 }
1933 if (!IconSmHandle)
1934 {
1935 /* Retry without copying from resource */
1936 IconSmHandle = co_IntCopyImage(
1937 UserHMGetHandle(Class->spicn),
1938 IMAGE_ICON,
1941 0);
1942 }
1943
1944 if (IconSmHandle)
1945 {
1946 Class->spicnSm = UserGetCurIconObject(IconSmHandle);
1947 Class->CSF_flags |= CSF_CACHEDSMICON;
1948 }
1949 }
1950
1951 if (pWnd->pcls->CSF_flags & CSF_SERVERSIDEPROC)
1953
1954 /* BugBoy Comments: Comment below say that System classes are always created
1955 as UNICODE. In windows, creating a window with the ANSI version of CreateWindow
1956 sets the window to ansi as verified by testing with IsUnicodeWindow API.
1957
1958 No where can I see in code or through testing does the window change back
1959 to ANSI after being created as UNICODE in ROS. I didnt do more testing to
1960 see what problems this would cause. */
1961
1962 // Set WndProc from Class.
1963 if (IsCallProcHandle(pWnd->pcls->lpfnWndProc))
1964 {
1966 if (pcpd)
1967 pWnd->lpfnWndProc = pcpd->pfnClientPrevious;
1968 }
1969 else
1970 {
1971 pWnd->lpfnWndProc = pWnd->pcls->lpfnWndProc;
1972 }
1973
1974 // GetWindowProc, test for non server side default classes and set WndProc.
1975 if ( pWnd->pcls->fnid <= FNID_GHOST && pWnd->pcls->fnid >= FNID_BUTTON )
1976 {
1977 if (bUnicodeWindow)
1978 {
1979 if (GETPFNCLIENTA(pWnd->pcls->fnid) == pWnd->lpfnWndProc)
1980 pWnd->lpfnWndProc = GETPFNCLIENTW(pWnd->pcls->fnid);
1981 }
1982 else
1983 {
1984 if (GETPFNCLIENTW(pWnd->pcls->fnid) == pWnd->lpfnWndProc)
1985 pWnd->lpfnWndProc = GETPFNCLIENTA(pWnd->pcls->fnid);
1986 }
1987 }
1988
1989 // If not an Unicode caller, set Ansi creator bit.
1990 if (!bUnicodeWindow) pWnd->state |= WNDS_ANSICREATOR;
1991
1992 // Clone Class Ansi/Unicode proc type.
1993 if (pWnd->pcls->CSF_flags & CSF_ANSIPROC)
1994 {
1995 pWnd->state |= WNDS_ANSIWINDOWPROC;
1996 pWnd->Unicode = FALSE;
1997 }
1998 else
1999 { /*
2000 * It seems there can be both an Ansi creator and Unicode Class Window
2001 * WndProc, unless the following overriding conditions occur:
2002 */
2003 if ( !bUnicodeWindow &&
2004 ( Class->atomClassName == gpsi->atomSysClass[ICLS_BUTTON] ||
2005 Class->atomClassName == gpsi->atomSysClass[ICLS_COMBOBOX] ||
2006 Class->atomClassName == gpsi->atomSysClass[ICLS_COMBOLBOX] ||
2007 Class->atomClassName == gpsi->atomSysClass[ICLS_DIALOG] ||
2008 Class->atomClassName == gpsi->atomSysClass[ICLS_EDIT] ||
2009 Class->atomClassName == gpsi->atomSysClass[ICLS_IME] ||
2010 Class->atomClassName == gpsi->atomSysClass[ICLS_LISTBOX] ||
2011 Class->atomClassName == gpsi->atomSysClass[ICLS_MDICLIENT] ||
2012 Class->atomClassName == gpsi->atomSysClass[ICLS_STATIC] ) )
2013 { // Override Class and set the window Ansi WndProc.
2014 pWnd->state |= WNDS_ANSIWINDOWPROC;
2015 pWnd->Unicode = FALSE;
2016 }
2017 else
2018 { // Set the window Unicode WndProc.
2019 pWnd->state &= ~WNDS_ANSIWINDOWPROC;
2020 pWnd->Unicode = TRUE;
2021 }
2022 }
2023
2024 /* BugBoy Comments: if the window being created is a edit control, ATOM 0xCxxx,
2025 then my testing shows that windows (2k and XP) creates a CallProc for it immediately
2026 Dont understand why it does this. */
2027 if (Class->atomClassName == gpsi->atomSysClass[ICLS_EDIT])
2028 {
2029 PCALLPROCDATA CallProc;
2030 CallProc = CreateCallProc(pWnd->head.rpdesk, pWnd->lpfnWndProc, pWnd->Unicode , pWnd->head.pti->ppi);
2031
2032 if (!CallProc)
2033 {
2035 ERR("Warning: Unable to create CallProc for edit control. Control may not operate correctly! hwnd %p\n", hWnd);
2036 }
2037 else
2038 {
2039 UserAddCallProcToClass(pWnd->pcls, CallProc);
2040 }
2041 }
2042
2044 pWnd->PropListItems = 0;
2045
2046 if ( WindowName->Buffer != NULL && WindowName->Length > 0 )
2047 {
2049 WindowName->Length + sizeof(UNICODE_NULL));
2050 if (pWnd->strName.Buffer == NULL)
2051 {
2052 goto AllocError;
2053 }
2054
2055 RtlCopyMemory(pWnd->strName.Buffer, WindowName->Buffer, WindowName->Length);
2056 pWnd->strName.Buffer[WindowName->Length / sizeof(WCHAR)] = L'\0';
2057 pWnd->strName.Length = WindowName->Length;
2058 pWnd->strName.MaximumLength = WindowName->Length + sizeof(UNICODE_NULL);
2059 }
2060
2061 /* Correct the window style. */
2062 if ((pWnd->style & (WS_CHILD | WS_POPUP)) != WS_CHILD)
2063 {
2064 pWnd->style |= WS_CLIPSIBLINGS;
2065 if (!(pWnd->style & WS_POPUP))
2066 {
2067 pWnd->style |= WS_CAPTION;
2068 }
2069 }
2070
2071 /* WS_EX_WINDOWEDGE depends on some other styles */
2072 if (pWnd->ExStyle & WS_EX_DLGMODALFRAME)
2073 pWnd->ExStyle |= WS_EX_WINDOWEDGE;
2074 else if (pWnd->style & (WS_DLGFRAME | WS_THICKFRAME))
2075 {
2076 if (!((pWnd->ExStyle & WS_EX_STATICEDGE) &&
2077 (pWnd->style & (WS_CHILD | WS_POPUP))))
2078 pWnd->ExStyle |= WS_EX_WINDOWEDGE;
2079 }
2080 else
2081 pWnd->ExStyle &= ~WS_EX_WINDOWEDGE;
2082
2083 if (!(pWnd->style & (WS_CHILD | WS_POPUP)))
2085
2086 /* Set the window menu */
2087 if ((Cs->style & (WS_CHILD | WS_POPUP)) != WS_CHILD)
2088 {
2089 if (Cs->hMenu)
2090 {
2091 IntSetMenu(pWnd, Cs->hMenu, &MenuChanged);
2092 }
2093 else if (pWnd->pcls->lpszMenuName) // Take it from the parent.
2094 {
2095 UNICODE_STRING MenuName;
2096 HMENU hMenu;
2097
2098 if (IS_INTRESOURCE(pWnd->pcls->lpszMenuName))
2099 {
2100 MenuName.Length = 0;
2101 MenuName.MaximumLength = 0;
2102 MenuName.Buffer = pWnd->pcls->lpszMenuName;
2103 }
2104 else
2105 {
2106 RtlInitUnicodeString( &MenuName, pWnd->pcls->lpszMenuName);
2107 }
2108 hMenu = co_IntCallLoadMenu( pWnd->pcls->hModule, &MenuName);
2109 if (hMenu) IntSetMenu(pWnd, hMenu, &MenuChanged);
2110 }
2111 }
2112 else // Not a child
2113 pWnd->IDMenu = (UINT_PTR)Cs->hMenu;
2114
2115
2116 if ( ParentWindow &&
2117 ParentWindow != ParentWindow->head.rpdesk->spwndMessage &&
2118 ParentWindow != ParentWindow->head.rpdesk->pDeskInfo->spwnd )
2119 {
2120 PWND Owner = IntGetNonChildAncestor(ParentWindow);
2121
2122 if (!IntValidateOwnerDepth(pWnd, Owner))
2123 {
2125 goto Error;
2126 }
2127 if ( pWnd->spwndOwner &&
2128 pWnd->spwndOwner->ExStyle & WS_EX_TOPMOST )
2129 {
2130 pWnd->ExStyle |= WS_EX_TOPMOST;
2131 }
2132 if ( pWnd->spwndOwner &&
2133 Class->atomClassName != gpsi->atomSysClass[ICLS_IME] &&
2134 pti != pWnd->spwndOwner->head.pti)
2135 {
2136 //ERR("CreateWindow Owner in.\n");
2137 UserAttachThreadInput(pti, pWnd->spwndOwner->head.pti, TRUE);
2138 }
2139 }
2140
2141 /* Insert the window into the thread's window list. */
2143
2144 /* Handle "CS_CLASSDC", it is tested first. */
2145 if ( (pWnd->pcls->style & CS_CLASSDC) && !(pWnd->pcls->pdce) )
2146 { /* One DCE per class to have CLASS. */
2147 pWnd->pcls->pdce = DceAllocDCE( pWnd, DCE_CLASS_DC );
2148 }
2149 else if ( pWnd->pcls->style & CS_OWNDC)
2150 { /* Allocate a DCE for this window. */
2152 }
2153
2154 return pWnd;
2155
2156AllocError:
2157 ERR("IntCreateWindow Allocation Error.\n");
2159Error:
2160 if(pWnd)
2162 return NULL;
2163}
2164
2165/*
2166 * @implemented
2167 */
2170 PUNICODE_STRING ClassName,
2171 PLARGE_STRING WindowName,
2172 PVOID acbiBuffer,
2173 DWORD dwVer )
2174{
2175 ULONG style;
2176 PWND Window = NULL, ParentWindow = NULL, OwnerWindow;
2177 HWND hWnd, hWndParent, hWndOwner, hwndInsertAfter;
2178 PWINSTATION_OBJECT WinSta;
2179 PCLS Class = NULL;
2180 SIZE Size;
2181 POINT MaxSize, MaxPos, MinTrack, MaxTrack;
2182 CBT_CREATEWNDW * pCbtCreate;
2184 USER_REFERENCE_ENTRY ParentRef, Ref;
2185 PTHREADINFO pti;
2186 DWORD dwShowMode = SW_SHOW;
2187 CREATESTRUCTW *pCsw = NULL;
2188 PVOID pszClass = NULL, pszName = NULL;
2189 PWND ret = NULL;
2190
2191 /* Get the current window station and reference it */
2192 pti = GetW32ThreadInfo();
2193 if (pti == NULL || pti->rpdesk == NULL)
2194 {
2195 ERR("Thread is not attached to a desktop! Cannot create window (%wZ)\n", ClassName);
2196 return NULL; // There is nothing to cleanup.
2197 }
2198 WinSta = pti->rpdesk->rpwinstaParent;
2200
2201 pCsw = NULL;
2202 pCbtCreate = NULL;
2203
2204 /* Get the class and reference it */
2205 Class = IntGetAndReferenceClass(ClassName, Cs->hInstance, FALSE);
2206 if(!Class)
2207 {
2209 ERR("Failed to find class %wZ\n", ClassName);
2210 goto cleanup;
2211 }
2212
2213 /* Now find the parent and the owner window */
2214 hWndParent = UserHMGetHandle(pti->rpdesk->pDeskInfo->spwnd);
2215 hWndOwner = NULL;
2216
2217 if (Cs->hwndParent == HWND_MESSAGE)
2218 {
2219 Cs->hwndParent = hWndParent = UserHMGetHandle(pti->rpdesk->spwndMessage);
2220 }
2221 else if (Cs->hwndParent)
2222 {
2223 if ((Cs->style & (WS_CHILD|WS_POPUP)) != WS_CHILD)
2224 hWndOwner = Cs->hwndParent;
2225 else
2226 hWndParent = Cs->hwndParent;
2227 }
2228 else if ((Cs->style & (WS_CHILD|WS_POPUP)) == WS_CHILD)
2229 {
2230 ERR("Cannot create a child window (%wZ) without a parent\n", ClassName);
2232 goto cleanup; /* WS_CHILD needs a parent, but WS_POPUP doesn't */
2233 }
2235 (IS_INTRESOURCE(Cs->lpszClass) ||
2236 Cs->lpszClass != (LPCWSTR)MAKEINTATOM(gpsi->atomSysClass[ICLS_HWNDMESSAGE]) ||
2237 _wcsicmp(Cs->lpszClass, L"Message") != 0))
2238 {
2239 if (pti->ppi->dwLayout & LAYOUT_RTL)
2240 {
2242 }
2243 }
2244
2245 ParentWindow = hWndParent ? UserGetWindowObject(hWndParent): NULL;
2246 OwnerWindow = hWndOwner ? UserGetWindowObject(hWndOwner): NULL;
2247
2248 if (hWndParent && !ParentWindow)
2249 {
2250 ERR("Got invalid parent window handle for %wZ\n", ClassName);
2251 goto cleanup;
2252 }
2253 else if (hWndOwner && !OwnerWindow)
2254 {
2255 ERR("Got invalid owner window handle for %wZ\n", ClassName);
2256 ParentWindow = NULL;
2257 goto cleanup;
2258 }
2259
2260 if(OwnerWindow)
2261 {
2262 if (IntIsDesktopWindow(OwnerWindow)) OwnerWindow = NULL;
2263 else if (ParentWindow && !IntIsDesktopWindow(ParentWindow))
2264 {
2265 ERR("an owned window must be created as top-level\n");
2267 goto cleanup;
2268 }
2269 else /* owner must be a top-level window */
2270 {
2271 while ((OwnerWindow->style & (WS_POPUP|WS_CHILD)) == WS_CHILD && !IntIsDesktopWindow(OwnerWindow->spwndParent))
2272 OwnerWindow = OwnerWindow->spwndParent;
2273 }
2274 }
2275
2276 /* Fix the position and the size of the window */
2277 if (ParentWindow)
2278 {
2279 UserRefObjectCo(ParentWindow, &ParentRef);
2280 IntFixWindowCoordinates(Cs, ParentWindow, &dwShowMode);
2281 }
2282
2283 /* Allocate and initialize the new window */
2285 WindowName,
2286 Class,
2287 ParentWindow,
2288 OwnerWindow,
2289 acbiBuffer,
2290 NULL,
2291 dwVer );
2292 if(!Window)
2293 {
2294 ERR("IntCreateWindow(%wZ) failed\n", ClassName);
2295 goto cleanup;
2296 }
2297
2299 hwndInsertAfter = HWND_TOP;
2300
2301 UserRefObjectCo(Window, &Ref);
2303 ObDereferenceObject(WinSta);
2304
2305 /* NCCREATE, WM_NCCALCSIZE and Hooks need the original values */
2306 Cs->lpszName = (LPCWSTR) WindowName;
2307 Cs->lpszClass = (LPCWSTR) ClassName;
2308
2310 if ( ISITHOOKED(WH_CBT) || (pti->rpdesk->pDeskInfo->fsHooks & HOOKID_TO_FLAG(WH_CBT)) )
2311 {
2312 // Allocate the calling structures Justin Case this goes Global.
2315 if (!pCsw || !pCbtCreate)
2316 {
2317 ERR("UserHeapAlloc() failed!\n");
2318 goto cleanup;
2319 }
2320
2321 if (!IntMsgCreateStructW( Window, pCsw, Cs, &pszClass, &pszName ) )
2322 {
2323 ERR("IntMsgCreateStructW() failed!\n");
2324 goto cleanup;
2325 }
2326
2327 pCbtCreate->lpcs = pCsw;
2328 pCbtCreate->hwndInsertAfter = hwndInsertAfter;
2329
2332 if (Result != 0)
2333 {
2334 ERR("WH_CBT HCBT_CREATEWND hook failed! 0x%x\n", Result);
2335 goto cleanup;
2336 }
2337 // Write back changes.
2338 Cs->cx = pCsw->cx;
2339 Cs->cy = pCsw->cy;
2340 Cs->x = pCsw->x;
2341 Cs->y = pCsw->y;
2342 hwndInsertAfter = pCbtCreate->hwndInsertAfter;
2343 }
2344
2345 if ((Cs->style & (WS_CHILD|WS_POPUP)) == WS_CHILD)
2346 {
2347 if (ParentWindow != co_GetDesktopWindow(Window))
2348 {
2349 Cs->x += ParentWindow->rcClient.left;
2350 Cs->y += ParentWindow->rcClient.top;
2351 }
2352 }
2353
2354 /* Send the WM_GETMINMAXINFO message */
2355 Size.cx = Cs->cx;
2356 Size.cy = Cs->cy;
2357
2358 if ((Cs->style & WS_THICKFRAME) || !(Cs->style & (WS_POPUP | WS_CHILD)))
2359 {
2360 co_WinPosGetMinMaxInfo(Window, &MaxSize, &MaxPos, &MinTrack, &MaxTrack);
2361 if (Size.cx > MaxTrack.x) Size.cx = MaxTrack.x;
2362 if (Size.cy > MaxTrack.y) Size.cy = MaxTrack.y;
2363 if (Size.cx < MinTrack.x) Size.cx = MinTrack.x;
2364 if (Size.cy < MinTrack.y) Size.cy = MinTrack.y;
2365 }
2366
2367 Window->rcWindow.left = Cs->x;
2368 Window->rcWindow.top = Cs->y;
2369 Window->rcWindow.right = Cs->x + Size.cx;
2370 Window->rcWindow.bottom = Cs->y + Size.cy;
2371 /*
2372 if (0 != (Window->style & WS_CHILD) && ParentWindow)
2373 {
2374 ERR("co_UserCreateWindowEx(): Offset rcWindow\n");
2375 RECTL_vOffsetRect(&Window->rcWindow,
2376 ParentWindow->rcClient.left,
2377 ParentWindow->rcClient.top);
2378 }
2379 */
2380 /* correct child window coordinates if mirroring on parent is enabled */
2381 if (ParentWindow != NULL)
2382 {
2383 if ( ((Cs->style & WS_CHILD) == WS_CHILD) &&
2384 ((ParentWindow->ExStyle & WS_EX_LAYOUTRTL) == WS_EX_LAYOUTRTL))
2385 {
2386 Window->rcWindow.right = ParentWindow->rcClient.right - (Window->rcWindow.left - ParentWindow->rcClient.left);
2387 Window->rcWindow.left = Window->rcWindow.right - Size.cx;
2388 }
2389 }
2390
2391 Window->rcClient = Window->rcWindow;
2392
2393 if (Window->spwndNext || Window->spwndPrev)
2394 {
2395 ERR("Window 0x%p has been linked too early!\n", Window);
2396 }
2397
2398 if (!(Window->state2 & WNDS2_WIN31COMPAT))
2399 {
2400 if (Class->style & CS_PARENTDC && !(ParentWindow->style & WS_CLIPCHILDREN))
2401 Window->style &= ~(WS_CLIPSIBLINGS | WS_CLIPCHILDREN);
2402 }
2403
2404 if ((Window->style & (WS_CHILD | WS_POPUP)) == WS_CHILD)
2405 {
2407 {
2408 if (pti != ParentWindow->head.pti)
2409 {
2410 //ERR("CreateWindow Parent in.\n");
2411 UserAttachThreadInput(pti, ParentWindow->head.pti, TRUE);
2412 }
2413 }
2414 }
2415
2416 /* Send the NCCREATE message */
2418 if (!Result)
2419 {
2420 ERR("co_UserCreateWindowEx(%wZ): NCCREATE message failed\n", ClassName);
2421 goto cleanup;
2422 }
2423
2424 /* Link the window */
2425 if (ParentWindow != NULL)
2426 {
2427 /* Link the window into the siblings list */
2428 if ((Cs->style & (WS_CHILD | WS_MAXIMIZE)) == WS_CHILD)
2430 else
2431 IntLinkHwnd(Window, hwndInsertAfter);
2432 }
2433
2434 /* Create the IME window for pWnd */
2436 {
2437 PWND pwndDefaultIme = co_IntCreateDefaultImeWindow(Window, Window->hModule);
2438 UserAssignmentLock((PVOID*)&pti->spwndDefaultIme, pwndDefaultIme);
2439
2440 if (pwndDefaultIme)
2441 {
2442 HWND hImeWnd;
2444 UserRefObjectCo(pwndDefaultIme, &Ref);
2445
2446 hImeWnd = UserHMGetHandle(pwndDefaultIme);
2447
2449
2450 if (pti->pClientInfo->CI_flags & CI_IMMACTIVATE)
2451 {
2452 HKL hKL = pti->KeyboardLayout->hkl;
2454 pti->pClientInfo->CI_flags &= ~CI_IMMACTIVATE;
2455 }
2456
2457 UserDerefObjectCo(pwndDefaultIme);
2458 }
2459 }
2460
2461 /* Send the WM_NCCALCSIZE message */
2462 {
2463 // RECT rc;
2464 MaxPos.x = Window->rcWindow.left;
2465 MaxPos.y = Window->rcWindow.top;
2466
2467 Result = co_WinPosGetNonClientSize(Window, &Window->rcWindow, &Window->rcClient);
2468 //rc = Window->rcWindow;
2469 //Result = co_IntSendMessageNoWait(UserHMGetHandle(Window), WM_NCCALCSIZE, FALSE, (LPARAM)&rc);
2470 //Window->rcClient = rc;
2471
2472 RECTL_vOffsetRect(&Window->rcWindow, MaxPos.x - Window->rcWindow.left,
2473 MaxPos.y - Window->rcWindow.top);
2474 }
2475
2476 /* Send the WM_CREATE message. */
2478 if (Result == (LRESULT)-1)
2479 {
2480 ERR("co_UserCreateWindowEx(%wZ): WM_CREATE message failed\n", ClassName);
2481 goto cleanup;
2482 }
2483
2484 /* Send the EVENT_OBJECT_CREATE event */
2485 IntNotifyWinEvent(EVENT_OBJECT_CREATE, Window, OBJID_WINDOW, CHILDID_SELF, 0);
2486
2487 /* By setting the flag below it can be examined to determine if the window
2488 was created successfully and a valid pwnd was passed back to caller since
2489 from here the function has to succeed. */
2491
2492 /* Send the WM_SIZE and WM_MOVE messages. */
2493 if (!(Window->state & WNDS_SENDSIZEMOVEMSGS))
2494 {
2496 }
2497
2498 /* Show or maybe minimize or maximize the window. */
2499
2501 if (style & (WS_MINIMIZE | WS_MAXIMIZE))
2502 {
2503 RECTL NewPos;
2504 UINT SwFlag = (style & WS_MINIMIZE) ? SW_MINIMIZE : SW_MAXIMIZE;
2505
2506 SwFlag = co_WinPosMinMaximize(Window, SwFlag, &NewPos);
2507 SwFlag |= SWP_NOZORDER|SWP_FRAMECHANGED; /* Frame always gets changed */
2508 if (!(style & WS_VISIBLE) || (style & WS_CHILD) || UserGetActiveWindow() ||
2509 (Window->ExStyle & WS_EX_NOACTIVATE))
2510 {
2511 SwFlag |= SWP_NOACTIVATE;
2512 }
2513 co_WinPosSetWindowPos(Window, 0, NewPos.left, NewPos.top,
2514 NewPos.right, NewPos.bottom, SwFlag);
2515 }
2516
2517 /* Send the WM_PARENTNOTIFY message */
2519
2520 /* Notify the shell that a new window was created */
2521 if (Window->spwndOwner == NULL ||
2522 !(Window->spwndOwner->style & WS_VISIBLE) ||
2523 (Window->spwndOwner->ExStyle & WS_EX_TOOLWINDOW))
2524 {
2525 if (UserIsDesktopWindow(Window->spwndParent) &&
2526 (Window->style & WS_VISIBLE) &&
2527 (!(Window->ExStyle & WS_EX_TOOLWINDOW) ||
2528 (Window->ExStyle & WS_EX_APPWINDOW)))
2529 {
2531 }
2532 }
2533
2534 /* Initialize and show the window's scrollbars */
2535 if (Window->style & WS_VSCROLL)
2536 {
2538 }
2539 if (Window->style & WS_HSCROLL)
2540 {
2542 }
2543
2544 /* Show the new window */
2545 if (Cs->style & WS_VISIBLE)
2546 {
2547 if (Window->style & WS_MAXIMIZE)
2548 dwShowMode = SW_SHOW;
2549 else if (Window->style & WS_MINIMIZE)
2550 dwShowMode = SW_SHOWMINIMIZED;
2551
2552 co_WinPosShowWindow(Window, dwShowMode);
2553
2554 if (Window->ExStyle & WS_EX_MDICHILD)
2555 {
2556 ASSERT(ParentWindow);
2557 if(!ParentWindow)
2558 goto cleanup;
2560 /* ShowWindow won't activate child windows */
2562 }
2563 }
2564
2565 if (Class->atomClassName == gaGuiConsoleWndClass)
2566 {
2567 /* Count only console windows manually */
2569 }
2570
2571 /* Set the hotkey */
2572 if (!(Window->style & (WS_POPUP | WS_CHILD)) || (Window->ExStyle & WS_EX_APPWINDOW))
2573 {
2574 if (pti->ppi->dwHotkey)
2575 {
2577 pti->ppi->dwHotkey = 0; /* Only the first suitable window gets the hotkey */
2578 }
2579 }
2580
2581 TRACE("co_UserCreateWindowEx(%wZ): Created window %p\n", ClassName, hWnd);
2582 ret = Window;
2583
2584cleanup:
2585 if (!ret)
2586 {
2587 TRACE("co_UserCreateWindowEx(): Error Created window!\n");
2588 /* If the window was created, the class will be dereferenced by co_UserDestroyWindow */
2589 if (Window)
2591 else if (Class)
2593 }
2594
2595 if (pCsw) ExFreePoolWithTag(pCsw, TAG_HOOK);
2596 if (pCbtCreate) ExFreePoolWithTag(pCbtCreate, TAG_HOOK);
2597 if (pszName) UserHeapFree(pszName);
2598 if (pszClass) UserHeapFree(pszClass);
2599
2600 if (Window)
2601 {
2603 }
2604 if (ParentWindow) UserDerefObjectCo(ParentWindow);
2605
2606 // See CORE-13717, not setting error on success.
2607 if (ret)
2609
2610 return ret;
2611}
2612
2614NTAPI
2616 OUT PLARGE_STRING plstrSafe,
2617 IN PLARGE_STRING plstrUnsafe)
2618{
2619 LARGE_STRING lstrTemp;
2620 PVOID pvBuffer = NULL;
2621
2622 _SEH2_TRY
2623 {
2624 /* Probe and copy the string */
2625 ProbeForRead(plstrUnsafe, sizeof(LARGE_STRING), sizeof(ULONG));
2626 lstrTemp = *plstrUnsafe;
2627 }
2629 {
2630 /* Fail */
2632 }
2633 _SEH2_END
2634
2635 if (lstrTemp.Length != 0)
2636 {
2637 /* Allocate a buffer from paged pool */
2638 pvBuffer = ExAllocatePoolWithTag(PagedPool, lstrTemp.Length, TAG_STRING);
2639 if (!pvBuffer)
2640 {
2641 return STATUS_NO_MEMORY;
2642 }
2643
2644 _SEH2_TRY
2645 {
2646 /* Probe and copy the buffer */
2647 ProbeForRead(lstrTemp.Buffer, lstrTemp.Length, sizeof(WCHAR));
2648 RtlCopyMemory(pvBuffer, lstrTemp.Buffer, lstrTemp.Length);
2649 }
2651 {
2652 /* Cleanup and fail */
2653 ExFreePoolWithTag(pvBuffer, TAG_STRING);
2655 }
2656 _SEH2_END
2657 }
2658
2659 /* Set the output string */
2660 plstrSafe->Buffer = pvBuffer;
2661 plstrSafe->Length = lstrTemp.Length;
2662 plstrSafe->MaximumLength = lstrTemp.Length;
2663
2664 return STATUS_SUCCESS;
2665}
2666
2670HWND
2671NTAPI
2673 DWORD dwExStyle,
2674 PLARGE_STRING plstrClassName,
2675 PLARGE_STRING plstrClsVersion,
2676 PLARGE_STRING plstrWindowName,
2677 DWORD dwStyle,
2678 int x,
2679 int y,
2680 int nWidth,
2681 int nHeight,
2683 HMENU hMenu,
2685 LPVOID lpParam,
2686 DWORD dwFlags,
2687 PVOID acbiBuffer)
2688{
2690 LARGE_STRING lstrWindowName;
2691 LARGE_STRING lstrClassName;
2692 LARGE_STRING lstrClsVersion;
2693 UNICODE_STRING ustrClassName;
2694 UNICODE_STRING ustrClsVersion;
2695 CREATESTRUCTW Cs;
2696 HWND hwnd = NULL;
2697 PWND pwnd;
2698
2699 lstrWindowName.Buffer = NULL;
2700 lstrClassName.Buffer = NULL;
2701 lstrClsVersion.Buffer = NULL;
2702
2703 if ( (dwStyle & (WS_POPUP|WS_CHILD)) != WS_CHILD)
2704 {
2705 /* check hMenu is valid handle */
2706 if (hMenu && !UserGetMenuObject(hMenu))
2707 {
2708 ERR("NtUserCreateWindowEx: Got an invalid menu handle!\n");
2710 return NULL;
2711 }
2712 }
2713
2714 /* Copy the window name to kernel mode */
2715 Status = ProbeAndCaptureLargeString(&lstrWindowName, plstrWindowName);
2716 if (!NT_SUCCESS(Status))
2717 {
2718 ERR("NtUserCreateWindowEx: failed to capture plstrWindowName\n");
2720 return NULL;
2721 }
2722
2723 plstrWindowName = &lstrWindowName;
2724
2725 /* Check if the class is an atom */
2726 if (IS_ATOM(plstrClassName))
2727 {
2728 /* It is, pass the atom in the UNICODE_STRING */
2729 ustrClassName.Buffer = (PVOID)plstrClassName;
2730 ustrClassName.Length = 0;
2731 ustrClassName.MaximumLength = 0;
2732 }
2733 else
2734 {
2735 /* It's not, capture the class name */
2736 Status = ProbeAndCaptureLargeString(&lstrClassName, plstrClassName);
2737 if (!NT_SUCCESS(Status))
2738 {
2739 ERR("NtUserCreateWindowEx: failed to capture plstrClassName\n");
2740 /* Set last error, cleanup and return */
2742 goto cleanup;
2743 }
2744
2745 /* We pass it on as a UNICODE_STRING */
2746 ustrClassName.Buffer = lstrClassName.Buffer;
2747 ustrClassName.Length = (USHORT)min(lstrClassName.Length, MAXUSHORT); // FIXME: LARGE_STRING truncated
2748 ustrClassName.MaximumLength = (USHORT)min(lstrClassName.MaximumLength, MAXUSHORT);
2749 }
2750
2751 /* Check if the class version is an atom */
2752 if (IS_ATOM(plstrClsVersion))
2753 {
2754 /* It is, pass the atom in the UNICODE_STRING */
2755 ustrClsVersion.Buffer = (PVOID)plstrClsVersion;
2756 ustrClsVersion.Length = 0;
2757 ustrClsVersion.MaximumLength = 0;
2758 }
2759 else
2760 {
2761 /* It's not, capture the class name */
2762 Status = ProbeAndCaptureLargeString(&lstrClsVersion, plstrClsVersion);
2763 if (!NT_SUCCESS(Status))
2764 {
2765 ERR("NtUserCreateWindowEx: failed to capture plstrClsVersion\n");
2766 /* Set last error, cleanup and return */
2768 goto cleanup;
2769 }
2770
2771 /* We pass it on as a UNICODE_STRING */
2772 ustrClsVersion.Buffer = lstrClsVersion.Buffer;
2773 ustrClsVersion.Length = (USHORT)min(lstrClsVersion.Length, MAXUSHORT); // FIXME: LARGE_STRING truncated
2774 ustrClsVersion.MaximumLength = (USHORT)min(lstrClsVersion.MaximumLength, MAXUSHORT);
2775 }
2776
2777 /* Fill the CREATESTRUCTW */
2778 /* we will keep here the original parameters */
2779 Cs.style = dwStyle;
2780 Cs.lpCreateParams = lpParam;
2781 Cs.hInstance = hInstance;
2782 Cs.hMenu = hMenu;
2784 Cs.cx = nWidth;
2785 Cs.cy = nHeight;
2786 Cs.x = x;
2787 Cs.y = y;
2788 Cs.lpszName = (LPCWSTR) plstrWindowName->Buffer;
2789 Cs.lpszClass = ustrClassName.Buffer;
2790 Cs.dwExStyle = dwExStyle;
2791
2793
2794 /* Call the internal function */
2795 pwnd = co_UserCreateWindowEx(&Cs, &ustrClsVersion, plstrWindowName, acbiBuffer, dwFlags);
2796
2797 if(!pwnd)
2798 {
2799 ERR("co_UserCreateWindowEx failed!\n");
2800 }
2801 hwnd = pwnd ? UserHMGetHandle(pwnd) : NULL;
2802
2803 UserLeave();
2804
2805cleanup:
2806 if (lstrWindowName.Buffer)
2807 {
2808 ExFreePoolWithTag(lstrWindowName.Buffer, TAG_STRING);
2809 }
2810 if (lstrClassName.Buffer)
2811 {
2812 ExFreePoolWithTag(lstrClassName.Buffer, TAG_STRING);
2813 }
2814 if (lstrClsVersion.Buffer)
2815 {
2816 ExFreePoolWithTag(lstrClsVersion.Buffer, TAG_STRING);
2817 }
2818
2819 return hwnd;
2820}
2821
2823{
2824 HWND* List;
2825 HWND* phWnd;
2826 PWND pWnd;
2828
2830 if (!List)
2831 return;
2832
2833 for (phWnd = List; *phWnd; ++phWnd)
2834 {
2835 pWnd = ValidateHwndNoErr(*phWnd);
2836 if (pWnd == NULL)
2837 continue;
2838 ASSERT(pWnd->spwndOwner == Window);
2839 ASSERT(pWnd != Window);
2840
2841 WndSetOwner(pWnd, NULL);
2843 {
2844 UserRefObjectCo(pWnd, &Ref); // Temp HACK?
2846 UserDerefObjectCo(pWnd); // Temp HACK?
2847 }
2848 else
2849 {
2850 ERR("IntWndBelongsToThread(0x%p) is FALSE, ignoring.\n", pWnd);
2851 }
2852 }
2853
2855}
2856
2858{
2859 HWND hWnd;
2860 PWND pwndTemp;
2861 PTHREADINFO ti;
2862 MSG msg;
2863 PWND Window = Object;
2864
2865 ASSERT_REFS_CO(Window); // FIXME: Temp HACK?
2866
2867 /* NtUserDestroyWindow does check if the window has already been destroyed
2868 but co_UserDestroyWindow can be called from more paths which means
2869 that it can also be called for a window that has already been destroyed. */
2871 {
2872 TRACE("Tried to destroy a window twice\n");
2873 return TRUE;
2874 }
2875
2878
2879 TRACE("co_UserDestroyWindow(Window = 0x%p, hWnd = 0x%p)\n", Window, hWnd);
2880
2881 /* Check for owner thread */
2882 if (Window->head.pti != ti)
2883 {
2884 /* Check if we are destroying the desktop window */
2885 if (! ((Window->head.rpdesk->dwDTFlags & DF_DESTROYED) && Window == Window->head.rpdesk->pDeskInfo->spwnd))
2886 {
2888 return FALSE;
2889 }
2890 }
2891
2892 /* If window was created successfully and it is hooked */
2893 if ((Window->state2 & WNDS2_WMCREATEMSGPROCESSED))
2894 {
2896 {
2897 ERR("Destroy Window WH_CBT Call Hook return!\n");
2898 return FALSE;
2899 }
2900 }
2901
2902 if (Window->pcls->atomClassName != gpsi->atomSysClass[ICLS_IME])
2903 {
2904 if ((Window->style & (WS_POPUP|WS_CHILD)) != WS_CHILD)
2905 {
2906 if (Window->spwndOwner)
2907 {
2908 //ERR("DestroyWindow Owner out.\n");
2909 UserAttachThreadInput(Window->head.pti, Window->spwndOwner->head.pti, FALSE);
2910 }
2911 }
2912 }
2913
2914 /* Inform the parent */
2915 if (Window->style & WS_CHILD)
2916 {
2918 }
2919
2920 if (!Window->spwndOwner && !IntGetParent(Window))
2921 {
2923 }
2924
2925 /* Hide the window */
2926 if (Window->style & WS_VISIBLE)
2927 {
2928 if (Window->style & WS_CHILD)
2929 {
2930 /* Only child windows receive WM_SHOWWINDOW in DestroyWindow() */
2932 }
2933 else
2934 {
2936 }
2937 }
2938
2939 /* Adjust last active */
2940 if ((pwndTemp = Window->spwndOwner))
2941 {
2942 while (pwndTemp->spwndOwner)
2943 pwndTemp = pwndTemp->spwndOwner;
2944
2945 if (pwndTemp->spwndLastActive == Window)
2946 WndSetLastActive(pwndTemp, Window->spwndOwner);
2947 }
2948
2949 if (Window->spwndParent && IntIsWindow(UserHMGetHandle(Window)))
2950 {
2951 if ((Window->style & (WS_POPUP | WS_CHILD)) == WS_CHILD)
2952 {
2954 {
2955 //ERR("DestroyWindow Parent out.\n");
2956 UserAttachThreadInput(Window->head.pti, Window->spwndParent->head.pti, FALSE);
2957 }
2958 }
2959 }
2960
2961 if (Window->head.pti->MessageQueue->spwndActive == Window)
2962 Window->head.pti->MessageQueue->spwndActive = NULL;
2963 if (Window->head.pti->MessageQueue->spwndFocus == Window)
2964 Window->head.pti->MessageQueue->spwndFocus = NULL;
2965 if (Window->head.pti->MessageQueue->spwndActivePrev == Window)
2966 Window->head.pti->MessageQueue->spwndActivePrev = NULL;
2967 if (Window->head.pti->MessageQueue->spwndCapture == Window)
2968 Window->head.pti->MessageQueue->spwndCapture = NULL;
2969
2970 /*
2971 * Check if this window is the Shell's Desktop Window. If so set hShellWindow to NULL
2972 */
2973
2974 if (ti->pDeskInfo != NULL)
2975 {
2976 if (ti->pDeskInfo->hShellWindow == hWnd)
2977 {
2978 ERR("Destroying the ShellWindow!\n");
2979 ti->pDeskInfo->hShellWindow = NULL;
2980 }
2981 }
2982
2984
2986 {
2987 return TRUE;
2988 }
2989
2990 /* Recursively destroy owned windows */
2991 if (!(Window->style & WS_CHILD))
2992 {
2994 }
2995
2996 /* Generate mouse move message for the next window */
2997 msg.message = WM_MOUSEMOVE;
2998 msg.wParam = UserGetMouseButtonsState();
2999 msg.lParam = MAKELPARAM(gpsi->ptCursor.x, gpsi->ptCursor.y);
3000 msg.pt = gpsi->ptCursor;
3002
3003 IntNotifyWinEvent(EVENT_OBJECT_DESTROY, Window, OBJID_WINDOW, CHILDID_SELF, 0);
3004
3005 /* Send destroy messages */
3007
3008 /* Destroy the default IME window if necessary */
3009 if (IS_IMM_MODE() && !(ti->TIF_flags & TIF_INCLEANUP) &&
3010 ti->spwndDefaultIme && (ti->spwndDefaultIme != Window) &&
3011 !(Window->state & WNDS_DESTROYED) && !IS_WND_IMELIKE(Window))
3012 {
3013 if (IS_WND_CHILD(Window))
3014 {
3017 }
3018 else
3019 {
3022 }
3023 }
3024
3026 {
3027 return TRUE;
3028 }
3029
3030 /* Destroy the window storage */
3032
3033 return TRUE;
3034}
3035
3036
3037/*
3038 * @implemented
3039 */
3042{
3043 PWND Window;
3044 BOOLEAN ret = FALSE;
3046
3047 TRACE("Enter NtUserDestroyWindow\n");
3049
3051 if (Window)
3052 {
3053 UserRefObjectCo(Window, &Ref); // FIXME: Dunno if win should be reffed during destroy...
3055 UserDerefObjectCo(Window); // FIXME: Dunno if win should be reffed during destroy...
3056 }
3057
3058 TRACE("Leave NtUserDestroyWindow, ret=%u\n", ret);
3059 UserLeave();
3060 return ret;
3061}
3062
3063
3066 PWND ChildAfter,
3067 RTL_ATOM ClassAtom,
3068 PUNICODE_STRING WindowName)
3069{
3070 BOOL CheckWindowName;
3071 HWND *List, *phWnd;
3072 HWND Ret = NULL;
3073 UNICODE_STRING CurrentWindowName;
3074
3075 ASSERT(Parent);
3076
3077 CheckWindowName = WindowName->Buffer != 0;
3078
3080 {
3081 phWnd = List;
3082 if(ChildAfter)
3083 {
3084 /* skip handles before and including ChildAfter */
3085 while(*phWnd && (*(phWnd++) != UserHMGetHandle(ChildAfter)))
3086 ;
3087 }
3088
3089 /* search children */
3090 while(*phWnd)
3091 {
3092 PWND Child;
3093 if(!(Child = UserGetWindowObject(*(phWnd++))))
3094 {
3095 continue;
3096 }
3097
3098 /* Do not send WM_GETTEXT messages in the kernel mode version!
3099 The user mode version however calls GetWindowText() which will
3100 send WM_GETTEXT messages to windows belonging to its processes */
3101 if (!ClassAtom || Child->pcls->atomNVClassName == ClassAtom)
3102 {
3103 // FIXME: LARGE_STRING truncated
3104 CurrentWindowName.Buffer = Child->strName.Buffer;
3105 CurrentWindowName.Length = (USHORT)min(Child->strName.Length, MAXUSHORT);
3106 CurrentWindowName.MaximumLength = (USHORT)min(Child->strName.MaximumLength, MAXUSHORT);
3107 if(!CheckWindowName ||
3108 (Child->strName.Length < 0xFFFF &&
3109 !RtlCompareUnicodeString(WindowName, &CurrentWindowName, TRUE)))
3110 {
3111 Ret = UserHMGetHandle(Child);
3112 break;
3113 }
3114 }
3115 }
3117 }
3118
3119 return Ret;
3120}
3121
3122/*
3123 * FUNCTION:
3124 * Searches a window's children for a window with the specified
3125 * class and name
3126 * ARGUMENTS:
3127 * hwndParent = The window whose childs are to be searched.
3128 * NULL = desktop
3129 * HWND_MESSAGE = message-only windows
3130 *
3131 * hwndChildAfter = Search starts after this child window.
3132 * NULL = start from beginning
3133 *
3134 * ucClassName = Class name to search for
3135 * Reguired parameter.
3136 *
3137 * ucWindowName = Window name
3138 * ->Buffer == NULL = don't care
3139 *
3140 * RETURNS:
3141 * The HWND of the window if it was found, otherwise NULL
3142 */
3143/*
3144 * @implemented
3145 */
3148 HWND hwndChildAfter,
3149 PUNICODE_STRING ucClassName,
3150 PUNICODE_STRING ucWindowName,
3151 DWORD dwUnknown)
3152{
3153 PWND Parent, ChildAfter;
3154 UNICODE_STRING ClassName = {0}, WindowName = {0};
3155 HWND Desktop, Ret = NULL;
3156 BOOL DoMessageWnd = FALSE;
3157 RTL_ATOM ClassAtom = (RTL_ATOM)0;
3158
3159 TRACE("Enter NtUserFindWindowEx\n");
3161
3162 if (ucClassName != NULL || ucWindowName != NULL)
3163 {
3164 _SEH2_TRY
3165 {
3166 if (ucClassName != NULL)
3167 {
3168 ClassName = ProbeForReadUnicodeString(ucClassName);
3169 if (ClassName.Length != 0)
3170 {
3171 ProbeForRead(ClassName.Buffer,
3172 ClassName.Length,
3173 sizeof(WCHAR));
3174 }
3175 else if (!IS_ATOM(ClassName.Buffer))
3176 {
3179 }
3180
3181 if (!IntGetAtomFromStringOrAtom(&ClassName,
3182 &ClassAtom))
3183 {
3186 }
3187 }
3188
3189 if (ucWindowName != NULL)
3190 {
3191 WindowName = ProbeForReadUnicodeString(ucWindowName);
3192 if (WindowName.Length != 0)
3193 {
3194 ProbeForRead(WindowName.Buffer,
3195 WindowName.Length,
3196 sizeof(WCHAR));
3197 }
3198 }
3199 }
3201 {
3203 _SEH2_YIELD(goto Exit); // Return NULL
3204 }
3205 _SEH2_END;
3206
3207 if (ucClassName != NULL)
3208 {
3209 if (ClassName.Length == 0 && ClassName.Buffer != NULL &&
3210 !IS_ATOM(ClassName.Buffer))
3211 {
3213 goto Exit; // Return NULL
3214 }
3215 else if (ClassAtom == (RTL_ATOM)0)
3216 {
3217 /* LastError code was set by IntGetAtomFromStringOrAtom */
3218 goto Exit; // Return NULL
3219 }
3220 }
3221 }
3222
3224
3225 if(hwndParent == NULL)
3226 {
3228 DoMessageWnd = TRUE;
3229 }
3230 else if(hwndParent == HWND_MESSAGE)
3231 {
3233 }
3234
3236 {
3237 goto Exit; // Return NULL
3238 }
3239
3240 ChildAfter = NULL;
3241 if(hwndChildAfter && !(ChildAfter = UserGetWindowObject(hwndChildAfter)))
3242 {
3243 goto Exit; // Return NULL
3244 }
3245
3246 _SEH2_TRY
3247 {
3249 {
3250 HWND *List, *phWnd;
3251 PWND TopLevelWindow;
3252 BOOLEAN CheckWindowName;
3253 BOOLEAN WindowMatches;
3254 BOOLEAN ClassMatches;
3255
3256 /* windows searches through all top-level windows if the parent is the desktop
3257 window */
3258
3260 {
3261 phWnd = List;
3262
3263 if(ChildAfter)
3264 {
3265 /* skip handles before and including ChildAfter */
3266 while(*phWnd && (*(phWnd++) != UserHMGetHandle(ChildAfter)))
3267 ;
3268 }
3269
3270 CheckWindowName = WindowName.Buffer != 0;
3271
3272 /* search children */
3273 while(*phWnd)
3274 {
3275 UNICODE_STRING ustr;
3276
3277 if(!(TopLevelWindow = UserGetWindowObject(*(phWnd++))))
3278 {
3279 continue;
3280 }
3281
3282 /* Do not send WM_GETTEXT messages in the kernel mode version!
3283 The user mode version however calls GetWindowText() which will
3284 send WM_GETTEXT messages to windows belonging to its processes */
3285 ustr.Buffer = TopLevelWindow->strName.Buffer;
3286 ustr.Length = (USHORT)min(TopLevelWindow->strName.Length, MAXUSHORT); // FIXME:LARGE_STRING truncated
3287 ustr.MaximumLength = (USHORT)min(TopLevelWindow->strName.MaximumLength, MAXUSHORT);
3288 WindowMatches = !CheckWindowName ||
3289 (TopLevelWindow->strName.Length < 0xFFFF &&
3290 !RtlCompareUnicodeString(&WindowName, &ustr, TRUE));
3291 ClassMatches = (ClassAtom == (RTL_ATOM)0) ||
3292 ClassAtom == TopLevelWindow->pcls->atomNVClassName;
3293
3294 if (WindowMatches && ClassMatches)
3295 {
3296 Ret = UserHMGetHandle(TopLevelWindow);
3297 break;
3298 }
3299
3300 if (IntFindWindow(TopLevelWindow, NULL, ClassAtom, &WindowName))
3301 {
3302 /* window returns the handle of the top-level window, in case it found
3303 the child window */
3304 Ret = UserHMGetHandle(TopLevelWindow);
3305 break;
3306 }
3307
3308 }
3310 }
3311 }
3312 else
3313 {
3314 TRACE("FindWindowEx: Not Desktop Parent!\n");
3315 Ret = IntFindWindow(Parent, ChildAfter, ClassAtom, &WindowName);
3316 }
3317
3318 if (Ret == NULL && DoMessageWnd)
3319 {
3320 PWND MsgWindows;
3321
3322 if((MsgWindows = UserGetWindowObject(IntGetMessageWindow())))
3323 {
3324 Ret = IntFindWindow(MsgWindows, ChildAfter, ClassAtom, &WindowName);
3325 }
3326 }
3327 }
3329 {
3331 Ret = NULL;
3332 }
3333 _SEH2_END;
3334
3335Exit:
3336 TRACE("Leave NtUserFindWindowEx, ret %p\n", Ret);
3337 UserLeave();
3338 return Ret;
3339}
3340
3341/* @implemented */
3344{
3345 PWND WndAncestor, Parent, pwndMessage;
3346 PDESKTOP pDesktop;
3347 PWND pwndDesktop;
3348
3349 pDesktop = pWnd->head.rpdesk;
3350 ASSERT(pDesktop);
3351 ASSERT(pDesktop->pDeskInfo);
3352
3353 pwndDesktop = pDesktop->pDeskInfo->spwnd;
3354 if (pWnd == pwndDesktop)
3355 return NULL;
3356
3357 pwndMessage = pDesktop->spwndMessage;
3358 if (pWnd == pwndMessage)
3359 return NULL;
3360
3361 Parent = pWnd->spwndParent;
3362 if (!Parent)
3363 return NULL;
3364
3365 switch (uType)
3366 {
3367 case GA_PARENT:
3368 return Parent;
3369
3370 case GA_ROOT:
3371 WndAncestor = pWnd;
3372 if (Parent == pwndDesktop)
3373 break;
3374
3375 do
3376 {
3377 if (Parent == pwndMessage)
3378 break;
3379
3380 WndAncestor = Parent;
3381
3382 pDesktop = Parent->head.rpdesk;
3383 ASSERT(pDesktop);
3384 ASSERT(pDesktop->pDeskInfo);
3385
3386 Parent = Parent->spwndParent;
3387 } while (Parent != pDesktop->pDeskInfo->spwnd);
3388 break;
3389
3390 case GA_ROOTOWNER:
3391 WndAncestor = pWnd;
3392 for (PWND pwndNode = IntGetParent(pWnd); pwndNode; pwndNode = IntGetParent(pwndNode))
3393 {
3394 WndAncestor = pwndNode;
3395 }
3396 break;
3397
3398 default:
3399 return NULL;
3400 }
3401
3402 return WndAncestor;
3403}
3404
3405/* @implemented */
3408{
3409 PWND Window, pwndAncestor;
3410 HWND hwndAncestor = NULL;
3411
3412 TRACE("Enter NtUserGetAncestor\n");
3414
3416 if (!Window)
3417 goto Quit;
3418
3419 if (!uType || uType > GA_ROOTOWNER)
3420 {
3422 goto Quit;
3423 }
3424
3425 pwndAncestor = UserGetAncestor(Window, uType);
3426 if (pwndAncestor)
3427 hwndAncestor = UserHMGetHandle(pwndAncestor);
3428
3429Quit:
3430 UserLeave();
3431 TRACE("Leave NtUserGetAncestor returning %p\n", hwndAncestor);
3432 return hwndAncestor;
3433}
3434
3438/* combo state struct */
3439typedef struct
3440{
3441 HWND self;
3442 HWND owner;
3443 UINT dwStyle;
3444 HWND hWndEdit;
3445 HWND hWndLBox;
3446 UINT wState;
3447 HFONT hFont;
3448 RECT textRect;
3449 RECT buttonRect;
3450 RECT droppedRect;
3451 INT droppedIndex;
3452 INT fixedOwnerDrawHeight;
3453 INT droppedWidth; /* last two are not used unless set */
3454 INT editHeight; /* explicitly */
3457
3458// Window Extra data container.
3459typedef struct _WND2CBOX
3460{
3464
3465#define CBF_BUTTONDOWN 0x0002
3469BOOL
3472 HWND hWnd,
3473 PCOMBOBOXINFO pcbi)
3474{
3475 PWND Wnd;
3476 PPROCESSINFO ppi;
3477 BOOL NotSameppi = FALSE;
3478 BOOL Ret = TRUE;
3479
3480 TRACE("Enter NtUserGetComboBoxInfo\n");
3482
3483 if (!(Wnd = UserGetWindowObject(hWnd)))
3484 {
3485 Ret = FALSE;
3486 goto Exit;
3487 }
3488 _SEH2_TRY
3489 {
3490 ProbeForWrite(pcbi, sizeof(COMBOBOXINFO), 1);
3491 }
3493 {
3495 Ret = FALSE;
3496 _SEH2_YIELD(goto Exit);
3497 }
3498 _SEH2_END;
3499
3500 if (pcbi->cbSize < sizeof(COMBOBOXINFO))
3501 {
3503 Ret = FALSE;
3504 goto Exit;
3505 }
3506
3507 // Pass the user pointer, it was already probed.
3509 {
3511 goto Exit;
3512 }
3513
3515 NotSameppi = ppi != Wnd->head.pti->ppi;
3516 if (NotSameppi)
3517 {
3518 KeAttachProcess(&Wnd->head.pti->ppi->peProcess->Pcb);
3519 }
3520
3521 _SEH2_TRY
3522 {
3523 LPHEADCOMBO lphc = ((PWND2CBOX)Wnd)->pCBox;
3524 pcbi->rcItem = lphc->textRect;
3525 pcbi->rcButton = lphc->buttonRect;
3526 pcbi->stateButton = 0;
3527 if (lphc->wState & CBF_BUTTONDOWN)
3529 if (RECTL_bIsEmptyRect(&lphc->buttonRect))
3531 pcbi->hwndCombo = lphc->self;
3532 pcbi->hwndItem = lphc->hWndEdit;
3533 pcbi->hwndList = lphc->hWndLBox;
3534 }
3536 {
3537 Ret = FALSE;
3539 }
3540 _SEH2_END;
3541
3542Exit:
3543 if (NotSameppi) KeDetachProcess();
3544 TRACE("Leave NtUserGetComboBoxInfo, ret=%i\n", Ret);
3545 UserLeave();
3546 return Ret;
3547}
3548
3552/* Listbox structure */
3553typedef struct
3554{
3555 HWND self; /* Our own window handle */
3556 HWND owner; /* Owner window to send notifications to */
3557 UINT style; /* Window style */
3558 INT width; /* Window width */
3559 INT height; /* Window height */
3560 VOID *items; /* Array of items */
3561 INT nb_items; /* Number of items */
3562 INT top_item; /* Top visible item */
3563 INT selected_item; /* Selected item */
3564 INT focus_item; /* Item that has the focus */
3565 INT anchor_item; /* Anchor item for extended selection */
3566 INT item_height; /* Default item height */
3567 INT page_size; /* Items per listbox page */
3568 INT column_width; /* Column width for multi-column listboxes */
3569} LB_DESCR;
3570
3571// Window Extra data container.
3572typedef struct _WND2LB
3573{
3580DWORD
3583 HWND hWnd)
3584{
3585 PWND Wnd;
3586 PPROCESSINFO ppi;
3587 BOOL NotSameppi = FALSE;
3588 DWORD Ret = 0;
3589
3590 TRACE("Enter NtUserGetListBoxInfo\n");
3592
3593 if (!(Wnd = UserGetWindowObject(hWnd)))
3594 {
3595 goto Exit; // Return 0
3596 }
3597
3598 if ((Wnd->pcls->atomClassName != gpsi->atomSysClass[ICLS_LISTBOX]) && Wnd->fnid != FNID_LISTBOX)
3599 {
3600 Ret = (DWORD)co_IntSendMessage(UserHMGetHandle(Wnd), LB_GETLISTBOXINFO, 0, 0);
3601 goto Exit;
3602 }
3603
3604 // wine lisbox:test_GetListBoxInfo lb_getlistboxinfo = 0, should not send a message!
3606 NotSameppi = ppi != Wnd->head.pti->ppi;
3607 if (NotSameppi)
3608 {
3609 KeAttachProcess(&Wnd->head.pti->ppi->peProcess->Pcb);
3610 }
3611
3612 _SEH2_TRY
3613 {
3614 LB_DESCR *descr = ((PWND2LB)Wnd)->pLBiv;
3615 // See Controls ListBox.c:LB_GETLISTBOXINFO must match...
3616 Ret = descr->page_size;
3617 }
3619 {
3620 Ret = 0;
3622 }
3623 _SEH2_END;
3624
3625Exit:
3626 if (NotSameppi) KeDetachProcess();
3627 TRACE("Leave NtUserGetListBoxInfo, ret=%lu\n", Ret);
3628 UserLeave();
3629 return Ret;
3630}
3631
3632/*
3633 * NtUserSetParent
3634 *
3635 * The NtUserSetParent function changes the parent window of the specified
3636 * child window.
3637 *
3638 * Remarks
3639 * The new parent window and the child window must belong to the same
3640 * application. If the window identified by the hWndChild parameter is
3641 * visible, the system performs the appropriate redrawing and repainting.
3642 * For compatibility reasons, NtUserSetParent does not modify the WS_CHILD
3643 * or WS_POPUP window styles of the window whose parent is being changed.
3644 *
3645 * Status
3646 * @implemented
3647 */
3648
3651{
3652 HWND Ret;
3653
3654 TRACE("Enter NtUserSetParent\n");
3656
3657 /*
3658 Check Parent first from user space, set it here.
3659 */
3660 if (!hWndNewParent)
3661 {
3662 hWndNewParent = IntGetDesktopWindow();
3663 }
3664 else if (hWndNewParent == HWND_MESSAGE)
3665 {
3666 hWndNewParent = IntGetMessageWindow();
3667 }
3668
3669 Ret = co_UserSetParent(hWndChild, hWndNewParent);
3670
3671 TRACE("Leave NtUserSetParent, ret=%p\n", Ret);
3672 UserLeave();
3673 return Ret;
3674}
3675
3676/*
3677 * UserGetShellWindow
3678 *
3679 * Returns a handle to shell window that was set by NtUserSetShellWindowEx.
3680 *
3681 * Status
3682 * @implemented
3683 */
3685{
3686 PWINSTATION_OBJECT WinStaObject;
3687 HWND Ret;
3688
3690 UserMode,
3691 0,
3692 &WinStaObject,
3693 0);
3694
3695 if (!NT_SUCCESS(Status))
3696 {
3698 return NULL;
3699 }
3700
3701 Ret = (HWND)WinStaObject->ShellWindow;
3702
3703 ObDereferenceObject(WinStaObject);
3704 return Ret;
3705}
3706
3707/*
3708 * NtUserSetShellWindowEx
3709 *
3710 * This is undocumented function to set global shell window. The global
3711 * shell window has special handling of window position.
3712 *
3713 * Status
3714 * @implemented
3715 */
3718{
3719 PWINSTATION_OBJECT WinStaObject;
3720 PWND WndShell, WndListView;
3721 BOOL Ret = FALSE;
3724 PTHREADINFO ti;
3725
3726 TRACE("Enter NtUserSetShellWindowEx\n");
3728
3729 if (!(WndShell = UserGetWindowObject(hwndShell)))
3730 {
3731 goto Exit; // Return FALSE
3732 }
3733
3734 if (!(WndListView = UserGetWindowObject(hwndListView)))
3735 {
3736 goto Exit; // Return FALSE
3737 }
3738
3740 UserMode,
3741 0,
3742 &WinStaObject,
3743 0);
3744
3745 if (!NT_SUCCESS(Status))
3746 {
3748 goto Exit; // Return FALSE
3749 }
3750
3751 /*
3752 * Test if we are permitted to change the shell window.
3753 */
3754 if (WinStaObject->ShellWindow)
3755 {
3756 ObDereferenceObject(WinStaObject);
3757 goto Exit; // Return FALSE
3758 }
3759
3760 /*
3761 * Move shell window into background.
3762 */
3763 if (hwndListView && hwndListView != hwndShell)
3764 {
3765 /*
3766 * Disabled for now to get Explorer working.
3767 * -- Filip, 01/nov/2003
3768 */
3769#if 0
3771#endif
3772
3773 if (WndListView->ExStyle & WS_EX_TOPMOST)
3774 {
3775 ObDereferenceObject(WinStaObject);
3776 goto Exit; // Return FALSE
3777 }
3778 }
3779
3780 if (WndShell->ExStyle & WS_EX_TOPMOST)
3781 {
3782 ObDereferenceObject(WinStaObject);
3783 goto Exit; // Return FALSE
3784 }
3785
3786 UserRefObjectCo(WndShell, &Ref);
3787 WndShell->state2 |= WNDS2_BOTTOMMOST;
3789
3790 WinStaObject->ShellWindow = hwndShell;
3791 WinStaObject->ShellListView = hwndListView;
3792
3793 ti = GetW32ThreadInfo();
3794 if (ti->pDeskInfo)
3795 {
3796 ti->pDeskInfo->hShellWindow = hwndShell;
3797 ti->pDeskInfo->spwndShell = WndShell;
3798 ti->pDeskInfo->spwndBkGnd = WndListView;
3799 ti->pDeskInfo->ppiShellProcess = ti->ppi;
3800 }
3801
3803
3804 UserDerefObjectCo(WndShell);
3805
3806 ObDereferenceObject(WinStaObject);
3807 Ret = TRUE;
3808
3809Exit:
3810 TRACE("Leave NtUserSetShellWindowEx, ret=%i\n", Ret);
3811 UserLeave();
3812 return Ret;
3813}
3814
3815// Fixes wine Win test_window_styles and todo tests...
3816static BOOL FASTCALL
3818{
3820 return TRUE;
3821 else if (!(ExStyle & WS_EX_STATICEDGE) && (Style & (WS_DLGFRAME | WS_THICKFRAME)))
3822 return TRUE;
3823 else
3824 return FALSE;
3825}
3826
3827static LONG_PTR
3829{
3831 PWINSTATION_OBJECT WindowStation;
3832 LONG_PTR OldValue;
3834
3836 {
3837 return 0;
3838 }
3839
3840 if ((INT)Index >= 0)
3841 {
3842 if ((Index + Size) > Window->cbwndExtra)
3843 {
3845 return 0;
3846 }
3847
3848 PVOID Address = (PUCHAR)(&Window[1]) + Index;
3849
3850#ifdef _WIN64
3851 if (Size == sizeof(LONG))
3852 {
3853 OldValue = ReadUnalignedU32(Address);
3854 WriteUnalignedU32(Address, NewValue);
3855 }
3856 else
3857#endif
3858 {
3859 OldValue = ReadUnalignedUlongPtr(Address);
3860 /*
3861 if ( Index == DWLP_DLGPROC && Wnd->state & WNDS_DIALOGWINDOW)
3862 {
3863 OldValue = (LONG_PTR)IntSetWindowProc( Wnd, (WNDPROC)NewValue, Ansi);
3864 if (!OldValue) return 0;
3865 }
3866 */
3868 }
3869
3870 }
3871 else
3872 {
3873#ifdef _WIN64
3874 if (Size == sizeof(LONG))
3875 {
3876 if ((Index != GWL_STYLE) &&
3877 (Index != GWL_EXSTYLE) &&
3878 (Index != GWL_ID) &&
3879 (Index != GWL_USERDATA))
3880 {
3881 ERR("NtUserSetWindowLong(): Index requires pointer size: %lu\n", Index);
3883 return 0;
3884 }
3885 }
3886#endif
3887
3888 switch (Index)
3889 {
3890 case GWL_EXSTYLE: // LONG
3891 OldValue = (LONG) Window->ExStyle;
3892 Style.styleOld = OldValue;
3893 Style.styleNew = NewValue;
3894
3895 co_IntSendMessage(hWnd, WM_STYLECHANGING, GWL_EXSTYLE, (LPARAM) &Style);
3896
3897 /*
3898 * Remove extended window style bit WS_EX_TOPMOST for shell windows.
3899 */
3900 WindowStation = Window->head.pti->rpdesk->rpwinstaParent;
3901 if(WindowStation)
3902 {
3903 if (hWnd == WindowStation->ShellWindow || hWnd == WindowStation->ShellListView)
3904 Style.styleNew &= ~WS_EX_TOPMOST;
3905 }
3906 /* WS_EX_WINDOWEDGE depends on some other styles */
3907 if (IntCheckFrameEdge(Window->style, NewValue))
3908 Style.styleNew |= WS_EX_WINDOWEDGE;
3909 else
3910 Style.styleNew &= ~WS_EX_WINDOWEDGE;
3911
3912 if (!(Window->ExStyle & WS_EX_LAYERED))
3913 {
3915 }
3916
3917 Window->ExStyle = (DWORD)Style.styleNew;
3918
3919 co_IntSendMessage(hWnd, WM_STYLECHANGED, GWL_EXSTYLE, (LPARAM) &Style);
3920 break;
3921
3922 case GWL_STYLE: // LONG
3923 OldValue = (LONG) Window->style;
3924 Style.styleOld = OldValue;
3925 Style.styleNew = NewValue;
3926
3927 if (!bAlter)
3928 co_IntSendMessage(hWnd, WM_STYLECHANGING, GWL_STYLE, (LPARAM) &Style);
3929
3930 /* WS_CLIPSIBLINGS can't be reset on top-level windows */
3931 if (UserIsDesktopWindow(Window->spwndParent)) Style.styleNew |= WS_CLIPSIBLINGS;
3932 /* WS_MINIMIZE can't be reset */
3933 if (OldValue & WS_MINIMIZE) Style.styleNew |= WS_MINIMIZE;
3934 /* Fixes wine FIXME: changing WS_DLGFRAME | WS_THICKFRAME is supposed to change WS_EX_WINDOWEDGE too */
3935 if (IntCheckFrameEdge(NewValue, Window->ExStyle))
3936 Window->ExStyle |= WS_EX_WINDOWEDGE;
3937 else
3938 Window->ExStyle &= ~WS_EX_WINDOWEDGE;
3939
3940 if ((OldValue & (WS_CHILD | WS_POPUP)) == WS_CHILD)
3941 {
3942 if ((NewValue & (WS_CHILD | WS_POPUP)) != WS_CHILD)
3943 {
3945 ERR("IDMenu going null! %d\n",Window->IDMenu);
3946 Window->IDMenu = 0; // Window->spmenu = 0;
3947 }
3948 }
3949 else
3950 {
3951 if ((NewValue & (WS_CHILD | WS_POPUP)) == WS_CHILD)
3952 {
3953 PMENU pMenu = UserGetMenuObject(UlongToHandle(Window->IDMenu));
3954 Window->state &= ~WNDS_HASMENU;
3955 if (pMenu)
3956 {
3957 ERR("IDMenu released 0x%p\n",pMenu);
3958 // ROS may not hold a lock after setting menu to window. But it should!
3959 //IntReleaseMenuObject(pMenu);
3960 }
3961 }
3962 }
3963
3964 if ((Style.styleOld ^ Style.styleNew) & WS_VISIBLE)
3965 {
3966 if (Style.styleOld & WS_VISIBLE) Window->head.pti->cVisWindows--;
3967 if (Style.styleNew & WS_VISIBLE) Window->head.pti->cVisWindows++;
3969 }
3970 Window->style = (DWORD)Style.styleNew;
3971
3972 if (!bAlter)
3973 co_IntSendMessage(hWnd, WM_STYLECHANGED, GWL_STYLE, (LPARAM) &Style);
3974 break;
3975
3976 case GWLP_WNDPROC: // LONG_PTR
3977 {
3978 if ( Window->head.pti->ppi != PsGetCurrentProcessWin32Process() ||
3979 Window->fnid & FNID_FREED)
3980 {
3982 return 0;
3983 }
3984 OldValue = (LONG_PTR)IntSetWindowProc(Window,
3985 (WNDPROC)NewValue,
3986 Ansi);
3987 break;
3988 }
3989
3990 case GWLP_HINSTANCE: // LONG_PTR
3991 OldValue = (LONG_PTR) Window->hModule;
3992 Window->hModule = (HINSTANCE) NewValue;
3993 break;
3994
3995 case GWLP_HWNDPARENT: // LONG_PTR
3996 Parent = Window->spwndParent;
3998 OldValue = (LONG_PTR)IntSetOwner(UserHMGetHandle(Window), (HWND)NewValue);
3999 else
4000 OldValue = (LONG_PTR)co_UserSetParent(UserHMGetHandle(Window), (HWND)NewValue);
4001 break;
4002
4003 case GWLP_ID: // LONG
4004 OldValue = (LONG) Window->IDMenu;
4005 Window->IDMenu = (UINT) NewValue;
4006 break;
4007
4008 case GWLP_USERDATA: // LONG or LONG_PTR
4009 OldValue = Window->dwUserData;
4010 Window->dwUserData = NewValue;
4011 break;
4012
4013 default:
4014 ERR("NtUserSetWindowLong(): Unsupported index %lu\n", Index);
4016 OldValue = 0;
4017 break;
4018 }
4019 }
4020
4021 return OldValue;
4022}
4023
4026{
4027 return (LONG)co_IntSetWindowLongPtr(hWnd, Index, NewValue, Ansi, sizeof(LONG), FALSE);
4028}
4029
4032{
4033 return co_IntSetWindowLongPtr(hWnd, Index, NewValue, Ansi, sizeof(LONG_PTR), FALSE);
4034}
4035
4036/*
4037 * NtUserSetWindowLong
4038 *
4039 * The NtUserSetWindowLong function changes an attribute of the specified
4040 * window. The function also sets the 32-bit (long) value at the specified
4041 * offset into the extra window memory.
4042 *
4043 * Status
4044 * @implemented
4045 */
4046
4049{
4050 LONG ret;
4051
4053
4054 if (hWnd == IntGetDesktopWindow())
4055 {
4057 UserLeave();
4058 return 0;
4059 }
4060
4061 ret = (LONG)co_IntSetWindowLongPtr(hWnd, Index, NewValue, Ansi, sizeof(LONG), FALSE);
4062
4063 UserLeave();
4064
4065 return ret;
4066}
4067
4068#ifdef _WIN64
4071{
4072 LONG_PTR ret;
4073
4075
4076 if (hWnd == IntGetDesktopWindow())
4077 {
4079 UserLeave();
4080 return 0;
4081 }
4082
4083 ret = co_IntSetWindowLongPtr(hWnd, Index, NewValue, Ansi, sizeof(LONG_PTR), FALSE);
4084
4085 UserLeave();
4086
4087 return ret;
4088}
4089#endif // _WIN64
4090
4093{
4094 LONG ret;
4095
4097
4098 if (hWnd == IntGetDesktopWindow())
4099 {
4101 UserLeave();
4102 return 0;
4103 }
4104
4105 ret = co_IntSetWindowLongPtr(hWnd, Index, NewValue, FALSE, sizeof(LONG), TRUE);
4106
4107 UserLeave();
4108
4109 return ret;
4110}
4111
4112
4113/*
4114 * NtUserSetWindowWord
4115 *
4116 * Legacy function similar to NtUserSetWindowLong.
4117 *
4118 * Status
4119 * @implemented
4120 */
4121
4124{
4125 PWND Window;
4126 WORD OldValue;
4127 WORD Ret = 0;
4128
4129 TRACE("Enter NtUserSetWindowWord\n");
4131
4132 if (hWnd == IntGetDesktopWindow())
4133 {
4135 goto Exit; // Return 0
4136 }
4137
4139 {
4140 goto Exit; // Return 0
4141 }
4142
4143 switch (Index)
4144 {
4145 case GWL_ID:
4146 case GWL_HINSTANCE:
4147 case GWL_HWNDPARENT:
4149 goto Exit;
4150
4151 default:
4152 if (Index < 0)
4153 {
4155 goto Exit; // Return 0
4156 }
4157 }
4158
4159 if ((ULONG)Index > (Window->cbwndExtra - sizeof(WORD)))
4160 {
4162 goto Exit; // Return 0
4163 }
4164
4165 OldValue = *((WORD *)((PCHAR)(Window + 1) + Index));
4166 *((WORD *)((PCHAR)(Window + 1) + Index)) = NewValue;
4167
4168 Ret = OldValue;
4169
4170Exit:
4171 TRACE("Leave NtUserSetWindowWord, ret=%u\n", Ret);
4172 UserLeave();
4173 return Ret;
4174}
4175
4176/*
4177 QueryWindow based on KJK::Hyperion and James Tabor.
4178
4179 0 = QWUniqueProcessId
4180 1 = QWUniqueThreadId
4181 2 = QWActiveWindow
4182 3 = QWFocusWindow
4183 4 = QWIsHung Implements IsHungAppWindow found
4184 by KJK::Hyperion.
4185
4186 9 = QWKillWindow When I called this with hWnd ==
4187 DesktopWindow, it shutdown the system
4188 and rebooted.
4189*/
4190/*
4191 * @implemented
4192 */
4195{
4196/* Console Leader Process CID Window offsets */
4197#define GWLP_CONSOLE_LEADER_PID 0
4198#define GWLP_CONSOLE_LEADER_TID 4
4199
4200 DWORD_PTR Result = 0;
4201 PWND pWnd, pwndActive;
4202 PTHREADINFO pti, ptiActive;
4203
4204 TRACE("Enter NtUserQueryWindow\n");
4206
4207 if (!(pWnd = UserGetWindowObject(hWnd)))
4208 {
4209 goto Exit; // Return 0
4210 }
4211
4212 switch(Index)
4213 {
4215 {
4216 if ( (pWnd->head.pti->TIF_flags & TIF_CSRSSTHREAD) &&
4218 {
4219 // IntGetWindowLong(offset == GWLP_CONSOLE_LEADER_PID)
4220 Result = (DWORD_PTR)(*((LONG_PTR*)((PCHAR)(pWnd + 1) + GWLP_CONSOLE_LEADER_PID)));
4221 }
4222 else
4223 {
4225 }
4226 break;
4227 }
4228
4230 {
4231 if ( (pWnd->head.pti->TIF_flags & TIF_CSRSSTHREAD) &&
4233 {
4234 // IntGetWindowLong(offset == GWLP_CONSOLE_LEADER_TID)
4235 Result = (DWORD_PTR)(*((LONG_PTR*)((PCHAR)(pWnd + 1) + GWLP_CONSOLE_LEADER_TID)));
4236 }
4237 else
4238 {
4240 }
4241 break;
4242 }
4243
4245 Result = (DWORD_PTR)(pWnd->head.pti->MessageQueue->spwndActive ? UserHMGetHandle(pWnd->head.pti->MessageQueue->spwndActive) : 0);
4246 break;
4247
4248 case QUERY_WINDOW_FOCUS:
4249 Result = (DWORD_PTR)(pWnd->head.pti->MessageQueue->spwndFocus ? UserHMGetHandle(pWnd->head.pti->MessageQueue->spwndFocus) : 0);
4250 break;
4251
4253 Result = (pWnd->fnid == FNID_GHOST) || MsqIsHung(pWnd->head.pti, MSQ_HUNG);
4254 break;
4255
4257 Result = (DWORD_PTR)pWnd->head.pti->pEThread->Cid.UniqueProcess;
4258 break;
4259
4261 Result = (pWnd->head.pti->MessageQueue == gpqForeground);
4262 break;
4263
4264 case QUERY_WINDOW_DEFAULT_IME: /* default IME window */
4265 if (pWnd->head.pti->spwndDefaultIme)
4266 Result = (DWORD_PTR)UserHMGetHandle(pWnd->head.pti->spwndDefaultIme);
4267 break;
4268
4269 case QUERY_WINDOW_DEFAULT_ICONTEXT: /* default input context handle */
4270 if (pWnd->head.pti->spDefaultImc)
4271 Result = (DWORD_PTR)UserHMGetHandle(pWnd->head.pti->spDefaultImc);
4272 break;
4273
4276 {
4277 pwndActive = gpqForeground->spwndActive;
4279 if (pti->rpdesk == pwndActive->head.rpdesk)
4280 {
4281 ptiActive = pwndActive->head.pti;
4282 if (ptiActive->spwndDefaultIme)
4284 }
4285 }
4286 break;
4287 }
4288
4289Exit:
4290 TRACE("Leave NtUserQueryWindow, ret=%u\n", Result);
4291 UserLeave();
4292 return Result;
4293}
4294
4295/*
4296 * @implemented
4297 */
4300{
4301 UNICODE_STRING SafeMessageName;
4303 UINT Ret = 0;
4304
4305 TRACE("Enter NtUserRegisterWindowMessage\n");
4307
4308 if(MessageNameUnsafe == NULL)
4309 {
4311 goto Exit; // Return 0
4312 }
4313
4314 Status = IntSafeCopyUnicodeStringTerminateNULL(&SafeMessageName, MessageNameUnsafe);
4315 if(!NT_SUCCESS(Status))
4316 {
4318 goto Exit; // Return 0
4319 }
4320
4321 Ret = (UINT)IntAddAtom(SafeMessageName.Buffer);
4322 if (SafeMessageName.Buffer)
4323 ExFreePoolWithTag(SafeMessageName.Buffer, TAG_STRING);
4324
4325Exit:
4326 TRACE("Leave NtUserRegisterWindowMessage, ret=%u\n", Ret);
4327 UserLeave();
4328 return Ret;
4329}
4330
4331/*
4332 * @implemented
4333 */
4336 WORD fnID)
4337{
4338 PWND Wnd;
4339 BOOL Ret = FALSE;
4340
4341 TRACE("Enter NtUserSetWindowFNID\n");
4343
4344 if (!(Wnd = UserGetWindowObject(hWnd)))
4345 {
4346 goto Exit; // Return FALSE
4347 }
4348
4349 if (Wnd->head.pti->ppi != PsGetCurrentProcessWin32Process())
4350 {
4352 goto Exit; // Return FALSE
4353 }
4354
4355 // From user land we only set these.
4356 if (fnID != FNID_DESTROY)
4357 {
4358 /* HACK: The minimum should be FNID_BUTTON, but menu code relies on this */
4359 if (fnID < FNID_FIRST || fnID > FNID_GHOST ||
4360 Wnd->fnid != 0)
4361 {
4363 goto Exit; // Return FALSE
4364 }
4365 }
4366
4367 Wnd->fnid |= fnID;
4368 Ret = TRUE;
4369
4370Exit:
4371 TRACE("Leave NtUserSetWindowFNID\n");
4372 UserLeave();
4373 return Ret;
4374}
4375
4377DefSetText(PWND Wnd, PCWSTR WindowText)
4378{
4380 BOOL Ret = FALSE;
4381
4382 RtlInitUnicodeString(&UnicodeString, WindowText);
4383
4384 if (UnicodeString.Length != 0)
4385 {
4386 if (Wnd->strName.MaximumLength > 0 &&
4388 {
4389 ASSERT(Wnd->strName.Buffer != NULL);
4390
4392 Wnd->strName.Buffer[UnicodeString.Length / sizeof(WCHAR)] = L'\0';
4396 }
4397 else
4398 {
4399 PWCHAR buf;
4400 Wnd->strName.MaximumLength = Wnd->strName.Length = 0;
4401 buf = Wnd->strName.Buffer;
4402 Wnd->strName.Buffer = NULL;
4403 if (buf != NULL)
4404 {
4406 }
4407
4410 if (Wnd->strName.Buffer != NULL)
4411 {
4412 Wnd->strName.Buffer[UnicodeString.Length / sizeof(WCHAR)] = L'\0';
4418 }
4419 else
4420 {
4422 goto Exit;
4423 }
4424 }
4425 }
4426 else
4427 {
4428 Wnd->strName.Length = 0;
4429 if (Wnd->strName.Buffer != NULL)
4430 Wnd->strName.Buffer[0] = L'\0';
4431 }
4432
4433 // FIXME: HAX! Windows does not do this in here!
4434 // In User32, these are called after: NotifyWinEvent EVENT_OBJECT_NAMECHANGE than
4435 // RepaintButton, StaticRepaint, NtUserCallHwndLock HWNDLOCK_ROUTINE_REDRAWFRAMEANDHOOK, etc.
4436 /* Send shell notifications */
4437 if (!Wnd->spwndOwner && !IntGetParent(Wnd))
4438 {
4439 co_IntShellHookNotify(HSHELL_REDRAW, (WPARAM) UserHMGetHandle(Wnd), FALSE); // FIXME Flashing?
4440 }
4441
4442 Ret = TRUE;
4443Exit:
4445 return Ret;
4446}
4447
4448/*
4449 * NtUserDefSetText
4450 *
4451 * Undocumented function that is called from DefWindowProc to set
4452 * window text.
4453 *
4454 * Status
4455 * @implemented
4456 */
4459{
4460 PWND Wnd;
4461 LARGE_STRING SafeText;
4463 BOOL Ret = TRUE;
4464
4465 TRACE("Enter NtUserDefSetText\n");
4466
4467 if (WindowText != NULL)
4468 {
4469 _SEH2_TRY
4470 {
4471 SafeText = ProbeForReadLargeString(WindowText);
4472 }
4474 {
4475 Ret = FALSE;
4477 }
4478 _SEH2_END;
4479
4480 if (!Ret)
4481 return FALSE;
4482 }
4483 else
4484 return TRUE;
4485
4487
4488 if(!(Wnd = UserGetWindowObject(hWnd)))
4489 {
4490 UserLeave();
4491 return FALSE;
4492 }
4493
4494 // ReactOS uses Unicode and not mixed. Up/Down converting will take time.
4495 // Brought to you by: The Wine Project! Dysfunctional Thought Processes!
4496 // Now we know what the bAnsi is for.
4498 if (SafeText.Buffer)
4499 {
4500 _SEH2_TRY
4501 {
4502 if (SafeText.bAnsi)
4503 ProbeForRead(SafeText.Buffer, SafeText.Length, sizeof(CHAR));
4504 else
4505 ProbeForRead(SafeText.Buffer, SafeText.Length, sizeof(WCHAR));
4507 }
4509 {
4510 Ret = FALSE;
4512 }
4513 _SEH2_END;
4514 if (!Ret) goto Exit;
4515 }
4516
4517 if (UnicodeString.Length != 0)
4518 {
4519 if (Wnd->strName.MaximumLength > 0 &&
4521 {
4522 ASSERT(Wnd->strName.Buffer != NULL);
4523
4525 Wnd->strName.Buffer[UnicodeString.Length / sizeof(WCHAR)] = L'\0';
4529 }
4530 else
4531 {
4532 PWCHAR buf;
4533 Wnd->strName.MaximumLength = Wnd->strName.Length = 0;
4534 buf = Wnd->strName.Buffer;
4535 Wnd->strName.Buffer = NULL;
4536 if (buf != NULL)
4537 {
4539 }
4540
4543 if (Wnd->strName.Buffer != NULL)
4544 {
4545 Wnd->strName.Buffer[UnicodeString.Length / sizeof(WCHAR)] = L'\0';
4551 }
4552 else
4553 {
4555 Ret = FALSE;
4556 goto Exit;
4557 }
4558 }
4559 }
4560 else
4561 {
4562 Wnd->strName.Length = 0;
4563 if (Wnd->strName.Buffer != NULL)
4564 Wnd->strName.Buffer[0] = L'\0';
4565 }
4566
4567 // FIXME: HAX! Windows does not do this in here!
4568 // In User32, these are called after: NotifyWinEvent EVENT_OBJECT_NAMECHANGE than
4569 // RepaintButton, StaticRepaint, NtUserCallHwndLock HWNDLOCK_ROUTINE_REDRAWFRAMEANDHOOK, etc.
4570 /* Send shell notifications */
4571 if (!Wnd->spwndOwner && !IntGetParent(Wnd))
4572 {
4573 co_IntShellHookNotify(HSHELL_REDRAW, (WPARAM) hWnd, FALSE); // FIXME Flashing?
4574 }
4575
4576 Ret = TRUE;
4577Exit:
4579 TRACE("Leave NtUserDefSetText, ret=%i\n", Ret);
4580 UserLeave();
4581 return Ret;
4582}
4583
4584/*
4585 * NtUserInternalGetWindowText
4586 *
4587 * Status
4588 * @implemented
4589 */
4590
4593{
4594 PWND Wnd;
4596 INT Result = 0;
4597
4598 TRACE("Enter NtUserInternalGetWindowText\n");
4600
4601 if(lpString && (nMaxCount <= 1))
4602 {
4604 goto Exit; // Return 0
4605 }
4606
4607 if(!(Wnd = UserGetWindowObject(hWnd)))
4608 {
4609 goto Exit; // Return 0
4610 }
4611
4612 Result = Wnd->strName.Length / sizeof(WCHAR);
4613 if(lpString)
4614 {
4615 const WCHAR Terminator = L'\0';
4616 INT Copy;
4617 WCHAR *Buffer = (WCHAR*)lpString;
4618
4619 Copy = min(nMaxCount - 1, Result);
4620 if(Copy > 0)
4621 {
4622 Status = MmCopyToCaller(Buffer, Wnd->strName.Buffer, Copy * sizeof(WCHAR));
4623 if(!NT_SUCCESS(Status))
4624 {
4626 Result = 0;
4627 goto Exit;
4628 }
4629 Buffer += Copy;
4630 }
4631
4632 Status = MmCopyToCaller(Buffer, &Terminator, sizeof(WCHAR));
4633 if(!NT_SUCCESS(Status))
4634 {
4636 Result = 0;
4637 goto Exit;
4638 }
4639
4640 Result = Copy;
4641 }
4642
4643Exit:
4644 TRACE("Leave NtUserInternalGetWindowText, ret=%i\n", Result);
4645 UserLeave();
4646 return Result;
4647}
4648
4649/*
4650 API Call
4651*/
4652BOOL
4655{
4656 int count = 0;
4657 PWND pWnd;
4658 HWND *win_array;
4659
4660// ASSERT(OwnerWnd);
4661
4662 TRACE("Enter ShowOwnedPopups Show: %s\n", (fShow ? "TRUE" : "FALSE"));
4663
4664 /* NOTE: Popups are not children */
4665 win_array = IntWinListOwnedPopups(OwnerWnd);
4666
4667 if (!win_array)
4668 return TRUE;
4669
4670 while (win_array[count])
4671 count++;
4672 while (--count >= 0)
4673 {
4674 if (!(pWnd = ValidateHwndNoErr( win_array[count] )))
4675 continue;
4676 ASSERT(pWnd->spwndOwner == OwnerWnd);
4677
4678 if (fShow)
4679 {
4680 if (pWnd->state & WNDS_HIDDENPOPUP)
4681 {
4682 /* In Windows, ShowOwnedPopups(TRUE) generates
4683 * WM_SHOWWINDOW messages with SW_PARENTOPENING,
4684 * regardless of the state of the owner
4685 */
4687 pWnd->state &= ~WNDS_HIDDENPOPUP;
4688 continue;
4689 }
4690 }
4691 else
4692 {
4693 if (pWnd->style & WS_VISIBLE)
4694 {
4695 /* In Windows, ShowOwnedPopups(FALSE) generates
4696 * WM_SHOWWINDOW messages with SW_PARENTCLOSING,
4697 * regardless of the state of the owner
4698 */
4700 pWnd->state |= WNDS_HIDDENPOPUP;
4701 continue;
4702 }
4703 }
4704 }
4706 TRACE("Leave ShowOwnedPopups\n");
4707 return TRUE;
4708}
4709
4710/* EOF */
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
unsigned char BOOLEAN
Definition: actypes.h:127
Arabic default style
Definition: afstyles.h:94
const DWORD Style
Definition: appswitch.c:72
const DWORD ExStyle
Definition: appswitch.c:73
#define msg(x)
Definition: auth_time.c:54
HWND hWnd
Definition: settings.c:17
LONG NTSTATUS
Definition: precomp.h:26
HFONT hFont
Definition: main.c:53
@ Update
Definition: registry.c:565
#define ERR(fmt,...)
Definition: precomp.h:57
BOOL Error
Definition: chkdsk.c:66
#define UlongToHandle(ul)
Definition: basetsd.h:91
#define HandleToUlong(h)
Definition: basetsd.h:73
#define DBG_DEFAULT_CHANNEL(ch)
Definition: debug.h:106
PCALLPROCDATA CreateCallProc(IN PDESKTOP Desktop, IN WNDPROC WndProc, IN BOOL Unicode, IN PPROCESSINFO pi)
Definition: callproc.c:29
ULONG_PTR FASTCALL UserGetCPD(PVOID pvClsWnd, GETCPD Flags, ULONG_PTR ProcIn)
Definition: callproc.c:107
HINSTANCE hInstance
Definition: charmap.c:19
Definition: bufpool.h:45
static __inline BOOL IsCallProcHandle(IN WNDPROC lpWndProc)
Definition: class.h:13
#define IS_ATOM(x)
Definition: class.h:3
WPARAM wParam
Definition: combotst.c:138
static HWND hwndParent
Definition: cryptui.c:299
#define STATUS_INVALID_HANDLE
Definition: d3dkmdt.h:40
#define STATUS_NO_MEMORY
Definition: d3dkmdt.h:51
VOID FASTCALL DceResetActiveDCEs(PWND Window)
Definition: windc.c:816
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
void FASTCALL DceFreeWindowDCE(PWND)
Definition: windc.c:686
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
static CHAR Desktop[MAX_PATH]
Definition: dem.c:256
#define ERROR_SUCCESS
Definition: deptool.c:10
#define DF_DESTROYED
Definition: desktop.h:50
static __inline PVOID DesktopHeapAlloc(IN PDESKTOP Desktop, IN SIZE_T Bytes)
Definition: desktop.h:204
#define UserIsMessageWindow(pWnd)
Definition: desktop.h:197
static __inline BOOL DesktopHeapFree(IN PDESKTOP Desktop, IN PVOID lpMem)
Definition: desktop.h:215
#define UserIsDesktopWindow(pWnd)
Definition: desktop.h:194
static __inline PVOID DesktopHeapAddressToUser(PVOID lpMem)
Definition: desktop.h:308
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#define APIENTRY
Definition: api.h:79
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
HANDLE HWND
Definition: compat.h:19
#define ERROR_ACCESS_DENIED
Definition: compat.h:97
static void cleanup(void)
Definition: main.c:1335
#define IS_INTRESOURCE(x)
Definition: loader.c:613
_ACRTIMP int __cdecl _wcsicmp(const wchar_t *, const wchar_t *)
Definition: wcs.c:164
VOID Copy(PVOID Src, PVOID Dst, ULONG NumBytes)
Definition: mmixer.c:126
#define pt(x, y)
Definition: drawing.c:79
return ret
Definition: mutex.c:146
#define L(x)
Definition: resources.c:13
#define ULONG_PTR
Definition: config.h:101
HWND hWndChild[NUM_TABS]
Definition: main.h:74
VOID FASTCALL IntEngWindowChanged(_In_ struct _WND *Window, _In_ FLONG flChanged)
#define RemoveEntryList(Entry)
Definition: env_spec_w32.h:986
#define InsertTailList(ListHead, Entry)
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define IsListEmpty(ListHead)
Definition: env_spec_w32.h:954
ULONG RtlCompareUnicodeString(PUNICODE_STRING s1, PUNICODE_STRING s2, BOOLEAN UpCase)
Definition: string_lib.cpp:31
#define NonPagedPool
Definition: env_spec_w32.h:307
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
#define PagedPool
Definition: env_spec_w32.h:308
HWND hwndListView
Definition: eventvwr.c:66
VOID NTAPI ProbeForRead(IN CONST VOID *Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:102
VOID NTAPI ProbeForWrite(IN PVOID Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:143
DWORD dwThreadId
Definition: fdebug.c:31
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
HWND FASTCALL IntGetThreadFocusWindow(VOID)
Definition: focus.c:43
HWND FASTCALL co_UserSetFocus(PWND Window)
Definition: focus.c:1311
PUSER_MESSAGE_QUEUE gpqForeground
Definition: focus.c:13
BOOL FASTCALL IntReleaseCapture(VOID)
Definition: focus.c:1525
HWND FASTCALL UserGetActiveWindow(VOID)
Definition: focus.c:1426
Status
Definition: gdiplustypes.h:24
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
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
VOID FASTCALL co_IntUserManualGuiCheck(BOOL Create)
Definition: guicheck.c:77
unsigned int UINT
Definition: sysinfo.c:13
#define ISITHOOKED(HookId)
Definition: hook.h:6
#define HOOKID_TO_FLAG(HookId)
Definition: hook.h:5
PSERVERINFO gpsi
Definition: imm.c:18
#define IMS_LOADTHREADLAYOUT
Definition: imm32_undoc.h:68
#define IMS_ACTIVATELAYOUT
Definition: imm32_undoc.h:60
#define WM_IME_SYSTEM
Definition: imm32_undoc.h:32
#define MOD_CONTROL
Definition: imm.h:185
#define WNDS2_WIN31COMPAT
Definition: ntuser.h:649
#define ICLS_IME
Definition: ntuser.h:927
#define QUERY_WINDOW_DEFAULT_ICONTEXT
Definition: ntuser.h:2855
#define ICLS_DIALOG
Definition: ntuser.h:930
#define QUERY_WINDOW_UNIQUE_THREAD_ID
Definition: ntuser.h:2848
#define QUERY_WINDOW_ACTIVE_IME
Definition: ntuser.h:2856
#define ICLS_LISTBOX
Definition: ntuser.h:915
#define WNDS2_WIN40COMPAT
Definition: ntuser.h:650
#define ICLS_EDIT
Definition: ntuser.h:913
#define TIF_CSRSSTHREAD
Definition: ntuser.h:266
#define TIF_INCLEANUP
Definition: ntuser.h:263
#define CURSORF_LRSHARED
Definition: ntuser.h:1201
#define FNID_SWITCH
Definition: ntuser.h:865
#define ICLS_COMBOBOX
Definition: ntuser.h:917
#define QUERY_WINDOW_FOCUS
Definition: ntuser.h:2850
#define ICLS_STATIC
Definition: ntuser.h:914
#define WS_EX2_LINKED
Definition: ntuser.h:676
#define GETPFNCLIENTW(fnid)
Definition: ntuser.h:906
#define GETPFNCLIENTA(fnid)
Definition: ntuser.h:904
#define FNID_DESTROY
Definition: ntuser.h:898
#define CSF_ANSIPROC
Definition: ntuser.h:557
#define FNID_DESKTOP
Definition: ntuser.h:862
#define QUERY_WINDOW_ACTIVE
Definition: ntuser.h:2849
#define FNID_LISTBOX
Definition: ntuser.h:871
#define WNDS_DESTROYED
Definition: ntuser.h:636
#define FNID_FIRST
Definition: ntuser.h:858
#define WNDS_SERVERSIDEWINDOWPROC
Definition: ntuser.h:623
#define WNDS2_BOTTOMMOST
Definition: ntuser.h:646
#define WNDS_SENDNCPAINT
Definition: ntuser.h:616
#define UserHMGetHandle(obj)
Definition: ntuser.h:230
#define WNDS_INTERNALPAINT
Definition: ntuser.h:617
BOOL NTAPI RtlLargeStringToUnicodeString(PUNICODE_STRING, PLARGE_STRING)
Definition: rtlstr.c:67
#define FNID_BUTTON
Definition: ntuser.h:866
@ UserGetCPDU2A
Definition: ntuser.h:541
@ UserGetCPDWindow
Definition: ntuser.h:543
@ UserGetCPDA2U
Definition: ntuser.h:540
#define FNID_COMBOBOX
Definition: ntuser.h:867
#define QUERY_WINDOW_REAL_ID
Definition: ntuser.h:2852
#define CSF_CACHEDSMICON
Definition: ntuser.h:562
#define NtUserSetWindowLongPtr
Definition: ntuser.h:3310
struct _THREADINFO * GetW32ThreadInfo(VOID)
Definition: misc.c:806
struct _WND * PWND
#define FNID_DIALOG
Definition: ntuser.h:869
#define ICLS_COMBOLBOX
Definition: ntuser.h:919
#define GETPFNSERVER(fnid)
Definition: ntuser.h:909
#define CI_IMMACTIVATE
Definition: ntuser.h:306
#define WNDS2_WMCREATEMSGPROCESSED
Definition: ntuser.h:670
#define IS_IMM_MODE()
Definition: ntuser.h:1212
#define FNID_EDIT
Definition: ntuser.h:870
#define ICLS_BUTTON
Definition: ntuser.h:912
struct _WND WND
@ TYPE_CALLPROC
Definition: ntuser.h:47
@ TYPE_WINDOW
Definition: ntuser.h:41
#define ICLS_DESKTOP
Definition: ntuser.h:929
#define QUERY_WINDOW_FOREGROUND
Definition: ntuser.h:2853
#define CURSORF_FROMRESOURCE
Definition: ntuser.h:1199
#define CSF_SERVERSIDEPROC
Definition: ntuser.h:556
#define WNDS_HIDDENPOPUP
Definition: ntuser.h:619
#define WNDS_ANSICREATOR
Definition: ntuser.h:634
#define FNID_GHOST
Definition: ntuser.h:875
#define WEF_SETBYWNDPTI
Definition: ntuser.h:236
#define WNDS2_INDESTROY
Definition: ntuser.h:648
#define ICLS_MDICLIENT
Definition: ntuser.h:918
#define GetWin32ClientInfo()
Definition: ntuser.h:352
#define QUERY_WINDOW_UNIQUE_PROCESS_ID
Definition: ntuser.h:2847
#define QUERY_WINDOW_ISHUNG
Definition: ntuser.h:2851
#define QUERY_WINDOW_DEFAULT_IME
Definition: ntuser.h:2854
#define WNDS2_WIN50COMPAT
Definition: ntuser.h:651
#define WNDS_SENDSIZEMOVEMSGS
Definition: ntuser.h:609
#define FNID_FREED
Definition: ntuser.h:900
#define HRGN_WINDOW
Definition: ntuser.h:361
#define WNDS_SENDERASEBACKGROUND
Definition: ntuser.h:614
#define WNDS_ANSIWINDOWPROC
Definition: ntuser.h:624
CLIENT_DATA ClientInfo
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:90
BOOL FASTCALL SetLayeredStatus(PWND pWnd, BYTE set)
Definition: layered.c:34
if(dx< 0)
Definition: linetemp.h:194
LONG_PTR LPARAM
Definition: minwindef.h:175
LONG_PTR LRESULT
Definition: minwindef.h:176
UINT_PTR WPARAM
Definition: minwindef.h:174
#define PCHAR
Definition: match.c:90
#define MmCopyToCaller(x, y, z)
Definition: mmcopy.h:19
#define ASSERT(a)
Definition: mode.c:44
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
static HICON
Definition: imagelist.c:80
static DWORD page_size
Definition: loader.c:54
unsigned short RTL_ATOM
Definition: atom.c:42
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
#define min(a, b)
Definition: monoChain.cc:55
UINT_PTR HKL
Definition: msctf.idl:125
VOID APIENTRY MsqRemoveWindowMessagesFromQueue(PWND Window)
Definition: msgqueue.c:798
VOID FASTCALL MsqDecPaintCountQueue(PTHREADINFO pti)
Definition: msgqueue.c:508
VOID FASTCALL co_MsqInsertMouseMessage(MSG *Msg, DWORD flags, ULONG_PTR dwExtraInfo, BOOL Hook)
Definition: msgqueue.c:580
BOOL FASTCALL MsqIsHung(PTHREADINFO pti, DWORD TimeOut)
Definition: msgqueue.c:2149
@ WM_ASYNC_DESTROYWINDOW
Definition: msgqueue.h:120
#define MSQ_HUNG
Definition: msgqueue.h:3
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
#define KernelMode
Definition: asm.h:38
#define UserMode
Definition: asm.h:39
_Out_writes_bytes_to_opt_ AbsoluteSecurityDescriptorSize PSECURITY_DESCRIPTOR _Inout_ PULONG _Out_writes_bytes_to_opt_ DaclSize PACL _Inout_ PULONG _Out_writes_bytes_to_opt_ SaclSize PACL _Inout_ PULONG _Out_writes_bytes_to_opt_ OwnerSize PSID Owner
Definition: rtlfuncs.h:1629
_In_ LPWSTR _In_ DWORD _In_ DWORD _In_ DWORD dwFlags
Definition: netsh.h:141
#define _In_
Definition: no_sal2.h:158
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define FASTCALL
Definition: nt_native.h:50
#define BOOL
Definition: nt_native.h:43
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
#define DWORD
Definition: nt_native.h:44
#define UNICODE_NULL
#define GDI_OBJ_HMGR_POWNED
Definition: ntgdihdl.h:117
PVOID NTAPI PsGetCurrentProcessWin32Process(VOID)
Definition: process.c:1183
NTSTATUS NTAPI PsLookupThreadByThreadId(IN HANDLE ThreadId, OUT PETHREAD *Thread)
Definition: thread.c:643
PVOID NTAPI PsGetCurrentThreadWin32Thread(VOID)
Definition: thread.c:805
PVOID *typedef PHANDLE
Definition: ntsecpkg.h:455
LRESULT APIENTRY co_HOOK_CallHooks(INT HookId, INT Code, WPARAM wParam, LPARAM lParam)
Definition: hook.c:1102
BOOL FASTCALL IntImeCanDestroyDefIMEforChild(_In_ PWND pImeWnd, _In_ PWND pwndTarget)
Definition: ime.c:2130
PWND FASTCALL co_IntCreateDefaultImeWindow(_In_ PWND pwndTarget, _In_ HINSTANCE hInst)
Definition: ime.c:2064
BOOL FASTCALL IntImeCanDestroyDefIME(_In_ PWND pImeWnd, _In_ PWND pwndTarget)
Definition: ime.c:2177
BOOL FASTCALL IntWantImeWindow(_In_ PWND pwndTarget)
Definition: ime.c:2024
UINT FASTCALL co_WinPosMinMaximize(PWND Wnd, UINT ShowFlag, RECT *NewPos)
Definition: winpos.c:2437
VOID FASTCALL co_WinPosActivateOtherWindow(PWND Wnd)
Definition: winpos.c:397
BOOLEAN FASTCALL co_WinPosSetWindowPos(PWND Window, HWND WndInsertAfter, INT x, INT y, INT cx, INT cy, UINT flags)
Definition: winpos.c:1792
LRESULT FASTCALL co_WinPosGetNonClientSize(PWND Window, RECT *WindowRect, RECT *ClientRect)
Definition: winpos.c:2388
UINT FASTCALL co_WinPosGetMinMaxInfo(PWND Window, POINT *MaxSize, POINT *MaxPos, POINT *MinTrack, POINT *MaxTrack)
Definition: winpos.c:940
BOOL FASTCALL IntScreenToClient(PWND Wnd, LPPOINT lpPoint)
Definition: winpos.c:213
void FASTCALL co_WinPosSendSizeMove(PWND Wnd)
Definition: winpos.c:2403
BOOLEAN FASTCALL co_WinPosShowWindow(PWND Wnd, INT Cmd)
Definition: winpos.c:2622
NTSTATUS FASTCALL IntValidateWindowStationHandle(HWINSTA WindowStation, KPROCESSOR_MODE AccessMode, ACCESS_MASK DesiredAccess, PWINSTATION_OBJECT *Object, POBJECT_HANDLE_INFORMATION pObjectHandleInfo)
Definition: winsta.c:225
VOID FASTCALL UserLeave(VOID)
Definition: ntuser.c:255
VOID FASTCALL UserEnterShared(VOID)
Definition: ntuser.c:241
VOID FASTCALL UserEnterExclusive(VOID)
Definition: ntuser.c:247
ATOM gaGuiConsoleWndClass
Definition: ntuser.c:27
BOOL FASTCALL UserIsEnteredExclusive(VOID)
Definition: ntuser.c:231
static __inline VOID UserDerefObjectCo(PVOID obj)
Definition: object.h:43
static __inline VOID UserRefObjectCo(PVOID obj, PUSER_REFERENCE_ENTRY UserReferenceEntry)
Definition: object.h:27
NTSTATUS NTAPI ObReferenceObjectByPointer(IN PVOID Object, IN ACCESS_MASK DesiredAccess, IN POBJECT_TYPE ObjectType, IN KPROCESSOR_MODE AccessMode)
Definition: obref.c:380
#define TAG_STRING
Definition: oslist.h:22
#define LOWORD(l)
Definition: pedump.c:82
#define WS_CHILD
Definition: pedump.c:617
#define WS_CAPTION
Definition: pedump.c:624
#define WS_EX_NOPARENTNOTIFY
Definition: pedump.c:646
#define WS_EX_DLGMODALFRAME
Definition: pedump.c:645
#define WS_MAXIMIZE
Definition: pedump.c:623
short WCHAR
Definition: pedump.c:58
#define WS_POPUP
Definition: pedump.c:616
#define WS_VSCROLL
Definition: pedump.c:627
#define WS_MINIMIZE
Definition: pedump.c:622
#define WS_VISIBLE
Definition: pedump.c:620
#define WS_EX_TOPMOST
Definition: pedump.c:647
long LONG
Definition: pedump.c:60
#define WS_DISABLED
Definition: pedump.c:621
#define WS_DLGFRAME
Definition: pedump.c:626
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
unsigned short USHORT
Definition: pedump.c:61
#define WS_HSCROLL
Definition: pedump.c:628
#define WS_CLIPCHILDREN
Definition: pedump.c:619
char CHAR
Definition: pedump.c:57
#define WS_THICKFRAME
Definition: pedump.c:630
static WCHAR Address[46]
Definition: ping.c:68
VOID NTAPI KeDetachProcess(VOID)
Definition: procobj.c:621
VOID NTAPI KeAttachProcess(IN PKPROCESS Process)
Definition: procobj.c:582
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:204
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:104
#define _SEH2_END
Definition: pseh2_64.h:194
#define _SEH2_TRY
Definition: pseh2_64.h:93
#define _SEH2_YIELD(__stmt)
Definition: pseh2_64.h:207
#define _SEH2_LEAVE
Definition: pseh2_64.h:206
DWORD FASTCALL co_UserShowScrollBar(PWND, int, BOOL, BOOL)
Definition: scrollbar.c:863
BOOL FASTCALL IntDestroyScrollBars(PWND)
Definition: scrollbar.c:810
#define ProbeForReadUnicodeString(Ptr)
Definition: probe.h:77
const char * descr
Definition: boot.c:45
#define STATUS_SUCCESS
Definition: shellext.h:65
static void Exit(void)
Definition: sock.c:1330
#define TRACE(s)
Definition: solgame.cpp:4
struct tagBaseWindow BaseWindow
RECT buttonRect
Definition: comctl32.h:158
RECT textRect
Definition: comctl32.h:157
LONG UIState
Definition: window.c:3455
UINT wState
Definition: comctl32.h:155
HWND hWndLBox
Definition: comctl32.h:154
HWND hWndEdit
Definition: comctl32.h:153
HWND self
Definition: comctl32.h:150
INT editHeight
Definition: window.c:3454
VOID * items
Definition: window.c:3560
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
GETCPD wType
Definition: ntuser.h:553
WNDPROC pfnClientPrevious
Definition: ntuser.h:552
Definition: ntuser.h:566
PWSTR lpszMenuName
Definition: ntuser.h:588
WNDPROC lpfnWndProc
Definition: ntuser.h:581
ATOM atomNVClassName
Definition: ntuser.h:569
INT cbwndExtra
Definition: ntuser.h:583
DWORD CSF_flags
Definition: ntuser.h:573
RTL_ATOM atomClassName
Definition: ntuser.h:568
UINT style
Definition: ntuser.h:580
HINSTANCE hModule
Definition: ntuser.h:584
DWORD fnid
Definition: ntuser.h:570
PVOID pdce
Definition: ntuser.h:572
struct _WND * spwnd
Definition: ntuser.h:137
PWND spwndMessage
Definition: desktop.h:20
PDESKTOPINFO pDeskInfo
Definition: desktop.h:8
KTHREAD Tcb
Definition: pstypes.h:1186
PVOID Win32Thread
Definition: ketypes.h:2013
ULONG Length
Definition: ntuser.h:91
ULONG MaximumLength
Definition: ntuser.h:92
ULONG bAnsi
Definition: ntuser.h:93
PVOID Buffer
Definition: ntuser.h:94
SHORT cWndStack
Definition: monitor.h:22
RECT rcWork
Definition: monitor.h:19
HMONITOR hMonitor
Definition: win32.h:271
DWORD dwHotkey
Definition: win32.h:270
DWORD dwLayout
Definition: win32.h:280
struct _WINSTATION_OBJECT * prpwinsta
Definition: win32.h:267
struct _DESKTOP * rpdesk
Definition: ntuser.h:194
PPROCESSINFO ppi
Definition: win32.h:88
struct _DESKTOPINFO * pDeskInfo
Definition: win32.h:93
struct _CLIENTINFO * pClientInfo
Definition: win32.h:94
struct tagIMC * spDefaultImc
Definition: win32.h:132
struct tagKL * KeyboardLayout
Definition: win32.h:90
FLONG TIF_flags
Definition: win32.h:95
struct _DESKTOP * rpdesk
Definition: win32.h:92
struct _WND * spwndDefaultIme
Definition: win32.h:131
LIST_ENTRY WindowListHead
Definition: win32.h:155
struct _USER_MESSAGE_QUEUE * MessageQueue
Definition: win32.h:89
USHORT MaximumLength
Definition: env_spec_w32.h:370
Definition: object.h:4
HANDLE ShellListView
Definition: winsta.h:44
HANDLE ShellWindow
Definition: winsta.h:43
LPHEADCOMBO pCBox
Definition: window.c:3462
LB_DESCR * pLBiv
Definition: window.c:3575
Definition: ntuser.h:694
DWORD ExStyle
Definition: ntuser.h:704
LIST_ENTRY ThreadListEntry
Definition: ntuser.h:764
PCLS pcls
Definition: ntuser.h:720
DWORD ExStyle2
Definition: ntuser.h:745
struct _WND * spwndOwner
Definition: ntuser.h:715
UINT Unicode
Definition: ntuser.h:756
struct _WND * spwndPrev
Definition: ntuser.h:712
THRDESKHEAD head
Definition: ntuser.h:695
struct _WND * spwndLastActive
Definition: ntuser.h:739
ULONG PropListItems
Definition: ntuser.h:724
DWORD style
Definition: ntuser.h:706
DWORD state2
Definition: ntuser.h:702
struct _WND * spwndChild
Definition: ntuser.h:714
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
struct _WND::@5624 InternalPos
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
struct _WND * spwndNext
Definition: ntuser.h:711
WNDPROC lpfnWndProc
Definition: ntuser.h:718
HINSTANCE hModule
Definition: ntuser.h:708
RECT rcWindow
Definition: ntuser.h:716
struct _WND * spwndParent
Definition: ntuser.h:713
ULONG cbwndExtra
Definition: ntuser.h:738
LPCREATESTRUCTW lpcs
Definition: winuser.h:3083
HWND hwndInsertAfter
Definition: winuser.h:3084
DWORD stateButton
Definition: winuser.h:3820
LPCWSTR lpszClass
Definition: winuser.h:3073
LPCWSTR lpszName
Definition: winuser.h:3072
LPVOID lpCreateParams
Definition: winuser.h:3063
HINSTANCE hInstance
Definition: winuser.h:3064
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
LONG right
Definition: windef.h:108
LONG bottom
Definition: windef.h:109
LONG top
Definition: windef.h:107
LONG left
Definition: windef.h:106
ATOM atomSysClass[ICLS_NOTUSED+1]
Definition: ntuser.h:1060
ATOM atomContextHelpIdProp
Definition: ntuser.h:1067
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
#define LONG_PTR
Definition: treelist.c:79
#define GWLP_WNDPROC
Definition: treelist.c:66
#define GWLP_USERDATA
Definition: treelist.c:63
#define DWORD_PTR
Definition: treelist.c:76
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
const uint16_t * PCWSTR
Definition: typedefs.h:57
const uint16_t * LPCWSTR
Definition: typedefs.h:57
uint32_t DWORD_PTR
Definition: typedefs.h:65
unsigned char * LPBYTE
Definition: typedefs.h:53
INT POOL_TYPE
Definition: typedefs.h:78
uint16_t * LPWSTR
Definition: typedefs.h:56
#define NTAPI
Definition: typedefs.h:36
void * PVOID
Definition: typedefs.h:50
ULONG_PTR SIZE_T
Definition: typedefs.h:80
int32_t INT
Definition: typedefs.h:58
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define MAXUSHORT
Definition: typedefs.h:83
#define IN
Definition: typedefs.h:39
uint16_t * PWCHAR
Definition: typedefs.h:56
unsigned char * PUCHAR
Definition: typedefs.h:53
uint32_t ULONG
Definition: typedefs.h:59
#define HIWORD(l)
Definition: typedefs.h:247
#define OUT
Definition: typedefs.h:40
char * PCHAR
Definition: typedefs.h:51
#define STATUS_ACCESS_DENIED
Definition: udferr_usr.h:145
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define WriteUnalignedUlongPtr
Definition: unaligned.h:142
__forceinline unsigned long ReadUnalignedU32(const unsigned long *p)
Definition: unaligned.h:76
#define ReadUnalignedUlongPtr
Definition: unaligned.h:141
__forceinline void WriteUnalignedU32(unsigned long *p, unsigned long val)
Definition: unaligned.h:111
#define WS_EX_SETANSICREATOR
Definition: undocuser.h:30
BOOL FASTCALL co_UserRedrawWindow(PWND Window, const RECTL *UpdateRect, PREGION UpdateRgn, ULONG Flags)
Definition: painting.c:897
RTL_ATOM FASTCALL IntAddAtom(LPWSTR AtomName)
Definition: useratom.c:13
FORCEINLINE PMENU UserGetMenuObject(HMENU hMenu)
Definition: userfuncs.h:3
#define ASSERT_REFS_CO(_obj_)
Definition: userfuncs.h:13
static __inline BOOL UserHeapFree(PVOID lpMem)
Definition: usrheap.h:44
_Must_inspect_result_ _In_ WDFCOLLECTION _In_ WDFOBJECT Object
_In_ WDFCOLLECTION _In_ ULONG Index
_Must_inspect_result_ _In_ WDFDEVICE _In_ BOOLEAN _In_opt_ PVOID Tag
Definition: wdfdevice.h:4071
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ _Strict_type_match_ POOL_TYPE PoolType
Definition: wdfdevice.h:3821
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4539
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFDEVICE Child
Definition: wdffdo.h:536
_In_ WDFIOTARGET _In_ _Strict_type_match_ WDF_IO_TARGET_SENT_IO_ACTION Action
Definition: wdfiotarget.h:510
_Must_inspect_result_ _In_ WDFCMRESLIST List
Definition: wdfresource.h:550
WDF_EXTERN_C_START typedef _Must_inspect_result_ _In_opt_ PCUNICODE_STRING UnicodeString
Definition: wdfstring.h:64
POBJECT_TYPE ExWindowStationObjectType
Definition: win32k.c:21
VOID FASTCALL SetLastNtError(_In_ NTSTATUS Status)
Definition: error.c:30
BOOL NTAPI GreDeleteObject(HGDIOBJ hobj)
Definition: gdiobj.c:1165
BOOL NTAPI GreIsHandleValid(HGDIOBJ hobj)
Definition: gdiobj.c:1153
NTSTATUS FASTCALL IntSafeCopyUnicodeStringTerminateNULL(PUNICODE_STRING Dest, PUNICODE_STRING Source)
Definition: misc.c:684
FORCEINLINE BOOL RECTL_bIsEmptyRect(_In_ const RECTL *prcl)
Definition: rect.h:44
FORCEINLINE VOID RECTL_vOffsetRect(_Inout_ RECTL *prcl, _In_ INT cx, _In_ INT cy)
Definition: rect.h:31
BOOL FASTCALL IntGdiSetRegionOwner(HRGN hRgn, DWORD OwnerMask)
Definition: region.c:2459
#define ValidateHwndNoErr(hwnd)
Definition: precomp.h:97
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
BOOL FASTCALL IntMsgCreateStructW(PWND, CREATESTRUCTW *, CREATESTRUCTW *, PVOID *, PVOID *)
Definition: message.c:646
BOOL FASTCALL co_IntDestroyCaret(PTHREADINFO Win32Thread)
Definition: caret.c:159
VOID UserAddCallProcToClass(IN OUT PCLS Class, IN PCALLPROCDATA CallProc)
Definition: class.c:428
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 FASTCALL UserClipboardFreeWindow(PWND pWindow)
Definition: clipboard.c:414
VOID FASTCALL UserClipboardRelease(PWND pWindow)
Definition: clipboard.c:374
PCURICON_OBJECT FASTCALL UserGetCurIconObject(HCURSOR hCurIcon)
Definition: cursoricon.c:200
PDESKTOP FASTCALL IntGetActiveDesktop(VOID)
Definition: desktop.c:1285
PTHREADINFO gptiDesktopThread
Definition: desktop.c:54
HWND FASTCALL IntGetCurrentThreadDesktopWindow(VOID)
Definition: desktop.c:1442
PWND FASTCALL UserGetDesktopWindow(VOID)
Definition: desktop.c:1408
BOOL IntDeRegisterShellHookWindow(HWND hWnd)
Definition: desktop.c:1801
HWND FASTCALL IntGetMessageWindow(VOID)
Definition: desktop.c:1420
HWND FASTCALL IntGetDesktopWindow(VOID)
Definition: desktop.c:1397
NTSTATUS FASTCALL IntValidateDesktopHandle(HDESK Desktop, KPROCESSOR_MODE AccessMode, ACCESS_MASK DesiredAccess, PDESKTOP *Object)
Definition: desktop.c:1260
PUSER_MESSAGE_QUEUE FASTCALL IntGetFocusMessageQueue(VOID)
Definition: desktop.c:1330
VOID co_IntShellHookNotify(WPARAM Message, WPARAM wParam, LPARAM lParam)
Definition: desktop.c:1707
PWND FASTCALL co_GetDesktopWindow(PWND pWnd)
Definition: desktop.c:1389
VOID FASTCALL IntNotifyWinEvent(DWORD Event, PWND pWnd, LONG idObject, LONG idChild, DWORD flags)
Definition: event.c:178
BOOL FASTCALL UserRegisterHotKey(PWND pWnd, int id, UINT fsModifiers, UINT vk)
Definition: hotkey.c:447
VOID FASTCALL UnregisterWindowHotKeys(PWND pWnd)
Definition: hotkey.c:105
NTSTATUS FASTCALL UserAttachThreadInput(PTHREADINFO ptiFrom, PTHREADINFO ptiTo, BOOL fAttach)
Definition: input.c:495
WORD FASTCALL UserGetMouseButtonsState(VOID)
Definition: mouse.c:22
BOOL FASTCALL IntDestroyMenuObject(PMENU Menu, BOOL bRecurse)
Definition: menu.c:317
BOOL FASTCALL IntSetMenu(PWND Wnd, HMENU Menu, BOOL *Changed)
Definition: menu.c:5485
LRESULT FASTCALL co_IntSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1495
LONG NTAPI UserGetSystemMetrics(ULONG Index)
Definition: metric.c:209
PMONITOR NTAPI UserGetMonitorObject(IN HMONITOR hMonitor)
Definition: monitor.c:74
PMONITOR NTAPI UserGetPrimaryMonitor(VOID)
Definition: monitor.c:102
PVOID UserGetObject(PUSER_HANDLE_TABLE ht, HANDLE handle, HANDLE_TYPE type)
Definition: object.c:495
BOOL FASTCALL UserMarkObjectDestroy(PVOID Object)
Definition: object.c:620
PVOID FASTCALL UserAssignmentLock(PVOID *ppvObj, PVOID pvNew)
Definition: object.c:837
BOOL FASTCALL UserDereferenceObject(PVOID Object)
Definition: object.c:643
BOOL FASTCALL UserDeleteObject(HANDLE h, HANDLE_TYPE type)
Definition: object.c:716
PUSER_HANDLE_TABLE gHandleTable
Definition: object.c:13
BOOL FASTCALL UserObjectInDestroy(HANDLE h)
Definition: object.c:702
PVOID FASTCALL UserCreateObject(PUSER_HANDLE_TABLE ht, PDESKTOP pDesktop, PTHREADINFO pti, HANDLE *h, HANDLE_TYPE type, ULONG size)
Definition: object.c:568
PVOID FASTCALL UserAssignmentUnlock(PVOID *ppvObj)
Definition: object.c:857
PVOID UserGetObjectNoErr(PUSER_HANDLE_TABLE ht, HANDLE handle, HANDLE_TYPE type)
Definition: object.c:481
VOID FASTCALL UserReferenceObject(PVOID obj)
Definition: object.c:730
VOID FASTCALL UserRemoveWindowProps(_In_ PWND Window)
Definition: prop.c:115
HANDLE FASTCALL UserGetProp(_In_ PWND Window, _In_ ATOM Atom, _In_ BOOLEAN SystemProp)
Definition: prop.c:46
#define USERTAG_WINDOWLIST
Definition: tags.h:298
#define TAG_HOOK
Definition: tags.h:5
BOOL FASTCALL DestroyTimersForWindow(PTHREADINFO pti, PWND Window)
Definition: timer.c:528
struct _WND2LB WND2LB
ULONG FASTCALL IntSetStyle(PWND pwnd, ULONG set_bits, ULONG clear_bits)
Definition: window.c:144
HWND *FASTCALL IntWinListChildren(PWND Window)
Definition: window.c:275
DWORD_PTR APIENTRY NtUserQueryWindow(HWND hWnd, DWORD Index)
Definition: window.c:4194
DWORD APIENTRY NtUserAlterWindowStyle(HWND hWnd, DWORD Index, LONG NewValue)
Definition: window.c:4092
LONG_PTR FASTCALL co_UserSetWindowLongPtr(HWND hWnd, DWORD Index, LONG_PTR NewValue, BOOL Ansi)
Definition: window.c:4031
PWND FASTCALL co_IntSetParent(PWND Wnd, PWND WndNewParent)
Definition: window.c:1158
BOOL APIENTRY NtUserSetWindowFNID(HWND hWnd, WORD fnID)
Definition: window.c:4335
#define GWLP_CONSOLE_LEADER_PID
BOOL APIENTRY NtUserSetShellWindowEx(HWND hwndShell, HWND hwndListView)
Definition: window.c:3717
LONG APIENTRY NtUserSetWindowLong(HWND hWnd, DWORD Index, LONG NewValue, BOOL Ansi)
Definition: window.c:4048
DWORD FASTCALL IntGetWindowContextHelpId(PWND pWnd)
Definition: window.c:439
INT gNestedWindowLimit
Definition: window.c:16
static LONG_PTR co_IntSetWindowLongPtr(HWND hWnd, DWORD Index, LONG_PTR NewValue, BOOL Ansi, ULONG Size, BOOL bAlter)
Definition: window.c:3828
BOOL APIENTRY NtUserDefSetText(HWND hWnd, PLARGE_STRING WindowText)
Definition: window.c:4458
struct _WND2CBOX WND2CBOX
HWND FASTCALL co_UserSetParent(HWND hWndChild, HWND hWndNewParent)
Definition: window.c:1295
VOID FASTCALL IntFreeHwndList(PWINDOWLIST pwlTarget)
Definition: window.c:1467
struct _WND2CBOX * PWND2CBOX
HWND APIENTRY NtUserFindWindowEx(HWND hwndParent, HWND hwndChildAfter, PUNICODE_STRING ucClassName, PUNICODE_STRING ucWindowName, DWORD dwUnknown)
Definition: window.c:3147
UINT APIENTRY NtUserRegisterWindowMessage(PUNICODE_STRING MessageNameUnsafe)
Definition: window.c:4299
HWND NTAPI NtUserCreateWindowEx(DWORD dwExStyle, PLARGE_STRING plstrClassName, PLARGE_STRING plstrClsVersion, PLARGE_STRING plstrWindowName, DWORD dwStyle, int x, int y, int nWidth, int nHeight, HWND hWndParent, HMENU hMenu, HINSTANCE hInstance, LPVOID lpParam, DWORD dwFlags, PVOID acbiBuffer)
Definition: window.c:2672
PWINDOWLIST gpwlCache
Definition: window.c:19
PWND FASTCALL IntGetParent(PWND Wnd)
Definition: window.c:205
HWND *FASTCALL IntWinListOwnedPopups(PWND Window)
Definition: window.c:316
PWND FASTCALL UserGetWindowObject(HWND hWnd)
Definition: window.c:123
WNDPROC FASTCALL IntGetWindowProc(PWND pWnd, BOOL Ansi)
Definition: window.c:782
#define CBF_BUTTONDOWN
Definition: window.c:3465
#define GROW_COUNT
static VOID UserFreeWindowInfo(PTHREADINFO ti, PWND Wnd)
Definition: window.c:542
PWND FASTCALL IntGetWindowObject(HWND hWnd)
Definition: window.c:75
struct _WND2LB * PWND2LB
static BOOL FASTCALL IntCheckFrameEdge(ULONG Style, ULONG ExStyle)
Definition: window.c:3817
PVOID FASTCALL IntReAllocatePoolWithTag(POOL_TYPE PoolType, PVOID pOld, SIZE_T cbOld, SIZE_T cbNew, ULONG Tag)
Definition: window.c:24
PWINDOWLIST FASTCALL IntPopulateHwndList(PWINDOWLIST pwl, PWND pwnd, DWORD dwFlags)
Definition: window.c:1393
LONG FASTCALL co_UserSetWindowLong(HWND hWnd, DWORD Index, LONG NewValue, BOOL Ansi)
Definition: window.c:4025
PWND FASTCALL IntCreateWindow(CREATESTRUCTW *Cs, PLARGE_STRING WindowName, PCLS Class, PWND ParentWindow, PWND OwnerWindow, PVOID acbiBuffer, PDESKTOP pdeskCreated, DWORD dwVer)
Definition: window.c:1805
static WNDPROC IntSetWindowProc(PWND pWnd, WNDPROC NewWndProc, BOOL Ansi)
Definition: window.c:842
BOOL FASTCALL IntEnableWindow(HWND hWnd, BOOL bEnable)
Definition: window.c:221
DWORD APIENTRY NtUserGetListBoxInfo(HWND hWnd)
Definition: window.c:3582
HWND FASTCALL IntFindWindow(PWND Parent, PWND ChildAfter, RTL_ATOM ClassAtom, PUNICODE_STRING WindowName)
Definition: window.c:3065
VOID FASTCALL IntUnlinkWindow(PWND Wnd)
Definition: window.c:1355
BOOL FASTCALL IntShowOwnedPopups(PWND OwnerWnd, BOOL fShow)
Definition: window.c:4654
LRESULT co_UserFreeWindow(PWND Window, PPROCESSINFO ProcessData, PTHREADINFO ThreadData, BOOLEAN SendMessages)
Definition: window.c:575
BOOL FASTCALL IntGrowHwndList(PWINDOWLIST *ppwl)
Definition: window.c:1373
struct HEADCOMBO * LPHEADCOMBO
PWND FASTCALL VerifyWnd(PWND pWnd)
Definition: window.c:88
void FASTCALL IntFixWindowCoordinates(CREATESTRUCTW *Cs, PWND ParentWindow, DWORD *dwShowMode)
Definition: window.c:1711
BOOL FASTCALL IntIsTopLevelWindow(PWND pWnd)
Definition: window.c:360
HWND FASTCALL IntGetWindow(HWND hWnd, UINT uCmd)
Definition: window.c:382
static void IntSendDestroyMsg(HWND hWnd)
Definition: window.c:462
PWND FASTCALL co_UserCreateWindowEx(CREATESTRUCTW *Cs, PUNICODE_STRING ClassName, PLARGE_STRING WindowName, PVOID acbiBuffer, DWORD dwVer)
Definition: window.c:2169
HWND FASTCALL UserGetShellWindow(VOID)
Definition: window.c:3684
BOOL FASTCALL IntValidateOwnerDepth(PWND Wnd, PWND Owner)
Definition: window.c:368
VOID FASTCALL IntRemoveTrackMouseEvent(PDESKTOP pDesk)
Definition: mouse.c:355
NTSTATUS NTAPI ProbeAndCaptureLargeString(OUT PLARGE_STRING plstrSafe, IN PLARGE_STRING plstrUnsafe)
Definition: window.c:2615
WORD APIENTRY NtUserSetWindowWord(HWND hWnd, INT Index, WORD NewValue)
Definition: window.c:4123
HWND APIENTRY NtUserGetAncestor(_In_ HWND hWnd, _In_ UINT uType)
Definition: window.c:3407
VOID FASTCALL IntProcessOwnerSwap(PWND Wnd, PWND WndNewOwner, PWND WndOldOwner)
Definition: window.c:1085
#define INITIAL_COUNT
BOOLEAN co_UserDestroyWindow(PVOID Object)
Definition: window.c:2857
#define GWLP_CONSOLE_LEADER_TID
HWND APIENTRY NtUserSetParent(HWND hWndChild, HWND hWndNewParent)
Definition: window.c:3650
static BOOL IntWndIsDefaultIme(_In_ PWND Window)
Definition: window.c:307
BOOL FASTCALL IntIsWindow(HWND hWnd)
Definition: window.c:177
BOOL APIENTRY DefSetText(PWND Wnd, PCWSTR WindowText)
Definition: window.c:4377
BOOLEAN APIENTRY NtUserDestroyWindow(HWND Wnd)
Definition: window.c:3041
BOOL FASTCALL IntIsChildWindow(PWND Parent, PWND BaseWindow)
Definition: window.c:929
static HWND FASTCALL IntSetOwner(HWND hWnd, HWND hWndNewOwner)
Definition: window.c:1117
NTSTATUS NTAPI NtUserBuildHwndList(HDESK hDesktop, HWND hwndParent, BOOLEAN bChildren, ULONG dwThreadId, ULONG cHwnd, HWND *phwndList, ULONG *pcHwndNeeded)
Definition: window.c:1515
BOOL FASTCALL UserUpdateUiState(PWND Wnd, WPARAM wParam)
Definition: window.c:40
PWINDOWLIST FASTCALL IntBuildHwndList(PWND pwnd, DWORD dwFlags, PTHREADINFO pti)
Definition: window.c:1422
VOID FASTCALL IntLinkHwnd(PWND Wnd, HWND hWndPrev)
Definition: window.c:985
VOID FASTCALL IntLinkWindow(PWND Wnd, PWND WndInsertAfter)
Definition: window.c:946
BOOL APIENTRY NtUserGetComboBoxInfo(HWND hWnd, PCOMBOBOXINFO pcbi)
Definition: window.c:3471
PWINDOWLIST gpwlList
Definition: window.c:18
BOOL FASTCALL IntIsWindowVisible(PWND Wnd)
Definition: window.c:190
static void IntSendParentNotify(PWND pWindow, UINT msg)
Definition: window.c:1689
INT APIENTRY NtUserInternalGetWindowText(HWND hWnd, LPWSTR lpString, INT nMaxCount)
Definition: window.c:4592
PWND FASTCALL UserGetAncestor(_In_ PWND pWnd, _In_ UINT uType)
Definition: window.c:3343
#define IS_DEFAULT(x)
PWND FASTCALL IntGetNonChildAncestor(PWND pWnd)
Definition: window.c:352
VOID FASTCALL IntDestroyOwnedWindows(PWND Window)
Definition: window.c:2822
#define OBJID_WINDOW
Definition: winable.h:15
#define CHILDID_SELF
Definition: winable.h:14
#define STARTF_USEPOSITION
Definition: winbase.h:470
#define MAKEINTATOM(i)
Definition: winbase.h:1198
ENGAPI ULONG APIENTRY EngGetLastError(VOID)
Definition: error.c:9
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:21
#define WOC_DELETE
Definition: winddi.h:1269
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
_In_ BOOL bEnable
Definition: winddi.h:3426
static VOID WndSetPrev(_Inout_ PWND pwnd, _In_opt_ PWND pwndPrev)
Definition: window.h:178
#define IntIsBroadcastHwnd(hWnd)
Definition: window.h:28
static VOID WndSetOwner(_Inout_ PWND pwnd, _In_opt_ PWND pwndOwner)
Definition: window.h:150
#define WINVER_WIN2K
Definition: window.h:56
#define IntIsDesktopWindow(WndObj)
Definition: window.h:25
#define WINVER_WINNT4
Definition: window.h:57
#define WL_IS_BAD(pwl)
Definition: window.h:97
static VOID WndSetChild(_Inout_ PWND pwnd, _In_opt_ PWND pwndChild)
Definition: window.h:164
#define IS_WND_IMELIKE(pWnd)
Definition: window.h:114
static VOID WndSetNext(_Inout_ PWND pwnd, _In_opt_ PWND pwndNext)
Definition: window.h:171
#define IntGetWndThreadId(WndObj)
Definition: window.h:35
#define HWND_TERMINATOR
Definition: window.h:83
#define IntWndBelongsToThread(WndObj, W32Thread)
Definition: window.h:32
static VOID WndSetParent(_Inout_ PWND pwnd, _In_opt_ PWND pwndParent)
Definition: window.h:157
#define IS_WND_CHILD(pWnd)
Definition: window.h:108
#define IntGetWndProcessId(WndObj)
Definition: window.h:38
struct tagWINDOWLIST WINDOWLIST
#define WINVER_WIN31
Definition: window.h:58
#define IACE_LIST
Definition: window.h:106
static VOID WndSetLastActive(_Inout_ PWND pwnd, _In_opt_ PWND pwndLastActive)
Definition: window.h:185
#define WL_CAPACITY(pwl)
Definition: window.h:98
#define ERROR_TLW_WITH_WSCHILD
Definition: winerror.h:1232
#define ERROR_INVALID_INDEX
Definition: winerror.h:1239
#define ERROR_INVALID_GW_COMMAND
Definition: winerror.h:1269
#define ERROR_INVALID_MENU_HANDLE
Definition: winerror.h:1227
#define ERROR_INVALID_WINDOW_HANDLE
Definition: winerror.h:1226
#define ERROR_CANNOT_FIND_WND_CLASS
Definition: winerror.h:1233
#define LAYOUT_RTL
Definition: wingdi.h:1371
#define SW_SHOWNORMAL
Definition: winuser.h:781
#define WS_EX_LAYOUTRTL
Definition: winuser.h:390
#define HWND_MESSAGE
Definition: winuser.h:1221
#define GW_OWNER
Definition: winuser.h:777
#define STATE_SYSTEM_PRESSED
Definition: winuser.h:2972
#define MAKEWPARAM(l, h)
Definition: winuser.h:4117
#define GW_HWNDFIRST
Definition: winuser.h:775
#define WS_EX_STATICEDGE
Definition: winuser.h:403
#define SW_HIDE
Definition: winuser.h:779
#define SWP_NOACTIVATE
Definition: winuser.h:1253
#define GW_HWNDLAST
Definition: winuser.h:776
#define GWL_USERDATA
Definition: winuser.h:872
#define WM_ENABLE
Definition: winuser.h:1643
#define GA_ROOT
Definition: winuser.h:2893
#define SWP_FRAMECHANGED
Definition: winuser.h:1251
#define MAKELPARAM(l, h)
Definition: winuser.h:4116
#define GWL_HINSTANCE
Definition: winuser.h:866
#define HWND_TOPMOST
Definition: winuser.h:1219
#define HSHELL_WINDOWDESTROYED
Definition: winuser.h:1267
#define WM_SETHOTKEY
Definition: winuser.h:1680
#define IMAGE_ICON
Definition: winuser.h:212
#define SM_CYSIZE
Definition: winuser.h:1003
#define WM_CREATE
Definition: winuser.h:1636
#define GWL_ID
Definition: winuser.h:870
#define WS_EX_APPWINDOW
Definition: winuser.h:383
#define SW_MINIMIZE
Definition: winuser.h:787
#define HSHELL_WINDOWCREATED
Definition: winuser.h:1266
#define LR_COPYFROMRESOURCE
Definition: winuser.h:1110
#define SB_VERT
Definition: winuser.h:553
#define WM_CANCELMODE
Definition: winuser.h:1663
#define SM_CXFRAME
Definition: winuser.h:1005
#define SWP_NOMOVE
Definition: winuser.h:1255
#define WS_EX_NOACTIVATE
Definition: winuser.h:395
#define GA_ROOTOWNER
Definition: winuser.h:2894
#define RDW_NOINTERNALPAINT
Definition: winuser.h:1228
#define HCBT_DESTROYWND
Definition: winuser.h:59
#define WS_EX_TOOLWINDOW
Definition: winuser.h:404
#define SM_CYSMICON
Definition: winuser.h:1024
#define GA_PARENT
Definition: winuser.h:2892
#define SWP_NOSIZE
Definition: winuser.h:1256
#define WM_MOUSEMOVE
Definition: winuser.h:1803
#define SC_TASKLIST
Definition: winuser.h:2635
#define RDW_NOCHILDREN
Definition: winuser.h:1233
#define WH_CBT
Definition: winuser.h:35
#define GWLP_HINSTANCE
Definition: winuser.h:867
#define SM_CXSIZE
Definition: winuser.h:1002
#define HCBT_CREATEWND
Definition: winuser.h:58
#define CB_GETCOMBOBOXINFO
Definition: winuser.h:1970
#define SM_CYFRAME
Definition: winuser.h:1007
#define GW_HWNDNEXT
Definition: winuser.h:772
#define WM_NCCREATE
Definition: winuser.h:1711
#define WM_MDIREFRESHMENU
Definition: winuser.h:1854
#define WM_SHOWWINDOW
Definition: winuser.h:1656
#define SW_SHOWMINIMIZED
Definition: winuser.h:782
#define SM_CXSMICON
Definition: winuser.h:1023
#define HWND_TOP
Definition: winuser.h:1218
#define WS_EX_MDICHILD
Definition: winuser.h:394
_In_ int nMaxCount
Definition: winuser.h:5034
#define GWLP_HWNDPARENT
Definition: winuser.h:869
#define STATE_SYSTEM_INVISIBLE
Definition: winuser.h:2984
#define SWP_SHOWWINDOW
Definition: winuser.h:1259
#define WS_EX_WINDOWEDGE
Definition: winuser.h:407
#define WS_EX_LAYERED
Definition: winuser.h:389
#define SW_PARENTCLOSING
Definition: winuser.h:2478
#define SWP_HIDEWINDOW
Definition: winuser.h:1252
#define WM_NCDESTROY
Definition: winuser.h:1712
#define GWLP_ID
Definition: winuser.h:871
#define GW_HWNDPREV
Definition: winuser.h:773
#define CS_OWNDC
Definition: winuser.h:663
#define SW_SHOW
Definition: winuser.h:786
#define CS_CLASSDC
Definition: winuser.h:658
#define WM_DESTROY
Definition: winuser.h:1637
#define GWL_HWNDPARENT
Definition: winuser.h:868
#define RDW_NOFRAME
Definition: winuser.h:1227
#define GW_CHILD
Definition: winuser.h:774
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:3014
#define WM_PARENTNOTIFY
Definition: winuser.h:1831
#define SWP_NOZORDER
Definition: winuser.h:1258
#define SW_MAXIMIZE
Definition: winuser.h:783
#define RDW_NOERASE
Definition: winuser.h:1226
#define GWL_STYLE
Definition: winuser.h:863
#define CS_PARENTDC
Definition: winuser.h:664
#define RDW_VALIDATE
Definition: winuser.h:1229
#define VK_ESCAPE
Definition: winuser.h:2250
#define SW_PARENTOPENING
Definition: winuser.h:2480
#define HWND_NOTOPMOST
Definition: winuser.h:1217
#define WS_EX_NOINHERITLAYOUT
Definition: winuser.h:396
#define HWND_BOTTOM
Definition: winuser.h:1216
#define SB_HORZ
Definition: winuser.h:552
#define GWL_EXSTYLE
Definition: winuser.h:862
_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
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
_In_opt_ PALLOCATE_FUNCTION _In_opt_ PFREE_FUNCTION _In_ ULONG _In_ SIZE_T _In_ ULONG _In_ USHORT Depth
Definition: exfuncs.h:819
#define ObDereferenceObject
Definition: obfuncs.h:203
#define PsGetCurrentProcess
Definition: psfuncs.h:17
#define NT_ASSERT
Definition: rtlfuncs.h:3327