branch update for HEAD-2003050101
[reactos.git] / lib / user32 / windows / window.c
1 /* $Id$
2  *
3  * COPYRIGHT:       See COPYING in the top level directory
4  * PROJECT:         ReactOS user32.dll
5  * FILE:            lib/user32/windows/window.c
6  * PURPOSE:         Window management
7  * PROGRAMMER:      Casper S. Hornstrup (chorns@users.sourceforge.net)
8  * UPDATE HISTORY:
9  *      06-06-2001  CSH  Created
10  */
11
12 /* INCLUDES ******************************************************************/
13
14 #include <windows.h>
15 #include <user32.h>
16 #include <window.h>
17 #include <debug.h>
18 #include <user32/callback.h>
19
20 /* FUNCTIONS *****************************************************************/
21 ULONG
22    WinHasThickFrameStyle(ULONG Style, ULONG ExStyle)
23 {
24   return((Style & WS_THICKFRAME) &&
25          (!((Style & (WS_DLGFRAME | WS_BORDER)) == WS_DLGFRAME)));
26 }
27
28 NTSTATUS STDCALL
29 User32SendNCCALCSIZEMessageForKernel(PVOID Arguments, ULONG ArgumentLength)
30 {
31   PSENDNCCALCSIZEMESSAGE_CALLBACK_ARGUMENTS CallbackArgs;
32   SENDNCCALCSIZEMESSAGE_CALLBACK_RESULT Result;
33   WNDPROC Proc;
34
35   DbgPrint("User32SendNCCALCSIZEMessageForKernel.\n");
36   CallbackArgs = (PSENDNCCALCSIZEMESSAGE_CALLBACK_ARGUMENTS)Arguments;
37   if (ArgumentLength != sizeof(SENDNCCALCSIZEMESSAGE_CALLBACK_ARGUMENTS))
38     {
39       DbgPrint("Wrong length.\n");
40       return(STATUS_INFO_LENGTH_MISMATCH);
41     }
42   Proc = (WNDPROC)GetWindowLongW(CallbackArgs->Wnd, GWL_WNDPROC);
43   DbgPrint("Proc %X\n", Proc);
44   /* Call the window procedure; notice kernel messages are always unicode. */
45   if (CallbackArgs->Validate)
46     {
47       Result.Result = CallWindowProcW(Proc, CallbackArgs->Wnd, WM_NCCALCSIZE, 
48                                       TRUE, 
49                                       (LPARAM)&CallbackArgs->Params);
50       Result.Params = CallbackArgs->Params;
51     }
52   else
53     {
54       Result.Result = CallWindowProcW(Proc, CallbackArgs->Wnd, WM_NCCALCSIZE,
55                                       FALSE, (LPARAM)&CallbackArgs->Rect);
56       Result.Rect = CallbackArgs->Rect;
57     }
58   DbgPrint("Returning result %d.\n", Result);
59   return(ZwCallbackReturn(&Result, sizeof(Result), STATUS_SUCCESS));
60 }
61
62 NTSTATUS STDCALL
63 User32SendGETMINMAXINFOMessageForKernel(PVOID Arguments, ULONG ArgumentLength)
64 {
65   PSENDGETMINMAXINFO_CALLBACK_ARGUMENTS CallbackArgs;
66   SENDGETMINMAXINFO_CALLBACK_RESULT Result;
67   WNDPROC Proc;
68
69   DbgPrint("User32SendGETMINAXINFOMessageForKernel.\n");
70   CallbackArgs = (PSENDGETMINMAXINFO_CALLBACK_ARGUMENTS)Arguments;
71   if (ArgumentLength != sizeof(SENDGETMINMAXINFO_CALLBACK_ARGUMENTS))
72     {
73       DbgPrint("Wrong length.\n");
74       return(STATUS_INFO_LENGTH_MISMATCH);
75     }
76   Proc = (WNDPROC)GetWindowLongW(CallbackArgs->Wnd, GWL_WNDPROC);
77   DbgPrint("Proc %X\n", Proc);
78   /* Call the window procedure; notice kernel messages are always unicode. */
79   Result.Result = CallWindowProcW(Proc, CallbackArgs->Wnd, WM_GETMINMAXINFO, 
80                                   0, (LPARAM)&CallbackArgs->MinMaxInfo);
81   Result.MinMaxInfo = CallbackArgs->MinMaxInfo;
82   DbgPrint("Returning result %d.\n", Result);
83   return(ZwCallbackReturn(&Result, sizeof(Result), STATUS_SUCCESS));
84 }
85
86 NTSTATUS STDCALL
87 User32SendCREATEMessageForKernel(PVOID Arguments, ULONG ArgumentLength)
88 {
89   PSENDCREATEMESSAGE_CALLBACK_ARGUMENTS CallbackArgs;
90   WNDPROC Proc;
91   LRESULT Result;
92
93   DbgPrint("User32SendCREATEMessageForKernel.\n");
94   CallbackArgs = (PSENDCREATEMESSAGE_CALLBACK_ARGUMENTS)Arguments;
95   if (ArgumentLength != sizeof(SENDCREATEMESSAGE_CALLBACK_ARGUMENTS))
96     {
97       DbgPrint("Wrong length.\n");
98       return(STATUS_INFO_LENGTH_MISMATCH);
99     }
100   Proc = (WNDPROC)GetWindowLongW(CallbackArgs->Wnd, GWL_WNDPROC);
101   DbgPrint("Proc %X\n", Proc);
102   /* Call the window procedure; notice kernel messages are always unicode. */
103   Result = CallWindowProcW(Proc, CallbackArgs->Wnd, WM_CREATE, 0, 
104                            (LPARAM)&CallbackArgs->CreateStruct);
105   DbgPrint("Returning result %d.\n", Result);
106   return(ZwCallbackReturn(&Result, sizeof(LRESULT), STATUS_SUCCESS));
107 }
108
109 NTSTATUS STDCALL
110 User32SendNCCREATEMessageForKernel(PVOID Arguments, ULONG ArgumentLength)
111 {
112   PSENDNCCREATEMESSAGE_CALLBACK_ARGUMENTS CallbackArgs;
113   WNDPROC Proc;
114   LRESULT Result;
115
116   DbgPrint("User32SendNCCREATEMessageForKernel.\n");
117   CallbackArgs = (PSENDNCCREATEMESSAGE_CALLBACK_ARGUMENTS)Arguments;
118   if (ArgumentLength != sizeof(SENDNCCREATEMESSAGE_CALLBACK_ARGUMENTS))
119     {
120       DbgPrint("Wrong length.\n");
121       return(STATUS_INFO_LENGTH_MISMATCH);
122     }
123   Proc = (WNDPROC)GetWindowLongW(CallbackArgs->Wnd, GWL_WNDPROC);
124   DbgPrint("Proc %X\n", Proc);
125   /* Call the window procedure; notice kernel messages are always unicode. */
126   Result = CallWindowProcW(Proc, CallbackArgs->Wnd, WM_NCCREATE, 0, 
127                            (LPARAM)&CallbackArgs->CreateStruct);
128   DbgPrint("Returning result %d.\n", Result);
129   return(ZwCallbackReturn(&Result, sizeof(LRESULT), STATUS_SUCCESS));
130 }
131
132 NTSTATUS STDCALL
133 User32CallSendAsyncProcForKernel(PVOID Arguments, ULONG ArgumentLength)
134 {
135   PSENDASYNCPROC_CALLBACK_ARGUMENTS CallbackArgs;
136
137   DbgPrint("User32CallSendAsyncProcKernel()\n");
138   CallbackArgs = (PSENDASYNCPROC_CALLBACK_ARGUMENTS)Arguments;
139   if (ArgumentLength != sizeof(WINDOWPROC_CALLBACK_ARGUMENTS))
140     {
141       return(STATUS_INFO_LENGTH_MISMATCH);
142     }
143   CallbackArgs->Callback(CallbackArgs->Wnd, CallbackArgs->Msg,
144                          CallbackArgs->Context, CallbackArgs->Result);
145   return(STATUS_SUCCESS);
146 }
147
148 NTSTATUS STDCALL
149 User32CallWindowProcFromKernel(PVOID Arguments, ULONG ArgumentLength)
150 {
151   PWINDOWPROC_CALLBACK_ARGUMENTS CallbackArgs;
152   LRESULT Result;
153
154   CallbackArgs = (PWINDOWPROC_CALLBACK_ARGUMENTS)Arguments;
155   if (ArgumentLength != sizeof(WINDOWPROC_CALLBACK_ARGUMENTS))
156     {
157       return(STATUS_INFO_LENGTH_MISMATCH);
158     }
159   if (CallbackArgs->Proc == NULL)
160     {
161       CallbackArgs->Proc = (WNDPROC)GetWindowLong(CallbackArgs->Wnd, 
162                                                   GWL_WNDPROC);
163     }
164   Result = CallWindowProcW(CallbackArgs->Proc, CallbackArgs->Wnd, 
165                            CallbackArgs->Msg, CallbackArgs->wParam, 
166                            CallbackArgs->lParam);
167   return(ZwCallbackReturn(&Result, sizeof(LRESULT), STATUS_SUCCESS));
168 }
169
170 static void NC_AdjustRectOuter95 (LPRECT rect, DWORD style, BOOL menu, DWORD exStyle)
171 {
172     int adjust;
173     if(style & WS_ICONIC) return;
174
175     if ((exStyle & (WS_EX_STATICEDGE|WS_EX_DLGMODALFRAME)) ==
176         WS_EX_STATICEDGE)
177     {
178         adjust = 1; /* for the outer frame always present */
179     }
180     else
181     {
182         adjust = 0;
183         if ((exStyle & WS_EX_DLGMODALFRAME) ||
184             (style & (WS_THICKFRAME|WS_DLGFRAME))) adjust = 2; /* outer */
185     }
186     if (style & WS_THICKFRAME)
187         adjust +=  ( GetSystemMetrics (SM_CXFRAME)
188                    - GetSystemMetrics (SM_CXDLGFRAME)); /* The resize border */
189     if ((style & (WS_BORDER|WS_DLGFRAME)) ||
190         (exStyle & WS_EX_DLGMODALFRAME))
191         adjust++; /* The other border */
192
193     InflateRect (rect, adjust, adjust);
194
195     if ((style & WS_CAPTION) == WS_CAPTION)
196     {
197         if (exStyle & WS_EX_TOOLWINDOW)
198             rect->top -= GetSystemMetrics(SM_CYSMCAPTION);
199         else
200             rect->top -= GetSystemMetrics(SM_CYCAPTION);
201     }
202     if (menu) rect->top -= GetSystemMetrics(SM_CYMENU);
203 }
204
205 static void
206 NC_AdjustRectInner95 (LPRECT rect, DWORD style, DWORD exStyle)
207 {
208     if(style & WS_ICONIC) return;
209
210     if (exStyle & WS_EX_CLIENTEDGE)
211         InflateRect(rect, GetSystemMetrics(SM_CXEDGE), GetSystemMetrics(SM_CYEDGE));
212
213     if (style & WS_VSCROLL)
214     {
215         if((exStyle & WS_EX_LEFTSCROLLBAR) != 0)
216             rect->left  -= GetSystemMetrics(SM_CXVSCROLL);
217         else
218             rect->right += GetSystemMetrics(SM_CXVSCROLL);
219     }
220     if (style & WS_HSCROLL) rect->bottom += GetSystemMetrics(SM_CYHSCROLL);
221 }
222
223 WINBOOL STDCALL
224 AdjustWindowRect(LPRECT lpRect,
225                  DWORD dwStyle,
226                  WINBOOL bMenu)
227 {
228   return(AdjustWindowRectEx(lpRect, dwStyle, bMenu, 0));
229 }
230
231 WINBOOL STDCALL
232 AdjustWindowRectEx(LPRECT lpRect, 
233                    DWORD dwStyle, 
234                    WINBOOL bMenu, 
235                    DWORD dwExStyle)
236 {
237     dwStyle &= (WS_DLGFRAME | WS_BORDER | WS_THICKFRAME | WS_CHILD);
238     dwExStyle &= (WS_EX_DLGMODALFRAME | WS_EX_CLIENTEDGE |
239                 WS_EX_STATICEDGE | WS_EX_TOOLWINDOW);
240     if (dwExStyle & WS_EX_DLGMODALFRAME) dwStyle &= ~WS_THICKFRAME;
241
242     NC_AdjustRectOuter95( lpRect, dwStyle, bMenu, dwExStyle );
243     NC_AdjustRectInner95( lpRect, dwStyle, dwExStyle );
244     lpRect->right += 2;
245     lpRect->bottom += 2;
246     return TRUE;
247 }
248
249 WINBOOL STDCALL
250 AllowSetForegroundWindow(DWORD dwProcessId)
251 {
252   return(FALSE);
253 }
254
255 WINBOOL STDCALL
256 AnimateWindow(HWND hwnd,
257               DWORD dwTime,
258               DWORD dwFlags)
259 {
260   return FALSE;
261 }
262
263 UINT STDCALL
264 ArrangeIconicWindows(HWND hWnd)
265 {
266   return 0;
267 }
268
269 HDWP STDCALL
270 BeginDeferWindowPos(int nNumWindows)
271 {
272   return (HDWP)0;
273 }
274
275 WINBOOL STDCALL
276 BringWindowToTop(HWND hWnd)
277 {
278   return FALSE;
279 }
280
281 WORD STDCALL
282 CascadeWindows(HWND hwndParent,
283                UINT wHow,
284                CONST RECT *lpRect,
285                UINT cKids,
286                const HWND *lpKids)
287 {
288   return 0;
289 }
290
291 HWND STDCALL
292 ChildWindowFromPoint(HWND hWndParent,
293                      POINT Point)
294 {
295   return (HWND)0;
296 }
297
298 HWND STDCALL
299 ChildWindowFromPointEx(HWND hwndParent,
300                        POINT pt,
301                        UINT uFlags)
302 {
303   return (HWND)0;
304 }
305
306 WINBOOL STDCALL
307 CloseWindow(HWND hWnd)
308 {
309     SendMessageA(hWnd, WM_CLOSE, 0, 0);
310     SendMessageA(hWnd, WM_SYSCOMMAND, SC_CLOSE, 0);
311     
312     return (WINBOOL)(hWnd);
313 }
314
315 HWND STDCALL
316 CreateWindowExA(DWORD dwExStyle,
317                 LPCSTR lpClassName,
318                 LPCSTR lpWindowName,
319                 DWORD dwStyle,
320                 int x,
321                 int y,
322                 int nWidth,
323                 int nHeight,
324                 HWND hWndParent,
325                 HMENU hMenu,
326                 HINSTANCE hInstance,
327                 LPVOID lpParam)
328 {
329   UNICODE_STRING WindowName;
330   UNICODE_STRING ClassName;
331   HWND Handle;
332   INT sw;
333   
334   if (IS_ATOM(lpClassName)) 
335     {
336       RtlInitUnicodeString(&ClassName, NULL);
337       ClassName.Buffer = (LPWSTR)lpClassName;
338     } 
339   else 
340     {
341       if (!RtlCreateUnicodeStringFromAsciiz(&(ClassName), (PCSZ)lpClassName)) 
342         {
343           SetLastError(ERROR_OUTOFMEMORY);
344           return (HWND)0;
345         }
346     }
347
348   if (!RtlCreateUnicodeStringFromAsciiz(&WindowName, (PCSZ)lpWindowName)) 
349     {
350       if (!IS_ATOM(lpClassName)) 
351         {
352           RtlFreeUnicodeString(&ClassName);
353         }
354       SetLastError(ERROR_OUTOFMEMORY);
355       return (HWND)0;
356     }
357
358   /* Fixup default coordinates. */
359   sw = SW_SHOW;
360   if (x == (LONG) CW_USEDEFAULT || nWidth == (LONG) CW_USEDEFAULT)
361     {
362       if (dwStyle & (WS_CHILD | WS_POPUP))
363         {
364           if (x == (LONG) CW_USEDEFAULT)
365             {
366               x = y = 0;
367             }
368           if (nWidth == (LONG) CW_USEDEFAULT)
369             {
370               nWidth = nHeight = 0;
371             }
372         }
373       else
374         {
375           STARTUPINFOA info;
376
377           GetStartupInfoA(&info);
378
379           if (x == (LONG) CW_USEDEFAULT)
380             {
381               if (y != (LONG) CW_USEDEFAULT)
382                 {
383                   sw = y;
384                 }
385               x = (info.dwFlags & STARTF_USEPOSITION) ? info.dwX : 0;
386               y = (info.dwFlags & STARTF_USEPOSITION) ? info.dwY : 0;
387             }
388           
389           if (nWidth == (LONG) CW_USEDEFAULT)
390             {
391               if (info.dwFlags & STARTF_USESIZE)
392                 {
393                   nWidth = info.dwXSize;
394                   nHeight = info.dwYSize;
395                 }
396               else
397                 {
398                   RECT r;
399
400                   SystemParametersInfoA(SPI_GETWORKAREA, 0, &r, 0);
401                   nWidth = (((r.right - r.left) * 3) / 4) - x;
402                   nHeight = (((r.bottom - r.top) * 3) / 4) - y;
403                 }
404             }
405         }
406     }
407
408   Handle = NtUserCreateWindowEx(dwExStyle,
409                                 &ClassName,
410                                 &WindowName,
411                                 dwStyle,
412                                 x,
413                                 y,
414                                 nWidth,
415                                 nHeight,
416                                 hWndParent,
417                                 hMenu,
418                                 hInstance,
419                                 lpParam,
420                                 sw);
421
422   RtlFreeUnicodeString(&WindowName);
423
424   if (!IS_ATOM(lpClassName)) 
425     {
426       RtlFreeUnicodeString(&ClassName);
427     }
428   
429   return Handle;
430 }
431
432 HWND STDCALL
433 CreateWindowExW(DWORD dwExStyle,
434                 LPCWSTR lpClassName,
435                 LPCWSTR lpWindowName,
436                 DWORD dwStyle,
437                 int x,
438                 int y,
439                 int nWidth,
440                 int nHeight,
441                 HWND hWndParent,
442                 HMENU hMenu,
443                 HINSTANCE hInstance,
444                 LPVOID lpParam)
445 {
446   UNICODE_STRING WindowName;
447   UNICODE_STRING ClassName;
448   HANDLE Handle;
449   UINT sw;
450
451   if (IS_ATOM(lpClassName)) 
452     {
453       RtlInitUnicodeString(&ClassName, NULL);
454       ClassName.Buffer = (LPWSTR)lpClassName;
455     } 
456   else 
457     {
458       RtlInitUnicodeString(&ClassName, lpClassName);
459     }
460
461   RtlInitUnicodeString(&WindowName, lpWindowName);
462
463   /* Fixup default coordinates. */
464   sw = SW_SHOW;
465   if (x == (LONG) CW_USEDEFAULT || nWidth == (LONG) CW_USEDEFAULT)
466     {
467       if (dwStyle & (WS_CHILD | WS_POPUP))
468         {
469           if (x == (LONG) CW_USEDEFAULT)
470             {
471               x = y = 0;
472             }
473           if (nWidth == (LONG) CW_USEDEFAULT)
474             {
475               nWidth = nHeight = 0;
476             }
477         }
478       else
479         {
480           STARTUPINFOW info;
481
482           GetStartupInfoW(&info);
483
484           if (x == (LONG) CW_USEDEFAULT)
485             {
486               if (y != (LONG) CW_USEDEFAULT)
487                 {
488                   sw = y;
489                 }
490               x = (info.dwFlags & STARTF_USEPOSITION) ? info.dwX : 0;
491               y = (info.dwFlags & STARTF_USEPOSITION) ? info.dwY : 0;
492             }
493           
494           if (nWidth == (LONG) CW_USEDEFAULT)
495             {
496               if (info.dwFlags & STARTF_USESIZE)
497                 {
498                   nWidth = info.dwXSize;
499                   nHeight = info.dwYSize;
500                 }
501               else
502                 {
503                   RECT r;
504
505                   SystemParametersInfoW(SPI_GETWORKAREA, 0, &r, 0);
506                   nWidth = (((r.right - r.left) * 3) / 4) - x;
507                   nHeight = (((r.bottom - r.top) * 3) / 4) - y;
508                 }
509             }
510         }
511     }
512
513   Handle = NtUserCreateWindowEx(dwExStyle,
514                                 &ClassName,
515                                 &WindowName,
516                                 dwStyle,
517                                 x,
518                                 y,
519                                 nWidth,
520                                 nHeight,
521                                 hWndParent,
522                                 hMenu,
523                                 hInstance,
524                                 lpParam,
525                                 0);
526
527   return (HWND)Handle;
528 }
529
530 HDWP STDCALL
531 DeferWindowPos(HDWP hWinPosInfo,
532                HWND hWnd,
533                HWND hWndInsertAfter,
534                int x,
535                int y,
536                int cx,
537                int cy,
538                UINT uFlags)
539 {
540   return (HDWP)0;
541 }
542
543 WINBOOL STDCALL
544 DestroyWindow(HWND hWnd)
545 {
546   SendMessageW(hWnd, WM_DESTROY, 0, 0);
547   SendMessageW(hWnd, WM_NCDESTROY, 0, 0);
548
549   return NtUserDestroyWindow(hWnd);
550 }
551
552 WINBOOL STDCALL
553 EndDeferWindowPos(HDWP hWinPosInfo)
554 {
555   return FALSE;
556 }
557
558 WINBOOL STDCALL
559 EnumChildWindows(HWND hWndParent,
560                  ENUMWINDOWSPROC lpEnumFunc,
561                  LPARAM lParam)
562 {
563   return FALSE;
564 }
565
566 WINBOOL STDCALL
567 EnumThreadWindows(DWORD dwThreadId,
568                   ENUMWINDOWSPROC lpfn,
569                   LPARAM lParam)
570 {
571   return FALSE;
572 }
573
574 WINBOOL STDCALL
575 EnumWindows(ENUMWINDOWSPROC lpEnumFunc,
576             LPARAM lParam)
577 {
578   return FALSE;
579 }
580
581 HWND STDCALL
582 FindWindowA(LPCSTR lpClassName, LPCSTR lpWindowName)
583 {
584   //FIXME: FindWindow does not search children, but FindWindowEx does.
585   //       what should we do about this?
586   return FindWindowExA (NULL, NULL, lpClassName, lpWindowName);
587 }
588
589 HWND STDCALL
590 FindWindowExA(HWND hwndParent,
591               HWND hwndChildAfter,
592               LPCSTR lpszClass,
593               LPCSTR lpszWindow)
594 {
595   return (HWND)0;
596 }
597
598 HWND STDCALL
599 FindWindowW(LPCWSTR lpClassName, LPCWSTR lpWindowName)
600 {
601   //FIXME: FindWindow does not search children, but FindWindowEx does.
602   //       what should we do about this?
603   return FindWindowExW (NULL, NULL, lpClassName, lpWindowName);
604 }
605
606 HWND STDCALL
607 FindWindowExW(HWND hwndParent,
608               HWND hwndChildAfter,
609               LPCWSTR lpszClass,
610               LPCWSTR lpszWindow)
611 {
612   return (HWND)0;
613 }
614
615 WINBOOL STDCALL
616 GetAltTabInfo(HWND hwnd,
617               int iItem,
618               PALTTABINFO pati,
619               LPTSTR pszItemText,
620               UINT cchItemText)
621 {
622   return FALSE;
623 }
624
625 WINBOOL STDCALL
626 GetAltTabInfoA(HWND hwnd,
627                int iItem,
628                PALTTABINFO pati,
629                LPSTR pszItemText,
630                UINT cchItemText)
631 {
632   return FALSE;
633 }
634
635 WINBOOL STDCALL
636 GetAltTabInfoW(HWND hwnd,
637                int iItem,
638                PALTTABINFO pati,
639                LPWSTR pszItemText,
640                UINT cchItemText)
641 {
642   return FALSE;
643 }
644
645 HWND STDCALL
646 GetAncestor(HWND hwnd, UINT gaFlags)
647 {
648   return(NtUserGetAncestor(hwnd, gaFlags));
649 }
650
651 WINBOOL STDCALL
652 GetClientRect(HWND hWnd, LPRECT lpRect)
653 {
654   return(NtUserGetClientRect(hWnd, lpRect));
655 }
656
657 HWND STDCALL
658 GetDesktopWindow(VOID)
659 {
660   return (HWND)0;
661 }
662
663 HWND STDCALL
664 GetForegroundWindow(VOID)
665 {
666   return (HWND)0;
667 }
668
669 WINBOOL STDCALL
670 GetGUIThreadInfo(DWORD idThread,
671                  LPGUITHREADINFO lpgui)
672 {
673   return FALSE;
674 }
675
676 HWND STDCALL
677 GetLastActivePopup(HWND hWnd)
678 {
679   return (HWND)0;
680 }
681
682 HWND STDCALL
683 GetParent(HWND hWnd)
684 {
685   return NtUserGetAncestor(hWnd, GA_PARENT);
686 }
687
688 WINBOOL STDCALL
689 GetProcessDefaultLayout(DWORD *pdwDefaultLayout)
690 {
691   return FALSE;
692 }
693
694 WINBOOL STDCALL
695 GetTitleBarInfo(HWND hwnd,
696                 PTITLEBARINFO pti)
697 {
698   return FALSE;
699 }
700
701 HWND STDCALL
702 GetTopWindow(HWND hWnd)
703 {
704   return (HWND)0;
705 }
706
707 HWND STDCALL
708 GetWindow(HWND hWnd,
709           UINT uCmd)
710 {
711   return (HWND)0;
712 }
713
714 WINBOOL STDCALL
715 GetWindowInfo(HWND hwnd,
716               PWINDOWINFO pwi)
717 {
718   return FALSE;
719 }
720
721 UINT STDCALL
722 GetWindowModuleFileName(HWND hwnd,
723                         LPSTR lpszFileName,
724                         UINT cchFileNameMax)
725 {
726   return 0;
727 }
728
729 UINT STDCALL
730 GetWindowModuleFileNameA(HWND hwnd,
731                          LPSTR lpszFileName,
732                          UINT cchFileNameMax)
733 {
734   return 0;
735 }
736
737 UINT STDCALL
738 GetWindowModuleFileNameW(HWND hwnd,
739                          LPWSTR lpszFileName,
740                          UINT cchFileNameMax)
741 {
742   return 0;
743 }
744
745 WINBOOL STDCALL
746 GetWindowPlacement(HWND hWnd,
747                    WINDOWPLACEMENT *lpwndpl)
748 {
749   return FALSE;
750 }
751
752 WINBOOL STDCALL
753 GetWindowRect(HWND hWnd,
754               LPRECT lpRect)
755 {
756   return(NtUserGetWindowRect(hWnd, lpRect));
757 }
758
759 int STDCALL
760 GetWindowTextA(HWND hWnd, LPSTR lpString, int nMaxCount)
761 {
762   return(SendMessageA(hWnd, WM_GETTEXT, nMaxCount, (LPARAM)lpString));
763 }
764
765 int STDCALL
766 GetWindowTextLengthA(HWND hWnd)
767 {
768   return(SendMessageA(hWnd, WM_GETTEXTLENGTH, 0, 0));
769 }
770
771 int STDCALL
772 GetWindowTextLengthW(HWND hWnd)
773 {
774   return 0;
775 }
776
777 int STDCALL
778 GetWindowTextW(HWND hWnd,
779                LPWSTR lpString,
780                int nMaxCount)
781 {
782   return 0;
783 }
784
785 DWORD STDCALL
786 GetWindowThreadProcessId(HWND hWnd,
787                          LPDWORD lpdwProcessId)
788 {
789   return 0;
790 }
791
792 WINBOOL STDCALL
793 IsChild(HWND hWndParent,
794         HWND hWnd)
795 {
796   return FALSE;
797 }
798
799 WINBOOL STDCALL
800 IsIconic(HWND hWnd)
801 {
802   return FALSE;
803 }
804
805 WINBOOL STDCALL
806 IsWindow(HWND hWnd)
807 {
808   return FALSE;
809 }
810
811 WINBOOL STDCALL
812 IsWindowUnicode(HWND hWnd)
813 {
814   return FALSE;
815 }
816
817 WINBOOL STDCALL
818 IsWindowVisible(HWND hWnd)
819 {
820   while (GetWindowLong(hWnd, GWL_STYLE) & WS_CHILD)
821     {
822       if (!(GetWindowLong(hWnd, GWL_STYLE) & WS_VISIBLE))
823         {
824           return(FALSE);
825         }
826       hWnd = GetAncestor(hWnd, GA_PARENT);
827     }
828   return(GetWindowLong(hWnd, GWL_STYLE) & WS_VISIBLE);
829 }
830
831 WINBOOL STDCALL
832 IsZoomed(HWND hWnd)
833 {
834   ULONG uStyle = GetWindowLong(hWnd, GWL_STYLE);
835   
836   return (uStyle & WS_MAXIMIZE);
837 }
838
839 WINBOOL STDCALL
840 LockSetForegroundWindow(UINT uLockCode)
841 {
842   return FALSE;
843 }
844
845 WINBOOL STDCALL
846 MoveWindow(HWND hWnd,
847            int X,
848            int Y,
849            int nWidth,
850            int nHeight,
851            WINBOOL bRepaint)
852 {
853     return NtUserMoveWindow(hWnd, X, Y, nWidth, nHeight, bRepaint);
854 }
855
856 WINBOOL STDCALL
857 OpenIcon(HWND hWnd)
858 {
859   return FALSE;
860 }
861
862 HWND STDCALL
863 RealChildWindowFromPoint(HWND hwndParent,
864                          POINT ptParentClientCoords)
865 {
866   return (HWND)0;
867 }
868
869 UINT
870 RealGetWindowClass(HWND  hwnd,
871                    LPTSTR pszType,
872                    UINT  cchType)
873 {
874   return 0;
875 }
876
877 WINBOOL STDCALL
878 SetForegroundWindow(HWND hWnd)
879 {
880   return FALSE;
881 }
882
883 WINBOOL STDCALL
884 SetLayeredWindowAttributes(HWND hwnd,
885                            COLORREF crKey,
886                            BYTE bAlpha,
887                            DWORD dwFlags)
888 {
889   return FALSE;
890 }
891
892 HWND STDCALL
893 SetParent(HWND hWndChild,
894           HWND hWndNewParent)
895 {
896   return (HWND)0;
897 }
898
899 WINBOOL STDCALL
900 SetProcessDefaultLayout(DWORD dwDefaultLayout)
901 {
902   return FALSE;
903 }
904
905 WINBOOL STDCALL
906 SetWindowPlacement(HWND hWnd,
907                    CONST WINDOWPLACEMENT *lpwndpl)
908 {
909   return FALSE;
910 }
911
912 WINBOOL STDCALL
913 SetWindowPos(HWND hWnd,
914              HWND hWndInsertAfter,
915              int X,
916              int Y,
917              int cx,
918              int cy,
919              UINT uFlags)
920 {
921   return FALSE;
922 }
923
924 WINBOOL STDCALL
925 SetWindowTextA(HWND hWnd,
926                LPCSTR lpString)
927 {
928   return FALSE;
929 }
930
931 WINBOOL STDCALL
932 SetWindowTextW(HWND hWnd,
933                LPCWSTR lpString)
934 {
935   return FALSE;
936 }
937
938 WINBOOL STDCALL
939 ShowOwnedPopups(HWND hWnd,
940                 WINBOOL fShow)
941 {
942   return FALSE;
943 }
944
945 WINBOOL STDCALL
946 ShowWindow(HWND hWnd,
947            int nCmdShow)
948 {
949   return NtUserShowWindow(hWnd, nCmdShow);
950 }
951
952 WINBOOL STDCALL
953 ShowWindowAsync(HWND hWnd,
954                 int nCmdShow)
955 {
956   return FALSE;
957 }
958
959 WORD STDCALL
960 TileWindows(HWND hwndParent,
961             UINT wHow,
962             CONST RECT *lpRect,
963             UINT cKids,
964             const HWND *lpKids)
965 {
966   return 0;
967 }
968
969 WINBOOL STDCALL
970 UpdateLayeredWindow(HWND hwnd,
971                     HDC hdcDst,
972                     POINT *pptDst,
973                     SIZE *psize,
974                     HDC hdcSrc,
975                     POINT *pptSrc,
976                     COLORREF crKey,
977                     BLENDFUNCTION *pblend,
978                     DWORD dwFlags)
979 {
980   return FALSE;
981 }
982
983 HWND STDCALL
984 WindowFromPoint(POINT Point)
985 {
986   return (HWND)0;
987 }
988
989 int STDCALL
990 MapWindowPoints(HWND hWndFrom, HWND hWndTo, LPPOINT lpPoints, UINT cPoints)
991 {
992   POINT FromOffset, ToOffset;
993   LONG XMove, YMove;
994   ULONG i;
995
996   NtUserGetClientOrigin(hWndFrom, &FromOffset);
997   NtUserGetClientOrigin(hWndTo, &ToOffset);
998   XMove = FromOffset.x - ToOffset.x;
999   YMove = FromOffset.y - ToOffset.y;
1000
1001   for (i = 0; i < cPoints; i++)
1002     {
1003       lpPoints[i].x += XMove;
1004       lpPoints[i].y += YMove;
1005     }
1006   return(MAKELONG(LOWORD(XMove), LOWORD(YMove))); 
1007 }
1008
1009
1010 WINBOOL STDCALL 
1011 ScreenToClient(HWND hWnd, LPPOINT lpPoint)
1012 {
1013   return(MapWindowPoints(NULL, hWnd, lpPoint, 1));
1014 }
1015
1016 /* EOF */