2002-07-04 David Welch <welch@computer2.darkstar.org>
authorDavid Welch <welch@cwcom.net>
Thu, 4 Jul 2002 19:56:38 +0000 (19:56 +0000)
committerDavid Welch <welch@cwcom.net>
Thu, 4 Jul 2002 19:56:38 +0000 (19:56 +0000)
* subsys/win32k/include/callback.h: Fixed callback argument
definitions.
* subsys/win32k/ntuser/winpos.c: Implemented some more of the windows
sizing/moving code.
* subsys/win32k/ntuser/painting.c: Implemented some more of the
window painting code.
* subsys/win32k/objects/coord.c: Implemented LPtoDP and DPtoLP.
* subsys/win32k/objects/region.c: Added stubs for some more
region functions.

2002-07-04  David Welch  <welch@computer2.darkstar.org>

* ntoskrnl/ps/process.c (NtCreateProcess): Duplicate the
process desktop handle as well.

2002-07-04  David Welch  <welch@computer2.darkstar.org>

* ntoskrnl/se/token.c: Don't call the ZwXXX variant of
system calls when in system context.

2002-07-04  David Welch  <welch@computer2.darkstar.org>

* ntoskrnl/Makefile: Added file with MDA output code.
* ntoskrnl/kd/kdebug.c: Recognize MDA as a destination for
debug output.

2002-07-04  David Welch  <welch@computer2.darkstar.org>

* lib/user32/windows/defwnd.c: Implemented some more of the
default window handler.

2002-07-04  David Welch  <welch@computer2.darkstar.org>

* lib/user32/misc/stubs.c: Removed some stubs to seperate files.

2002-07-04  David Welch  <welch@computer2.darkstar.org>

* lib/user32/user32.def: Export ScreenToClient otherwise we
get problems when code in user32 tries to call it.

2002-07-04  David Welch  <welch@computer2.darkstar.org>

* include/win32k/region.h: Added prototypes for some missing
region functions.

2002-07-04  David Welch  <welch@computer2.darkstar.org>

* include/win32k/ntuser.h: Added prototypes for some missing
NtUserXXX functions.

2002-07-04  David Welch  <welch@computer2.darkstar.org>

* include/user32/wininternal.h: Added some constants for
private GetDCEx styles that WINE needs.

2002-07-04  David Welch  <welch@computer2.darkstar.org>

* include/user32/callback.h: Fixed callbacks for messages with
parameters.

2002-07-04  David Welch  <welch@computer2.darkstar.org>

* include/napi/win32.h (W32THREAD): Added pointer to the
thread's desktop.
* include/napi/win32.h (W32PROCESS): Removed handle table,
added a pointer to the process's window station.
* subsys/win32k/ntuser/guicheck.c (W32kGuiCheck): Reference
a process's window station on the first win32k system call. Reference
a thread's desktop on the first win32k system call.

2002-07-04  David Welch  <welch@computer2.darkstar.org>

* include/messages.h: Added some missing WM_XXX constants.

2002-07-04  David Welch  <welch@computer2.darkstar.org>

* drivers/dd/ide/makefile: Compiling with debugging messages
needs libgcc to be linked in.

2002-07-04  David Welch  <welch@computer2.darkstar.org>

* iface/addsys/genw32k.c: Generate a variable with the
number of system calls.
* iface/native/genntdll.c: Generate a proper stack frame for
the user system call stubs.
* ntoskrnl/ke/i386/syscall.S: Generate a proper stack frame for
the handler for system calls.

2002-07-04  David Welch  <welch@computer2.darkstar.org>

* Makefile: Build the GUI startup application.
* subsys/system/gstart/gstart.c: Application to start up
the GUI.

svn path=/trunk/; revision=3179

50 files changed:
reactos/ChangeLog
reactos/Makefile
reactos/apps/tests/gditest/gditest.c
reactos/drivers/dd/ide/makefile
reactos/iface/addsys/genw32k.c
reactos/iface/native/genntdll.c
reactos/include/messages.h
reactos/include/napi/win32.h
reactos/include/user32/callback.h
reactos/include/user32/wininternal.h
reactos/include/win32k/ntuser.h
reactos/include/win32k/region.h
reactos/install.bochs
reactos/lib/user32/misc/desktop.c
reactos/lib/user32/misc/dllmain.c
reactos/lib/user32/misc/stubs.c
reactos/lib/user32/user32.def
reactos/lib/user32/windows/defwnd.c
reactos/lib/user32/windows/window.c
reactos/ntoskrnl/Makefile
reactos/ntoskrnl/include/internal/ex.h
reactos/ntoskrnl/include/internal/kd.h
reactos/ntoskrnl/include/internal/ps.h
reactos/ntoskrnl/kd/kdebug.c
reactos/ntoskrnl/kd/mda.c [new file with mode: 0644]
reactos/ntoskrnl/ke/i386/syscall.S
reactos/ntoskrnl/ps/process.c
reactos/ntoskrnl/se/token.c
reactos/subsys/system/gstart/Makefile [new file with mode: 0644]
reactos/subsys/system/gstart/gstart.c [new file with mode: 0644]
reactos/subsys/system/gstart/gstart.rc [new file with mode: 0644]
reactos/subsys/win32k/include/callback.h
reactos/subsys/win32k/include/msgqueue.h
reactos/subsys/win32k/include/window.h
reactos/subsys/win32k/include/winpos.h
reactos/subsys/win32k/include/winsta.h
reactos/subsys/win32k/main/dllmain.c
reactos/subsys/win32k/makefile
reactos/subsys/win32k/ntuser/callback.c
reactos/subsys/win32k/ntuser/class.c
reactos/subsys/win32k/ntuser/guicheck.c
reactos/subsys/win32k/ntuser/message.c
reactos/subsys/win32k/ntuser/msgqueue.c
reactos/subsys/win32k/ntuser/stubs.c
reactos/subsys/win32k/ntuser/window.c
reactos/subsys/win32k/ntuser/winpos.c
reactos/subsys/win32k/ntuser/winsta.c
reactos/subsys/win32k/objects/coord.c
reactos/subsys/win32k/objects/region.c
reactos/tools/depend.mk

index 12f6ea6..487c4a0 100644 (file)
@@ -1,3 +1,99 @@
+2002-07-04  David Welch  <welch@computer2.darkstar.org>
+
+       * subsys/win32k/include/callback.h: Fixed callback argument
+       definitions.
+       * subsys/win32k/ntuser/winpos.c: Implemented some more of the windows
+       sizing/moving code.
+       * subsys/win32k/ntuser/painting.c: Implemented some more of the
+       window painting code.
+       * subsys/win32k/objects/coord.c: Implemented LPtoDP and DPtoLP.
+       * subsys/win32k/objects/region.c: Added stubs for some more
+       region functions.
+
+2002-07-04  David Welch  <welch@computer2.darkstar.org>
+
+       * ntoskrnl/ps/process.c (NtCreateProcess): Duplicate the
+       process desktop handle as well.
+
+2002-07-04  David Welch  <welch@computer2.darkstar.org>
+
+       * ntoskrnl/se/token.c: Don't call the ZwXXX variant of
+       system calls when in system context.
+
+2002-07-04  David Welch  <welch@computer2.darkstar.org>
+
+       * ntoskrnl/Makefile: Added file with MDA output code.
+       * ntoskrnl/kd/kdebug.c: Recognize MDA as a destination for
+       debug output.
+
+2002-07-04  David Welch  <welch@computer2.darkstar.org>
+
+       * lib/user32/windows/defwnd.c: Implemented some more of the
+       default window handler.
+
+2002-07-04  David Welch  <welch@computer2.darkstar.org>
+
+       * lib/user32/misc/stubs.c: Removed some stubs to seperate files.
+
+2002-07-04  David Welch  <welch@computer2.darkstar.org>
+
+       * lib/user32/user32.def: Export ScreenToClient otherwise we
+       get problems when code in user32 tries to call it.
+
+2002-07-04  David Welch  <welch@computer2.darkstar.org>
+
+       * include/win32k/region.h: Added prototypes for some missing
+       region functions.
+
+2002-07-04  David Welch  <welch@computer2.darkstar.org>
+
+       * include/win32k/ntuser.h: Added prototypes for some missing
+       NtUserXXX functions.
+
+2002-07-04  David Welch  <welch@computer2.darkstar.org>
+
+       * include/user32/wininternal.h: Added some constants for
+       private GetDCEx styles that WINE needs.
+
+2002-07-04  David Welch  <welch@computer2.darkstar.org>
+
+       * include/user32/callback.h: Fixed callbacks for messages with
+       parameters.
+
+2002-07-04  David Welch  <welch@computer2.darkstar.org>
+
+       * include/napi/win32.h (W32THREAD): Added pointer to the
+       thread's desktop.
+       * include/napi/win32.h (W32PROCESS): Removed handle table,
+       added a pointer to the process's window station.
+       * subsys/win32k/ntuser/guicheck.c (W32kGuiCheck): Reference
+       a process's window station on the first win32k system call. Reference
+       a thread's desktop on the first win32k system call.
+
+2002-07-04  David Welch  <welch@computer2.darkstar.org>
+
+       * include/messages.h: Added some missing WM_XXX constants.
+
+2002-07-04  David Welch  <welch@computer2.darkstar.org>
+
+       * drivers/dd/ide/makefile: Compiling with debugging messages
+       needs libgcc to be linked in.
+
+2002-07-04  David Welch  <welch@computer2.darkstar.org>
+
+       * iface/addsys/genw32k.c: Generate a variable with the
+       number of system calls.
+       * iface/native/genntdll.c: Generate a proper stack frame for
+       the user system call stubs.
+       * ntoskrnl/ke/i386/syscall.S: Generate a proper stack frame for
+       the handler for system calls.
+
+2002-07-04  David Welch  <welch@computer2.darkstar.org>
+
+       * Makefile: Build the GUI startup application.
+       * subsys/system/gstart/gstart.c: Application to start up
+       the GUI.
+
 2002-06-18  David Welch  <welch@whitehall1-5.seh.ox.ac.uk>
 
        * tools/helper.mk: Make an import library a proper target
 
 
 
-       
\ No newline at end of file
+       
index 33cdb28..72a16d4 100644 (file)
@@ -74,7 +74,7 @@ STORAGE_DRIVERS = atapi cdrom class2 disk scsiport
 
 # System applications
 # autochk lsass services shell winlogon
-SYS_APPS = autochk services shell winlogon
+SYS_APPS = autochk services shell winlogon gstart
 
 # System services
 # rpcss eventlog
index fa63aed..5c1f476 100644 (file)
@@ -41,7 +41,7 @@ int main (void)
 
   printf("Entering GDITest..\n");
 
-  GdiDllInitialize (NULL, DLL_PROCESS_ATTACH, NULL);
+   GdiDllInitialize (NULL, DLL_PROCESS_ATTACH, NULL);
 
   // Set up a DC called Desktop that accesses DISPLAY
   Desktop = CreateDCA("DISPLAY", NULL, NULL, NULL);
index c849d26..a50a63a 100644 (file)
@@ -1,4 +1,4 @@
-# $Id: makefile,v 1.25 2001/08/21 20:13:11 chorns Exp $
+# $Id: makefile,v 1.26 2002/07/04 19:56:32 dwelch Exp $
 
 PATH_TO_TOP = ../../..
 
@@ -10,6 +10,8 @@ TARGET_OBJECTS = ide.o
 
 TARGET_HEADERS = *.h
 
+TARGET_GCCLIBS = gcc
+
 include $(PATH_TO_TOP)/rules.mak
 
 include $(TOOLS_PATH)/helper.mk
index 426b332..a82ca0b 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: genw32k.c,v 1.1 2000/02/21 22:34:26 ekohl Exp $
+/* $Id: genw32k.c,v 1.2 2002/07/04 19:56:33 dwelch Exp $
  *
  * COPYRIGHT:             See COPYING in the top level directory
  * PROJECT:               ReactOS version of ntdll
@@ -162,6 +162,7 @@ char    *stmp;
        fprintf(out, "\n\n#define MIN_SYSCALL_NUMBER    0\n");
        fprintf(out, "#define MAX_SYSCALL_NUMBER    %d\n", sys_call_idx-1);
        fprintf(out, "#define NUMBER_OF_SYSCALLS    %d\n", sys_call_idx);
+       fprintf(out, "ULONG Win32kNumberOfSysCalls = %d;\n", sys_call_idx);
 
        return(0);
 }
index 79e39d2..c611edc 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: genntdll.c,v 1.10 2000/02/21 22:35:12 ekohl Exp $
+/* $Id: genntdll.c,v 1.11 2002/07/04 19:56:33 dwelch Exp $
  *
  * COPYRIGHT:             See COPYING in the top level directory
  * PROJECT:               ReactOS version of ntdll
 
 /* FUNCTIONS ****************************************************************/
 
+void write_syscall_stub(FILE* out, FILE* out3, char* name, char* name2,
+                       unsigned int nr_args, unsigned int sys_call_idx)
+{
+#ifdef PARAMETERIZED_LIBS
+  fprintf(out,"__asm__(\"\\n\\t.global _%s@%s\\n\\t\"\n",name,nr_args);
+  fprintf(out,"\".global _%s@%s\\n\\t\"\n",name2,nr_args);
+  fprintf(out,"\"_%s@%s:\\n\\t\"\n",name,nr_args);
+  fprintf(out,"\"_%s@%s:\\n\\t\"\n",name2,nr_args);
+#else
+  fprintf(out,"__asm__(\"\\n\\t.global _%s\\n\\t\"\n",name);
+  fprintf(out,"\".global _%s\\n\\t\"\n",name2);
+  fprintf(out,"\"_%s:\\n\\t\"\n",name);
+  fprintf(out,"\"_%s:\\n\\t\"\n",name2);
+#endif
+  fprintf(out,"\t\"pushl\t%%ebp\\n\\t\"\n");
+  fprintf(out,"\t\"movl\t%%esp, %%ebp\\n\\t\"\n");
+  fprintf(out,"\t\"mov\t$%d,%%eax\\n\\t\"\n",sys_call_idx);
+  fprintf(out,"\t\"lea\t8(%%ebp),%%edx\\n\\t\"\n");
+  fprintf(out,"\t\"int\t$0x2E\\n\\t\"\n");
+  fprintf(out,"\t\"popl\t%%ebp\\n\\t\"\n");
+  fprintf(out,"\t\"ret\t$%s\\n\\t\");\n\n",nr_args);
+  
+  /*
+   * Now write the NTOSKRNL stub for the
+   * current system call. ZwXXX does NOT
+   * alias the corresponding NtXXX call.
+   */
+  fprintf(out3,"__asm__(\n");
+  fprintf(out3,"\".global _%s@%s\\n\\t\"\n",name2,nr_args);
+  fprintf(out3,"\"_%s@%s:\\n\\t\"\n",name2,nr_args);
+  fprintf(out3,"\t\"pushl\t%%ebp\\n\\t\"\n");
+  fprintf(out3,"\t\"movl\t%%esp, %%ebp\\n\\t\"\n");
+  fprintf(out3,"\t\"mov\t$%d,%%eax\\n\\t\"\n",sys_call_idx);
+  fprintf(out3,"\t\"lea\t8(%%ebp),%%edx\\n\\t\"\n");
+  fprintf(out3,"\t\"int\t$0x2E\\n\\t\"\n");
+  fprintf(out3,"\t\"popl\t%%ebp\\n\\t\"\n");
+  fprintf(out3,"\t\"ret\t$%s\\n\\t\");\n\n",nr_args);
+}
+
 int makeSystemServiceTable(FILE *in, FILE *out)
 {
 char    line [INPUT_BUFFER_SIZE];
@@ -257,34 +296,8 @@ process(
                         * system call: NtXXX and ZwXXX symbols
                         * are aliases.
                         */
-#ifdef PARAMETERIZED_LIBS
-                       fprintf(out,"__asm__(\"\\n\\t.global _%s@%s\\n\\t\"\n",name,nr_args);
-                       fprintf(out,"\".global _%s@%s\\n\\t\"\n",name2,nr_args);
-                       fprintf(out,"\"_%s@%s:\\n\\t\"\n",name,nr_args);
-                       fprintf(out,"\"_%s@%s:\\n\\t\"\n",name2,nr_args);
-#else
-                       fprintf(out,"__asm__(\"\\n\\t.global _%s\\n\\t\"\n",name);
-                       fprintf(out,"\".global _%s\\n\\t\"\n",name2);
-                       fprintf(out,"\"_%s:\\n\\t\"\n",name);
-                       fprintf(out,"\"_%s:\\n\\t\"\n",name2);
-#endif
-                       fprintf(out,"\t\"mov\t$%d,%%eax\\n\\t\"\n",sys_call_idx);
-                       fprintf(out,"\t\"lea\t4(%%esp),%%edx\\n\\t\"\n");
-                       fprintf(out,"\t\"int\t$0x2E\\n\\t\"\n");
-                       fprintf(out,"\t\"ret\t$%s\\n\\t\");\n\n",nr_args);
-
-                       /*
-                        * Now write the NTOSKRNL stub for the
-                        * current system call. ZwXXX does NOT
-                        * alias the corresponding NtXXX call.
-                        */
-                       fprintf(out3,"__asm__(\n");
-                       fprintf(out3,"\".global _%s@%s\\n\\t\"\n",name2,nr_args);
-                       fprintf(out3,"\"_%s@%s:\\n\\t\"\n",name2,nr_args);
-                       fprintf(out3,"\t\"mov\t$%d,%%eax\\n\\t\"\n",sys_call_idx);
-                       fprintf(out3,"\t\"lea\t4(%%esp),%%edx\\n\\t\"\n");
-                       fprintf(out3,"\t\"int\t$0x2E\\n\\t\"\n");
-                       fprintf(out3,"\t\"ret\t$%s\\n\\t\");\n\n",nr_args);
+                       write_syscall_stub(out, out3, name, name2,
+                                          nr_args, sys_call_idx);
                }
        }
 
