:pserver:cvsanon@mok.lvcm.com:/CVS/ReactOS reactos
[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   /* Send a NCCREATE message. */
501   Cs.lpCreateParams = lpParam;
502   Cs.hInstance = hInstance;
503   Cs.hMenu = hMenu;
504   Cs.hwndParent = hWndParent;
505   Cs.cx = nWidth;
506   Cs.cy = nHeight;
507   Cs.x = x;
508   Cs.y = y;
509   Cs.style = dwStyle;
510   Cs.lpszName = lpWindowName->Buffer;
511   Cs.lpszClass = lpClassName->Buffer;
512   Cs.dwExStyle = dwExStyle;
513   DPRINT("NtUserCreateWindowEx(): About to send NCCREATE message.\n");
514   Result = W32kSendNCCREATEMessage(WindowObject->Self, &Cs);
515   if (!Result)
516     {
517       /* FIXME: Cleanup. */
518       DPRINT("NtUserCreateWindowEx(): NCCREATE message failed.\n");
519       return(NULL);
520     }
521  
522   /* Calculate the non-client size. */
523   MaxPos.x = WindowObject->WindowRect.left;
524   MaxPos.y = WindowObject->WindowRect.top;
525   DPRINT("NtUserCreateWindowEx(): About to get non-client size.\n");
526   Result = WinPosGetNonClientSize(WindowObject->Self, 
527                                   &WindowObject->WindowRect,
528                                   &WindowObject->ClientRect);
529   W32kOffsetRect(&WindowObject->WindowRect, 
530                  MaxPos.x - WindowObject->WindowRect.left,
531                  MaxPos.y - WindowObject->WindowRect.top);
532
533   /* Send the CREATE message. */
534   DPRINT("NtUserCreateWindowEx(): about to send CREATE message.\n");
535   Result = W32kSendCREATEMessage(WindowObject->Self, &Cs);
536   if (Result == (LRESULT)-1)
537     {
538       /* FIXME: Cleanup. */
539       DPRINT("NtUserCreateWindowEx(): send CREATE message failed.\n");
540       return(NULL);
541     } 
542
543   /* Send move and size messages. */
544   if (!(WindowObject->Flags & WINDOWOBJECT_NEED_SIZE))
545     {
546       LONG lParam;
547       
548       lParam = 
549         MAKE_LONG(WindowObject->ClientRect.right - 
550                   WindowObject->ClientRect.left,
551                   WindowObject->ClientRect.bottom - 
552                   WindowObject->ClientRect.top);
553       DPRINT("NtUserCreateWindow(): About to send WM_SIZE\n");
554       W32kCallWindowProc(NULL, WindowObject->Self, WM_SIZE, SIZE_RESTORED, 
555                          lParam);
556       lParam = 
557         MAKE_LONG(WindowObject->ClientRect.left,
558                   WindowObject->ClientRect.top);
559       DPRINT("NtUserCreateWindow(): About to send WM_MOVE\n");
560       W32kCallWindowProc(NULL, WindowObject->Self, WM_MOVE, 0, lParam);
561     }
562
563   /* Show or maybe minimize or maximize the window. */
564   if (WindowObject->Style & (WS_MINIMIZE | WS_MAXIMIZE))
565     {
566       RECT NewPos;
567       UINT16 SwFlag;
568
569       SwFlag = (WindowObject->Style & WS_MINIMIZE) ? SW_MINIMIZE : 
570         SW_MAXIMIZE;
571       WinPosMinMaximize(WindowObject, SwFlag, &NewPos);
572       SwFlag = 
573         ((WindowObject->Style & WS_CHILD) || W32kGetActiveWindow()) ?
574         SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED :
575         SWP_NOZORDER | SWP_FRAMECHANGED;
576       DPRINT("NtUserCreateWindow(): About to minimize/maximize\n");
577       WinPosSetWindowPos(WindowObject->Self, 0, NewPos.left, NewPos.top,
578                          NewPos.right, NewPos.bottom, SwFlag);
579     }
580
581   /* Notify the parent window of a new child. */
582   if ((WindowObject->Style & WS_CHILD) ||
583       (!(WindowObject->ExStyle & WS_EX_NOPARENTNOTIFY)))
584     {
585       DPRINT("NtUserCreateWindow(): About to notify parent\n");
586       W32kCallWindowProc(NULL, WindowObject->Parent->Self,
587                          WM_PARENTNOTIFY, 
588                          MAKEWPARAM(WM_CREATE, WindowObject->IDMenu),
589                          (LPARAM)WindowObject->Self);
590     }
591
592   if (dwStyle & WS_VISIBLE)
593     {
594       DPRINT("NtUserCreateWindow(): About to show window\n");
595       WinPosShowWindow(WindowObject->Self, dwShowMode);
596     }
597
598   DPRINT("NtUserCreateWindow(): = %X\n", Handle);
599   return((HWND)Handle);
600 }
601
602 DWORD STDCALL
603 NtUserDeferWindowPos(HDWP WinPosInfo,
604                      HWND Wnd,
605                      HWND WndInsertAfter,
606                      LONG x,
607                      LONG y,
608                      LONG cx,
609                      LONG cy,
610                      UINT Flags)
611 {
612   UNIMPLEMENTED
613
614   return 0;
615 }
616
617 BOOLEAN STDCALL
618 NtUserDestroyWindow(HWND Wnd)
619 {
620   UNIMPLEMENTED
621
622   return 0;
623 }
624
625 DWORD STDCALL
626 NtUserEndDeferWindowPosEx(DWORD Unknown0,
627                           DWORD Unknown1)
628 {
629   UNIMPLEMENTED
630     
631   return 0;
632 }
633
634 DWORD STDCALL
635 NtUserFillWindow(DWORD Unknown0,
636                  DWORD Unknown1,
637                  DWORD Unknown2,
638                  DWORD Unknown3)
639 {
640   UNIMPLEMENTED
641
642   return 0;
643 }
644
645 HWND STDCALL
646 NtUserFindWindowEx(HWND hwndParent,
647                    HWND hwndChildAfter,
648                    PUNICODE_STRING ucClassName,
649                    PUNICODE_STRING ucWindowName,
650                    DWORD Unknown4)
651 {
652 #if 0
653   NTSTATUS status;
654   HWND windowHandle;
655   PWINDOW_OBJECT windowObject;
656   PLIST_ENTRY currentEntry;
657   PWNDCLASS_OBJECT classObject;
658   
659   W32kGuiCheck();
660   
661   status = ClassReferenceClassByNameOrAtom(&classObject, ucClassName->Buffer);
662   if (!NT_SUCCESS(status))
663     {
664       return (HWND)0;
665     }
666
667   ExAcquireFastMutexUnsafe (&PsGetWin32Process()->WindowListLock);
668   currentEntry = PsGetWin32Process()->WindowListHead.Flink;
669   while (currentEntry != &PsGetWin32Process()->WindowListHead)
670     {
671       windowObject = CONTAINING_RECORD (currentEntry, WINDOW_OBJECT, 
672                                         ListEntry);
673
674       if (classObject == windowObject->Class &&
675           RtlCompareUnicodeString (ucWindowName, &windowObject->WindowName, 
676                                    TRUE) == 0)
677         {
678           ObmCreateHandle(PsGetWin32Process()->HandleTable,
679                           windowObject,
680                           &windowHandle);
681           ExReleaseFastMutexUnsafe (&PsGetWin32Process()->WindowListLock);
682           ObmDereferenceObject (classObject);
683       
684           return  windowHandle;
685         }
686       currentEntry = currentEntry->Flink;
687   }
688   ExReleaseFastMutexUnsafe (&PsGetWin32Process()->WindowListLock);
689   
690   ObmDereferenceObject (classObject);
691
692   return  (HWND)0;
693 #endif
694 }
695
696 DWORD STDCALL
697 NtUserFlashWindowEx(DWORD Unknown0)
698 {
699   UNIMPLEMENTED
700
701   return 0;
702 }
703
704 DWORD STDCALL
705 NtUserGetForegroundWindow(VOID)
706 {
707   UNIMPLEMENTED
708
709   return 0;
710 }
711
712 DWORD STDCALL
713 NtUserGetInternalWindowPos(DWORD Unknown0,
714                            DWORD Unknown1,
715                            DWORD Unknown2)
716 {
717   UNIMPLEMENTED
718
719   return 0;
720 }
721
722 DWORD STDCALL
723 NtUserGetOpenClipboardWindow(VOID)
724 {
725   UNIMPLEMENTED
726
727   return 0;
728 }
729
730 DWORD STDCALL
731 NtUserGetWindowDC(DWORD Unknown0)
732 {
733   UNIMPLEMENTED
734
735   return 0;
736 }
737
738 DWORD STDCALL
739 NtUserGetWindowPlacement(DWORD Unknown0,
740                          DWORD Unknown1)
741 {
742   UNIMPLEMENTED
743
744   return 0;
745 }
746
747 DWORD STDCALL
748 NtUserInternalGetWindowText(DWORD Unknown0,
749                             DWORD Unknown1,
750                             DWORD Unknown2)
751 {
752   UNIMPLEMENTED
753
754   return 0;
755 }
756
757 DWORD STDCALL
758 NtUserLockWindowUpdate(DWORD Unknown0)
759 {
760   UNIMPLEMENTED
761
762   return 0;
763 }
764
765 DWORD STDCALL
766 NtUserMoveWindow(DWORD Unknown0,
767                  DWORD Unknown1,
768                  DWORD Unknown2,
769                  DWORD Unknown3,
770                  DWORD Unknown4,
771                  DWORD Unknown5)
772 {
773   UNIMPLEMENTED
774
775   return 0;
776 }
777
778 DWORD STDCALL
779 NtUserQueryWindow(DWORD Unknown0,
780                   DWORD Unknown1)
781 {
782   UNIMPLEMENTED
783
784   return 0;
785 }
786
787 DWORD STDCALL
788 NtUserRealChildWindowFromPoint(DWORD Unknown0,
789                                DWORD Unknown1,
790                                DWORD Unknown2)
791 {
792   UNIMPLEMENTED
793
794   return 0;
795 }
796
797 DWORD STDCALL
798 NtUserRedrawWindow(DWORD Unknown0,
799                    DWORD Unknown1,
800                    DWORD Unknown2,
801                    DWORD Unknown3)
802 {
803   UNIMPLEMENTED
804
805   return 0;
806 }
807
808 UINT STDCALL
809 NtUserRegisterWindowMessage(LPCWSTR MessageName)
810 {
811   UNIMPLEMENTED
812
813   return(0);
814 }
815
816 DWORD STDCALL
817 NtUserScrollWindowEx(DWORD Unknown0,
818                      DWORD Unknown1,
819                      DWORD Unknown2,
820                      DWORD Unknown3,
821                      DWORD Unknown4,
822                      DWORD Unknown5,
823                      DWORD Unknown6,
824                      DWORD Unknown7)
825 {
826   UNIMPLEMENTED
827
828   return 0;
829 }
830
831 DWORD STDCALL
832 NtUserSetActiveWindow(DWORD Unknown0)
833 {
834   UNIMPLEMENTED
835
836   return 0;
837 }
838
839 DWORD STDCALL
840 NtUserSetImeOwnerWindow(DWORD Unknown0,
841                         DWORD Unknown1)
842 {
843   UNIMPLEMENTED
844
845   return 0;
846 }
847
848 DWORD STDCALL
849 NtUserSetInternalWindowPos(DWORD Unknown0,
850                            DWORD Unknown1,
851                            DWORD Unknown2,
852                            DWORD Unknown3)
853 {
854   UNIMPLEMENTED
855
856   return 0;
857
858 }
859
860 DWORD STDCALL
861 NtUserSetLayeredWindowAttributes(DWORD Unknown0,
862                                  DWORD Unknown1,
863                                  DWORD Unknown2,
864                                  DWORD Unknown3)
865 {
866   UNIMPLEMENTED
867
868   return 0;
869 }
870
871 DWORD STDCALL
872 NtUserSetLogonNotifyWindow(DWORD Unknown0)
873 {
874   UNIMPLEMENTED
875
876   return 0;
877 }
878
879 DWORD STDCALL
880 NtUserSetShellWindowEx(DWORD Unknown0,
881                        DWORD Unknown1)
882 {
883   UNIMPLEMENTED
884
885   return 0;
886 }
887
888 DWORD STDCALL
889 NtUserSetWindowFNID(DWORD Unknown0,
890                     DWORD Unknown1)
891 {
892   UNIMPLEMENTED
893
894   return 0;
895 }
896
897 DWORD STDCALL
898 NtUserGetWindowLong(HWND hWnd, DWORD Index)
899 {
900   PWINDOW_OBJECT WindowObject;
901   NTSTATUS Status;
902   DWORD Result;
903
904   W32kGuiCheck();
905
906   Status = 
907     ObmReferenceObjectByHandle(PsGetWin32Process()->WindowStation->HandleTable,
908                                hWnd,
909                                otWindow,
910                                (PVOID*)&WindowObject);
911   if (!NT_SUCCESS(Status))
912     {
913       return(0);
914     }
915
916   switch (Index)
917     {
918     case GWL_EXSTYLE:
919       {
920         Result = (DWORD)WindowObject->ExStyle;
921         break;
922       }
923
924     case GWL_STYLE:
925       {
926         Result = (DWORD)WindowObject->Style;
927         break;
928       }
929
930     case GWL_WNDPROC:
931       {
932         Result = (DWORD)WindowObject->Class->Class.lpfnWndProc; 
933         break;
934       }
935
936     default:
937       {
938         DPRINT1("NtUserGetWindowLong(): Unsupported index %d\n", Index);
939         Result = 0;
940         break;
941       }
942     }
943
944   ObmDereferenceObject(WindowObject);
945   return(Result);
946 }
947
948 DWORD STDCALL
949 NtUserSetWindowLong(DWORD Unknown0,
950                     DWORD Unknown1,
951                     DWORD Unknown2,
952                     DWORD Unknown3)
953 {
954   UNIMPLEMENTED
955
956   return 0;
957 }
958
959 DWORD STDCALL
960 NtUserSetWindowPlacement(DWORD Unknown0,
961                          DWORD Unknown1)
962 {
963   UNIMPLEMENTED
964
965   return 0;
966 }
967
968 DWORD STDCALL
969 NtUserSetWindowPos(DWORD Unknown0,
970                    DWORD Unknown1,
971                    DWORD Unknown2,
972                    DWORD Unknown3,
973                    DWORD Unknown4,
974                    DWORD Unknown5,
975                    DWORD Unknown6)
976 {
977   UNIMPLEMENTED
978
979   return 0;
980 }
981
982 DWORD STDCALL
983 NtUserSetWindowRgn(DWORD Unknown0,
984                    DWORD Unknown1,
985                    DWORD Unknown2)
986 {
987   UNIMPLEMENTED
988
989   return 0;
990 }
991
992 DWORD STDCALL
993 NtUserSetWindowWord(DWORD Unknown0,
994                     DWORD Unknown1,
995                     DWORD Unknown2)
996 {
997   UNIMPLEMENTED
998
999   return 0;
1000 }
1001
1002 BOOL STDCALL
1003 NtUserShowWindow(HWND hWnd,
1004                  LONG nCmdShow)
1005 {
1006   W32kGuiCheck();
1007
1008   return(WinPosShowWindow(hWnd, nCmdShow));
1009 }
1010
1011 DWORD STDCALL
1012 NtUserShowWindowAsync(DWORD Unknown0,
1013                       DWORD Unknown1)
1014 {
1015   UNIMPLEMENTED
1016
1017   return 0;
1018 }
1019
1020 DWORD STDCALL
1021 NtUserUpdateLayeredWindow(DWORD Unknown0,
1022                           DWORD Unknown1,
1023                           DWORD Unknown2,
1024                           DWORD Unknown3,
1025                           DWORD Unknown4,
1026                           DWORD Unknown5,
1027                           DWORD Unknown6,
1028                           DWORD Unknown7,
1029                           DWORD Unknown8)
1030 {
1031   UNIMPLEMENTED
1032
1033   return 0;
1034 }
1035
1036 DWORD STDCALL
1037 NtUserWindowFromPoint(DWORD Unknown0,
1038                       DWORD Unknown1)
1039 {
1040   UNIMPLEMENTED
1041
1042   return 0;
1043 }
1044
1045 /* EOF */