branch update for HEAD-2003021201
[reactos.git] / subsys / win32k / ntuser / window.c
1 /* $Id$
2  *
3  * COPYRIGHT:        See COPYING in the top level directory
4  * PROJECT:          ReactOS kernel
5  * PURPOSE:          Windows
6  * FILE:             subsys/win32k/ntuser/window.c
7  * PROGRAMER:        Casper S. Hornstrup (chorns@users.sourceforge.net)
8  * REVISION HISTORY:
9  *       06-06-2001  CSH  Created
10  */
11 /* INCLUDES ******************************************************************/
12
13 #include <ddk/ntddk.h>
14 #include <win32k/win32k.h>
15 #include <include/object.h>
16 #include <include/guicheck.h>
17 #include <include/window.h>
18 #include <include/class.h>
19 #include <include/error.h>
20 #include <include/winsta.h>
21 #include <include/winpos.h>
22 #include <include/callback.h>
23 #include <include/msgqueue.h>
24 #include <include/rect.h>
25
26 //#define NDEBUG
27 #include <debug.h>
28
29 /* FUNCTIONS *****************************************************************/
30
31 HWND STDCALL
32 NtUserGetAncestor(HWND hWnd, UINT Flags)
33 {
34   if (W32kIsDesktopWindow(hWnd))
35     {
36       return(NULL);
37     }
38   if (Flags & GA_PARENT)
39     {
40       PWINDOW_OBJECT Window;
41       HWND hParent;
42
43       Window = W32kGetWindowObject(hWnd);
44       if (Window == NULL)
45         {
46           return(NULL);
47         }     
48
49       if (Window->Parent == NULL)
50         {
51           W32kReleaseWindowObject(Window);
52         }
53
54       hParent = Window->Parent->Self;
55
56       W32kReleaseWindowObject(Window);
57
58       return(hParent);
59     }
60   else
61     {
62       UNIMPLEMENTED;
63       return(NULL);
64     }
65 }
66
67 VOID
68 W32kSetFocusWindow(HWND hWnd)
69 {
70 }
71
72 BOOL
73 W32kIsChildWindow(HWND Parent, HWND Child)
74 {
75   PWINDOW_OBJECT BaseWindow = W32kGetWindowObject(Child);
76   PWINDOW_OBJECT Window = BaseWindow;
77   while (Window != NULL && Window->Style & WS_CHILD)
78     {
79       if (Window->Self == Parent)
80         {
81           W32kReleaseWindowObject(BaseWindow);
82           return(TRUE);
83         }
84       Window = Window->Parent;
85     }
86   W32kReleaseWindowObject(BaseWindow);
87   return(FALSE);  
88 }
89
90 BOOL
91 W32kIsWindowVisible(HWND Wnd)
92 {
93   PWINDOW_OBJECT BaseWindow = W32kGetWindowObject(Wnd);
94   PWINDOW_OBJECT Window = BaseWindow;
95   BOOLEAN Result = FALSE;
96   while (Window != NULL && Window->Style & WS_CHILD)
97     {
98       if (!(Window->Style & WS_VISIBLE))
99         {
100           W32kReleaseWindowObject(BaseWindow);
101           return(FALSE);
102         }
103       Window = Window->Parent;
104     }
105   if (Window != NULL && Window->Style & WS_VISIBLE)
106     {
107       Result = TRUE;
108     }
109   W32kReleaseWindowObject(BaseWindow);
110   return(Result);
111 }
112
113 BOOL
114 W32kIsDesktopWindow(HWND hWnd)
115 {
116   PWINDOW_OBJECT WindowObject;
117   BOOL IsDesktop;
118   WindowObject = W32kGetWindowObject(hWnd);
119   IsDesktop = WindowObject->Parent == NULL;
120   W32kReleaseWindowObject(WindowObject);
121   return(IsDesktop);
122 }
123
124 HWND W32kGetDesktopWindow()
125 {
126   return W32kGetActiveDesktop()->DesktopWindow;
127 }
128
129 HWND W32kGetParentWindow(HWND hWnd)
130 {
131   return W32kGetWindowObject(hWnd)->ParentHandle;
132 }
133
134 PWINDOW_OBJECT
135 W32kGetWindowObject(HWND hWnd)
136 {
137   PWINDOW_OBJECT WindowObject;
138   NTSTATUS Status;
139   Status = 
140     ObmReferenceObjectByHandle(PsGetWin32Process()->WindowStation->
141                                HandleTable,
142                                hWnd,
143                                otWindow,
144                                (PVOID*)&WindowObject);
145   if (!NT_SUCCESS(Status))
146     {
147       return(NULL);
148     }
149   return(WindowObject);
150 }
151
152 VOID
153 W32kReleaseWindowObject(PWINDOW_OBJECT Window)
154 {
155   ObmDereferenceObject(Window);
156 }
157
158 VOID
159 W32kGetClientRect(PWINDOW_OBJECT WindowObject, PRECT Rect)
160 {
161   Rect->left = Rect->top = 0;
162   Rect->right = WindowObject->ClientRect.right - WindowObject->ClientRect.left;
163   Rect->bottom = 
164     WindowObject->ClientRect.bottom - WindowObject->ClientRect.top;
165 }
166
167 BOOL STDCALL
168 W32kGetWindowRect(HWND hWnd, LPRECT Rect)
169 {
170   PWINDOW_OBJECT WindowObject;
171
172   WindowObject = W32kGetWindowObject(hWnd);
173   if (WindowObject == NULL)
174     {
175       return(FALSE);
176     }
177   *Rect = WindowObject->WindowRect;
178   if (WindowObject->Style & WS_CHILD)
179     {
180       DbgBreakPoint();
181     }
182   W32kReleaseWindowObject(WindowObject);
183   return(TRUE);
184 }
185
186 BOOL STDCALL
187 NtUserGetWindowRect(HWND hWnd, LPRECT Rect)
188 {
189   return(W32kGetWindowRect(hWnd, Rect));
190 }
191
192 HWND
193 W32kGetActiveWindow(VOID)
194 {
195   PUSER_MESSAGE_QUEUE Queue;
196   Queue = (PUSER_MESSAGE_QUEUE)W32kGetActiveDesktop()->ActiveMessageQueue;
197   if (Queue == NULL)
198     {
199       return(NULL);
200     }
201   else
202     {
203       return(Queue->ActiveWindow);
204     }
205 }
206
207 HWND
208 W32kGetFocusWindow(VOID)
209 {
210   PUSER_MESSAGE_QUEUE Queue;
211   Queue = (PUSER_MESSAGE_QUEUE)W32kGetActiveDesktop()->ActiveMessageQueue;
212   if (Queue == NULL)
213     {
214       return(NULL);
215     }
216   else
217     {
218       return(Queue->FocusWindow);
219     }
220 }
221
222
223 WNDPROC
224 W32kGetWindowProc(HWND Wnd)
225 {
226   PWINDOW_OBJECT WindowObject;
227   WNDPROC WndProc;
228
229   WindowObject = W32kGetWindowObject(Wnd);
230   WndProc = WindowObject->Class->Class.lpfnWndProc;
231   W32kReleaseWindowObject(Wnd);
232   return(WndProc);
233 }
234
235 NTSTATUS
236 InitWindowImpl(VOID)
237 {
238   return(STATUS_SUCCESS);
239 }
240
241 NTSTATUS
242 CleanupWindowImpl(VOID)
243 {
244   return(STATUS_SUCCESS);
245 }
246
247
248 DWORD STDCALL
249 NtUserAlterWindowStyle(DWORD Unknown0,
250                        DWORD Unknown1,
251                        DWORD Unknown2)
252 {
253   UNIMPLEMENTED
254
255   return(0);
256 }
257
258 DWORD STDCALL
259 NtUserChildWindowFromPointEx(HWND Parent,
260                              LONG x,
261                              LONG y,
262                              UINT Flags)
263 {
264   UNIMPLEMENTED
265
266   return(0);
267 }
268
269 HWND STDCALL
270 W32kCreateDesktopWindow(PWINSTATION_OBJECT WindowStation,
271                         PWNDCLASS_OBJECT DesktopClass,
272                         ULONG Width, ULONG Height)
273 {
274   PWSTR WindowName;
275   HWND Handle;
276   PWINDOW_OBJECT WindowObject;
277
278   /* Create the window object. */
279   WindowObject = (PWINDOW_OBJECT)ObmCreateObject(WindowStation->HandleTable, 
280                                                  &Handle, 
281                                                  otWindow,
282                                                  sizeof(WINDOW_OBJECT));
283   if (!WindowObject) 
284     {
285       return((HWND)0);
286     }
287
288   /*
289    * Fill out the structure describing it.
290    */
291   WindowObject->Class = DesktopClass;
292   WindowObject->ExStyle = 0;
293   WindowObject->Style = WS_VISIBLE;
294   WindowObject->x = 0;
295   WindowObject->y = 0;
296   WindowObject->Width = Width;
297   WindowObject->Height = Height;
298   WindowObject->ParentHandle = NULL;
299   WindowObject->Parent = NULL;
300   WindowObject->Menu = NULL;
301   WindowObject->Instance = NULL;
302   WindowObject->Parameters = NULL;
303   WindowObject->Self = Handle;
304   WindowObject->MessageQueue = NULL;
305   WindowObject->ExtraData = NULL;
306   WindowObject->ExtraDataSize = 0;
307   WindowObject->WindowRect.left = 0;
308   WindowObject->WindowRect.top = 0;
309   WindowObject->WindowRect.right = Width;
310   WindowObject->WindowRect.bottom = Height;
311   WindowObject->ClientRect = WindowObject->WindowRect;
312   InitializeListHead(&WindowObject->ChildrenListHead);
313
314   WindowName = ExAllocatePool(NonPagedPool, sizeof(L"DESKTOP"));
315   wcscpy(WindowName, L"DESKTOP");
316   RtlInitUnicodeString(&WindowObject->WindowName, WindowName);
317
318   return(Handle);
319 }
320
321 HWND STDCALL
322 NtUserCreateWindowEx(DWORD dwExStyle,
323                      PUNICODE_STRING lpClassName,
324                      PUNICODE_STRING lpWindowName,
325                      DWORD dwStyle,
326                      LONG x,
327                      LONG y,
328                      LONG nWidth,
329                      LONG nHeight,
330                      HWND hWndParent,
331                      HMENU hMenu,
332                      HINSTANCE hInstance,
333                      LPVOID lpParam,
334                      DWORD dwShowMode)
335 {
336   PWINSTATION_OBJECT WinStaObject;
337   PWNDCLASS_OBJECT ClassObject;
338   PWINDOW_OBJECT WindowObject;
339   PWINDOW_OBJECT ParentWindow;
340   UNICODE_STRING WindowName;
341   NTSTATUS Status;
342   HANDLE Handle;
343   POINT MaxSize, MaxPos, MinTrack, MaxTrack;
344   CREATESTRUCTW Cs;
345   LRESULT Result;
346
347   DPRINT("NtUserCreateWindowEx\n");
348
349   /* Initialize gui state if necessary. */
350   W32kGuiCheck();
351   W32kGraphicsCheck();
352
353   if (!RtlCreateUnicodeString(&WindowName, lpWindowName->Buffer))
354     {
355       SetLastNtError(STATUS_INSUFFICIENT_RESOURCES);
356       return((HWND)0);
357     }
358
359   if (hWndParent != NULL)
360     {
361       ParentWindow = W32kGetWindowObject(hWndParent);
362     }
363   else
364     {
365       hWndParent = PsGetWin32Thread()->Desktop->DesktopWindow;
366       ParentWindow = W32kGetWindowObject(hWndParent);
367     }
368
369   /* Check the class. */
370   Status = ClassReferenceClassByNameOrAtom(&ClassObject, lpClassName->Buffer);
371   if (!NT_SUCCESS(Status))
372     {
373       RtlFreeUnicodeString(&WindowName);
374       return((HWND)0);
375     }
376
377   /* Check the window station. */
378   DPRINT("IoGetCurrentProcess() %X\n", IoGetCurrentProcess());
379   DPRINT("PROCESS_WINDOW_STATION %X\n", PROCESS_WINDOW_STATION());
380   Status = ValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
381                                        KernelMode,
382                                        0,
383                                        &WinStaObject);
384   if (!NT_SUCCESS(Status))
385     {
386       RtlFreeUnicodeString(&WindowName);
387       ObmDereferenceObject(ClassObject);
388       DPRINT("Validation of window station handle (0x%X) failed\n",
389              PROCESS_WINDOW_STATION());
390       return (HWND)0;
391     }
392
393   /* Create the window object. */
394   WindowObject = (PWINDOW_OBJECT)
395     ObmCreateObject(PsGetWin32Process()->WindowStation->HandleTable, &Handle,
396                     otWindow, sizeof(WINDOW_OBJECT));
397   DPRINT("Created object with handle %X\n", Handle);
398   if (!WindowObject)
399     {
400       ObDereferenceObject(WinStaObject);
401       ObmDereferenceObject(ClassObject);
402       RtlFreeUnicodeString(&WindowName);
403       SetLastNtError(STATUS_INSUFFICIENT_RESOURCES);
404       return (HWND)0;
405     }
406   ObDereferenceObject(WinStaObject);
407
408   /*
409    * Fill out the structure describing it.
410    */
411   WindowObject->Class = ClassObject;
412   WindowObject->ExStyle = dwExStyle;
413   WindowObject->Style = dwStyle;
414   WindowObject->x = x;
415   WindowObject->y = y;
416   WindowObject->Width = nWidth;
417   WindowObject->Height = nHeight;
418   WindowObject->ParentHandle = hWndParent;
419   WindowObject->Menu = hMenu;
420   WindowObject->Instance = hInstance;
421   WindowObject->Parameters = lpParam;
422   WindowObject->Self = Handle;
423   WindowObject->MessageQueue = PsGetWin32Thread()->MessageQueue;
424   WindowObject->Parent = ParentWindow;
425   InsertHeadList(&ParentWindow->ChildrenListHead,
426                  &WindowObject->SiblingListEntry);
427   InitializeListHead(&WindowObject->ChildrenListHead);
428   InitializeListHead(&WindowObject->PropListHead);
429
430   RtlInitUnicodeString(&WindowObject->WindowName, WindowName.Buffer);
431   RtlFreeUnicodeString(&WindowName);
432
433   if (ClassObject->Class.cbWndExtra != 0)
434     {
435       WindowObject->ExtraData =
436         ExAllocatePool(PagedPool,
437                        ClassObject->Class.cbWndExtra * sizeof(DWORD));
438       WindowObject->ExtraDataSize = ClassObject->Class.cbWndExtra;
439     }
440   else
441     {
442       WindowObject->ExtraData = NULL;
443       WindowObject->ExtraDataSize = 0;
444     }
445
446   /* Correct the window style. */
447   if (!(dwStyle & WS_CHILD))
448     {
449       WindowObject->Style |= WS_CLIPSIBLINGS;
450       if (!(dwStyle & WS_POPUP))
451         {
452           WindowObject->Style |= WS_CAPTION;
453           /* FIXME: Note the window needs a size. */ 
454         }
455     }
456
457   /* Insert the window into the process's window list. */
458   ExAcquireFastMutexUnsafe (&PsGetWin32Thread()->WindowListLock);
459   InsertTailList (&PsGetWin32Thread()->WindowListHead, 
460                   &WindowObject->ThreadListEntry);
461   ExReleaseFastMutexUnsafe (&PsGetWin32Thread()->WindowListLock);
462
463   /*
464    * Insert the window into the list of windows associated with the thread's
465    * desktop. 
466    */
467   InsertTailList(&PsGetWin32Thread()->Desktop->WindowListHead,
468                  &WindowObject->DesktopListEntry);
469
470   /* FIXME: Maybe allocate a DCE for this window. */
471
472   /* Initialize the window dimensions. */
473   WindowObject->WindowRect.left = x;
474   WindowObject->WindowRect.top = y;
475   WindowObject->WindowRect.right = x + nWidth;
476   WindowObject->WindowRect.bottom = y + nHeight;
477   WindowObject->ClientRect = WindowObject->WindowRect;
478
479   /*
480    * Get the size and position of the window.
481    */
482   if ((dwStyle & WS_THICKFRAME) || !(dwStyle & (WS_POPUP | WS_CHILD)))
483     {
484       WinPosGetMinMaxInfo(WindowObject, &MaxSize, &MaxPos, &MinTrack,
485                           &MaxTrack);
486       x = min(MaxSize.x, y);
487       y = min(MaxSize.y, y);
488       x = max(MinTrack.x, x);
489       y = max(MinTrack.y, y);
490     }
491
492   WindowObject->WindowRect.left = x;
493   WindowObject->WindowRect.top = y;
494   WindowObject->WindowRect.right = x + nWidth;
495   WindowObject->WindowRect.bottom = y + nHeight;
496   WindowObject->ClientRect = WindowObject->WindowRect;
497
498   /* FIXME: Initialize the window menu. */
499
500   /* Initialize the window's scrollbars */
501   if (dwStyle & WS_VSCROLL)
502       SCROLL_CreateScrollBar(WindowObject, SB_VERT);
503   if (dwStyle & WS_HSCROLL)
504       SCROLL_CreateScrollBar(WindowObject, SB_HORZ);
505
506   /* Send a NCCREATE message. */
507   Cs.lpCreateParams = lpParam;
508   Cs.hInstance = hInstance;
509   Cs.hMenu = hMenu;
510   Cs.hwndParent = hWndParent;
511   Cs.cx = nWidth;
512   Cs.cy = nHeight;
513   Cs.x = x;
514   Cs.y = y;
515   Cs.style = dwStyle;
516   Cs.lpszName = lpWindowName->Buffer;
517   Cs.lpszClass = lpClassName->Buffer;
518   Cs.dwExStyle = dwExStyle;
519   DPRINT("NtUserCreateWindowEx(): About to send NCCREATE message.\n");
520   Result = W32kSendNCCREATEMessage(WindowObject->Self, &Cs);
521   if (!Result)
522     {
523       /* FIXME: Cleanup. */
524       DPRINT("NtUserCreateWindowEx(): NCCREATE message failed.\n");
525       return(NULL);
526     }
527  
528   /* Calculate the non-client size. */
529   MaxPos.x = WindowObject->WindowRect.left;
530   MaxPos.y = WindowObject->WindowRect.top;
531   DPRINT("NtUserCreateWindowEx(): About to get non-client size.\n");
532   Result = WinPosGetNonClientSize(WindowObject->Self, 
533                                   &WindowObject->WindowRect,
534                                   &WindowObject->ClientRect);
535   W32kOffsetRect(&WindowObject->WindowRect, 
536                  MaxPos.x - WindowObject->WindowRect.left,
537                  MaxPos.y - WindowObject->WindowRect.top);
538
539   /* Send the CREATE message. */
540   DPRINT("NtUserCreateWindowEx(): about to send CREATE message.\n");
541   Result = W32kSendCREATEMessage(WindowObject->Self, &Cs);
542   if (Result == (LRESULT)-1)
543     {
544       /* FIXME: Cleanup. */
545       DPRINT("NtUserCreateWindowEx(): send CREATE message failed.\n");
546       return(NULL);
547     } 
548
549   /* Send move and size messages. */
550   if (!(WindowObject->Flags & WINDOWOBJECT_NEED_SIZE))
551     {
552       LONG lParam;
553       
554       lParam = 
555         MAKE_LONG(WindowObject->ClientRect.right - 
556                   WindowObject->ClientRect.left,
557                   WindowObject->ClientRect.bottom - 
558                   WindowObject->ClientRect.top);
559       DPRINT("NtUserCreateWindow(): About to send WM_SIZE\n");
560       W32kCallWindowProc(NULL, WindowObject->Self, WM_SIZE, SIZE_RESTORED, 
561                          lParam);
562       lParam = 
563         MAKE_LONG(WindowObject->ClientRect.left,
564                   WindowObject->ClientRect.top);
565       DPRINT("NtUserCreateWindow(): About to send WM_MOVE\n");
566       W32kCallWindowProc(NULL, WindowObject->Self, WM_MOVE, 0, lParam);
567     }
568
569   /* Show or maybe minimize or maximize the window. */
570   if (WindowObject->Style & (WS_MINIMIZE | WS_MAXIMIZE))
571     {
572       RECT NewPos;
573       UINT16 SwFlag;
574
575       SwFlag = (WindowObject->Style & WS_MINIMIZE) ? SW_MINIMIZE : 
576         SW_MAXIMIZE;
577       WinPosMinMaximize(WindowObject, SwFlag, &NewPos);
578       SwFlag = 
579         ((WindowObject->Style & WS_CHILD) || W32kGetActiveWindow()) ?
580         SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED :
581         SWP_NOZORDER | SWP_FRAMECHANGED;
582       DPRINT("NtUserCreateWindow(): About to minimize/maximize\n");
583       WinPosSetWindowPos(WindowObject->Self, 0, NewPos.left, NewPos.top,
584                          NewPos.right, NewPos.bottom, SwFlag);
585     }
586
587   /* Notify the parent window of a new child. */
588   if ((WindowObject->Style & WS_CHILD) ||
589       (!(WindowObject->ExStyle & WS_EX_NOPARENTNOTIFY)))
590     {
591       DPRINT("NtUserCreateWindow(): About to notify parent\n");
592       W32kCallWindowProc(NULL, WindowObject->Parent->Self,
593                          WM_PARENTNOTIFY, 
594                          MAKEWPARAM(WM_CREATE, WindowObject->IDMenu),
595                          (LPARAM)WindowObject->Self);
596     }
597
598   if (dwStyle & WS_VISIBLE)
599     {
600       DPRINT("NtUserCreateWindow(): About to show window\n");
601       WinPosShowWindow(WindowObject->Self, dwShowMode);
602     }
603
604   DPRINT("NtUserCreateWindow(): = %X\n", Handle);
605   return((HWND)Handle);
606 }
607
608 DWORD STDCALL
609 NtUserDeferWindowPos(HDWP WinPosInfo,
610                      HWND Wnd,
611                      HWND WndInsertAfter,
612                      LONG x,
613                      LONG y,
614                      LONG cx,
615                      LONG cy,
616                      UINT Flags)
617 {
618   UNIMPLEMENTED
619
620   return 0;
621 }
622
623 BOOLEAN STDCALL
624 NtUserDestroyWindow(HWND Wnd)
625 {
626   UNIMPLEMENTED
627
628   return 0;
629 }
630
631 DWORD STDCALL
632 NtUserEndDeferWindowPosEx(DWORD Unknown0,
633                           DWORD Unknown1)
634 {
635   UNIMPLEMENTED
636     
637   return 0;
638 }
639
640 DWORD STDCALL
641 NtUserFillWindow(DWORD Unknown0,
642                  DWORD Unknown1,
643                  DWORD Unknown2,
644                  DWORD Unknown3)
645 {
646   UNIMPLEMENTED
647
648   return 0;
649 }
650
651 HWND STDCALL
652 NtUserFindWindowEx(HWND hwndParent,
653                    HWND hwndChildAfter,
654                    PUNICODE_STRING ucClassName,
655                    PUNICODE_STRING ucWindowName,
656                    DWORD Unknown4)
657 {
658 #if 0
659   NTSTATUS status;
660   HWND windowHandle;
661   PWINDOW_OBJECT windowObject;
662   PLIST_ENTRY currentEntry;
663   PWNDCLASS_OBJECT classObject;
664   
665   W32kGuiCheck();
666   
667   status = ClassReferenceClassByNameOrAtom(&classObject, ucClassName->Buffer);
668   if (!NT_SUCCESS(status))
669     {
670       return (HWND)0;
671     }
672
673   ExAcquireFastMutexUnsafe (&PsGetWin32Process()->WindowListLock);
674   currentEntry = PsGetWin32Process()->WindowListHead.Flink;
675   while (currentEntry != &PsGetWin32Process()->WindowListHead)
676     {
677       windowObject = CONTAINING_RECORD (currentEntry, WINDOW_OBJECT, 
678                                         ListEntry);
679
680       if (classObject == windowObject->Class &&
681           RtlCompareUnicodeString (ucWindowName, &windowObject->WindowName, 
682                                    TRUE) == 0)
683         {
684           ObmCreateHandle(PsGetWin32Process()->HandleTable,
685                           windowObject,
686                           &windowHandle);
687           ExReleaseFastMutexUnsafe (&PsGetWin32Process()->WindowListLock);
688           ObmDereferenceObject (classObject);
689       
690           return  windowHandle;
691         }
692       currentEntry = currentEntry->Flink;
693   }
694   ExReleaseFastMutexUnsafe (&PsGetWin32Process()->WindowListLock);
695   
696   ObmDereferenceObject (classObject);
697
698   return  (HWND)0;
699 #endif
700 }
701
702 DWORD STDCALL
703 NtUserFlashWindowEx(DWORD Unknown0)
704 {
705   UNIMPLEMENTED
706
707   return 0;
708 }
709
710 DWORD STDCALL
711 NtUserGetForegroundWindow(VOID)
712 {
713   UNIMPLEMENTED
714
715   return 0;
716 }
717
718 DWORD STDCALL
719 NtUserGetInternalWindowPos(DWORD Unknown0,
720                            DWORD Unknown1,
721                            DWORD Unknown2)
722 {
723   UNIMPLEMENTED
724
725   return 0;
726 }
727
728 DWORD STDCALL
729 NtUserGetOpenClipboardWindow(VOID)
730 {
731   UNIMPLEMENTED
732
733   return 0;
734 }
735
736 DWORD STDCALL
737 NtUserGetWindowDC(DWORD Unknown0)
738 {
739   UNIMPLEMENTED
740
741   return 0;
742 }
743
744 DWORD STDCALL
745 NtUserGetWindowPlacement(DWORD Unknown0,
746                          DWORD Unknown1)
747 {
748   UNIMPLEMENTED
749
750   return 0;
751 }
752
753 DWORD STDCALL
754 NtUserInternalGetWindowText(DWORD Unknown0,
755                             DWORD Unknown1,
756                             DWORD Unknown2)
757 {
758   UNIMPLEMENTED
759
760   return 0;
761 }
762
763 DWORD STDCALL
764 NtUserLockWindowUpdate(DWORD Unknown0)
765 {
766   UNIMPLEMENTED
767
768   return 0;
769 }
770
771 DWORD STDCALL
772 NtUserMoveWindow(DWORD Unknown0,
773                  DWORD Unknown1,
774                  DWORD Unknown2,
775                  DWORD Unknown3,
776                  DWORD Unknown4,
777                  DWORD Unknown5)
778 {
779   UNIMPLEMENTED
780
781   return 0;
782 }
783
784 DWORD STDCALL
785 NtUserQueryWindow(DWORD Unknown0,
786                   DWORD Unknown1)
787 {
788   UNIMPLEMENTED
789
790   return 0;
791 }
792
793 DWORD STDCALL
794 NtUserRealChildWindowFromPoint(DWORD Unknown0,
795                                DWORD Unknown1,
796                                DWORD Unknown2)
797 {
798   UNIMPLEMENTED
799
800   return 0;
801 }
802
803 DWORD STDCALL
804 NtUserRedrawWindow(DWORD Unknown0,
805                    DWORD Unknown1,
806                    DWORD Unknown2,
807                    DWORD Unknown3)
808 {
809   UNIMPLEMENTED
810
811   return 0;
812 }
813
814 UINT STDCALL
815 NtUserRegisterWindowMessage(LPCWSTR MessageName)
816 {
817   UNIMPLEMENTED
818
819   return(0);
820 }
821
822 DWORD STDCALL
823 NtUserScrollWindowEx(DWORD Unknown0,
824                      DWORD Unknown1,
825                      DWORD Unknown2,
826                      DWORD Unknown3,
827                      DWORD Unknown4,
828                      DWORD Unknown5,
829                      DWORD Unknown6,
830                      DWORD Unknown7)
831 {
832   UNIMPLEMENTED
833
834   return 0;
835 }
836
837 DWORD STDCALL
838 NtUserSetActiveWindow(DWORD Unknown0)
839 {
840   UNIMPLEMENTED
841
842   return 0;
843 }
844
845 DWORD STDCALL
846 NtUserSetImeOwnerWindow(DWORD Unknown0,
847                         DWORD Unknown1)
848 {
849   UNIMPLEMENTED
850
851   return 0;
852 }
853
854 DWORD STDCALL
855 NtUserSetInternalWindowPos(DWORD Unknown0,
856                            DWORD Unknown1,
857                            DWORD Unknown2,
858                            DWORD Unknown3)
859 {
860   UNIMPLEMENTED
861
862   return 0;
863
864 }
865
866 DWORD STDCALL
867 NtUserSetLayeredWindowAttributes(DWORD Unknown0,
868                                  DWORD Unknown1,
869                                  DWORD Unknown2,
870                                  DWORD Unknown3)
871 {
872   UNIMPLEMENTED
873
874   return 0;
875 }
876
877 DWORD STDCALL
878 NtUserSetLogonNotifyWindow(DWORD Unknown0)
879 {
880   UNIMPLEMENTED
881
882   return 0;
883 }
884
885 DWORD STDCALL
886 NtUserSetShellWindowEx(DWORD Unknown0,
887                        DWORD Unknown1)
888 {
889   UNIMPLEMENTED
890
891   return 0;
892 }
893
894 DWORD STDCALL
895 NtUserSetWindowFNID(DWORD Unknown0,
896                     DWORD Unknown1)
897 {
898   UNIMPLEMENTED
899
900   return 0;
901 }
902
903 DWORD STDCALL
904 NtUserGetWindowLong(HWND hWnd, DWORD Index)
905 {
906   PWINDOW_OBJECT WindowObject;
907   NTSTATUS Status;
908   DWORD Result;
909
910   W32kGuiCheck();
911
912   Status = 
913     ObmReferenceObjectByHandle(PsGetWin32Process()->WindowStation->HandleTable,
914                                hWnd,
915                                otWindow,
916                                (PVOID*)&WindowObject);
917   if (!NT_SUCCESS(Status))
918     {
919       return(0);
920     }
921
922   switch (Index)
923     {
924     case GWL_EXSTYLE:
925       {
926         Result = (DWORD)WindowObject->ExStyle;
927         break;
928       }
929
930     case GWL_STYLE:
931       {
932         Result = (DWORD)WindowObject->Style;
933         break;
934       }
935
936     case GWL_WNDPROC:
937       {
938         Result = (DWORD)WindowObject->Class->Class.lpfnWndProc; 
939         break;
940       }
941
942     default:
943       {
944         DPRINT1("NtUserGetWindowLong(): Unsupported index %d\n", Index);
945         Result = 0;
946         break;
947       }
948     }
949
950   ObmDereferenceObject(WindowObject);
951   return(Result);
952 }
953
954 DWORD STDCALL
955 NtUserSetWindowLong(DWORD Unknown0,
956                     DWORD Unknown1,
957                     DWORD Unknown2,
958                     DWORD Unknown3)
959 {
960   UNIMPLEMENTED
961
962   return 0;
963 }
964
965 DWORD STDCALL
966 NtUserSetWindowPlacement(DWORD Unknown0,
967                          DWORD Unknown1)
968 {
969   UNIMPLEMENTED
970
971   return 0;
972 }
973
974 DWORD STDCALL
975 NtUserSetWindowPos(DWORD Unknown0,
976                    DWORD Unknown1,
977                    DWORD Unknown2,
978                    DWORD Unknown3,
979                    DWORD Unknown4,
980                    DWORD Unknown5,
981                    DWORD Unknown6)
982 {
983   UNIMPLEMENTED
984
985   return 0;
986 }
987
988 DWORD STDCALL
989 NtUserSetWindowRgn(DWORD Unknown0,
990                    DWORD Unknown1,
991                    DWORD Unknown2)
992 {
993   UNIMPLEMENTED
994
995   return 0;
996 }
997
998 DWORD STDCALL
999 NtUserSetWindowWord(DWORD Unknown0,
1000                     DWORD Unknown1,
1001                     DWORD Unknown2)
1002 {
1003   UNIMPLEMENTED
1004
1005   return 0;
1006 }
1007
1008 BOOL STDCALL
1009 NtUserShowWindow(HWND hWnd,
1010                  LONG nCmdShow)
1011 {
1012   W32kGuiCheck();
1013
1014   return(WinPosShowWindow(hWnd, nCmdShow));
1015 }
1016
1017 DWORD STDCALL
1018 NtUserShowWindowAsync(DWORD Unknown0,
1019                       DWORD Unknown1)
1020 {
1021   UNIMPLEMENTED
1022
1023   return 0;
1024 }
1025
1026 DWORD STDCALL
1027 NtUserUpdateLayeredWindow(DWORD Unknown0,
1028                           DWORD Unknown1,
1029                           DWORD Unknown2,
1030                           DWORD Unknown3,
1031                           DWORD Unknown4,
1032                           DWORD Unknown5,
1033                           DWORD Unknown6,
1034                           DWORD Unknown7,
1035                           DWORD Unknown8)
1036 {
1037   UNIMPLEMENTED
1038
1039   return 0;
1040 }
1041
1042 DWORD STDCALL
1043 NtUserWindowFromPoint(DWORD Unknown0,
1044                       DWORD Unknown1)
1045 {
1046   UNIMPLEMENTED
1047
1048   return 0;
1049 }
1050
1051 /* EOF */