index 138c3b0..a2e5745 100644 (file)
@@ -932,6 +932,7 @@ extern "C" {
 #define WM_DRAWCLIPBOARD       (776)
 #define WM_DRAWITEM    (43)
 #define WM_DROPFILES   (563)
+#define WM_DROPOBJECT   (544)
 #define WM_ENABLE      (10)
 #define WM_ENDSESSION  (22)
 #define WM_ENTERIDLE   (289)
@@ -995,6 +996,7 @@ extern "C" {
 #define WM_MENUSELECT  (287)
 #define WM_MOUSEACTIVATE       (33)
 #define WM_MOUSEMOVE   (512)
+#define WM_MOUSEWHEEL   (522)
 #define WM_MOVE        (3)
 #define WM_MOVING      (534)
 #define WM_NCACTIVATE  (134)
@@ -1038,6 +1040,7 @@ extern "C" {
 #define WM_PSD_PAGESETUPDLG    (1024)
 #define WM_PSD_YAFULLPAGERECT  (1030)
 #define WM_QUERYDRAGICON       (55)
+#define WM_QUERYDROPOBJECT      (555)
 #define WM_QUERYENDSESSION     (17)
 #define WM_QUERYNEWPALETTE     (783)
 #define WM_QUERYOPEN   (19)
@@ -1063,6 +1066,7 @@ extern "C" {
 #define WM_SPOOLERSTATUS       (42)
 #define WM_STYLECHANGED        (125)
 #define WM_STYLECHANGING       (124)
+#define WM_SYNCPAINT    (136)
 #define WM_SYSCHAR     (262)
 #define WM_SYSCOLORCHANGE      (21)
 #define WM_SYSCOMMAND  (274)
index 1b17477..948d28e 100644 (file)
@@ -4,15 +4,16 @@
 typedef struct _W32THREAD
 {
   PVOID MessageQueue;
+  FAST_MUTEX WindowListLock;
+  LIST_ENTRY WindowListHead;
+  struct _DESKTOP_OBJECT* Desktop;
 } __attribute__((packed)) W32THREAD, *PW32THREAD;
 
 typedef struct _W32PROCESS
 {
   FAST_MUTEX ClassListLock;
   LIST_ENTRY ClassListHead;
-  FAST_MUTEX WindowListLock;
-  LIST_ENTRY WindowListHead;
-  struct _USER_HANDLE_TABLE* HandleTable;
+  struct _WINSTATION_OBJECT* WindowStation;
 } W32PROCESS, *PW32PROCESS;
 
 PW32THREAD STDCALL
index 8bad97f..2b24d8c 100644 (file)
@@ -6,7 +6,7 @@
 #define USER32_CALLBACK_SENDNCCREATE        (2)
 #define USER32_CALLBACK_SENDNCCALCSIZE      (3)
 #define USER32_CALLBACK_SENDCREATE          (4)
-#define USER32_CALLBACK_MAXIMUM             (4)
+#define USER32_CALLBACK_MAXIMUM             (5)
 
 typedef struct _WINDOWPROC_CALLBACK_ARGUMENTS
 {
@@ -19,10 +19,10 @@ typedef struct _WINDOWPROC_CALLBACK_ARGUMENTS
 
 typedef struct _SENDASYNCPROC_CALLBACK_ARGUMENTS
 {
-  SENDASYNCPROC Proc;
+  SENDASYNCPROC Callback;
   HWND Wnd;
   UINT Msg;
-  ULONG Data;
+  ULONG_PTR Context;
   LRESULT Result;
 } SENDASYNCPROC_CALLBACK_ARGUMENTS, *PSENDASYNCPROC_CALLBACK_ARGUMENTS;
 
@@ -39,6 +39,23 @@ typedef struct _SENDCREATEMESSAGE_CALLBACK_ARGUMENTS
   CREATESTRUCT CreateStruct;
 } SENDCREATEMESSAGE_CALLBACK_ARGUMENTS, *PSENDCREATEMESSAGE_CALLBACK_ARGUMENTS;
 
+typedef struct _SENDNCCALCSIZEMESSAGE_CALLBACK_ARGUMENTS
+{
+  HWND Wnd;
+  BOOL Validate;
+  RECT Rect;
+  NCCALCSIZE_PARAMS Params;
+} SENDNCCALCSIZEMESSAGE_CALLBACK_ARGUMENTS, 
+  *PSENDNCCALCSIZEMESSAGE_CALLBACK_ARGUMENTS;
+
+typedef struct _SENDNCCALCSIZEMESSAGE_CALLBACK_RESULT
+{
+  LRESULT Result;
+  RECT Rect;
+  NCCALCSIZE_PARAMS Params;
+} SENDNCCALCSIZEMESSAGE_CALLBACK_RESULT, 
+  *PSENDNCCALCSIZEMESSAGE_CALLBACK_RESULT;
+
 NTSTATUS STDCALL
 User32CallWindowProcFromKernel(PVOID Arguments, ULONG ArgumentLength);
 NTSTATUS STDCALL
index a9898bb..ac0464c 100644 (file)
@@ -1,4 +1,5 @@
 #define WIN_NCACTIVATED  (0x0080)
 
 #define DCX_KEEPCLIPRGN (0x40000)
-#define DCX_USESTYLE (0x10000)
+#define DCX_USESTYLE    (0x10000)
+#define DCX_WINDOWPAINT (0x20000)
index dbfce58..56a8917 100644 (file)
@@ -1,8 +1,14 @@
 #ifndef __WIN32K_NTUSER_H
 #define __WIN32K_NTUSER_H
 
+ULONG STDCALL
+NtUserGetSystemMetrics(ULONG Index);
+DWORD STDCALL
+NtUserGetClassLong(HWND hWnd, DWORD Offset);
 DWORD STDCALL
 NtUserGetWindowLong(HWND hWnd, DWORD Index);
+INT STDCALL
+NtUserReleaseDC(HWND hWnd, HDC hDc);
 
 NTSTATUS
 STDCALL
@@ -29,11 +35,8 @@ NtUserAttachThreadInput(
   DWORD Unknown1,
   DWORD Unknown2);
 
-DWORD
-STDCALL
-NtUserBeginPaint(
-  DWORD Unknown0,
-  DWORD Unknown1);
+HDC STDCALL
+NtUserBeginPaint(HWND hWnd, PAINTSTRUCT* lPs);
 
 DWORD
 STDCALL
@@ -429,11 +432,8 @@ DWORD
 STDCALL
 NtUserEndMenu(VOID);
 
-DWORD
-STDCALL
-NtUserEndPaint(
-  DWORD Unknown0,
-  DWORD Unknown1);
+BOOL STDCALL
+NtUserEndPaint(HWND hWnd, PAINTSTRUCT* lPs);
 
 DWORD
 STDCALL
@@ -619,12 +619,8 @@ STDCALL
 NtUserGetDC(
   DWORD Unknown0);
 
-DWORD
-STDCALL
-NtUserGetDCEx(
-  DWORD Unknown0,
-  DWORD Unknown1,
-  DWORD Unknown2);
+HDC STDCALL
+NtUserGetDCEx(HWND hWnd, HANDLE hRegion, ULONG Flags);
 
 DWORD
 STDCALL
@@ -1181,6 +1177,12 @@ NtUserSendInput(
   DWORD Unknown1,
   DWORD Unknown2);
 
+LRESULT STDCALL
+NtUserSendMessage(HWND hWnd,
+                 UINT Msg,
+                 WPARAM wParam,
+                 LPARAM lParam);
+
 BOOL
 STDCALL
 NtUserSendMessageCallback(
index cba1d30..b6fd2e4 100644 (file)
@@ -2,6 +2,11 @@
 #ifndef __WIN32K_REGION_H
 #define __WIN32K_REGION_H
 
+INT STDCALL
+W32kGetBoxRgn(HRGN hRgn, PRECT Rect);
+HRGN STDCALL
+W32kCropRgn(HRGN hDest, HRGN hSrc, const RECT* Rect, const POINT* Point);
+
 INT
 STDCALL
 W32kCombineRgn(HRGN  hDest,
index ea4cf2e..9f08db2 100644 (file)
@@ -1,7 +1,7 @@
 #!/bin/sh
 /sbin/modprobe loop
 echo "Installing to disk."
-mount -t vfat /mnt/hda3/bochs/10M.vga.dos /mnt/floppy -o loop,offset=8704,rw
+mount -t vfat /home/welch/devel/bochs/10M.vga.dos /mnt/floppy -o loop,offset=8704,rw
 cp -rv reactos /mnt/floppy
 umount /mnt/floppy
 
index d7f1c44..a4a9686 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: desktop.c,v 1.2 2001/06/29 19:31:59 ekohl Exp $
+/* $Id: desktop.c,v 1.3 2002/07/04 19:56:34 dwelch Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS user32.dll
@@ -21,49 +21,47 @@ CloseDesktop(
   return NtUserCloseDesktop(hDesktop);
 }
 
-HDESK
-STDCALL
-CreateDesktopA(
-  LPCSTR lpszDesktop,
-  LPCSTR lpszDevice,
-  LPDEVMODEA pDevmode,
-  DWORD dwFlags,
-  ACCESS_MASK dwDesiredAccess,
-  LPSECURITY_ATTRIBUTES lpsa)
+HDESK STDCALL
+CreateDesktopA(LPCSTR lpszDesktop,
+              LPCSTR lpszDevice,
+              LPDEVMODEA pDevmode,
+              DWORD dwFlags,
+              ACCESS_MASK dwDesiredAccess,
+              LPSECURITY_ATTRIBUTES lpsa)
 {
   ANSI_STRING DesktopNameA;
   UNICODE_STRING DesktopNameU;
   HDESK hDesktop;
 
-       if (lpszDesktop != NULL) {
-               RtlInitAnsiString(&DesktopNameA, (LPSTR)lpszDesktop);
-               RtlAnsiStringToUnicodeString(&DesktopNameU, &DesktopNameA, TRUE);
-  } else {
-    RtlInitUnicodeString(&DesktopNameU, NULL);
-  }
-
-  hDesktop = CreateDesktopW(
-    DesktopNameU.Buffer,
-    NULL,
-    pDevmode,
-    dwFlags,
-    dwDesiredAccess,
-    lpsa);
-
-       RtlFreeUnicodeString(&DesktopNameU);
-
-  return hDesktop;
+  if (lpszDesktop != NULL) 
+    {
+      RtlInitAnsiString(&DesktopNameA, (LPSTR)lpszDesktop);
+      RtlAnsiStringToUnicodeString(&DesktopNameU, &DesktopNameA, TRUE);
+    } 
+  else 
+    {
+      RtlInitUnicodeString(&DesktopNameU, NULL);
+    }
+  /* FIXME: Need to convert the DEVMODE parameter. */
+  
+  hDesktop = CreateDesktopW(DesktopNameU.Buffer,
+                           NULL,
+                           pDevmode,
+                           dwFlags,
+                           dwDesiredAccess,
+                           lpsa);
+  
+  RtlFreeUnicodeString(&DesktopNameU);
+  return(hDesktop);
 }
 
-HDESK
-STDCALL
-CreateDesktopW(
-  LPCWSTR lpszDesktop,
-  LPCWSTR lpszDevice,
-  LPDEVMODEW pDevmode,
-  DWORD dwFlags,
-  ACCESS_MASK dwDesiredAccess,
-  LPSECURITY_ATTRIBUTES lpsa)
+HDESK STDCALL
+CreateDesktopW(LPCWSTR lpszDesktop,
+              LPCWSTR lpszDevice,
+              LPDEVMODEW pDevmode,
+              DWORD dwFlags,
+              ACCESS_MASK dwDesiredAccess,
+              LPSECURITY_ATTRIBUTES lpsa)
 {
   UNICODE_STRING DesktopName;
   HWINSTA hWinSta;
@@ -73,14 +71,13 @@ CreateDesktopW(
 
   RtlInitUnicodeString(&DesktopName, lpszDesktop);
 
-  hDesktop = NtUserCreateDesktop(
-    &DesktopName,
-    dwFlags,
-    dwDesiredAccess,
-    lpsa,
-    hWinSta);
+  hDesktop = NtUserCreateDesktop(&DesktopName,
+                                dwFlags,
+                                dwDesiredAccess,
+                                lpsa,
+                                hWinSta);
 
-  return hDesktop;
+  return(hDesktop);
 }
 
 WINBOOL
index e81d537..5fa32a3 100644 (file)
@@ -32,7 +32,7 @@ User32ConvertString(PCSTR String)
 {
   ANSI_STRING InString;
   UNICODE_STRING OutString;
 RtlInitAnsiString(&InString, String);
+ RtlInitAnsiString(&InString, String);
   RtlAnsiStringToUnicodeString(&OutString, &InString, TRUE);
   return(OutString.Buffer);
 }
index 8ac77a1..c962931 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: stubs.c,v 1.8 2002/06/13 20:36:40 dwelch Exp $
+/* $Id: stubs.c,v 1.9 2002/07/04 19:56:34 dwelch Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS user32.dll
  */
 #include <windows.h>
 
+WINBOOL STDCALL 
+ScreenToClient(HWND hWnd, LPPOINT lpPoint)
+{
+}
+
 WINBOOL
 STDCALL
 AnyPopup(VOID)
index cd95112..847d291 100644 (file)
@@ -528,7 +528,7 @@ RemovePropW@8
 ReplyMessage@4
 ;ResolveDesktopForWOW
 ReuseDDElParam@20
-;ScreenToClient
+ScreenToClient
 ;ScrollChildren
 ScrollDC@28
 ScrollWindow@20
index 851d548..520340e 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: defwnd.c,v 1.3 2002/06/18 21:51:09 dwelch Exp $
+/* $Id: defwnd.c,v 1.4 2002/07/04 19:56:34 dwelch Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS user32.dll
@@ -29,47 +29,30 @@ static HBITMAP hbitmapRestoreD;
 
 /* FUNCTIONS *****************************************************************/
 
-LRESULT
-STDCALL
-DefFrameProcA(
-  HWND hWnd,
-  HWND hWndMDIClient,
-  UINT uMsg,
-  WPARAM wParam,
-  LPARAM lParam)
+LRESULT STDCALL
+DefFrameProcA(HWND hWnd,
+             HWND hWndMDIClient,
+             UINT uMsg,
+             WPARAM wParam,
+             LPARAM lParam)
 {
-  return (LRESULT)0;
+  return((LRESULT)0);
 }
 
-LRESULT
-STDCALL
-DefFrameProcW(
-  HWND hWnd,
-  HWND hWndMDIClient,
-  UINT uMsg,
-  WPARAM wParam,
-  LPARAM lParam)
+LRESULT STDCALL
+DefFrameProcW(HWND hWnd,
+             HWND hWndMDIClient,
+             UINT uMsg,
+             WPARAM wParam,
+             LPARAM lParam)
 {
-  return (LRESULT)0;
+  return((LRESULT)0);
 }
 
 
 BOOL 
-UserRedrawIconTitle(HWND hWnd)
+DefWndRedrawIconTitle(HWND hWnd)
 {
-#if 0
-  LPINTERNALPOS lpPos = (LPINTERNALPOS)GetPropA(hWnd, atomInternalPos);
-  if (lpPos)
-    {
-      if (lpPos->hwndIconTitle)
-       {
-         SendMessageA(lpPos->hwndIconTitle, WM_SHOWWINDOW, TRUE, 0);
-         InvalidateRect(lpPos->hwndIconTitle, NULL, TRUE);
-         return(TRUE);
-       }
-    }
-  return(FALSE);
-#endif
 }
 
 ULONG
@@ -342,7 +325,7 @@ UserDrawFrameNC(HDC hdc, RECT* rect, BOOL dlgFrame, BOOL active)
 }
 
 VOID
-UserDoPaintNC(HWND hWnd, HRGN clip)
+DefWndDoPaintNC(HWND hWnd, HRGN clip)
 {
   ULONG Active;
   HDC hDc;
@@ -354,8 +337,8 @@ UserDoPaintNC(HWND hWnd, HRGN clip)
   Style = GetWindowLong(hWnd, GWL_STYLE);
   ExStyle = GetWindowLong(hWnd, GWL_EXSTYLE);
 
-  hDc = GetDCEx(hWnd, (clip > 1) ? clip : 0, DCX_USESTYLE | DCX_WINDOW |
-               ((clip > 1) ? (DCX_INTERSECTRGN | DCX_KEEPCLIPRGN) : 0));
+  hDc = GetDCEx(hWnd, (clip > (HRGN)1) ? clip : 0, DCX_USESTYLE | DCX_WINDOW |
+               ((clip > (HRGN)1) ? (DCX_INTERSECTRGN | DCX_KEEPCLIPRGN) : 0));
   if (hDc == 0)
     {
       return;
@@ -404,58 +387,213 @@ UserDoPaintNC(HWND hWnd, HRGN clip)
 }
 
 LRESULT
-UserPaintNC(HWND hWnd, HRGN clip)
+DefWndPaintNC(HWND hWnd, HRGN clip)
 {
   if (IsWindowVisible(hWnd))
     {
       if (IsIconic(hWnd))
        {
-         UserRedrawIconTitle(hWnd);
+         DefWndRedrawIconTitle(hWnd);
        }
       else
        {
-         UserDoPaintNC(hWnd, clip);
+         DefWndDoPaintNC(hWnd, clip);
        }
     }
   return(0);
 }
 
 LRESULT
-UserHitTestNC(HWND hWnd, POINT Point)
+DefWndHitTestNC(HWND hWnd, POINT Point)
 {
 }
 
 LRESULT
-UserHandleLButtonDownNC(HWND hWnd, WPARAM wParam, LPARAM lParam)
+DefWndHandleLButtonDownNC(HWND hWnd, WPARAM wParam, LPARAM lParam)
 {
 }
 
 LRESULT
-UserHandleLButtonDblClkNC(HWND hWnd, WPARAM wParam, LPARAM lParam)
+DefWndHandleLButtonDblClkNC(HWND hWnd, WPARAM wParam, LPARAM lParam)
 {
 }
 
 LRESULT
-UserHandleActiveNC(HWND hWnd, WPARAM wParam)
+DefWndHandleActiveNC(HWND hWnd, WPARAM wParam)
 {
 }
 
 VOID
-UserSetRedrawDefWnd(HWND hWnd, WPARAM wParam)
+DefWndSetRedraw(HWND hWnd, WPARAM wParam)
 {
 }
 
+LRESULT 
+DefWndHandleSetCursor(HWND hWnd, WPARAM wParam, LPARAM lParam)
+{
+  /* Not for child windows. */
+  if (hWnd != (HWND)wParam)
+    {
+      return(0);
+    }
+
+  switch(LOWORD(lParam))
+    {
+    case HTERROR:
+      {
+       WORD Msg = HIWORD(lParam);
+       if (Msg == WM_LBUTTONDOWN || Msg == WM_MBUTTONDOWN ||
+           Msg == WM_RBUTTONDOWN)
+         {
+           MessageBeep(0);
+         }
+       break;
+      }
+
+    case HTCLIENT:
+      {
+       HICON hCursor = (HICON)GetClassLong(hWnd, GCL_HCURSOR);
+       if (hCursor)
+         {
+           SetCursor(hCursor);
+           return(TRUE);
+         }
+       return(FALSE);
+      }
+
+    case HTLEFT:
+    case HTRIGHT:
+      {
+       return((LRESULT)SetCursor(LoadCursorW(0, IDC_SIZEWE)));
+      }
+
+    case HTTOP:
+    case HTBOTTOM:
+      {
+       return((LRESULT)SetCursor(LoadCursorW(0, IDC_SIZENS)));
+      }
+
+    case HTTOPLEFT:
+    case HTBOTTOMRIGHT:
+      {
+       return((LRESULT)SetCursor(LoadCursorW(0, IDC_SIZENWSE)));
+      }
+
+    case HTBOTTOMLEFT:
+    case HTTOPRIGHT:
+      {
+       return((LRESULT)SetCursor(LoadCursorW(0, IDC_SIZENESW)));
+      }
+    }
+  return((LRESULT)SetCursor(LoadCursorW(0, IDC_ARROW)));
+}
+
+LRESULT
+DefWndHandleSysCommand(HWND hWnd, WPARAM wParam, POINT Pt)
+{
+  /* FIXME: Implement system commands. */
+  return(0);
+}
+
+VOID
+DefWndAdjustRect(RECT* Rect, ULONG Style, BOOL Menu, ULONG ExStyle)
+{
+  if (Style & WS_ICONIC)
+    {
+      return;
+    }
+
+  if (UserHasThickFrameStyle(Style, ExStyle))
+    {
+      InflateRect(Rect, GetSystemMetrics(SM_CXFRAME), 
+                 GetSystemMetrics(SM_CYFRAME));
+    }
+  else if (UserHasDlgFrameStyle(Style, ExStyle))
+    {
+      InflateRect(Rect, GetSystemMetrics(SM_CXDLGFRAME),
+                 GetSystemMetrics(SM_CYDLGFRAME));
+    }
+  else if (UserHasThinFrameStyle(Style, ExStyle))
+    {
+      InflateRect(Rect, GetSystemMetrics(SM_CXBORDER),
+                 GetSystemMetrics(SM_CYBORDER));
+    }
+  if (Style & WS_CAPTION)
+    {
+      Rect->top -= GetSystemMetrics(SM_CYCAPTION) - 
+       GetSystemMetrics(SM_CYBORDER);
+    }
+  if (Menu)
+    {
+      Rect->top -= GetSystemMetrics(SM_CYMENU) + GetSystemMetrics(SM_CYBORDER);
+    }
+  if (Style & WS_VSCROLL)
+    {
+      Rect->right += GetSystemMetrics(SM_CXVSCROLL) - 1;
+      if (UserHasAnyFrameStyle(Style, ExStyle))
+       {
+         Rect->right++;
+       }
+    }
+  if (Style & WS_HSCROLL)
+    {
+      Rect->bottom += GetSystemMetrics(SM_CYHSCROLL) - 1;
+      if (UserHasAnyFrameStyle(Style, ExStyle))
+       {
+         Rect->bottom++;
+       }
+    }
+}
+
+LRESULT STDCALL
+DefWndNCCalcSize(HWND hWnd, RECT* Rect)
+{
+  LRESULT Result;
+  LONG Style = GetClassLongW(hWnd, GCL_STYLE);
+  RECT TmpRect = {0, 0, 0, 0};
+
+  if (Style & CS_VREDRAW)
+    {
+      Result |= WVR_VREDRAW;
+    }
+  if (Style & CS_HREDRAW)
+    {
+      Result |= WVR_HREDRAW;
+    }
+
+  if (!(GetWindowLong(hWnd, GWL_STYLE) & WS_MINIMIZE))
+    {
+      DefWndAdjustRect(&TmpRect, GetWindowLong(hWnd, GWL_STYLE),
+                      FALSE, GetWindowLong(hWnd, GWL_EXSTYLE));
+      Rect->left -= TmpRect.left;
+      Rect->top -= TmpRect.top;
+      Rect->right -= TmpRect.right;
+      Rect->bottom -= TmpRect.bottom;
+      /* FIXME: Adjust if the window has a menu. */
+      Rect->bottom = max(Rect->top, Rect->bottom);
+      Rect->right = max(Rect->left, Rect->right);
+    }
+  return(Result);
+}
+
+LRESULT
+DefWndHandleWindowPosChanging(HWND hWnd, WINDOWPOS* Pos)
+{
+  /* FIXME: Implement this. */
+}
+
 LRESULT STDCALL
 User32DefWindowProc(HWND hWnd,
                    UINT Msg,
                    WPARAM wParam,
-                   LPARAM lParam)
+                   LPARAM lParam,
+                   BOOL bUnicode)
 {
   switch (Msg)
     {
     case WM_NCPAINT:
       {
-       return(UserPaintNC(hWnd, (HRGN)wParam));
+       return(DefWndPaintNC(hWnd, (HRGN)wParam));
       }
 
     case WM_NCHITTEST:
@@ -463,18 +601,18 @@ User32DefWindowProc(HWND hWnd,
        POINT Point;
        Point.x = SLOWORD(lParam);
        Point.y = SHIWORD(lParam);
-       return(UserHitTestNC(hWnd, Point));
+       return(DefWndHitTestNC(hWnd, Point));
       }
 
     case WM_NCLBUTTONDOWN:
       {
-       return(UserHandleLButtonDownNC(hWnd, wParam, lParam));
+       return(DefWndHandleLButtonDownNC(hWnd, wParam, lParam));
       }
 
     case WM_LBUTTONDBLCLK:
     case WM_NCLBUTTONDBLCLK:
       {
-       return(UserHandleLButtonDblClkNC(hWnd, wParam, lParam));
+       return(DefWndHandleLButtonDblClkNC(hWnd, wParam, lParam));
       }
 
     case WM_NCRBUTTONDOWN:
@@ -488,26 +626,73 @@ User32DefWindowProc(HWND hWnd,
 
     case WM_RBUTTONUP:
       {
+       POINT Pt;
        if (hWnd == GetCapture())
          {
            ReleaseCapture();
          }
+       Pt.x = SLOWORD(lParam);
+       Pt.y = SHIWORD(lParam);
+       ClientToScreen(hWnd, &Pt);
+       lParam = MAKELPARAM(Pt.x, Pt.y);
+       if (bUnicode)
+         {
+           SendMessageW(hWnd, WM_CONTEXTMENU, (WPARAM)hWnd, lParam);
+         }
+       else
+         {
+           SendMessageA (hWnd, WM_CONTEXTMENU, (WPARAM)hWnd, lParam);
+         }
        break;
       }
 
     case WM_NCRBUTTONUP:
       {
+       /* Wine does nothing here. */
        break;
       }
 
     case WM_CONTEXTMENU:
       {
+       if (GetWindowLong(hWnd, GWL_STYLE) & WS_CHILD)
+         {
+           if (bUnicode)
+             {
+               SendMessageW(GetParent(hWnd), Msg, wParam, lParam);
+             }
+           else
+             {
+               SendMessageA(hWnd, WM_CONTEXTMENU, wParam, lParam);
+             }
+         }
+       else
+         {
+           LONG HitCode;
+           POINT Pt;
+
+           Pt.x = SLOWORD(lParam);
+           Pt.y = SHIWORD(lParam);
+           
+           if (GetWindowLong(hWnd, GWL_STYLE) & WS_CHILD)
+             {
+               ScreenToClient(GetParent(hWnd), &Pt);
+             }
+
+           HitCode = DefWndHitTestNC(hWnd, Pt);
+
+           if (HitCode == HTCAPTION || HitCode == HTSYSMENU)
+             {
+               TrackPopupMenu(GetSystemMenu(hWnd, FALSE),
+                              TPM_LEFTBUTTON | TPM_RIGHTBUTTON,
+                              Pt.x, Pt.y, 0, hWnd, NULL);
+             }
+         }
        break;
       }
 
     case WM_NCACTIVATE:
       {
-       return(UserHandleActiveNC(hWnd, wParam));
+       return(DefWndHandleActiveNC(hWnd, wParam));
       }
 
     case WM_NCDESTROY:
@@ -523,18 +708,45 @@ User32DefWindowProc(HWND hWnd,
     case WM_PAINTICON:
     case WM_PAINT:
       {
-       /* FIXME: Paint the icon if minimized otherwise just paint nothing. */
+       PAINTSTRUCT Ps;
+       HDC hDc = BeginPaint(hWnd, &Ps);
+       if (hDc)
+         {
+           HICON hIcon;
+           if (GetWindowLongW(hWnd, GWL_STYLE) & WS_MINIMIZE &&
+               (hIcon = (HICON)GetClassLongW(hWnd, GCL_HICON)) != NULL)
+             {
+               RECT WindowRect;
+               INT x, y;
+               GetWindowRect(hWnd, &WindowRect);
+               x = (WindowRect.right - WindowRect.left - 
+                    GetSystemMetrics(SM_CXICON)) / 2;
+               y = (WindowRect.bottom - WindowRect.top - 
+                    GetSystemMetrics(SM_CYICON)) / 2;
+               DrawIcon(hDc, x, y, hIcon);
+             }
+           EndPaint(hWnd, &Ps);
+         }
        return(0);
       }
-#if 0
+
     case WM_SYNCPAINT:
       {
+       HRGN hRgn;
+       hRgn = CreateRectRgn(0, 0, 0, 0);
+       if (GetUpdateRgn(hWnd, hRgn, FALSE) != NULLREGION)
+         {
+           RedrawWindow(hWnd, NULL, hRgn, 
+                        RDW_ERASENOW | RDW_ERASE | RDW_FRAME |
+                        RDW_ALLCHILDREN);
+         }
+       DeleteObject(hRgn);
        return(0);
       }
-#endif
+
     case WM_SETREDRAW:
       {
-       UserSetRedrawDefWnd(hWnd, wParam);
+       DefWndSetRedraw(hWnd, wParam);
        return(0);
       }
 
@@ -546,217 +758,215 @@ User32DefWindowProc(HWND hWnd,
 
     case WM_MOUSEACTIVATE:
       {
-       /* FIXME: Send to parent if child. */
+       if (GetWindowLong(hWnd, GWL_STYLE) & WS_CHILD)
+         {
+           LONG Ret;
+           if (bUnicode)
+             {
+               Ret = SendMessageW(GetParent(hWnd), WM_MOUSEACTIVATE,
+                                  wParam, lParam);
+             }
+           else
+             {
+               Ret = SendMessageA(GetParent(hWnd), WM_MOUSEACTIVATE,
+                                  wParam, lParam);
+             }
+           if (Ret)
+             {
+               return(Ret);
+             }
+         }
        return((LOWORD(lParam) >= HTCLIENT) ? MA_ACTIVATE : MA_NOACTIVATE);
       }
 
     case WM_ACTIVATE:
       {
-       if (LOWORD(lParam) != WA_INACTIVE)
+       if (LOWORD(lParam) != WA_INACTIVE &&
+           GetWindowLong(hWnd, GWL_STYLE) & WS_MINIMIZE)
          {
            /* Check if the window is minimized. */
            SetFocus(hWnd);
          }
        break;
       }
-#if 0
+
     case WM_MOUSEWHEEL:
       {
-       return(0);
+       if (GetWindowLong(hWnd, GWL_STYLE & WS_CHILD))
+         {
+           if (bUnicode)
+             {
+               return(SendMessageW(GetParent(hWnd), WM_MOUSEWHEEL,
+                                   wParam, lParam));
+             }
+           else
+             {
+               return(SendMessageA(GetParent(hWnd), WM_MOUSEWHEEL,
+                                   wParam, lParam));
+             }
+         }
+       break;
       }
-#endif
+
     case WM_ERASEBKGND:
     case WM_ICONERASEBKGND:
       {
-       RECT rect;
-       HBRUSH hbr = (HBRUSH)GetClassLongW(hWnd, GCL_HBRBACKGROUND);
-       if (!hbr) return 0;
-       
-       /*  Since WM_ERASEBKGND may receive either a window dc or a    */ 
-       /*  client dc, the area to be erased has to be retrieved from  */
-       /*  the device context.                                    */
-       GetClipBox( (HDC)wParam, &rect );
-       
-       /* Always call the Win32 variant of FillRect even on Win16,
-        * since despite the fact that Win16, as well as Win32,
-        * supports special background brushes for a window class,
-        * the Win16 variant of FillRect does not.
-        */
-       FillRect( (HDC) wParam, &rect, hbr );
-       return 1;
-      }
-#if 0
+       RECT Rect;
+       HBRUSH hBrush = (HBRUSH)GetClassLongW(hWnd, GCL_HBRBACKGROUND);
+       GetClipBox((HDC)wParam, &Rect);
+       FillRect((HDC)wParam, &Rect, hBrush);
+       return(1);
+      }
+
     case WM_GETDLGCODE:
-       return 0;
-
-    case WM_CTLCOLORMSGBOX:
-    case WM_CTLCOLOREDIT:
-    case WM_CTLCOLORLISTBOX:
-    case WM_CTLCOLORBTN:
-    case WM_CTLCOLORDLG:
-    case WM_CTLCOLORSTATIC:
-    case WM_CTLCOLORSCROLLBAR:
-       return (LRESULT)DEFWND_ControlColor( (HDC)wParam, msg - WM_CTLCOLORMSGBOX );
-
-    case WM_CTLCOLOR:
-       return (LRESULT)DEFWND_ControlColor( (HDC)wParam, HIWORD(lParam) );
-       
+      {
+       return(0);
+      }
+
+      /* FIXME: Implement colour controls. */
+
     case WM_SETCURSOR:
-       if (wndPtr->dwStyle & WS_CHILD)
-       {
-            /* with the exception of the border around a resizable wnd,
-             * give the parent first chance to set the cursor */
-            if ((LOWORD(lParam) < HTSIZEFIRST) || (LOWORD(lParam) > HTSIZELAST))
-            {
-                if (pSendMessage(wndPtr->parent->hwndSelf, WM_SETCURSOR, wParam, lParam))
-                    return TRUE;
-            }
-        }
-       return NC_HandleSetCursor( wndPtr->hwndSelf, wParam, lParam );
+      {
+       if (GetWindowLong(hWnd, GWL_STYLE) & WS_CHILD)
+         {
+           if (LOWORD(lParam) < HTLEFT || LOWORD(lParam) > HTBOTTOMRIGHT)
+             {
+               BOOL bResult;
+               if (bUnicode)
+                 {
+                   bResult = SendMessageW(GetParent(hWnd), WM_SETCURSOR, 
+                                          wParam, lParam);
+                 }
+               else              
+                 {
+                   bResult = SendMessageA(GetParent(hWnd), WM_SETCURSOR, 
+                                          wParam, lParam);
+                 }
+               if (bResult)
+                 {
+                   return(TRUE);
+                 }
+             }
+         }
+       return(DefWndHandleSetCursor(hWnd, wParam, lParam));      
+      }
 
     case WM_SYSCOMMAND:
-        {
-            POINT pt;
-            pt.x = SLOWORD(lParam);
-            pt.y = SHIWORD(lParam);
-            return NC_HandleSysCommand( wndPtr->hwndSelf, wParam, pt );
-        }
-
-    case WM_KEYDOWN:
-       if(wParam == VK_F10) iF10Key = VK_F10;
-       break;
+      {
+       POINT Pt;
+       Pt.x = SLOWORD(lParam);
+       Pt.y = SHIWORD(lParam);
+       return(DefWndHandleSysCommand(hWnd, wParam, Pt));
+      }
 
-    case WM_SYSKEYDOWN:
-       if( HIWORD(lParam) & KEYDATA_ALT )
-       {
-           /* if( HIWORD(lParam) & ~KEYDATA_PREVSTATE ) */
-             if( wParam == VK_MENU && !iMenuSysKey )
-               iMenuSysKey = 1;
-             else
-               iMenuSysKey = 0;
-           
-           iF10Key = 0;
-
-           if( wParam == VK_F4 )       /* try to close the window */
-           {
-               HWND hWnd = WIN_GetTopParent( wndPtr->hwndSelf );
-               wndPtr = WIN_FindWndPtr( hWnd );
-               if( wndPtr && !(wndPtr->clsStyle & CS_NOCLOSE) )
-                   pPostMessage( hWnd, WM_SYSCOMMAND, SC_CLOSE, 0 );
-                WIN_ReleaseWndPtr(wndPtr);
-           }
-       } 
-       else if( wParam == VK_F10 )
-               iF10Key = 1;
-            else
-               if( wParam == VK_ESCAPE && (GetKeyState(VK_SHIFT) & 0x8000))
-                   pSendMessage( wndPtr->hwndSelf, WM_SYSCOMMAND, SC_KEYMENU, VK_SPACE );
-       break;
-
-    case WM_KEYUP:
-    case WM_SYSKEYUP:
-       /* Press and release F10 or ALT */
-       if (((wParam == VK_MENU) && iMenuSysKey) ||
-            ((wParam == VK_F10) && iF10Key))
-             pSendMessage( WIN_GetTopParent(wndPtr->hwndSelf),
-                             WM_SYSCOMMAND, SC_KEYMENU, 0L );
-       iMenuSysKey = iF10Key = 0;
-        break;
-
-    case WM_SYSCHAR:
-       iMenuSysKey = 0;
-       if (wParam == VK_RETURN && (wndPtr->dwStyle & WS_MINIMIZE))
-        {
-           pPostMessage( wndPtr->hwndSelf, WM_SYSCOMMAND, SC_RESTORE, 0L );
-           break;
-        } 
-       if ((HIWORD(lParam) & KEYDATA_ALT) && wParam)
-        {
-           if (wParam == VK_TAB || wParam == VK_ESCAPE) break;
-           if (wParam == VK_SPACE && (wndPtr->dwStyle & WS_CHILD))
-               pSendMessage( wndPtr->parent->hwndSelf, msg, wParam, lParam );
-           else
-               pSendMessage( wndPtr->hwndSelf, WM_SYSCOMMAND, SC_KEYMENU, wParam );
-        } 
-       else /* check for Ctrl-Esc */
-            if (wParam != VK_ESCAPE) MessageBeep(0);
-       break;
+      /* FIXME: Handle key messages. */
 
     case WM_SHOWWINDOW:
-        if (!lParam) return 0; /* sent from ShowWindow */
-        if (!(wndPtr->dwStyle & WS_POPUP) || !wndPtr->owner) return 0;
-        if ((wndPtr->dwStyle & WS_VISIBLE) && wParam) return 0;
-       else if (!(wndPtr->dwStyle & WS_VISIBLE) && !wParam) return 0;
-        ShowWindow( wndPtr->hwndSelf, wParam ? SW_SHOWNOACTIVATE : SW_HIDE );
-       break; 
+      {
+       if (lParam)
+         {
+           return(0);
+         }
+       /* FIXME: Check for a popup window. */
+       if ((GetWindowLongW(hWnd, GWL_STYLE) & WS_VISIBLE && !wParam) ||
+           (!(GetWindowLongW(hWnd, GWL_STYLE) & WS_VISIBLE) && wParam))
+         {
+           return(0);
+         } 
+       ShowWindow(hWnd, wParam ? SW_SHOWNOACTIVATE : SW_HIDE);
+       break;
+      }
 
     case WM_CANCELMODE:
-       if (wndPtr->parent == WIN_GetDesktop()) EndMenu();
-       if (GetCapture() == wndPtr->hwndSelf) ReleaseCapture();
-        WIN_ReleaseDesktop();
+      {
+       /* FIXME: Check for a desktop. */
+       if (GetCapture() == hWnd)
+         {
+           ReleaseCapture();
+         }
        break;
+      }
 
     case WM_VKEYTOITEM:
     case WM_CHARTOITEM:
-       return -1;
+      return(-1);
 
     case WM_DROPOBJECT:
-       return DRAG_FILE;  
+      /* FIXME: Implement this. */
+      break;
 
     case WM_QUERYDROPOBJECT:
-       if (wndPtr->dwExStyle & WS_EX_ACCEPTFILES) return 1;
+      {
+       if (GetWindowLongW(hWnd, GWL_EXSTYLE) & WS_EX_ACCEPTFILES)
+         {
+           return(1);
+         }
        break;
+      }
 
     case WM_QUERYDRAGICON:
-        {
-            UINT len;
-
-            HICON hIcon = GetClassLongW( wndPtr->hwndSelf, GCL_HICON );
-            if (hIcon) return hIcon;
-            for(len=1; len<64; len++)
-                if((hIcon = LoadIconW(wndPtr->hInstance, MAKEINTRESOURCEW(len))))
-                    return (LRESULT)hIcon;
-            return (LRESULT)LoadIconW(0, IDI_APPLICATIONW);
-        }
-        break;
+      {
+       UINT Len;
+       HICON hIcon;
+
+       hIcon = (HICON)GetClassLongW(hWnd, GCL_HICON);
+       if (hIcon)
+         {
+           return((LRESULT)hIcon);
+         }
+       for (Len = 1; Len < 64; Len++)
+         {
+           if ((hIcon = LoadIconW(NULL, MAKEINTRESOURCE(Len))) != NULL)
+             {
+               return((LRESULT)hIcon);
+             }
+         }
+       return((LRESULT)LoadIconW(0, IDI_APPLICATION));
+      }
 
-    case WM_ISACTIVEICON:
-       return ((wndPtr->flags & WIN_NCACTIVATED) != 0);
+      /* FIXME: WM_ISACTIVEICON */
 
     case WM_NOTIFYFORMAT:
-      if (IsWindowUnicode(wndPtr->hwndSelf)) return NFR_UNICODE;
-      else return NFR_ANSI;
-        
-    case WM_QUERYOPEN:
-    case WM_QUERYENDSESSION:
-       return 1;
+      {
+       if (IsWindowUnicode(hWnd))
+         {
+           return(NFR_UNICODE);
+         }
+       else
+         {
+           return(NFR_ANSI);
+         }
+      }
 
     case WM_SETICON:
-       {
-               int index = (wParam != ICON_SMALL) ? GCL_HICON : GCL_HICONSM;
-               HICON hOldIcon = GetClassLongW(wndPtr->hwndSelf, index); 
-               SetClassLongW(wndPtr->hwndSelf, index, lParam);
-
-               SetWindowPos(wndPtr->hwndSelf, 0, 0, 0, 0, 0, SWP_FRAMECHANGED
-                        | SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE
-                        | SWP_NOZORDER);
-
-               if( wndPtr->flags & WIN_NATIVE )
-                   wndPtr->pDriver->pSetHostAttr(wndPtr, HAK_ICONS, 0);
-
-               return hOldIcon;
-       }
+      {
+       INT Index = (wParam != 0) ? GCL_HICON : GCL_HICONSM;
+       HICON hOldIcon = (HICON)GetClassLongW(hWnd, Index);
+       SetClassLongW(hWnd, Index, lParam);
+       SetWindowPos(hWnd, 0, 0, 0, 0, 0, 
+                    SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE |
+                    SWP_NOACTIVATE | SWP_NOZORDER);
+       return((LRESULT)hOldIcon);
+      }
 
     case WM_GETICON:
-       {
-               int index = (wParam != ICON_SMALL) ? GCL_HICON : GCL_HICONSM;
-               return GetClassLongW(wndPtr->hwndSelf, index); 
-       }
+      {
+       INT Index = (wParam != 0) ? GCL_HICON : GCL_HICONSM;
+       return(GetClassLongW(hWnd, Index));
+      }
 
     case WM_HELP:
-       pSendMessage( wndPtr->parent->hwndSelf, msg, wParam, lParam );
-       break;    
-#endif
+      {
+       if (bUnicode)
+         {
+           SendMessageW(GetParent(hWnd), Msg, wParam, lParam);
+         }
+       else
+         {
+           SendMessageA(GetParent(hWnd), Msg, wParam, lParam);
+         }
+       break;
+      }
     }
   return 0;
 }
@@ -768,6 +978,8 @@ DefWindowProcA(HWND hWnd,
               LPARAM lParam)
 {
   LRESULT Result;
+  static ATOM WindowTextAtom = 0;
+  PSTR WindowText;
 
   switch (Msg)
     {
@@ -776,38 +988,82 @@ DefWindowProcA(HWND hWnd,
        CREATESTRUCTA* Cs = (CREATESTRUCTA*)lParam;
        if (HIWORD(Cs->lpszName))
          {
-           /* FIXME: Set the window title. */
+           WindowTextAtom = GlobalAddAtomA("USER32!WindowTextAtomA");
+           WindowText = User32AllocHeap(strlen(Cs->lpszName) * sizeof(CHAR));
+           strcpy(WindowText, Cs->lpszName);
+           SetPropA(hWnd, WindowTextAtom, WindowText);
          }
-       Result = 1;
-       break;
+       return(1);
       }
 
     case WM_NCCALCSIZE:
       {
+       return(DefWndNCCalcSize(hWnd, (RECT*)lParam));
       }
 
     case WM_WINDOWPOSCHANGING:
       {
-      }
-
-    case WM_WINDOWPOSCHANGED:
-      {
+       return(DefWndHandleWindowPosChanging(hWnd, (WINDOWPOS*)lParam));
       }
 
     case WM_GETTEXTLENGTH:
       {
+       if (WindowTextAtom == 0 ||
+           (WindowText = GetPropA(hWnd, WindowTextAtom)) == NULL)
+         {
+           return(0);
+         }
+       return(wcslen(WindowText));
       }
 
     case WM_GETTEXT:
       {
+       if (WindowTextAtom == 0 ||
+           (WindowText = GetPropA(hWnd, WindowTextAtom)) == NULL)
+         {
+           if (wParam > 1)
+             {
+               ((PSTR)lParam) = '\0';
+             }
+           return(0);
+         }
+       strncpy((PWSTR)lParam, WindowText, wParam);
+       return(min(wParam, wcslen(WindowText)));
       }
 
     case WM_SETTEXT:
       {
+       if (WindowTextAtom != 0)
+         {
+           WindowTextAtom = GlobalAddAtomA("USER32!WindowTextAtomW");      
+         }
+       if (WindowTextAtom != 0 &&
+           (WindowText = GetPropA(hWnd, WindowTextAtom)) == NULL)
+         {
+           User32FreeHeap(WindowText);
+         }
+       WindowText = User32AllocHeap(strlen((PSTR)lParam) * sizeof(CHAR));
+       strcpy(WindowText, (PSTR)lParam);
+       SetPropA(hWnd, WindowTextAtom, WindowText);
+      }
+
+    case WM_NCDESTROY:
+      {
+       if (WindowTextAtom != 0 &&
+           (WindowText = RemovePropA(hWnd, WindowTextAtom)) == NULL)
+         {
+           User32FreeHeap(WindowText);
+         }
+       if (WindowTextAtom != 0)
+         {
+           GlobalDeleteAtom(WindowTextAtom);
+         }
+       /* FIXME: Destroy scroll bars here as well. */
+       return(0);
       }
 
     default:
-      Result = User32DefWindowProc(hWnd, Msg, wParam, lParam);
+      Result = User32DefWindowProc(hWnd, Msg, wParam, lParam, FALSE);
       break;
     }
 
@@ -821,6 +1077,8 @@ DefWindowProcW(HWND hWnd,
               LPARAM lParam)
 {
   LRESULT Result;
+  static ATOM WindowTextAtom = 0;
+  PWSTR WindowText;
 
   switch (Msg)
     {
@@ -829,38 +1087,82 @@ DefWindowProcW(HWND hWnd,
        CREATESTRUCTW* Cs = (CREATESTRUCTW*)lParam;
        if (HIWORD(Cs->lpszName))
          {
-           /* FIXME: Set the window title. */
+           WindowTextAtom = GlobalAddAtomW(L"USER32!WindowTextAtomW");
+           WindowText = User32AllocHeap(wcslen(Cs->lpszName) * sizeof(WCHAR));
+           wcscpy(WindowText, Cs->lpszName);
+           SetPropW(hWnd, WindowTextAtom, WindowText);
          }
-       Result = 1;
-       break;
+       return(1);
       }
 
     case WM_NCCALCSIZE:
       {
+       return(DefWndNCCalcSize(hWnd, (RECT*)lParam));
       }
 
     case WM_WINDOWPOSCHANGING:
       {
-      }
-
-    case WM_WINDOWPOSCHANGED:
-      {
+       return(DefWndHandleWindowPosChanging(hWnd, (WINDOWPOS*)lParam));
       }
 
     case WM_GETTEXTLENGTH:
       {
+       if (WindowTextAtom == 0 ||
+           (WindowText = GetPropW(hWnd, WindowTextAtom)) == NULL)
+         {
+           return(0);
+         }
+       return(wcslen(WindowText));
       }
 
     case WM_GETTEXT:
       {
+       if (WindowTextAtom == 0 ||
+           (WindowText = GetPropW(hWnd, WindowTextAtom)) == NULL)
+         {
+           if (wParam > 1)
+             {
+               ((PWSTR)lParam) = '\0';
+             }
+           return(0);
+         }
+       wcsncpy((PWSTR)lParam, WindowText, wParam);
+       return(min(wParam, wcslen(WindowText)));
       }
 
     case WM_SETTEXT:
       {
+       if (WindowTextAtom != 0)
+         {
+           WindowTextAtom = GlobalAddAtom(L"USER32!WindowTextAtomW");      
+         }
+       if (WindowTextAtom != 0 &&
+           (WindowText = GetPropW(hWnd, WindowTextAtom)) == NULL)
+         {
+           User32FreeHeap(WindowText);
+         }
+       WindowText = User32AllocHeap(wcslen((PWSTR)lParam) * sizeof(WCHAR));
+       wcscpy(WindowText, (PWSTR)lParam);
+       SetPropW(hWnd, WindowTextAtom, WindowText);
+      }
+
+    case WM_NCDESTROY:
+      {
+       if (WindowTextAtom != 0 &&
+           (WindowText = RemovePropW(hWnd, WindowTextAtom)) == NULL)
+         {
+           User32FreeHeap(WindowText);
+         }
+       if (WindowTextAtom != 0)
+         {
+           GlobalDeleteAtom(WindowTextAtom);
+         }
+       /* FIXME: Destroy scroll bars here as well. */
+       return(0);
       }
 
     default:
-      Result = User32DefWindowProc(hWnd, Msg, wParam, lParam);
+      Result = User32DefWindowProc(hWnd, Msg, wParam, lParam, TRUE);
       break;
     }
 
index 1b7f5a7..578c8a5 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: window.c,v 1.6 2002/06/18 21:51:09 dwelch Exp $
+/* $Id: window.c,v 1.7 2002/07/04 19:56:34 dwelch Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS user32.dll
@@ -78,8 +78,8 @@ User32CallSendAsyncProcForKernel(PVOID Arguments, ULONG ArgumentLength)
     {
       return(STATUS_INFO_LENGTH_MISMATCH);
     }
-  CallbackArgs->Proc(CallbackArgs->Wnd, CallbackArgs->Msg,
-                    CallbackArgs->Data, CallbackArgs->Result);
+  CallbackArgs->Callback(CallbackArgs->Wnd, CallbackArgs->Msg,
+                        CallbackArgs->Context, CallbackArgs->Result);
   return(STATUS_SUCCESS);
 }
 
index 6e50836..f3686d0 100644 (file)
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.71 2002/06/18 21:51:09 dwelch Exp $
+# $Id: Makefile,v 1.72 2002/07/04 19:56:35 dwelch Exp $
 #
 # ReactOS Operating System
 #
@@ -328,7 +328,7 @@ OBJECTS_KD = \
        kd/kdebug.o \
        kd/service.o \
        kd/dlog.o \
-  kd/gdbstub.o
+  kd/gdbstub.o kd/mda.o
 
 DEP_OBJECTS := $(OBJECTS_NT) $(OBJECTS_MM) $(OBJECTS_ARCH) \
        $(OBJECTS_IO) $(OBJECTS_KE) $(OBJECTS_OB) \
@@ -340,6 +340,7 @@ DEP_OBJECTS := $(OBJECTS_NT) $(OBJECTS_MM) $(OBJECTS_ARCH) \
 #
 # Include automatic dependancy tracking
 #
+DEP_EXCLUDE_FILTER := ex/napi.% nt/zw.%
 include $(PATH_TO_TOP)/tools/depend.mk
 
 
index 25a7b99..bc96180 100644 (file)
@@ -25,11 +25,11 @@ typedef struct _DESKTOP_OBJECT
 {   
   CSHORT Type;
   CSHORT Size;
-
   LIST_ENTRY ListEntry;
   KSPIN_LOCK Lock;
   UNICODE_STRING Name;
   struct _WINSTATION_OBJECT *WindowStation;
+  LIST_ENTRY WindowListHead;
 } DESKTOP_OBJECT, *PDESKTOP_OBJECT;
 
 
index a58a66c..f21b333 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: kd.h,v 1.9 2002/05/16 06:39:30 ekohl Exp $
+/* $Id: kd.h,v 1.10 2002/07/04 19:56:35 dwelch Exp $
  *
  * kernel debugger prototypes
  */
@@ -15,6 +15,7 @@
 #define KD_DEBUG_SERIAL                0x08
 #define KD_DEBUG_BOCHS         0x10
 #define KD_DEBUG_FILELOG       0x20
+#define KD_DEBUG_MDA            0x40
 
 extern ULONG KdDebugState;
 
@@ -61,7 +62,9 @@ KdDebugPrint (LPSTR Message);
 
 KD_CONTINUE_TYPE
 KdEnterDebuggerException(PEXCEPTION_RECORD ExceptionRecord,
-  PCONTEXT Context,
-       PKTRAP_FRAME TrapFrame);
+                        PCONTEXT Context,
+                        PKTRAP_FRAME TrapFrame);
+VOID KdInitializeMda(VOID);
+VOID KdPrintMda(PCH pch);
 
 #endif /* __INCLUDE_INTERNAL_KERNEL_DEBUGGER_H */
index 4c19288..3be1d70 100644 (file)
@@ -16,7 +16,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id: ps.h,v 1.34 2002/06/04 15:26:55 dwelch Exp $
+/* $Id: ps.h,v 1.35 2002/07/04 19:56:35 dwelch Exp $
  *
  * FILE:            ntoskrnl/ke/kthread.c
  * PURPOSE:         Process manager definitions
@@ -460,14 +460,15 @@ struct _EPROCESS
    /*
     * Added by David Welch (welch@mcmail.com)
     */
-   MADDRESS_SPACE       AddressSpace;
-   HANDLE_TABLE         HandleTable;
-   LIST_ENTRY           ProcessListEntry;
+  HANDLE                Win32Desktop;
+  MADDRESS_SPACE        AddressSpace;
+  HANDLE_TABLE          HandleTable;
+  LIST_ENTRY            ProcessListEntry;
    
    /*
     * Added by Philip Susi for list of threads in process
     */
-   LIST_ENTRY           ThreadListHead;
+  LIST_ENTRY           ThreadListHead;
 };
 
 #define PROCESS_STATE_TERMINATED (1)
index 1824731..e3b8d83 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: kdebug.c,v 1.36 2002/05/08 17:05:32 chorns Exp $
+/* $Id: kdebug.c,v 1.37 2002/07/04 19:56:35 dwelch Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
@@ -140,6 +140,12 @@ KdInitSystem(ULONG Reserved,
                  KdDebuggerEnabled = TRUE;
                  KdDebugState |= KD_DEBUG_FILELOG;
                }
+             else if (!_strnicmp(p2, "MDA", 3))
+               {
+                 p2 += 3;
+                 KdDebuggerEnabled = TRUE;
+                 KdDebugState |= KD_DEBUG_MDA;
+               }
            }
        }
       else if (!_strnicmp(p2, "DEBUG", 5))
@@ -229,6 +235,8 @@ KdInitSystem(ULONG Reserved,
 
       if (KdDebugState & KD_DEBUG_FILELOG)
            PrintString("\n   File log debugging enabled\n\n");
+      if (KdDebugState & KD_DEBUG_MDA)
+           PrintString("\n   MDA debugging enabled\n\n");
     }
 
   /* Perform any initialization nescessary */
@@ -242,6 +250,9 @@ KdInitSystem(ULONG Reserved,
 
       if (KdDebugState & KD_DEBUG_FILELOG)
            DebugLogInit();
+
+      if (KdDebugState & KD_DEBUG_MDA)
+           KdInitializeMda();
     }
 }
 
@@ -320,6 +331,9 @@ KdpPrintString(PANSI_STRING String)
        if (KdDebugState & KD_DEBUG_FILELOG)
                DebugLogWrite(pch);
 
+       if (KdDebugState & KD_DEBUG_MDA)
+               KdPrintMda(pch);
+
        return((ULONG)String->Length);
 }
 
diff --git a/reactos/ntoskrnl/kd/mda.c b/reactos/ntoskrnl/kd/mda.c
new file mode 100644 (file)
index 0000000..d7d05a1
--- /dev/null
@@ -0,0 +1,151 @@
+/*
+ *  ReactOS kernel
+ *  Copyright (C) 1998, 1999, 2000, 2001 ReactOS Team
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+/* $Id: mda.c,v 1.1 2002/07/04 19:56:35 dwelch Exp $
+ *
+ * PROJECT:         ReactOS kernel
+ * FILE:            ntoskrnl/kd/mda.c
+ * PURPOSE:         Support for debugging using an MDA card.
+ * PROGRAMMER:      David Welch <welch@cwcom.net>
+ */
+
+/* INCLUDES ******************************************************************/
+
+#include <ddk/ntddk.h>
+#include <internal/ntoskrnl.h>
+#include <internal/kd.h>
+#include <internal/mm.h>
+#include <roscfg.h>
+#include "../dbg/kdb.h"
+
+/* VARIABLES ***************************************************************/
+
+STATIC ULONG MdaIndexPort;
+STATIC ULONG MdaValuePort;
+STATIC ULONG MdaStatusPort;
+STATIC ULONG MdaGfxPort;
+STATIC ULONG MdaModePort;
+STATIC PUSHORT VideoBuffer;
+
+#define MDA_COLUMNS (80)
+#define MDA_LINES   (25)
+
+STATIC ULONG MdaCursorX, MdaCursorY;
+
+/* PRIVATE FUNCTIONS ********************************************************/
+
+#if 0
+VOID STATIC
+KdWriteByteMDA(ULONG Reg, ULONG Value)
+{
+  WRITE_PORT_UCHAR((PUCHAR)MdaIndexPort, (CHAR)Reg);
+  WRITE_PORT_UCHAR((PUCHAR)MdaValuePort, (CHAR)Value);
+}
+
+VOID STATIC
+KdWriteWordMDA(ULONG Reg, ULONG Value)
+{
+  WRITE_PORT_UCHAR((PUCHAR)MdaIndexPort, (CHAR)Reg);
+  WRITE_PORT_UCHAR((PUCHAR)MdaValuePort, (CHAR)(Value >> 8));
+  WRITE_PORT_UCHAR((PUCHAR)MdaIndexPort, (CHAR)(Reg + 1));
+  WRITE_PORT_UCHAR((PUCHAR)MdaValuePort, (CHAR)(Value & 0xFF));
+}
+#endif
+
+VOID 
+KdInitializeMda(VOID)
+{
+  /* Setup the variables for the various port addresses. */
+  MdaIndexPort = 0x3b4;
+  MdaValuePort = 0x3b5;
+  MdaModePort = 0x3b8;
+  MdaStatusPort = 0x3ba;
+  MdaGfxPort = 0x3bf;
+
+  VideoBuffer = (PUSHORT)(0xd0000000 + 0xb0000);
+
+  MdaCursorX = MdaCursorY = 0;
+}
+
+VOID STATIC
+KdScrollMda(VOID)
+{
+  memmove(&VideoBuffer[(MDA_COLUMNS * 0) + 0], 
+         &VideoBuffer[(MDA_COLUMNS * 1) + 0],
+         MDA_COLUMNS * (MDA_LINES - 1) * 2);             
+  memset(&VideoBuffer[(MDA_COLUMNS * (MDA_LINES - 1)) + 0], 0,
+        MDA_COLUMNS * 2);
+}
+
+VOID STATIC
+KdPutCharMda(CHAR Ch)
+{
+  if (Ch == '\n')
+    {
+      if (MdaCursorY == (MDA_LINES - 1))
+       {
+         KdScrollMda();
+       }
+      else
+       {
+         MdaCursorY++;
+       }
+      MdaCursorX = 0;
+      return;
+    }
+  VideoBuffer[(MdaCursorY * MDA_COLUMNS) + MdaCursorX] = (Ch & 0xFF) | 0x0700;
+  MdaCursorX++;
+  if (MdaCursorX == (MDA_COLUMNS - 1))
+    {
+      if (MdaCursorY == (MDA_LINES - 1))
+       {
+         KdScrollMda();
+       }
+      else
+       {
+         MdaCursorY++;
+       }
+      MdaCursorX = 0;
+    }
+}
+
+VOID 
+KdPrintMda(PCH pch)
+{
+  while((*pch) != 0)
+    {
+      if ((*pch) == '\t')
+       {
+         KdPutCharMda(' ');
+         KdPutCharMda(' ');
+         KdPutCharMda(' ');
+         KdPutCharMda(' ');
+       }
+      if ((*pch) == '\r')
+       {
+         /* Nothing. */
+       }
+      else
+       {
+         KdPutCharMda(*pch);
+       }
+      pch++;
+    }
+}
+
+/* EOF */
index 6a9702e..c463d2d 100644 (file)
@@ -16,7 +16,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id: syscall.S,v 1.5 2002/06/11 22:09:02 dwelch Exp $
+/* $Id: syscall.S,v 1.6 2002/07/04 19:56:36 dwelch Exp $
  *
  * FILE:            ntoskrnl/hal/x86/syscall.s
  * PURPOSE:         2E trap handler
@@ -89,8 +89,9 @@ L3:
           pushl $0     /* XXX: TempCS */
           pushl $0     /* XXX: DebugPointer */
           pushl $0     /* XXX: DebugArgMark */
-          pushl $0     /* XXX: DebugEIP */
-          pushl $0     /* XXX: DebugEBP */
+          movl  0x60(%esp), %ebx
+          pushl %ebx   /* DebugEIP */
+          pushl %ebp   /* DebugEBP */
 
            /* Load the segment registers */
           movl  $KERNEL_DS, %ebx
index 83c5ba2..e682298 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: process.c,v 1.83 2002/06/17 22:52:31 joeg Exp $
+/* $Id: process.c,v 1.84 2002/07/04 19:56:36 dwelch Exp $
  *
  * COPYRIGHT:         See COPYING in the top level directory
  * PROJECT:           ReactOS kernel
@@ -259,6 +259,7 @@ PsInitProcessManagment(VOID)
    PsInitialSystemProcess->UniqueProcessId = 
      InterlockedIncrement(&PiNextProcessUniqueId);
    PsInitialSystemProcess->Win32WindowStation = (HANDLE)0;
+   PsInitialSystemProcess->Win32Desktop = (HANDLE)0;
    
    KeAcquireSpinLock(&PsProcessListLock, &oldIrql);
    InsertHeadList(&PsProcessListHead, 
@@ -546,7 +547,27 @@ NtCreateProcess(OUT PHANDLE ProcessHandle,
      {
        Process->Win32WindowStation = (HANDLE)0;
      }
-   
+   if (ParentProcess->Win32Desktop != (HANDLE)0)
+     {
+       /* Always duplicate the process window station. */
+       Process->Win32Desktop = 0;
+       Status = ObDuplicateObject(ParentProcess,
+                                 Process,
+                                 ParentProcess->Win32Desktop,
+                                 &Process->Win32Desktop,
+                                 0,
+                                 FALSE,
+                                 DUPLICATE_SAME_ACCESS);
+       if (!NT_SUCCESS(Status))
+        {
+          KeBugCheck(0);
+        }
+     }
+   else
+     {
+       Process->Win32Desktop = (HANDLE)0;
+     }
+
    KeAcquireSpinLock(&PsProcessListLock, &oldIrql);
    for (i = 0; i < PiProcessNotifyRoutineCount; i++)
     {
index 7860bfa..9f28e83 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: token.c,v 1.17 2002/06/17 22:52:32 joeg Exp $
+/* $Id: token.c,v 1.18 2002/07/04 19:56:36 dwelch Exp $
  *
  * COPYRIGHT:         See COPYING in the top level directory
  * PROJECT:           ReactOS kernel
@@ -974,14 +974,14 @@ SepCreateSystemProcessToken(struct _EPROCESS* Process)
                         SepTokenObjectType,
                         (PVOID*)&AccessToken);
 
-  Status = ZwAllocateLocallyUniqueId(&AccessToken->TokenId);
+  Status = NtAllocateLocallyUniqueId(&AccessToken->TokenId);
   if (!NT_SUCCESS(Status))
     {
       ObDereferenceObject(AccessToken);
       return(Status);
     }
 
-  Status = ZwAllocateLocallyUniqueId(&AccessToken->ModifiedId);
+  Status = NtAllocateLocallyUniqueId(&AccessToken->ModifiedId);
   if (!NT_SUCCESS(Status))
     {
       ObDereferenceObject(AccessToken);
diff --git a/reactos/subsys/system/gstart/Makefile b/reactos/subsys/system/gstart/Makefile
new file mode 100644 (file)
index 0000000..65269d5
--- /dev/null
@@ -0,0 +1,21 @@
+# $Id: Makefile,v 1.1 2002/07/04 19:56:36 dwelch Exp $
+
+PATH_TO_TOP = ../../..
+
+TARGET_TYPE = program
+
+TARGET_APPTYPE = console
+
+TARGET_NAME = gstart
+
+TARGET_INSTALLDIR = system32
+
+TARGET_SDKLIBS = user32.a gdi32.a ntdll.a kernel32.a
+
+TARGET_OBJECTS = $(TARGET_NAME).o
+
+include $(PATH_TO_TOP)/rules.mak
+
+include $(TOOLS_PATH)/helper.mk
+
+# EOF
diff --git a/reactos/subsys/system/gstart/gstart.c b/reactos/subsys/system/gstart/gstart.c
new file mode 100644 (file)
index 0000000..566a2c9
--- /dev/null
@@ -0,0 +1,89 @@
+/* $Id: gstart.c,v 1.1 2002/07/04 19:56:36 dwelch Exp $
+ *
+ * PROJECT    : ReactOS Operating System
+ * DESCRIPTION: ReactOS GUI Startup
+ * LICENSE    : See top level directory
+ *
+ */
+#define NTOS_MODE_USER
+#include <ntos.h>
+#include <windows.h>
+#include <stdarg.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <ctype.h>
+
+int ExecuteProcess(char* name, char* cmdline)
+{
+   PROCESS_INFORMATION ProcessInformation;
+   STARTUPINFO         StartupInfo;
+   BOOL                        ret;
+   CHAR                        fullname[260];
+   PCHAR               p;
+   
+   /* append '.exe' if needed */
+   strcpy (fullname, name);
+   p = strrchr (fullname, '.');
+   if ((p == NULL) || (_stricmp (p, ".exe") != 0))
+     {
+       strcat (fullname, ".exe");
+     }
+
+   memset(&StartupInfo, 0, sizeof(StartupInfo));
+   StartupInfo.cb = sizeof (STARTUPINFO);
+   StartupInfo.lpTitle = name;
+   if( cmdline && *cmdline  )
+     *(cmdline-1) = ' ';  
+   ret = CreateProcessA(fullname,
+                       name,
+                       NULL,
+                       NULL,
+                       FALSE,
+                       0,
+                       NULL,
+                       NULL,
+                       &StartupInfo,
+                       &ProcessInformation);
+   if (ret)
+     {
+       WaitForSingleObject(ProcessInformation.hProcess, INFINITE);
+       CloseHandle(ProcessInformation.hProcess);
+       CloseHandle(ProcessInformation.hThread);
+     }
+   return(ret);
+}
+
+int main(int argc, char* argv[])
+{
+  HDC Desktop;
+  HBRUSH Pen;
+
+  GdiDllInitialize (NULL, DLL_PROCESS_ATTACH, NULL);
+
+  /* Set up a DC called Desktop that accesses DISPLAY */
+  Desktop = CreateDCA("DISPLAY", NULL, NULL, NULL);
+  if (Desktop == NULL)
+    {
+      return 1;
+    }
+
+  Pen = CreatePen(PS_SOLID, 1, RGB(0, 0, 255));
+  SelectObject(Desktop, Pen);
+  Rectangle(Desktop, 0, 0, 640, 480);
+
+  if (argc > 1)
+    {
+      ExecuteProcess(argv[1], "");
+    }
+  else
+    {
+      Sleep(50);
+    }
+
+  DeleteDC(Desktop);
+
+  return(0);
+}
+
+/* EOF */
diff --git a/reactos/subsys/system/gstart/gstart.rc b/reactos/subsys/system/gstart/gstart.rc
new file mode 100644 (file)
index 0000000..0982e26
--- /dev/null
@@ -0,0 +1,38 @@
+#include "../../../include/defines.h"
+#include "../../../include/reactos/resource.h"
+
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+
+VS_VERSION_INFO VERSIONINFO
+       FILEVERSION     RES_UINT_FV_MAJOR,RES_UINT_FV_MINOR,RES_UINT_FV_REVISION,RES_UINT_FV_BUILD
+       PRODUCTVERSION  RES_UINT_PV_MAJOR,RES_UINT_PV_MINOR,RES_UINT_PV_REVISION,RES_UINT_PV_BUILD      
+       FILEFLAGSMASK   0x3fL
+#ifdef _DEBUG
+       FILEFLAGS       0x1L
+#else
+       FILEFLAGS       0x0L
+#endif
+       FILEOS          0x40004L
+       FILETYPE        0x2L
+       FILESUBTYPE     0x0L
+BEGIN
+    BLOCK "StringFileInfo"
+    BEGIN
+        BLOCK "040904b0"
+        BEGIN
+            VALUE "CompanyName",       RES_STR_COMPANY_NAME
+            VALUE "FileDescription",   "ReactOS Simple Shell\0"
+            VALUE "FileVersion",       RES_STR_FILE_VERSION
+            VALUE "InternalName",      "shell\0"
+            VALUE "LegalCopyright",    RES_STR_LEGAL_COPYRIGHT
+            VALUE "OriginalFilename",  "shell.exe\0"
+            VALUE "ProductName",       RES_STR_PRODUCT_NAME
+            VALUE "ProductVersion",    RES_STR_PRODUCT_VERSION
+        END
+    END
+    BLOCK "VarFileInfo"
+    BEGIN
+        VALUE "Translation", 0x409, 1200
+    END
+END
+
index db404b8..21cab96 100644 (file)
@@ -11,5 +11,14 @@ LRESULT STDCALL
 W32kSendNCCREATEMessage(HWND Wnd, CREATESTRUCT* CreateStruct);
 LRESULT STDCALL
 W32kSendCREATEMessage(HWND Wnd, CREATESTRUCT* CreateStruct);
+VOID STDCALL
+W32kCallSentMessageCallback(SENDASYNCPROC CompletionCallback,
+                           HWND hWnd,
+                           UINT Msg,
+                           ULONG_PTR CompletionCallbackContext,
+                           LRESULT Result);
+LRESULT STDCALL
+W32kSendNCCALCSIZEMessage(HWND Wnd, BOOL Validate, RECT Rect1,
+                         RECT Rect2, RECT Rect3, PWINDOWPOS Pos);
 
 #endif /* __SUBSYS_WIN32K_INCLUDE_CALLBACK_H */
index a090974..47d7ba1 100644 (file)
@@ -34,16 +34,30 @@ typedef struct _USER_SENT_MESSAGE_NOTIFY
 
 typedef struct _USER_MESSAGE_QUEUE
 {
+  /* Queue of messages sent to the queue. */
   LIST_ENTRY SentMessagesListHead;
+  /* Queue of messages posted to the queue. */
   LIST_ENTRY PostedMessagesListHead;
+  /* Queue of hardware messages for the queue. */
   LIST_ENTRY HardwareMessagesListHead;
+  /* Queue of sent-message notifies for the queue. */
   LIST_ENTRY NotifyMessagesListHead;
+  /* Lock for the queue. */
   FAST_MUTEX Lock;
+  /* True if a WM_QUIT message is pending. */
   BOOLEAN QuitPosted;
+  /* The quit exit code. */
   ULONG QuitExitCode;
+  /* Set if there are new messages in any of the queues. */
   KEVENT NewMessages;  
+  /* FIXME: Unknown. */
   ULONG QueueStatus;
+  /* Current window with focus for this queue. */
   HWND FocusWindow;
+  /* True if a window needs painting. */
+  BOOLEAN PaintPosted;
+  /* Count of paints pending. */
+  ULONG PaintCount;
 } USER_MESSAGE_QUEUE, *PUSER_MESSAGE_QUEUE;
 
 VOID
@@ -82,6 +96,13 @@ NTSTATUS
 MsqWaitForNewMessage(PUSER_MESSAGE_QUEUE MessageQueue);
 NTSTATUS
 MsqInitializeImpl(VOID);
+BOOLEAN
+MsqDispatchOneSentMessage(PUSER_MESSAGE_QUEUE MessageQueue);
+NTSTATUS
+MsqWaitForNewMessages(PUSER_MESSAGE_QUEUE MessageQueue);
+VOID
+MsqSendNotifyMessage(PUSER_MESSAGE_QUEUE MessageQueue,
+                    PUSER_SENT_MESSAGE_NOTIFY NotifyMessage);
 
 #define MAKE_LONG(x, y) ((((y) & 0xFFFF) << 16) | ((x) & 0xFFFF))
 
index 90b43ed..283575a 100644 (file)
@@ -4,9 +4,20 @@
 #include <windows.h>
 #include <ddk/ntddk.h>
 #include <include/class.h>
+#include <include/msgqueue.h>
+
+typedef struct _INTERNALPOS
+{
+  RECT NormalRect;
+  POINT IconPos;
+  POINT MaxPos;
+  HWND IconTitle;
+} INTERNALPOS, *PINTERNALPOS;
 
 typedef struct _WINDOW_OBJECT
 {
+  /* Internal position. */
+  PINTERNALPOS InternalPos;
   /* Pointer to the window class. */
   PWNDCLASS_OBJECT Class;
   /* Extended style. */
@@ -22,7 +33,6 @@ typedef struct _WINDOW_OBJECT
   INT Height;
   /* Parent window handle. */
   HWND ParentHandle;
-  struct _WINDOW_OBJECT* Parent;
   /* Window menu handle. */
   HMENU Menu;
   /* Handle of the module that created the window. */
@@ -31,6 +41,8 @@ typedef struct _WINDOW_OBJECT
   LPVOID Parameters;
   /* Entry in the thread's list of windows. */
   LIST_ENTRY ListEntry;
+  /* Entry in the global list of windows. */
+  LIST_ENTRY DesktopListEntry;
   /* Pointer to the extra data associated with the window. */
   PULONG ExtraData;
   /* Size of the extra data associated with the window. */
@@ -43,16 +55,42 @@ typedef struct _WINDOW_OBJECT
   HANDLE Self;
   /* Window flags. */
   ULONG Flags;
+  /* FIXME: Don't know. */
   UINT IDMenu;
+  /* Handle of region of the window to be updated. */
+  HANDLE UpdateRegion;
+  /* Pointer to the message queue associated with the window. */
+  PUSER_MESSAGE_QUEUE MessageQueue;
+  /* Head of the list of child windows. */
+  LIST_ENTRY ChildrenListHead;
+  /* Lock for the list of child windows. */
+  FAST_MUTEX ChildrenListLock;
+  /* Entry in the parent's list of child windows. */
+  LIST_ENTRY SiblingListEntry;
+  /* Entry in the list of thread windows. */
+  LIST_ENTRY ThreadListEntry;
+  /* Pointer to the parent window. */
+  struct _WINDOW_OBJECT* Parent;
 } WINDOW_OBJECT, *PWINDOW_OBJECT;
 
+/* Window flags. */
 #define WINDOWOBJECT_NEED_SIZE            (0x00000001)
+#define WINDOWOBJECT_NEED_BEGINPAINT      (0x00000002)
+#define WINDOWOBJECT_NEED_ERASEBACKGRD    (0x00000004)
+#define WINDOWOBJECT_NEED_NCPAINT         (0x00000008)
+#define WINDOWOBJECT_NEED_INTERNALPAINT   (0x00000010)
+#define WINDOWOBJECT_RESTOREMAX           (0x00000020)
 
 NTSTATUS
 InitWindowImpl(VOID);
-
 NTSTATUS
 CleanupWindowImpl(VOID);
+VOID
+W32kGetClientRect(PWINDOW_OBJECT WindowObject, PRECT Rect);
+PWINDOW_OBJECT
+W32kGetWindowObject(HWND hWnd);
+VOID
+W32kReleaseWindowObject(PWINDOW_OBJECT Window);
 
 #endif /* __WIN32K_WINDOW_H */
 
index 6593019..fdd8134 100644 (file)
@@ -1,9 +1,13 @@
+/* Undocumented flags. */
+#define SWP_NOCLIENTMOVE          0x0800
+#define SWP_NOCLIENTSIZE          0x1000
+
 LRESULT
 WinPosGetNonClientSize(HWND Wnd, RECT* WindowRect, RECT* ClientRect);
-VOID
+UINT
 WinPosGetMinMaxInfo(PWINDOW_OBJECT Window, POINT* MaxSize, POINT* MaxPos,
                    POINT* MinTrack, POINT* MaxTrack);
-VOID
+UINT
 WinPosMinMaximize(PWINDOW_OBJECT WindowObject, UINT ShowFlag, RECT* NewPos);
 BOOLEAN
 WinPosSetWindowPos(HWND Wnd, HWND WndInsertAfter, INT x, INT y, INT cx,
index aaa2911..d9d8a10 100644 (file)
@@ -20,18 +20,16 @@ NTSTATUS
 CleanupWindowStationImpl(VOID);
 
 NTSTATUS
-ValidateWindowStationHandle(
-  HWINSTA WindowStation,
-  KPROCESSOR_MODE AccessMode,
-  ACCESS_MASK DesiredAccess,
-  PWINSTATION_OBJECT *Object);
+ValidateWindowStationHandle(HWINSTA WindowStation,
+                           KPROCESSOR_MODE AccessMode,
+                           ACCESS_MASK DesiredAccess,
+                           PWINSTATION_OBJECT *Object);
 
 NTSTATUS
-ValidateDesktopHandle(
-  HDESK Desktop,
-  KPROCESSOR_MODE AccessMode,
-  ACCESS_MASK DesiredAccess,
-  PDESKTOP_OBJECT *Object);
+ValidateDesktopHandle(HDESK Desktop,
+                     KPROCESSOR_MODE AccessMode,
+                     ACCESS_MASK DesiredAccess,
+                     PDESKTOP_OBJECT *Object);
 
 #endif /* __WIN32K_WINSTA_H */
 
index e65c6ba..fb2687d 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: dllmain.c,v 1.25 2002/06/14 07:49:58 ekohl Exp $
+/* $Id: dllmain.c,v 1.26 2002/07/04 19:56:37 dwelch Exp $
  * 
  *  Entry Point for win32k.sys
  */
 #include <include/class.h>
 #include <include/window.h>
 
-/*
- * NOTE: the table is actually in the file ./svctab.c,
- * generated by iface/addsys/mktab.c + w32ksvc.db
- */
-#include "svctab.c"
+extern SSDT Win32kSSDT[];
+extern SSPT Win32kSSPT[];
+extern ULONG Win32kNumberOfSysCalls;
 
 /*
  * This definition doesn't work
@@ -40,7 +38,8 @@ DllMain (
    * Register user mode call interface
    * (system service table index = 1)
    */
-  Result = KeAddSystemServiceTable (Win32kSSDT, NULL, NUMBER_OF_SYSCALLS, Win32kSSPT, 1);
+  Result = KeAddSystemServiceTable (Win32kSSDT, NULL,
+                                   Win32kNumberOfSysCalls, Win32kSSPT, 1);
   if (Result == FALSE)
   {
     DbgPrint("Adding system services failed!\n");
index ce8ae93..88d9ac5 100644 (file)
@@ -1,4 +1,4 @@
-# $Id: makefile,v 1.45 2002/06/18 21:51:10 dwelch Exp $
+# $Id: makefile,v 1.46 2002/07/04 19:56:36 dwelch Exp $
 
 PATH_TO_TOP = ../..
 
@@ -23,14 +23,15 @@ TARGET_CFLAGS = $(CFLAGS_DBG) -I$(PATH_TO_TOP)/ntoskrnl/include -DUNICODE -Wall
 ENG_OBJECTS= eng/debug.o eng/mem.o eng/brush.o eng/bitblt.o eng/clip.o \
     eng/copybits.o eng/device.o eng/handle.o eng/lineto.o eng/paint.o \
     eng/palette.o eng/surface.o eng/xlate.o eng/transblt.o eng/mouse.o
-MAIN_OBJECTS = main/dllmain.o
+MAIN_OBJECTS = main/dllmain.o main/svctabm.o
 MISC_OBJECTS = misc/driver.o misc/error.o misc/math.o misc/object.o
 LDR_OBJECTS = ldr/loader.o
 NTUSER_OBJECTS = ntuser/class.o ntuser/guicheck.o ntuser/hook.o \
                  ntuser/message.o ntuser/msgqueue.o ntuser/stubs.o \
                  ntuser/userobj.o ntuser/window.o ntuser/winsta.o \
                 ntuser/input.o ntuser/keyboard.o ntuser/callback.o \
-                ntuser/winpos.o
+                ntuser/winpos.o ntuser/painting.o ntuser/metric.o \
+                ntuser/windc.o
 OBJECTS_OBJECTS = objects/bitmaps.o objects/brush.o objects/cliprgn.o  \
                   objects/color.o objects/coord.o objects/dc.o  \
                   objects/fillshap.o objects/gdiobj.o objects/icm.o  \
@@ -38,7 +39,7 @@ OBJECTS_OBJECTS = objects/bitmaps.o objects/brush.o objects/cliprgn.o  \
                   objects/path.o objects/pen.o objects/print.o  \
                   objects/region.o objects/text.o objects/wingl.o \
                   objects/bezier.o objects/objconv.o objects/dib.o \
-                 objects/palette.o
+                 objects/palette.o objects/rect.o
 DIB_OBJECTS = dib/dib4bpp.o dib/dib24bpp.o
 FREETYPE_OBJECTS = freetype/ctype.o freetype/grfont.o \
                freetype/src/base/ftsystem.o freetype/src/base/ftdebug.o \
@@ -56,7 +57,7 @@ TARGET_OBJECTS = \
   $(NTUSER_OBJECTS) $(OBJECTS_OBJECTS) $(STUBS_OBJECTS) \
   $(MATH_OBJECTS) $(FLOAT_OBJECTS) $(FREETYPE_OBJECTS) $(DIB_OBJECTS)
 
-TARGET_CLEAN = \
+TARGET_CLEAN = $(TARGET_OBJECTS:.o=.d) \
   dib/*.o \
   eng/*.o \
   freetype/*.o \
@@ -71,7 +72,12 @@ include $(PATH_TO_TOP)/rules.mak
 
 include $(TOOLS_PATH)/helper.mk
 
-main/dllmain.o: main/svctab.c
+# Automatic dependency tracking
+DEP_OBJECTS := $(TARGET_OBJECTS)
+DEP_EXCLUDE_FILTER := main/svctabm.d
+include $(PATH_TO_TOP)/tools/depend.mk
+
+misc/svctabm.o: misc/svctab.c
 
 .dummy:
 
index 38aee9f..6080499 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: callback.c,v 1.4 2002/06/21 04:14:07 ei Exp $
+/* $Id: callback.c,v 1.5 2002/07/04 19:56:37 dwelch Exp $
  *
  * COPYRIGHT:        See COPYING in the top level directory
  * PROJECT:          ReactOS kernel
@@ -32,12 +32,66 @@ W32kCallSentMessageCallback(SENDASYNCPROC CompletionCallback,
                            ULONG_PTR CompletionCallbackContext,
                            LRESULT Result)
 {
+  SENDASYNCPROC_CALLBACK_ARGUMENTS Arguments;
+  NTSTATUS Status;
+
+  Arguments.Callback = CompletionCallback;
+  Arguments.Wnd = hWnd;
+  Arguments.Msg = Msg;
+  Arguments.Context = CompletionCallbackContext;
+  Arguments.Result = Result;
+  Status = NtW32Call(USER32_CALLBACK_SENDASYNCPROC,
+                    &Arguments,
+                    sizeof(SENDASYNCPROC_CALLBACK_ARGUMENTS),
+                    NULL,
+                    NULL);
+  if (!NT_SUCCESS(Status))
+    {
+      return;
+    }
+  return;  
 }
 
 LRESULT STDCALL
-W32kSendNCCALCSIZEMessage(HWND Wnd, BOOL Validate, RECT Rect1,
-                         RECT Rect2, RECT Rect3, PWINDOWPOS Pos)
+W32kSendNCCALCSIZEMessage(HWND Wnd, BOOL Validate, PRECT Rect,
+                         NCCALCSIZE_PARAMS* Params)
 {
+  SENDNCCALCSIZEMESSAGE_CALLBACK_ARGUMENTS Arguments;
+  SENDNCCALCSIZEMESSAGE_CALLBACK_RESULT Result;
+  NTSTATUS Status;
+  PVOID ResultPointer;
+  ULONG ResultLength;
+
+  Arguments.Wnd = Wnd;
+  Arguments.Validate = Validate;
+  if (!Validate)
+    {
+      Arguments.Rect = *Rect;
+    }
+  else
+    {
+      Arguments.Params = *Params;
+    }
+  ResultPointer = &Result;
+  ResultLength = sizeof(SENDNCCALCSIZEMESSAGE_CALLBACK_RESULT);
+  Status = NtW32Call(USER32_CALLBACK_SENDNCCALCSIZE,
+                    &Arguments,
+                    sizeof(SENDNCCALCSIZEMESSAGE_CALLBACK_ARGUMENTS),
+                    &ResultPointer,
+                    &ResultLength);
+  if (!NT_SUCCESS(Status))
+    {
+      return(0);
+    }
+  if (!Validate)
+    {
+      *Rect = Result.Rect;
+    }
+  else
+    {
+      *Params = Result.Params;
+    }
+  return(Result.Result);
 }
 
 LRESULT STDCALL
@@ -114,7 +168,7 @@ W32kCallWindowProc(WNDPROC Proc,
                     &Arguments,
                     sizeof(WINDOWPROC_CALLBACK_ARGUMENTS),
                     &ResultPointer,
-                        &ResultLength);
+                    &ResultLength);
   if (!NT_SUCCESS(Status))
     {
       return(0xFFFFFFFF);
index 669a0e2..b956e13 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: class.c,v 1.7 2002/06/14 20:56:17 jfilby Exp $
+/* $Id: class.c,v 1.8 2002/07/04 19:56:37 dwelch Exp $
  *
  * COPYRIGHT:        See COPYING in the top level directory
  * PROJECT:          ReactOS kernel
@@ -17,6 +17,7 @@
 #include <include/error.h>
 #include <include/winsta.h>
 #include <include/object.h>
+#include <include/guicheck.h>
 
 //#define NDEBUG
 #include <debug.h>
@@ -251,6 +252,11 @@ NtUserRegisterClassExWOW(LPWNDCLASSEX lpwcx,
   return(Atom);
 }
 
+DWORD STDCALL
+NtUserGetClassLong(HWND hWnd, DWORD Offset)
+{
+}
+
 DWORD STDCALL
 NtUserSetClassLong(DWORD Unknown0,
                   DWORD Unknown1,
index af24fe1..0566e0b 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: guicheck.c,v 1.4 2002/01/27 01:11:24 dwelch Exp $
+ /* $Id: guicheck.c,v 1.5 2002/07/04 19:56:37 dwelch Exp $
  *
  * COPYRIGHT:        See COPYING in the top level directory
  * PROJECT:          ReactOS kernel
@@ -22,6 +22,7 @@
 #include <include/msgqueue.h>
 #include <include/object.h>
 #include <napi/win32.h>
+#include <include/winsta.h>
 
 #define NDEBUG
 #include <debug.h>
@@ -33,19 +34,46 @@ W32kGuiCheck(VOID)
 {
   if (PsGetWin32Process() == NULL)
     {
+      NTSTATUS Status;
+
       PsCreateWin32Process(PsGetCurrentProcess());
 
       InitializeListHead(&PsGetWin32Process()->ClassListHead);
-      ExInitializeFastMutex(&PsGetWin32Process()->ClassListLock);
-      InitializeListHead(&PsGetWin32Process()->WindowListHead);
-      ExInitializeFastMutex(&PsGetWin32Process()->WindowListLock);
-      PsGetWin32Process()->HandleTable = ObmCreateHandleTable();
+      ExInitializeFastMutex(&PsGetWin32Process()->ClassListLock);      
+
+      Status = 
+       ValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
+                                   UserMode,
+                                   GENERIC_ALL,
+                                   &PsGetWin32Process()->WindowStation);
+      if (!NT_SUCCESS(Status))
+       {
+         DbgPrint("W32K: Failed to reference a window station for "
+                  "process.\n");
+       }
     }
 
   if (PsGetWin32Thread() == NULL)
     {
+      NTSTATUS Status;
+
       PsCreateWin32Thread(PsGetCurrentThread());
       PsGetWin32Thread()->MessageQueue = MsqCreateMessageQueue();
+      InitializeListHead(&PsGetWin32Thread()->WindowListHead);
+      ExInitializeFastMutex(&PsGetWin32Thread()->WindowListLock);
+
+      /* By default threads get assigned their process's desktop. */
+      PsGetWin32Thread()->Desktop = NULL;
+      Status = ObReferenceObjectByHandle(PsGetCurrentProcess()->Win32Desktop,
+                                        GENERIC_ALL,
+                                        ExDesktopObjectType,
+                                        UserMode,
+                                        &PsGetWin32Thread()->Desktop,
+                                        NULL);
+      if (!NT_SUCCESS(Status))
+       {
+         DbgPrint("W32K: Failed to reference a desktop for thread.\n");
+       }
     }
 }
 
index 8c48ff5..d994bc9 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: message.c,v 1.6 2002/06/06 17:50:16 jfilby Exp $
+/* $Id: message.c,v 1.7 2002/07/04 19:56:37 dwelch Exp $
  *
  * COPYRIGHT:        See COPYING in the top level directory
  * PROJECT:          ReactOS kernel
@@ -21,8 +21,9 @@
 #include <include/object.h>
 #include <include/winsta.h>
 #include <include/callback.h>
+#include <include/painting.h>
 
-#define NDEBUG
+//#define NDEBUG
 #include <debug.h>
 
 /* FUNCTIONS *****************************************************************/
@@ -44,6 +45,9 @@ LRESULT STDCALL
 NtUserDispatchMessage(LPMSG lpMsg)
 {
   LRESULT Result;
+  ULONG PaintingFlag;
+  PWINDOW_OBJECT WindowObject;
+  NTSTATUS Status;
 
   /* Process timer messages. */
   if (lpMsg->message == WM_TIMER)
@@ -62,20 +66,38 @@ NtUserDispatchMessage(LPMSG lpMsg)
        }
     }
 
-  /* 
-   * FIXME: Check for valid window handle, valid window and valid window 
-   * proc. 
-   */
+  /* Get the window object. */
+  Status = 
+    ObmReferenceObjectByHandle(PsGetWin32Process()->WindowStation->HandleTable,
+                              lpMsg->hwnd,
+                              otWindow,
+                              (PVOID*)&WindowObject);
+  if (!NT_SUCCESS(Status))
+    {
+      return(0);
+    }
 
   /* FIXME: Check for paint message. */
+  PaintingFlag = (lpMsg->message == WM_PAINT);
+  if (PaintingFlag)
+    {
+      WindowObject->Flags |= WINDOWOBJECT_NEED_BEGINPAINT;
+    }
 
+  /* FIXME: Call hook procedures. */
+
+  /* Call the window procedure. */
   Result = W32kCallWindowProc(NULL /* WndProc */,
                              lpMsg->hwnd,
                              lpMsg->message,
                              lpMsg->wParam,
                              lpMsg->lParam);
 
-  /* FIXME: Check for paint message. */
+  if (PaintingFlag && WindowObject->Flags & WINDOWOBJECT_NEED_BEGINPAINT &&
+      WindowObject->UpdateRegion)
+    {
+      DbgBreakPoint();
+    }
 
   return(Result);
 }
@@ -108,7 +130,8 @@ NtUserGetMessage(LPMSG lpMsg,
 
   do
     {
-      /* FIXME: Dispatch sent messages here. */
+      /* Dispatch sent messages here. */
+      while (MsqDispatchOneSentMessage(ThreadQueue));
       
       /* Now look for a quit message. */
       /* FIXME: WINE checks the message number filter here. */
@@ -152,9 +175,17 @@ NtUserGetMessage(LPMSG lpMsg,
          return(TRUE);
        }
 
-      /* FIXME: Check for sent messages again. */
+      /* Check for sent messages again. */
+      while (MsqDispatchOneSentMessage(ThreadQueue));
 
-      /* FIXME: Check for paint messages. */
+      /* Check for paint messages. */
+      if (ThreadQueue->PaintPosted)
+       {
+         lpMsg->hwnd = PaintingFindWinToRepaint(hWnd, PsGetWin32Thread());
+         lpMsg->message = WM_PAINT;
+         lpMsg->wParam = lpMsg->lParam = 0;
+         return(TRUE); 
+       }
 
       /* Nothing found so far. Wait for new messages. */
       Status = MsqWaitForNewMessages(ThreadQueue);
@@ -293,12 +324,71 @@ NtUserQuerySendMessage(DWORD Unknown0)
   return 0;
 }
 
-BOOL STDCALL
+LRESULT STDCALL
 NtUserSendMessage(HWND hWnd,
                  UINT Msg,
-                 WPARAM Wparam,
+                 WPARAM wParam,
                  LPARAM lParam)
 {
+  LRESULT Result;
+  NTSTATUS Status;
+  PWINDOW_OBJECT Window;
+
+  /* FIXME: Check for a broadcast or topmost destination. */
+
+  /* FIXME: Call hooks. */
+
+  Status = 
+    ObmReferenceObjectByHandle(PsGetWin32Process()->WindowStation->HandleTable,
+                              hWnd,
+                              otWindow,
+                              (PVOID*)&Window);
+  if (!NT_SUCCESS(Status))
+    {
+      return(FALSE);
+    }
+
+  /* FIXME: Check for an exiting window. */
+
+  if (Window->MessageQueue == PsGetWin32Thread()->MessageQueue)
+    {
+      Result = W32kCallWindowProc(NULL, hWnd, Msg, wParam, lParam);
+      return(Result);
+    }
+  else
+    {
+      PUSER_SENT_MESSAGE Message;
+      PKEVENT CompletionEvent;
+      
+      CompletionEvent = ExAllocatePool(NonPagedPool, sizeof(KEVENT));
+      KeInitializeEvent(CompletionEvent, NotificationEvent, FALSE);
+
+      Message = ExAllocatePool(NonPagedPool, sizeof(USER_SENT_MESSAGE));
+      Message->Msg.hwnd = hWnd;
+      Message->Msg.message = Msg;
+      Message->Msg.wParam = wParam;
+      Message->Msg.lParam = lParam;
+      Message->CompletionEvent = CompletionEvent;
+      Message->Result = &Result;
+      Message->CompletionQueue = NULL;
+      Message->CompletionCallback = NULL;
+      MsqSendMessage(Window->MessageQueue, Message);
+
+      ObmDereferenceObject(Window);
+      Status = KeWaitForSingleObject(CompletionEvent,
+                                    UserRequest,
+                                    UserMode,
+                                    FALSE,
+                                    NULL);
+      if (Status == STATUS_WAIT_0)
+       {
+         return(Result);
+       }
+      else
+       {
+         return(FALSE);
+       }
+    }
 }
 
 BOOL STDCALL
@@ -309,9 +399,7 @@ NtUserSendMessageCallback(HWND hWnd,
                          SENDASYNCPROC lpCallBack,
                          ULONG_PTR dwData)
 {
-  UNIMPLEMENTED;
-  
-  return 0;
+  return(0);
 }
 
 BOOL STDCALL
index 451c055..1dce3b1 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: msgqueue.c,v 1.3 2002/05/06 22:20:32 dwelch Exp $
+/* $Id: msgqueue.c,v 1.4 2002/07/04 19:56:37 dwelch Exp $
  *
  * COPYRIGHT:        See COPYING in the top level directory
  * PROJECT:          ReactOS kernel
@@ -14,6 +14,7 @@
 #include <ddk/ntddk.h>
 #include <win32k/win32k.h>
 #include <include/msgqueue.h>
+#include <include/callback.h>
 
 #define NDEBUG
 #include <debug.h>
@@ -24,6 +25,28 @@ static PUSER_MESSAGE_QUEUE CurrentFocusMessageQueue;
 
 /* FUNCTIONS *****************************************************************/
 
+VOID
+MsqIncPaintCountQueue(PUSER_MESSAGE_QUEUE Queue)
+{
+  ExAcquireFastMutex(&Queue->Lock);
+  Queue->PaintCount++;
+  Queue->PaintPosted = TRUE;
+  ExReleaseFastMutex(&Queue->Lock);
+}
+
+VOID
+MsqDecPaintCountQueue(PUSER_MESSAGE_QUEUE Queue)
+{
+  ExAcquireFastMutex(&Queue->Lock);
+  Queue->PaintCount--;
+  if (Queue->PaintCount == 0)
+    {
+      Queue->PaintPosted = FALSE;
+    }
+  ExReleaseFastMutex(&Queue->Lock);
+}
+
+
 NTSTATUS
 MsqInitializeImpl(VOID)
 {
@@ -104,7 +127,7 @@ MsqPeekSentMessages(PUSER_MESSAGE_QUEUE MessageQueue)
   return(!IsListEmpty(&MessageQueue->SentMessagesListHead));
 }
 
-VOID
+BOOLEAN
 MsqDispatchOneSentMessage(PUSER_MESSAGE_QUEUE MessageQueue)
 {
   PUSER_SENT_MESSAGE Message;
@@ -113,12 +136,16 @@ MsqDispatchOneSentMessage(PUSER_MESSAGE_QUEUE MessageQueue)
   PUSER_SENT_MESSAGE_NOTIFY NotifyMessage;
 
   ExAcquireFastMutex(&MessageQueue->Lock);
+  if (IsListEmpty(&MessageQueue->SentMessagesListHead))
+    {
+      return(FALSE);
+    }
   Entry = RemoveHeadList(&MessageQueue->SentMessagesListHead);
   Message = CONTAINING_RECORD(Entry, USER_SENT_MESSAGE, ListEntry);
   ExReleaseFastMutex(&MessageQueue->Lock);
 
   /* Call the window procedure. */
-  Result = W32kCallWindowProc(W32kGetWindowProc(Message->Msg.hwnd),
+  Result = W32kCallWindowProc(NULL,
                              Message->Msg.hwnd,
                              Message->Msg.message,
                              Message->Msg.wParam,
@@ -148,10 +175,11 @@ MsqDispatchOneSentMessage(PUSER_MESSAGE_QUEUE MessageQueue)
       NotifyMessage->Result = Result;
       NotifyMessage->hWnd = Message->Msg.hwnd;
       NotifyMessage->Msg = Message->Msg.message;
-      MsqSendNotifyMessage(Message->CompletionQueue);
+      MsqSendNotifyMessage(Message->CompletionQueue, NotifyMessage);
     }
 
   ExFreePool(Message);
+  return(TRUE);
 }
 
 VOID
index 0b30632..6a33ae7 100644 (file)
@@ -36,17 +36,6 @@ NtUserAttachThreadInput(
   return 0;
 }
 
-DWORD
-STDCALL
-NtUserBeginPaint(
-  DWORD Unknown0,
-  DWORD Unknown1)
-{
-  UNIMPLEMENTED
-
-  return 0;
-}
-
 DWORD
 STDCALL
 NtUserBitBltSysBmp(
@@ -578,17 +567,6 @@ NtUserEndMenu(VOID)
   return 0;
 }
 
-DWORD
-STDCALL
-NtUserEndPaint(
-  DWORD Unknown0,
-  DWORD Unknown1)
-{
-  UNIMPLEMENTED
-
-  return 0;
-}
-
 DWORD
 STDCALL
 NtUserEnumDisplayDevices(
@@ -857,18 +835,6 @@ NtUserGetDC(
   return 0;
 }
 
-DWORD
-STDCALL
-NtUserGetDCEx(
-  DWORD Unknown0,
-  DWORD Unknown1,
-  DWORD Unknown2)
-{
-  UNIMPLEMENTED
-
-  return 0;
-}
-
 DWORD
 STDCALL
 NtUserGetDoubleClickTime(VOID)
index 14b4b5c..2309dd6 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: window.c,v 1.7 2002/06/18 21:51:11 dwelch Exp $
+/* $Id: window.c,v 1.8 2002/07/04 19:56:37 dwelch Exp $
  *
  * COPYRIGHT:        See COPYING in the top level directory
  * PROJECT:          ReactOS kernel
 
 /* FUNCTIONS *****************************************************************/
 
-BOOL
-W32kOffsetRect(LPRECT Rect, INT x, INT y)
+PWINDOW_OBJECT
+W32kGetWindowObject(HWND hWnd)
+{
+  PWINDOW_OBJECT WindowObject;
+  NTSTATUS Status;
+  Status = 
+    ObmReferenceObjectByHandle(PsGetWin32Process()->WindowStation->
+                              HandleTable,
+                              hWnd,
+                              otWindow,
+                              (PVOID*)&WindowObject);
+  if (!NT_SUCCESS(Status))
+    {
+      return(NULL);
+    }
+  return(WindowObject);
+}
+
+VOID
+W32kReleaseWindowObject(PWINDOW_OBJECT Window)
+{
+  ObmDereferenceObject(Window);
+}
+
+VOID
+W32kGetClientRect(PWINDOW_OBJECT WindowObject, PRECT Rect)
 {
-  Rect->left += x;
-  Rect->right += x;
-  Rect->top += y;
-  Rect->bottom += y;
-  return(TRUE);
 }
 
 HWND
@@ -128,6 +147,8 @@ NtUserCreateWindowEx(DWORD dwExStyle,
     }
 
   /* Check the window station. */
+  DPRINT("IoGetCurrentProcess() %X\n", IoGetCurrentProcess());
+  DPRINT("PROCESS_WINDOW_STATION %X\n", PROCESS_WINDOW_STATION());
   Status = ValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
                                       KernelMode,
                                       0,
@@ -143,8 +164,8 @@ NtUserCreateWindowEx(DWORD dwExStyle,
 
   /* Create the window object. */
   WindowObject = (PWINDOW_OBJECT) 
-    ObmCreateObject(PsGetWin32Process()->HandleTable, &Handle, otWindow
-                   sizeof(WINDOW_OBJECT));
+    ObmCreateObject(PsGetWin32Process()->WindowStation->HandleTable, &Handle
+                   otWindow, sizeof(WINDOW_OBJECT));
   DPRINT("Created object with handle %X\n", Handle);
   if (!WindowObject) 
     {
@@ -171,6 +192,7 @@ NtUserCreateWindowEx(DWORD dwExStyle,
   WindowObject->Instance = hInstance;
   WindowObject->Parameters = lpParam;
   WindowObject->Self = Handle;
+  WindowObject->MessageQueue = PsGetWin32Thread()->MessageQueue;
 
   /* FIXME: Add the window parent. */
 
@@ -202,10 +224,12 @@ NtUserCreateWindowEx(DWORD dwExStyle,
     }
 
   /* Insert the window into the process's window list. */
-  ExAcquireFastMutexUnsafe (&PsGetWin32Process()->WindowListLock);
-  InsertTailList (&PsGetWin32Process()->WindowListHead, 
+  ExAcquireFastMutexUnsafe (&PsGetWin32Thread()->WindowListLock);
+  InsertTailList (&PsGetWin32Thread()->WindowListHead, 
                  &WindowObject->ListEntry);
-  ExReleaseFastMutexUnsafe (&PsGetWin32Process()->WindowListLock);
+  ExReleaseFastMutexUnsafe (&PsGetWin32Thread()->WindowListLock);
+
+  /* FIXME: Insert the window into the desktop window list. */
 
   /* FIXME: Maybe allocate a DCE for this window. */
 
@@ -296,7 +320,7 @@ NtUserCreateWindowEx(DWORD dwExStyle,
       lParam = 
        MAKE_LONG(WindowObject->ClientRect.left,
                  WindowObject->ClientRect.top);
-      DPRINT("NtUserCreateWindow(): About to send WM_SIZE\n");
+      DPRINT("NtUserCreateWindow(): About to send WM_MOVE\n");
       W32kCallWindowProc(NULL, WindowObject->Self, WM_MOVE, 0, lParam);
     }
 
@@ -318,6 +342,8 @@ NtUserCreateWindowEx(DWORD dwExStyle,
                         NewPos.right, NewPos.bottom, SwFlag);
     }
 
+  /* FIXME: Need to set up parent window. */
+#if 0
   /* Notify the parent window of a new child. */
   if ((WindowObject->Style & WS_CHILD) ||
       (!(WindowObject->ExStyle & WS_EX_NOPARENTNOTIFY)))
@@ -328,6 +354,7 @@ NtUserCreateWindowEx(DWORD dwExStyle,
                         MAKEWPARAM(WM_CREATE, WindowObject->IDMenu),
                         (LPARAM)WindowObject->Self);
     }
+#endif
 
   if (dwStyle & WS_VISIBLE)
     {
@@ -389,6 +416,7 @@ NtUserFindWindowEx(HWND hwndParent,
                   PUNICODE_STRING ucWindowName,
                   DWORD Unknown4)
 {
+#if 0
   NTSTATUS status;
   HWND windowHandle;
   PWINDOW_OBJECT windowObject;
@@ -429,6 +457,7 @@ NtUserFindWindowEx(HWND hwndParent,
   ObmDereferenceObject (classObject);
 
   return  (HWND)0;
+#endif
 }
 
 DWORD STDCALL
@@ -642,10 +671,11 @@ NtUserGetWindowLong(HWND hWnd, DWORD Index)
   
   W32kGuiCheck();
 
-  Status = ObmReferenceObjectByHandle(PsGetWin32Process()->HandleTable,
-                                     hWnd,
-                                     otWindow,
-                                     (PVOID*)&WindowObject);
+  Status = 
+    ObmReferenceObjectByHandle(PsGetWin32Process()->WindowStation->HandleTable,
+                              hWnd,
+                              otWindow,
+                              (PVOID*)&WindowObject);
   if (!NT_SUCCESS(Status))
     {
       DPRINT("NtUserGetWindowLong(): Bad handle.\n");
@@ -743,21 +773,9 @@ BOOL STDCALL
 NtUserShowWindow(HWND hWnd,
                 LONG nCmdShow)
 {
-  PWINDOW_OBJECT WindowObject;
-  NTSTATUS Status;
-  
   W32kGuiCheck();
 
-  Status = ObmReferenceObjectByHandle(PsGetWin32Process()->HandleTable,
-                                     hWnd,
-                                     otWindow,
-                                     (PVOID*)&WindowObject);
-  if (!NT_SUCCESS(Status))
-    {
-      return(FALSE);
-    }
-
-  return TRUE;
+  return(WinPosShowWindow(hWnd, nCmdShow));
 }
 
 DWORD STDCALL
index 9751f25..eda22de 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: winpos.c,v 1.1 2002/05/06 22:20:32 dwelch Exp $
+/* $Id: winpos.c,v 1.2 2002/07/04 19:56:37 dwelch Exp $
  *
  * COPYRIGHT:        See COPYING in the top level directory
  * PROJECT:          ReactOS kernel
 #include <include/error.h>
 #include <include/winsta.h>
 #include <windows.h>
+#include <include/winpos.h>
+#include <include/rect.h>
+#include <include/callback.h>
+#include <include/painting.h>
 
 #define NDEBUG
 #include <debug.h>
 
 #define MINMAX_NOSWP  (0x00010000)
 
+#define SWP_EX_PAINTSELF 0x0002
+
 /* FUNCTIONS *****************************************************************/
 
+POINT STATIC
+WinPosFindIconPos(HWND hWnd, POINT Pos)
+{
+}
+
+HWND STATIC
+WinPosCreateIconTitle(PWINDOW_OBJECT WindowObject)
+{
+  return(NULL);
+}
+
+BOOL STATIC
+WinPosShowIconTitle(PWINDOW_OBJECT WindowObject, BOOL Show)
+{
+  PINTERNALPOS InternalPos = WindowObject->InternalPos;
+  PWINDOW_OBJECT IconWindow;
+  NTSTATUS Status;
+
+  if (InternalPos)
+    {
+      HWND hWnd = InternalPos->IconTitle;
+
+      if (hWnd == NULL)
+       {
+         hWnd = WinPosCreateIconTitle(WindowObject);
+       }
+      if (Show)
+       {
+         Status = 
+           ObmReferenceObjectByHandle(PsGetWin32Process()->WindowStation->
+                                      HandleTable,
+                                      hWnd,
+                                      otWindow,
+                                      (PVOID*)&IconWindow);
+         if (NT_SUCCESS(Status))
+           {
+             if (!(IconWindow->Style & WS_VISIBLE))
+               {
+                 NtUserSendMessage(hWnd, WM_SHOWWINDOW, TRUE, 0);
+                 WinPosSetWindowPos(hWnd, 0, 0, 0, 0, 0, SWP_NOSIZE |
+                                    SWP_NOMOVE | SWP_NOACTIVATE | 
+                                    SWP_NOZORDER | SWP_SHOWWINDOW);
+               }
+             ObmDereferenceObject(IconWindow);
+           }
+       }
+      else
+       {
+         WinPosShowWindow(hWnd, SW_HIDE);
+       }
+    }
+  return(FALSE);
+}
+
+PINTERNALPOS STATIC
+WinPosInitInternalPos(PWINDOW_OBJECT WindowObject, POINT pt, PRECT RestoreRect)
+{
+  if (WindowObject->InternalPos == NULL)
+    {
+      WindowObject->InternalPos = 
+       ExAllocatePool(NonPagedPool, sizeof(INTERNALPOS));
+      WindowObject->InternalPos->IconTitle = 0;
+      WindowObject->InternalPos->NormalRect = WindowObject->WindowRect;
+      WindowObject->InternalPos->IconPos.x = 
+       WindowObject->InternalPos->MaxPos.x = 0xFFFFFFFF;
+      WindowObject->InternalPos->IconPos.y = 
+       WindowObject->InternalPos->MaxPos.y = 0xFFFFFFFF;
+    }
+  if (WindowObject->Style & WS_MINIMIZE)
+    {
+      WindowObject->InternalPos->IconPos = pt;
+    }
+  else if (WindowObject->Style & WS_MAXIMIZE)
+    {
+      WindowObject->InternalPos->MaxPos = pt;
+    }
+  else if (RestoreRect != NULL)
+    {
+      WindowObject->InternalPos->NormalRect = *RestoreRect;
+    }
+  return(WindowObject->InternalPos);
+}
+
 UINT
 WinPosMinMaximize(PWINDOW_OBJECT WindowObject, UINT ShowFlag, RECT* NewPos)
 {
+  POINT Size;
+  PINTERNALPOS InternalPos;
+  UINT SwpFlags = 0;
+
+  Size.x = WindowObject->WindowRect.left;
+  Size.y = WindowObject->WindowRect.top;
+  InternalPos = WinPosInitInternalPos(WindowObject, Size, 
+                                     &WindowObject->WindowRect); 
+
+  if (InternalPos)
+    {
+      if (WindowObject->Style & WS_MINIMIZE)
+       {
+         if (!NtUserSendMessage(WindowObject->Self, WM_QUERYOPEN, 0, 0))
+           {
+             return(SWP_NOSIZE | SWP_NOMOVE);
+           }
+         SwpFlags |= SWP_NOCOPYBITS;
+       }
+      switch (ShowFlag)
+       {
+       case SW_MINIMIZE:
+         {
+           if (WindowObject->Style & WS_MAXIMIZE)
+             {
+               WindowObject->Flags |= WINDOWOBJECT_RESTOREMAX;
+               WindowObject->Style &= ~WS_MAXIMIZE;
+             }
+           else
+             {
+               WindowObject->Style &= ~WINDOWOBJECT_RESTOREMAX;
+             }
+           WindowObject->Style |= WS_MINIMIZE;
+           InternalPos->IconPos = WinPosFindIconPos(WindowObject,
+                                                    InternalPos->IconPos);
+           W32kSetRect(NewPos, InternalPos->IconPos.x, InternalPos->IconPos.y,
+                       NtUserGetSystemMetrics(SM_CXICON),
+                       NtUserGetSystemMetrics(SM_CYICON));
+           SwpFlags |= SWP_NOCOPYBITS;
+           break;
+         }
+
+       case SW_MAXIMIZE:
+         {
+           WinPosGetMinMaxInfo(WindowObject, &Size, &InternalPos->MaxPos, 
+                               NULL, NULL);
+           if (WindowObject->Style & WS_MINIMIZE)
+             {
+               WinPosShowIconTitle(WindowObject, FALSE);
+               WindowObject->Style &= ~WS_MINIMIZE;
+             }
+           WindowObject->Style |= WS_MINIMIZE;
+           W32kSetRect(NewPos, InternalPos->MaxPos.x, InternalPos->MaxPos.y,
+                       Size.x, Size.y);
+           break;
+         }
+
+       case SW_RESTORE:
+         {
+           if (WindowObject->Style & WS_MINIMIZE)
+             {
+               WindowObject->Style &= ~WS_MINIMIZE;
+               WinPosShowIconTitle(WindowObject, FALSE);
+               if (WindowObject->Flags & WINDOWOBJECT_RESTOREMAX)
+                 {
+                   WinPosGetMinMaxInfo(WindowObject, &Size,
+                                       &InternalPos->MaxPos, NULL, NULL);
+                   WindowObject->Style |= WS_MAXIMIZE;
+                   W32kSetRect(NewPos, InternalPos->MaxPos.x,
+                               InternalPos->MaxPos.y, Size.x, Size.y);
+                   break;
+                 }
+             }
+           else
+             {
+               if (!(WindowObject->Style & WS_MAXIMIZE))
+                 {
+                   return(-1);
+                 }
+               else
+                 {
+                   WindowObject->Style &= ~WS_MAXIMIZE;
+                 }           
+               *NewPos = InternalPos->NormalRect;
+               NewPos->right -= NewPos->left;
+               NewPos->bottom -= NewPos->top;
+               break;
+             }
+         }
+       }
+    }
+  else
+    {
+      SwpFlags |= SWP_NOSIZE | SWP_NOMOVE;
+    }
+  return(SwpFlags);
 }
 
 UINT
 WinPosGetMinMaxInfo(PWINDOW_OBJECT Window, POINT* MaxSize, POINT* MaxPos,
-                   POINT* MaxTrack)
+                   POINT* MinTrack, POINT* MaxTrack)
+{
+}
+
+BOOL STATIC
+WinPosChangeActiveWindow(HWND Wnd, BOOL MouseMsg)
+{
+}
+
+LONG STATIC
+WinPosDoNCCALCSize(PWINDOW_OBJECT Window, PWINDOWPOS WinPos,
+                  RECT* WindowRect, RECT* ClientRect)
 {
 }
 
+BOOL
+WinPosDoWinPosChanging(PWINDOW_OBJECT WindowObject,
+                      PWINDOWPOS WinPos,
+                      PRECT WindowRect,
+                      PRECT ClientRect)
+{
+  if (!(WinPos->flags & SWP_NOSENDCHANGING))
+    {
+      NtUserSendMessage(WindowObject->Self, WM_WINDOWPOSCHANGING, 0,
+                       (LPARAM)WinPos);
+    }
+  
+  *WindowRect = WindowObject->WindowRect;
+  *ClientRect = 
+    (WindowObject->Style & WS_MINIMIZE) ? WindowObject->WindowRect :
+    WindowObject->ClientRect;
+
+  if (!(WinPos->flags & SWP_NOSIZE))
+    {
+      WindowRect->right = WindowRect->left + WinPos->cx;
+      WindowRect->bottom = WindowRect->top + WinPos->cy;
+    }
+
+  if (!(WinPos->flags & SWP_NOMOVE))
+    {
+      WindowRect->left = WinPos->x;
+      WindowRect->top = WinPos->y;
+      WindowRect->right += WinPos->x - WindowObject->WindowRect.left;
+      WindowRect->bottom += WinPos->y - WindowObject->WindowRect.top;
+
+      W32kOffsetRect(ClientRect, WinPos->x - WindowObject->WindowRect.left,
+                    WinPos->y - WindowObject->WindowRect.top);
+    }
+
+  WinPos->flags |= SWP_NOCLIENTMOVE | SWP_NOCLIENTSIZE;
+  return(TRUE);
+}
+
 BOOLEAN
 WinPosSetWindowPos(HWND Wnd, HWND WndInsertAfter, INT x, INT y, INT cx,
                   INT cy, UINT flags)
 {
   PWINDOW_OBJECT Window;
   NTSTATUS Status;
+  WINDOWPOS WinPos;
+  RECT NewWindowRect;
+  RECT NewClientRect;
+  HRGN VisRgn = NULL;
+  ULONG WvrFlags = 0;
 
   /* FIXME: Get current active window from active queue. */
 
   /* FIXME: Check if the window is for a desktop. */
 
-  Status = ObmReferenceObjectByHandle(PsGetWin32Process()->HandleTable,
-                                     Wnd,
-                                     otWindow,
-                                     (PVOID*)&Window);
+  Status = 
+    ObmReferenceObjectByHandle(PsGetWin32Process()->WindowStation->HandleTable,
+                              Wnd,
+                              otWindow,
+                              (PVOID*)&Window);
   if (!NT_SUCCESS(Status))
     {
       return(FALSE);
@@ -74,27 +314,140 @@ WinPosSetWindowPos(HWND Wnd, HWND WndInsertAfter, INT x, INT y, INT cx,
       flags &= ~SWP_HIDEWINDOW;
     }
 
-  if (cx < 0)
+  cx = max(cx, 0);
+  cy = max(cy, 0);
+
+  if ((Window->WindowRect.right - Window->WindowRect.left) == cx &&
+      (Window->WindowRect.bottom - Window->WindowRect.top) == cy)
+    {
+      flags |= SWP_NOSIZE;
+    }
+  if (Window->WindowRect.left == x && Window->WindowRect.top == y)
     {
-      cx = 0;
+      flags |= SWP_NOMOVE;
     }
-  if (cy < 0)
+  if (FALSE /* FIXME: Check if the window if already active. */)
     {
-      cy = 0;
+      flags |= SWP_NOACTIVATE;
+    }
+  else if ((Window->Style & (WS_POPUP | WS_CHILD)) != WS_CHILD)
+    {
+      if (!(flags & SWP_NOACTIVATE))
+       {
+         flags &= ~SWP_NOZORDER;
+         WndInsertAfter = HWND_TOP;
+       }
     }
 
+  if (WndInsertAfter == HWND_TOPMOST || WndInsertAfter == HWND_NOTOPMOST)
+    {
+      WndInsertAfter = HWND_TOP;
+    }
+
+  if (WndInsertAfter != HWND_TOP && WndInsertAfter != HWND_BOTTOM)
+    {
+      /* FIXME: Find the window to insert after. */
+    }
+
+  WinPos.hwnd = Wnd;
+  WinPos.hwndInsertAfter = WndInsertAfter;
+  WinPos.x = x;
+  WinPos.y = y;
+  WinPos.cx = cx;
+  WinPos.cy = cy;
+  WinPos.flags = flags;
+
+  WinPosDoWinPosChanging(Window, &WinPos, &NewWindowRect, &NewClientRect);
+
+  if ((WinPos.flags & (SWP_NOZORDER | SWP_HIDEWINDOW | SWP_SHOWWINDOW)) !=
+      SWP_NOZORDER)
+    {
+      /* FIXME: SWP_DoOwnedPopups. */
+    }
   
+  /* FIXME: Adjust flags based on WndInsertAfter */
+
+  if ((!(WinPos.flags & (SWP_NOREDRAW | SWP_SHOWWINDOW)) &&
+       WinPos.flags & (SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | 
+                      SWP_HIDEWINDOW | SWP_FRAMECHANGED)) != 
+      (SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER))
+    {
+      if (Window->Style & WS_CLIPCHILDREN)
+       {
+         VisRgn = DceGetVisRgn(Wnd, DCX_WINDOW | DCX_CLIPSIBLINGS, 0, 0);
+       }
+      else
+       {
+         VisRgn = DceGetVisRgn(Wnd, DCX_WINDOW, 0, 0);
+       }
+    }
+
+  WvrFlags = WinPosDoNCCALCSize(Window, &WinPos, &NewWindowRect,
+                               &NewClientRect);
+
+  /* FIXME: Relink windows. */
+
+  /* FIXME: Reset active DCEs */
+
+  /* FIXME: Check for redrawing the whole client rect. */
+
+  if (WinPos.flags & SWP_SHOWWINDOW)
+    {
+      Window->Style |= WS_VISIBLE;
+      flags |= SWP_EX_PAINTSELF;
+      VisRgn = 1;
+    }
+  else
+    {
+      /* FIXME: Move the window bits */
+    }
+
+  if (WinPos.flags & SWP_HIDEWINDOW)
+    {
+      Window->Style &= ~WS_VISIBLE;
+    }
+
+  /* FIXME: Hide or show the claret */
+
+  if (VisRgn)
+    {
+      if (!(WinPos.flags & SWP_NOREDRAW))
+       {
+         if (flags & SWP_EX_PAINTSELF)
+           {
+             PaintRedrawWindow(Window->Self, NULL,
+                               (VisRgn == 1) ? 0 : VisRgn,
+                               RDW_ERASE | RDW_FRAME | RDW_INVALIDATE |
+                               RDW_ALLCHILDREN, 
+                               RDW_EX_XYWINDOW | RDW_EX_USEHRGN);
+           }
+         else
+           {
+             PaintRedrawWindow(Window->Self, NULL,
+                               (VisRgn == 1) ? 0 : VisRgn,
+                               RDW_ERASE | RDW_INVALIDATE | RDW_ALLCHILDREN,
+                               RDW_EX_USEHRGN);
+           }
+         /* FIXME: Redraw the window parent. */
+       }
+      /* FIXME: Delete VisRgn */
+    }
+
+  if (!(flags & SWP_NOACTIVATE))
+    {
+      WinPosChangeActiveWindow(WinPos.hwnd, FALSE);
+    }
+
+  /* FIXME: Check some conditions before doing this. */
+  NtUserSendMessage(WinPos.hwnd, WM_WINDOWPOSCHANGED, 0, (LPARAM)&WinPos);
+
+  ObmDereferenceObject(Window);
+  return(TRUE);
 }
 
 LRESULT
 WinPosGetNonClientSize(HWND Wnd, RECT* WindowRect, RECT* ClientRect)
 {
-  LRESULT Result;
-
-  Result = 
-    W32kSendNCCALCSIZEMessage(Wnd, FALSE, WindowRect, NULL,
-                             NULL, NULL, ClientRect);
-  return(Result);
 }
 
 BOOLEAN
@@ -107,10 +460,11 @@ WinPosShowWindow(HWND Wnd, INT Cmd)
   RECT NewPos;
   BOOLEAN ShowFlag;
 
-  Status = ObmReferenceObjectByHandle(PsGetWin32Process()->HandleTable,
-                                     Wnd,
-                                     otWindow,
-                                     (PVOID*)&Window);
+  Status = 
+    ObmReferenceObjectByHandle(PsGetWin32Process()->WindowStation->HandleTable,
+                              Wnd,
+                              otWindow,
+                              (PVOID*)&Window);
   if (!NT_SUCCESS(Status))
     {
       return(FALSE);
index 59914d9..8fb0bdc 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: winsta.c,v 1.3 2002/06/11 22:09:03 dwelch Exp $
+/* $Id: winsta.c,v 1.4 2002/07/04 19:56:37 dwelch Exp $
  *
  * COPYRIGHT:        See COPYING in the top level directory
  * PROJECT:          ReactOS kernel
@@ -172,15 +172,13 @@ NtUserCloseWindowStation(
  *   NtUserCloseWindowStation()
  *   Zero on failure
  */
-HWINSTA
-STDCALL
-NtUserCreateWindowStation(
-  PUNICODE_STRING lpszWindowStationName,
-  ACCESS_MASK dwDesiredAccess,
-  LPSECURITY_ATTRIBUTES lpSecurity,
-  DWORD Unknown3,
-  DWORD Unknown4,
-  DWORD Unknown5)
+HWINSTA STDCALL
+NtUserCreateWindowStation(PUNICODE_STRING lpszWindowStationName,
+                         ACCESS_MASK dwDesiredAccess,
+                         LPSECURITY_ATTRIBUTES lpSecurity,
+                         DWORD Unknown3,
+                         DWORD Unknown4,
+                         DWORD Unknown5)
 {
   OBJECT_ATTRIBUTES ObjectAttributes;
   UNICODE_STRING WindowStationName;
@@ -197,54 +195,51 @@ NtUserCreateWindowStation(
   DPRINT("Trying to open window station (%wZ)\n", &WindowStationName);
 
   /* Initialize ObjectAttributes for the window station object */
-  InitializeObjectAttributes(
-    &ObjectAttributes,
-    &WindowStationName,
-    0,
-    NULL,
-    NULL);
-
-  Status = ObOpenObjectByName(
-    &ObjectAttributes,
-    ExWindowStationObjectType,
-    NULL,
-    UserMode,
-    dwDesiredAccess,
-    NULL,
-    &WinSta);
+  InitializeObjectAttributes(&ObjectAttributes,
+                            &WindowStationName,
+                            0,
+                            NULL,
+                            NULL);
+  
+  Status = ObOpenObjectByName(&ObjectAttributes,
+                             ExWindowStationObjectType,
+                             NULL,
+                             UserMode,
+                             dwDesiredAccess,
+                             NULL,
+                             &WinSta);
   if (NT_SUCCESS(Status))
-  {
-    DPRINT("Successfully opened window station (%wZ)\n", WindowStationName);
-    return (HWINSTA)WinSta;
-  }
-
+    {
+      DPRINT("Successfully opened window station (%wZ)\n", WindowStationName);
+      return((HWINSTA)WinSta);
+    }
+  
   DPRINT("Creating window station (%wZ)\n", &WindowStationName);
 
-  Status = ObCreateObject(
-    &WinSta,
-    STANDARD_RIGHTS_REQUIRED,
-    &ObjectAttributes,
-    ExWindowStationObjectType,
-    (PVOID*)&WinStaObject);
+  Status = ObCreateObject(&WinSta,
+                         STANDARD_RIGHTS_REQUIRED,
+                         &ObjectAttributes,
+                         ExWindowStationObjectType,
+                         (PVOID*)&WinStaObject);
   if (!NT_SUCCESS(Status))
-  {
-    DPRINT("Failed creating window station (%wZ)\n", &WindowStationName);
-    SetLastNtError(STATUS_INSUFFICIENT_RESOURCES);
-    return (HWINSTA)0;
-  }
+    {
+      DPRINT("Failed creating window station (%wZ)\n", &WindowStationName);
+      SetLastNtError(STATUS_INSUFFICIENT_RESOURCES);
+      return (HWINSTA)0;
+    }
 
   WinStaObject->HandleTable = ObmCreateHandleTable();
   if (!WinStaObject->HandleTable)
-  {
-    DPRINT("Failed creating handle table\n");
-    ObDereferenceObject(WinStaObject);
-    SetLastNtError(STATUS_INSUFFICIENT_RESOURCES);
-    return (HWINSTA)0;
-  }
-
+    {
+      DPRINT("Failed creating handle table\n");
+      ObDereferenceObject(WinStaObject);
+      SetLastNtError(STATUS_INSUFFICIENT_RESOURCES);
+      return((HWINSTA)0);
+    }
+  
   DPRINT("Window station successfully created (%wZ)\n", &WindowStationName);
-
-  return (HWINSTA)WinSta;
+  
+  return((HWINSTA)WinSta);
 }
 
 BOOL
@@ -559,15 +554,12 @@ NtUserCreateDesktop(
   return (HDESK)Desktop;
 }
 
-HDESK
-STDCALL
-NtUserGetThreadDesktop(
-  DWORD dwThreadId,
-  DWORD Unknown1)
+HDESK STDCALL
+NtUserGetThreadDesktop(DWORD dwThreadId,
+                      DWORD Unknown1)
 {
-  UNIMPLEMENTED
-
-  return (HDESK)0;
+  UNIMPLEMENTED;
+  return((HDESK)0);
 }
 
 /*
@@ -731,14 +723,10 @@ NtUserResolveDesktopForWOW(
   return 0;
 }
 
-BOOL
-STDCALL
-NtUserSetThreadDesktop(
-  HDESK hDesktop)
+BOOL STDCALL
+NtUserSetThreadDesktop(HDESK hDesktop)
 {
-  UNIMPLEMENTED
-
-  return FALSE;
+  return(FALSE);
 }
 
 /*
index f57fd16..0aaa61f 100644 (file)
@@ -1,14 +1,24 @@
+/* $Id: coord.c,v 1.7 2002/07/04 19:56:37 dwelch Exp $
+ *
+ * COPYRIGHT:        See COPYING in the top level directory
+ * PROJECT:          ReactOS kernel
+ * PURPOSE:          Coordinate systems
+ * FILE:             subsys/win32k/objects/coord.c
+ * PROGRAMER:        Unknown
+ */
 
+/* INCLUDES ******************************************************************/
 
-#undef WIN32_LEAN_AND_MEAN
 #include <windows.h>
 #include <ddk/ntddk.h>
 #include <win32k/coord.h>
 #include <win32k/dc.h>
 
-// #define NDEBUG
+//#define NDEBUG
 #include <win32k/debug1.h>
 
+/* FUNCTIONS *****************************************************************/
+
 BOOL STDCALL W32kCombineTransform(LPXFORM  XFormResult,
                            CONST LPXFORM  xform1,
                            CONST LPXFORM  xform2)
@@ -35,11 +45,37 @@ BOOL STDCALL W32kCombineTransform(LPXFORM  XFormResult,
   return  TRUE;
 }
 
-BOOL STDCALL W32kDPtoLP(HDC  hDC,
-                 LPPOINT  Points,
-                 int  Count)
+VOID STATIC
+CoordDPtoLP(PDC Dc, LPPOINT Point)
+{ 
+FLOAT x, y;
+  x = (FLOAT)Point->x;
+  y = (FLOAT)Point->y;
+  Point->x = x * Dc->w.xformVport2World.eM11 +
+    y * Dc->w.xformVport2World.eM21 + Dc->w.xformVport2World.eDx;
+  Point->y = x * Dc->w.xformVport2World.eM12 +
+    y * Dc->w.xformVport2World.eM22 + Dc->w.xformVport2World.eDy; 
+}
+
+BOOL STDCALL 
+W32kDPtoLP(HDC  hDC,
+          LPPOINT  Points,
+          int  Count)
 {
-  UNIMPLEMENTED;
+  PDC Dc;  
+  ULONG i;
+  
+  Dc = DC_HandleToPtr (hDC);
+  if (Dc == NULL || !Dc->w.vport2WorldValid) 
+    {
+      return(FALSE);
+    }
+  
+  for (i = 0; i < Count; i++)
+    {
+      CoordDPtoLP(Dc, &Points[i]);
+    }
+  return(TRUE);
 }
 
 int
@@ -81,13 +117,35 @@ W32kGetWorldTransform(HDC  hDC,
   return  TRUE;
 }
 
-BOOL
-STDCALL
-W32kLPtoDP(HDC  hDC,
-                 LPPOINT  Points,
-                 int  Count)
+VOID STATIC
+CoordLPtoDP(PDC Dc, LPPOINT Point)
 {
-  UNIMPLEMENTED;
+  FLOAT x, y;
+  x = (FLOAT)Point->x;
+  y = (FLOAT)Point->y;
+  Point->x = x * Dc->w.xformWorld2Vport.eM11 +
+    y * Dc->w.xformWorld2Vport.eM21 + Dc->w.xformWorld2Vport.eDx;
+  Point->y = x * Dc->w.xformWorld2Vport.eM12 +
+    y * Dc->w.xformWorld2Vport.eM22 + Dc->w.xformWorld2Vport.eDy;
+}
+
+BOOL STDCALL
+W32kLPtoDP(HDC hDC, LPPOINT Points, INT Count)
+{
+  PDC Dc;  
+  ULONG i;
+  
+  Dc = DC_HandleToPtr (hDC);
+  if (Dc == NULL) 
+    {
+      return(FALSE);
+    }
+  
+  for (i = 0; i < Count; i++)
+    {
+      CoordLPtoDP(Dc, &Points[i]);
+    }
+  return(TRUE);
 }
 
 BOOL
index 2628109..1d4cffd 100644 (file)
-#undef WIN32_LEAN_AND_MEAN
 #include <windows.h>
 #include <ddk/ntddk.h>
 #include <win32k/region.h>
+#include <win32k/gdiobj.h>
 
-// #define NDEBUG
+//#define NDEBUG
 #include <win32k/debug1.h>
 
-INT
-STDCALL
+/* FUNCTIONS *****************************************************************/
+
+INT STDCALL
+W32kGetBoxRgn(HRGN hRgn, PRECT Rect)
+{
+}
+
+HRGN STDCALL
+W32kCropRgn(HRGN hDest, HRGN hSrc, const RECT* Rect, const POINT* Point)
+{
+}
+
+INT STDCALL
 W32kCombineRgn(HRGN  hDest,
-                    HRGN  hSrc1,
-                    HRGN  hSrc2,
-                    INT  CombineMode)
+              HRGN  hSrc1,
+              HRGN  hSrc2,
+              INT  CombineMode)
 {
   UNIMPLEMENTED;
 }
 
-HRGN
-STDCALL
+HRGN STDCALL
 W32kCreateEllipticRgn(INT  LeftRect,
-                            INT  TopRect,
-                            INT  RightRect,
-                            INT  BottomRect)
+                     INT  TopRect,
+                     INT  RightRect,
+                     INT  BottomRect)
 {
   UNIMPLEMENTED;
 }
 
-HRGN
-STDCALL
-W32kCreateEllipticRgnIndirect(CONST PRECT  rc)
+HRGN STDCALL
+W32kCreateEllipticRgnIndirect(CONST PRECT rc)
 {
   UNIMPLEMENTED;
 }
 
-HRGN
-STDCALL
+HRGN STDCALL
 W32kCreatePolygonRgn(CONST PPOINT  pt,
-                           INT  Count,
-                           INT  PolyFillMode)
+                    INT  Count,
+                    INT  PolyFillMode)
 {
   UNIMPLEMENTED;
 }
 
-HRGN
-STDCALL
+HRGN STDCALL
 W32kCreatePolyPolygonRgn(CONST PPOINT  pt,
-                               CONST PINT  PolyCounts,
-                               INT  Count,
-                               INT  PolyFillMode)
+                        CONST PINT  PolyCounts,
+                        INT  Count,
+                        INT  PolyFillMode)
 {
   UNIMPLEMENTED;
 }
 
-HRGN
-STDCALL
+HRGN STDCALL
 W32kCreateRectRgn(INT  LeftRect,
-                        INT  TopRect,
-                        INT  RightRect,
-                        INT  BottomRect)
+                 INT  TopRect,
+                 INT  RightRect,
+                 INT  BottomRect)
 {
-  UNIMPLEMENTED;
+  RGNDATA* Region;
+  PRECT Rect;
+
+  DPRINT("W32kCreateRectRgn(LeftRect %d, TopRect %d, RightRect %d, "
+        "BottomRect %d)\n", LeftRect, TopRect, RightRect, BottomRect);
+
+  Region = (RGNDATA*)GDIOBJ_AllocObject(sizeof(RGNDATA) + sizeof(RECT) - 1, 0);
+  Region->rdh.dwSize = sizeof(RGNDATA) + sizeof(RECT) - 1;
+  Region->rdh.iType = RDH_RECTANGLES;
+  Region->rdh.nCount = 0;
+  Rect = (PRECT)Region->Buffer;
+  Rect->left = LeftRect;
+  Rect->right = RightRect;
+  Rect->top = TopRect;
+  Rect->bottom = BottomRect;
+  Region->rdh.rcBound = *Rect;
+
+  return(GDIOBJ_PtrToHandle((PGDIOBJ)Region, 0));
 }
 
-HRGN
-STDCALL
-W32kCreateRectRgnIndirect(CONST PRECT  rc)
+HRGN STDCALL
+W32kCreateRectRgnIndirect(CONST PRECT rc)
 {
-  UNIMPLEMENTED;
+  return(W32kCreateRectRgn(rc->left, rc->top, rc->right, rc->bottom));
 }
 
-HRGN
-STDCALL
+HRGN STDCALL
 W32kCreateRoundRectRgn(INT  LeftRect,
-                             INT  TopRect,
-                             INT  RightRect,
-                             INT  BottomRect,
-                             INT  WidthEllipse,
-                             INT  HeightEllipse)
+                      INT  TopRect,
+                      INT  RightRect,
+                      INT  BottomRect,
+                      INT  WidthEllipse,
+                      INT  HeightEllipse)
 {
   UNIMPLEMENTED;
 }
 
-BOOL
-STDCALL
+BOOL STDCALL
 W32kEqualRgn(HRGN  hSrcRgn1,
-                   HRGN  hSrcRgn2)
+            HRGN  hSrcRgn2)
 {
   UNIMPLEMENTED;
 }
 
-HRGN
-STDCALL
+HRGN STDCALL
 W32kExtCreateRegion(CONST PXFORM  Xform,
-                          DWORD  Count,
-                          CONST PRGNDATA  RgnData)
+                   DWORD  Count,
+                   CONST PRGNDATA  RgnData)
 {
   UNIMPLEMENTED;
 }
 
-BOOL
-STDCALL
+BOOL STDCALL
 W32kFillRgn(HDC  hDC,
-                  HRGN  hRgn,
-                  HBRUSH  hBrush)
+           HRGN  hRgn,
+           HBRUSH  hBrush)
 {
   UNIMPLEMENTED;
 }
 
-BOOL
-STDCALL
+BOOL STDCALL
 W32kFrameRgn(HDC  hDC,
-                   HRGN  hRgn,
-                   HBRUSH  hBrush,
-                   INT  Width,
-                   INT  Height)
+            HRGN  hRgn,
+            HBRUSH  hBrush,
+            INT  Width,
+            INT  Height)
 {
   UNIMPLEMENTED;
 }
 
-INT
-STDCALL
+INT STDCALL
 W32kGetRgnBox(HRGN  hRgn,
-                   LPRECT  hRect)
+             LPRECT  hRect)
 {
   UNIMPLEMENTED;
 }
 
-BOOL
-STDCALL
+BOOL STDCALL
 W32kInvertRgn(HDC  hDC,
-                    HRGN  hRgn)
+             HRGN  hRgn)
 {
   UNIMPLEMENTED;
 }
 
-INT
-STDCALL
+INT STDCALL
 W32kOffsetRgn(HRGN  hRgn,
-                   INT  XOffset,
-                   INT  YOffset)
+             INT  XOffset,
+             INT  YOffset)
 {
   UNIMPLEMENTED;
 }
 
-BOOL
-STDCALL
+BOOL STDCALL
 W32kPaintRgn(HDC  hDC,
-                   HRGN  hRgn)
+            HRGN  hRgn)
 {
   UNIMPLEMENTED;
 }
 
-BOOL
-STDCALL
+BOOL STDCALL
 W32kPtInRegion(HRGN  hRgn,
-                     INT  X,
-                     INT  Y)
+              INT  X,
+              INT  Y)
 {
   UNIMPLEMENTED;
 }
 
-BOOL
-STDCALL
+BOOL STDCALL
 W32kRectInRegion(HRGN  hRgn,
-                       CONST LPRECT  rc)
+                CONST LPRECT  rc)
 {
   UNIMPLEMENTED;
 }
 
-BOOL
-STDCALL
+BOOL STDCALL
 W32kSetRectRgn(HRGN  hRgn,
-                     INT  LeftRect,
-                     INT  TopRect,
-                     INT  RightRect,
-                     INT  BottomRect)
+              INT  LeftRect,
+              INT  TopRect,
+              INT  RightRect,
+              INT  BottomRect)
 {
   UNIMPLEMENTED;
 }
index c05ecea..bf49d44 100644 (file)
@@ -2,7 +2,7 @@
 # Define $DEP_OBJECTS before this file is included
 # $DEP_OBJECTS contain a list of object files that are checked for dependancies
 
-DEP_FILTERED := $(filter-out ex/napi.% nt/zw.%, $(DEP_OBJECTS:.o=.d))
+DEP_FILTERED := $(filter-out $(DEP_EXCLUDE_FILTER), $(DEP_OBJECTS:.o=.d))
 DEP_FILES := $(join $(dir $(DEP_FILTERED)), $(addprefix ., $(notdir $(DEP_FILTERED))))