sync to trunk (44770)
authorSamuel Serapion <samuel.serapion@gmail.com>
Sun, 27 Dec 2009 17:55:04 +0000 (17:55 +0000)
committerSamuel Serapion <samuel.serapion@gmail.com>
Sun, 27 Dec 2009 17:55:04 +0000 (17:55 +0000)
svn path=/branches/ros-amd64-bringup/; revision=44771

51 files changed:
1  2 
reactos/Makefile
reactos/ReactOS-arm.rbuild
reactos/dll/ntdll/ldr/actctx.c
reactos/dll/ntdll/ldr/utils.c
reactos/dll/ntdll/ntdll.rbuild
reactos/dll/win32/advapi32/reg/reg.c
reactos/dll/win32/advapi32/service/sctrl.c
reactos/dll/win32/gdi32/objects/region.c
reactos/dll/win32/kernel32/except/except.c
reactos/dll/win32/kernel32/kernel32.pspec
reactos/dll/win32/kernel32/kernel32.rbuild
reactos/dll/win32/kernel32/process/proc.c
reactos/dll/win32/kernel32/thread/thread.c
reactos/dll/win32/shell32/shell32_main.c
reactos/dll/win32/syssetup/install.c
reactos/dll/win32/user32/misc/dde.c
reactos/dll/win32/user32/windows/class.c
reactos/dll/win32/user32/windows/clipboard.c
reactos/dll/win32/user32/windows/draw.c
reactos/dll/win32/user32/windows/window.c
reactos/dll/win32/wdmaud.drv/wdmaud.rbuild
reactos/drivers/input/i8042prt/keyboard.c
reactos/drivers/storage/ide/uniata/id_ata.cpp
reactos/drivers/video/videoprt/agp.c
reactos/drivers/video/videoprt/resource.c
reactos/include/crt/mingw32/intrin_x86.h
reactos/include/ddk/wdm.h
reactos/include/psdk/winnt.h
reactos/include/psdk/winternl.h
reactos/include/reactos/win32k/ntuser.h
reactos/lib/sdk/crt/crt.rbuild
reactos/ntoskrnl/dbgk/dbgkutil.c
reactos/ntoskrnl/ex/harderr.c
reactos/ntoskrnl/include/internal/ke.h
reactos/ntoskrnl/kdbg/kdb.c
reactos/ntoskrnl/ke/bug.c
reactos/ntoskrnl/mm/freelist.c
reactos/ntoskrnl/ps/kill.c
reactos/ntoskrnl/ps/thread.c
reactos/ntoskrnl/rtl/libsupp.c
reactos/subsystems/win32/win32k/ntuser/class.c
reactos/subsystems/win32/win32k/ntuser/hook.c
reactos/subsystems/win32/win32k/ntuser/keyboard.c
reactos/subsystems/win32/win32k/ntuser/message.c
reactos/subsystems/win32/win32k/ntuser/misc.c
reactos/subsystems/win32/win32k/ntuser/msgqueue.c
reactos/subsystems/win32/win32k/ntuser/painting.c
reactos/subsystems/win32/win32k/ntuser/simplecall.c
reactos/tools/rbuild/backend/mingw/rules.mak
reactos/tools/rbuild/backend/msvc/vcprojmaker.cpp
reactos/tools/rbuild/rbuild.h

Simple merge
                        <compilerflag>-ftracer</compilerflag>
                </if>
          <compilerflag>-Wno-attributes</compilerflag>
+         <compilerflag>-U_UNICODE</compilerflag>
+         <compilerflag>-UUNICODE</compilerflag>
        </group>
  
 -
 +    
        <define name="__MSVCRT__"/> <!-- DUBIOUS -->
 -
 +    
        <group linkerset="ld">
          <linkerflag>--strip-debug</linkerflag> <!-- INVESTIGATE -->
          <linkerflag>-static</linkerflag> <!-- INVESTIGATE -->
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -142,10 -201,9 +201,9 @@@ HRG
  WINAPI
  CreatePolygonRgn( const POINT * lppt, int cPoints, int fnPolyFillMode)
  {
 -    return (HRGN) NtGdiPolyPolyDraw( (HDC) fnPolyFillMode, (PPOINT) lppt, (PULONG) &cPoints, 1, GdiPolyPolyRgn);
 +    return (HRGN) NtGdiPolyPolyDraw( ULongToHandle(fnPolyFillMode), (PPOINT) lppt, (PULONG) &cPoints, 1, GdiPolyPolyRgn);
  }
  
  /*
   * @implemented
   */
@@@ -156,10 -214,9 +214,9 @@@ CreatePolyPolygonRgn( const POINT* lppt
                        int nCount,
                        int fnPolyFillMode)
  {
 -    return (HRGN) NtGdiPolyPolyDraw(  (HDC) fnPolyFillMode, (PPOINT) lppt, (PULONG) lpPolyCounts, (ULONG) nCount, GdiPolyPolyRgn );
 +    return (HRGN) NtGdiPolyPolyDraw( ULongToHandle(fnPolyFillMode), (PPOINT) lppt, (PULONG) lpPolyCounts, (ULONG) nCount, GdiPolyPolyRgn );
  }
  
  /*
   * @implemented
   */
@@@ -9,17 -8,11 +9,15 @@@
  @ stdcall AddLocalAlternateComputerNameA(str ptr)
  @ stdcall AddLocalAlternateComputerNameW(wstr ptr)
  @ stdcall AddRefActCtx(ptr)
- ;@ stdcall AddSIDToBoundaryDescriptor ; Win 7
- ;@ stdcall AddSecureMemoryCacheCallback ; Win 7
  @ stdcall AddVectoredContinueHandler(long ptr) ntdll.RtlAddVectoredContinueHandler
  @ stdcall AddVectoredExceptionHandler(long ptr) ntdll.RtlAddVectoredExceptionHandler
 +;@ stdcall AdjustCalendarDate ; Win 7
  @ stdcall AllocConsole()
 -@ stub AllocLSCallback ; missing in XP SP3 and 2003 R2
 +@ stub AllocLSCallback ; missing in XP SP3 and 2003 R2 and Win 7
  @ stdcall AllocateUserPhysicalPages(long ptr ptr)
 +;@ stdcall AllocateUserPhysicalPagesNuma ; Win 7
 +;@ stdcall ApplicationRecoveryFinished ; Win 7
 +;@ stdcall ApplicationRecoveryInProgress ; Win 7
  @ stdcall AreFileApisANSI()
  @ stdcall AssignProcessToJobObject(ptr ptr)
  @ stdcall AttachConsole(long)
@@@ -183,34 -185,35 +185,35 @@@ CreateRemoteThread(HANDLE hProcess
  
          if (NT_SUCCESS(Status))
          {
 -            Teb = ThreadBasicInfo.TebBaseAddress;
 +        Teb = ThreadBasicInfo.TebBaseAddress;
  
 -            /* Save it */
 -            Teb->ActivationContextStackPointer = ActivationContextStack;
 +        /* Save it */
 +        Teb->ActivationContextStackPointer = ActivationContextStack;
+ #ifndef SXS_SUPPORT_FIXME
 -            /* Query the Context */
 -            Status = RtlQueryInformationActivationContext(1,
 -                                                          0,
 -                                                          NULL,
 -                                                          ActivationContextBasicInformation,
 -                                                          &ActivationCtxInfo,
 -                                                          sizeof(ActivationCtxInfo),
 +        /* Query the Context */
 +        Status = RtlQueryInformationActivationContext(1,
 +                                                      0,
 +                                                      NULL,
 +                                                      ActivationContextBasicInformation,
 +                                                      &ActivationCtxInfo,
 +                                                      sizeof(ActivationCtxInfo),
                                                            &retLen);
              if (NT_SUCCESS(Status))
              {
 -                /* Does it need to be activated? */
 -                if (!ActivationCtxInfo.hActCtx)
 -                {
 -                    /* Activate it */
 +        /* Does it need to be activated? */
 +        if (!ActivationCtxInfo.hActCtx)
 +        {
 +            /* Activate it */
                      Status = RtlActivateActivationContext(1,
 -                                                          ActivationCtxInfo.hActCtx,
 -                                                          &Cookie);
 +                                                    ActivationCtxInfo.hActCtx,
 +                                                    &Cookie);
                      if (!NT_SUCCESS(Status))
                          DPRINT1("RtlActivateActivationContext failed %x\n", Status);
 -                }
 -            }
 +        }
 +    }
              else
                  DPRINT1("RtlQueryInformationActivationContext failed %x\n", Status);
+ #endif
          }
          else
              DPRINT1("RtlAllocateActivationContextStack failed %x\n", Status);
Simple merge
Simple merge
        <library>advapi32</library>
        <library>libsamplerate</library>
        <library>msvcrt</library>
+       <library>mmixer</library>
+       <library>setupapi</library>
+       <library>ksuser</library>
        <file>wdmaud.c</file>
        <file>mixer.c</file>
+       <file>mmixer.c</file>
+       <file>legacy.c</file>
        <file>wdmaud.rc</file>
 -</module>
 +</module>
Simple merge
@@@ -1420,4 -1416,4 +1420,4 @@@ __INTRIN_INLINE void _mm_pause(void
  
  #endif /* KJK_INTRIN_X86_H_ */
  
--/* EOF */
++/* EOF */
@@@ -3212,4 -3205,4 +3212,4 @@@ ExFreeToPagedLookasideList
  }
  #endif
  
--#endif // _WDMDDK_
++#endif // _WDMDDK_
Simple merge
Simple merge
                                <file>setjmp.s</file>
                        </directory>
                </if>
++              <if property="ARCH" value="amd64">
++                      <directory name="amd64">
++                              <file>setjmp.s</file>
++                      </directory>
++              </if>
        </directory>
        <directory name="signal">
                <file>signal.c</file>
Simple merge
Simple merge
@@@ -1389,7 -1349,8 +1389,8 @@@ KdbEnterDebuggerException
      ULONGLONG ull;
      BOOLEAN Resume = FALSE;
      BOOLEAN EnterConditionMet = TRUE;
 -    ULONG OldEflags;
 +    ULONG_PTR OldEflags;
+     KIRQL OldIrql;
      NTSTATUS ExceptionCode;
  
      ExceptionCode = (ExceptionRecord ? ExceptionRecord->ExceptionCode : STATUS_BREAKPOINT);
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -2042,6 -1661,563 +1661,563 @@@ IntUninitMessagePumpHook(
     return FALSE;
  }
  
 -                       HKL dwhkl)
+ /** Functions ******************************************************************/
+ BOOL APIENTRY
+ NtUserPostMessage(HWND hWnd,
+                   UINT Msg,
+                   WPARAM wParam,
+                   LPARAM lParam)
+ {
+    DECLARE_RETURN(BOOL);
+    DPRINT("Enter NtUserPostMessage\n");
+    UserEnterExclusive();
+    RETURN( UserPostMessage(hWnd, Msg, wParam, lParam));
+ CLEANUP:
+    DPRINT("Leave NtUserPostMessage, ret=%i\n",_ret_);
+    UserLeave();
+    END_CLEANUP;
+ }
+ BOOL APIENTRY
+ NtUserPostThreadMessage(DWORD idThread,
+                         UINT Msg,
+                         WPARAM wParam,
+                         LPARAM lParam)
+ {
+    DECLARE_RETURN(BOOL);
+    DPRINT("Enter NtUserPostThreadMessage\n");
+    UserEnterExclusive();
+    RETURN( UserPostThreadMessage( idThread,
+                                   Msg,
+                                   wParam,
+                                   lParam));
+ CLEANUP:
+    DPRINT("Leave NtUserPostThreadMessage, ret=%i\n",_ret_);
+    UserLeave();
+    END_CLEANUP;
+ }
+ DWORD APIENTRY
+ NtUserQuerySendMessage(DWORD Unknown0)
+ {
+    UNIMPLEMENTED;
+    return 0;
+ }
+ ////////// API on the way out!
+ LRESULT APIENTRY
+ NtUserSendMessageTimeout( HWND hWnd,
+                           UINT Msg,
+                           WPARAM wParam,
+                           LPARAM lParam,
+                           UINT uFlags,
+                           UINT uTimeout,
+                           ULONG_PTR *uResult,
+                           PNTUSERSENDMESSAGEINFO UnsafeInfo )
+ {
+    DOSENDMESSAGE dsm;
+    LRESULT Result;
+    DECLARE_RETURN(BOOL);
+    DPRINT("Enter NtUserSendMessageTimeout\n");
+    UserEnterExclusive();
+    dsm.uFlags = uFlags;
+    dsm.uTimeout = uTimeout;
+    Result = co_IntDoSendMessage(hWnd, Msg, wParam, lParam, &dsm, UnsafeInfo);
+    if(uResult != NULL && Result != 0)
+    {
+       NTSTATUS Status;
+       Status = MmCopyToCaller(uResult, &dsm.Result, sizeof(ULONG_PTR));
+       if(!NT_SUCCESS(Status))
+       {
+          SetLastWin32Error(ERROR_INVALID_PARAMETER);
+          RETURN( FALSE);
+       }
+    }
+    RETURN( Result);
+ CLEANUP:
+    DPRINT("Leave NtUserSendMessageTimeout, ret=%i\n",_ret_);
+    UserLeave();
+    END_CLEANUP;
+ }
+ LRESULT APIENTRY
+ NtUserSendMessage( HWND Wnd,
+                    UINT Msg,
+                    WPARAM wParam,
+                    LPARAM lParam,
+                    PNTUSERSENDMESSAGEINFO UnsafeInfo )
+ {
+    DECLARE_RETURN(BOOL);
+    DPRINT("Enter NtUserSendMessage\n");
+    UserEnterExclusive();
+    RETURN(co_IntDoSendMessage(Wnd, Msg, wParam, lParam, NULL, UnsafeInfo));
+ CLEANUP:
+    DPRINT("Leave NtUserSendMessage, ret=%i\n",_ret_);
+    UserLeave();
+    END_CLEANUP;
+ }
+ //////////
+ BOOL APIENTRY
+ NtUserWaitMessage(VOID)
+ {
+    DECLARE_RETURN(BOOL);
+    DPRINT("EnterNtUserWaitMessage\n");
+    UserEnterExclusive();
+    RETURN(co_IntWaitMessage(NULL, 0, 0));
+ CLEANUP:
+    DPRINT("Leave NtUserWaitMessage, ret=%i\n",_ret_);
+    UserLeave();
+    END_CLEANUP;
+ }
+ BOOL APIENTRY
+ NtUserGetMessage( PNTUSERGETMESSAGEINFO UnsafeInfo,
+                   HWND hWnd,
+                   UINT MsgFilterMin,
+                   UINT MsgFilterMax )
+ /*
+  * FUNCTION: Get a message from the calling thread's message queue.
+  * ARGUMENTS:
+  *      UnsafeMsg - Pointer to the structure which receives the returned message.
+  *      Wnd - Window whose messages are to be retrieved.
+  *      MsgFilterMin - Integer value of the lowest message value to be
+  *                     retrieved.
+  *      MsgFilterMax - Integer value of the highest message value to be
+  *                     retrieved.
+  */
+ {
+    BOOL GotMessage;
+    NTUSERGETMESSAGEINFO Info;
+    NTSTATUS Status;
+    /* FIXME: if initialization is removed, gcc complains that this may be used before initialization. Please review */
+    PWINDOW_OBJECT Window = NULL;
+    PMSGMEMORY MsgMemoryEntry;
+    PVOID UserMem;
+    UINT Size;
+    USER_MESSAGE Msg;
+    DECLARE_RETURN(BOOL);
+ //   USER_REFERENCE_ENTRY Ref;
+    DPRINT("Enter NtUserGetMessage\n");
+    UserEnterExclusive();
+    /* Validate input */
+    if (hWnd && !(Window = UserGetWindowObject(hWnd)))
+    {
+       RETURN(-1);
+    }
+ //   if (Window) UserRefObjectCo(Window, &Ref);
+    if (MsgFilterMax < MsgFilterMin)
+    {
+       MsgFilterMin = 0;
+       MsgFilterMax = 0;
+    }
+    do
+    {
+       GotMessage = co_IntPeekMessage(&Msg, Window, MsgFilterMin, MsgFilterMax, PM_REMOVE);
+       if (GotMessage)
+       {
+          Info.Msg = Msg.Msg;
+          /* See if this message type is present in the table */
+          MsgMemoryEntry = FindMsgMemory(Info.Msg.message);
+          if (NULL == MsgMemoryEntry)
+          {
+             /* Not present, no copying needed */
+             Info.LParamSize = 0;
+          }
+          else
+          {
+             /* Determine required size */
+             Size = MsgMemorySize(MsgMemoryEntry, Info.Msg.wParam,
+                                  Info.Msg.lParam);
+             /* Allocate required amount of user-mode memory */
+             Info.LParamSize = Size;
+             UserMem = NULL;
+             Status = ZwAllocateVirtualMemory(NtCurrentProcess(), &UserMem, 0,
+                                              &Info.LParamSize, MEM_COMMIT, PAGE_READWRITE);
+             if (! NT_SUCCESS(Status))
+             {
+                SetLastNtError(Status);
+                RETURN( (BOOL) -1);
+             }
+             /* Transfer lParam data to user-mode mem */
+             Status = MmCopyToCaller(UserMem, (PVOID) Info.Msg.lParam, Size);
+             if (! NT_SUCCESS(Status))
+             {
+                ZwFreeVirtualMemory(NtCurrentProcess(), (PVOID *) &UserMem,
+                                    &Info.LParamSize, MEM_DECOMMIT);
+                SetLastNtError(Status);
+                RETURN( (BOOL) -1);
+             }
+             Info.Msg.lParam = (LPARAM) UserMem;
+          }
+          if (Msg.FreeLParam && 0 != Msg.Msg.lParam)
+          {
+             ExFreePool((void *) Msg.Msg.lParam);
+          }
+          Status = MmCopyToCaller(UnsafeInfo, &Info, sizeof(NTUSERGETMESSAGEINFO));
+          if (! NT_SUCCESS(Status))
+          {
+             SetLastNtError(Status);
+             RETURN( (BOOL) -1);
+          }
+       }
+       else if (! co_IntWaitMessage(Window, MsgFilterMin, MsgFilterMax))
+       {
+          RETURN( (BOOL) -1);
+       }
+    }
+    while (! GotMessage);
+    RETURN( WM_QUIT != Info.Msg.message);
+ CLEANUP:
+ //   if (Window) UserDerefObjectCo(Window);
+    DPRINT("Leave NtUserGetMessage\n");
+    UserLeave();
+    END_CLEANUP;
+ }
+ BOOL
+ APIENTRY
+ NtUserGetMessageX(
+    PMSG pMsg,
+    HWND hWnd,
+    UINT MsgFilterMin,
+    UINT MsgFilterMax)
+ {
+    MSG Msg;
+    BOOL Ret = FALSE;
+    DECLARE_RETURN(BOOL);
+    DPRINT("Enter NtUserGetMessage\n");
+    UserEnterExclusive();
+    if ( (MsgFilterMin|MsgFilterMax) & ~WM_MAXIMUM )
+    {
+       SetLastWin32Error(ERROR_INVALID_PARAMETER);
+       RETURN( Ret);
+    }
+    Ret = co_IntGetPeekMessage(&Msg, hWnd, MsgFilterMin, MsgFilterMax, PM_REMOVE, TRUE);
+    if (Ret)
+    {
+       _SEH2_TRY
+       {
+          ProbeForWrite(pMsg, sizeof(MSG), 1);
+          RtlCopyMemory(pMsg, &Msg, sizeof(MSG));
+       }
+       _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+       {
+          SetLastNtError(_SEH2_GetExceptionCode());
+          Ret = FALSE;
+       }
+       _SEH2_END;
+    }
+    RETURN( Ret);
+ CLEANUP:
+    DPRINT("Leave NtUserGetMessage\n");
+    UserLeave();
+    END_CLEANUP;
+ }
+ BOOL APIENTRY
+ NtUserPeekMessage(PNTUSERGETMESSAGEINFO UnsafeInfo,
+                   HWND hWnd,
+                   UINT MsgFilterMin,
+                   UINT MsgFilterMax,
+                   UINT RemoveMsg)
+ {
+    NTSTATUS Status;
+    BOOL Present;
+    NTUSERGETMESSAGEINFO Info;
+    PWINDOW_OBJECT Window;
+    PMSGMEMORY MsgMemoryEntry;
+    PVOID UserMem;
+    UINT Size;
+    USER_MESSAGE Msg;
+    DECLARE_RETURN(BOOL);
+    DPRINT("Enter NtUserPeekMessage\n");
+    UserEnterExclusive();
+    if (hWnd == (HWND)-1 || hWnd == (HWND)0x0000FFFF || hWnd == (HWND)0xFFFFFFFF)
+       hWnd = (HWND)1;
+    /* Validate input */
+    if (hWnd && hWnd != (HWND)1)
+    {
+       if (!(Window = UserGetWindowObject(hWnd)))
+       {
+          RETURN(-1);
+       }
+    }
+    else
+    {
+       Window = (PWINDOW_OBJECT)hWnd;
+    }
+    if (MsgFilterMax < MsgFilterMin)
+    {
+       MsgFilterMin = 0;
+       MsgFilterMax = 0;
+    }
+    Present = co_IntPeekMessage(&Msg, Window, MsgFilterMin, MsgFilterMax, RemoveMsg);
+    if (Present)
+    {
+       Info.Msg = Msg.Msg;
+       /* See if this message type is present in the table */
+       MsgMemoryEntry = FindMsgMemory(Info.Msg.message);
+       if (NULL == MsgMemoryEntry)
+       {
+          /* Not present, no copying needed */
+          Info.LParamSize = 0;
+       }
+       else
+       {
+          /* Determine required size */
+          Size = MsgMemorySize(MsgMemoryEntry, Info.Msg.wParam,
+                               Info.Msg.lParam);
+          /* Allocate required amount of user-mode memory */
+          Info.LParamSize = Size;
+          UserMem = NULL;
+          Status = ZwAllocateVirtualMemory(NtCurrentProcess(), &UserMem, 0,
+                                           &Info.LParamSize, MEM_COMMIT, PAGE_READWRITE);
+          if (! NT_SUCCESS(Status))
+          {
+             SetLastNtError(Status);
+             RETURN( (BOOL) -1);
+          }
+          /* Transfer lParam data to user-mode mem */
+          Status = MmCopyToCaller(UserMem, (PVOID) Info.Msg.lParam, Size);
+          if (! NT_SUCCESS(Status))
+          {
+             ZwFreeVirtualMemory(NtCurrentProcess(), (PVOID *) &UserMem,
+                                 &Info.LParamSize, MEM_RELEASE);
+             SetLastNtError(Status);
+             RETURN( (BOOL) -1);
+          }
+          Info.Msg.lParam = (LPARAM) UserMem;
+       }
+       if (RemoveMsg && Msg.FreeLParam && 0 != Msg.Msg.lParam)
+       {
+          ExFreePool((void *) Msg.Msg.lParam);
+       }
+       Status = MmCopyToCaller(UnsafeInfo, &Info, sizeof(NTUSERGETMESSAGEINFO));
+       if (! NT_SUCCESS(Status))
+       {
+          SetLastNtError(Status);
+          RETURN( (BOOL) -1);
+       }
+    }
+    RETURN( Present);
+ CLEANUP:
+    DPRINT("Leave NtUserPeekMessage, ret=%i\n",_ret_);
+    UserLeave();
+    END_CLEANUP;
+ }
+ BOOL
+ APIENTRY
+ NtUserPeekMessageX(
+    PMSG pMsg,
+    HWND hWnd,
+    UINT MsgFilterMin,
+    UINT MsgFilterMax,
+    UINT RemoveMsg)
+ {
+    MSG Msg;
+    BOOL Ret = FALSE;
+    DECLARE_RETURN(BOOL);
+    DPRINT("Enter NtUserPeekMessage\n");
+    UserEnterExclusive();
+    if ( RemoveMsg & PM_BADMSGFLAGS )
+    {
+       SetLastWin32Error(ERROR_INVALID_FLAGS);
+       RETURN( Ret);
+    }
+    Ret = co_IntGetPeekMessage(&Msg, hWnd, MsgFilterMin, MsgFilterMax, RemoveMsg, FALSE);
+    if (Ret)
+    {
+       _SEH2_TRY
+       {
+          ProbeForWrite(pMsg, sizeof(MSG), 1);
+          RtlCopyMemory(pMsg, &Msg, sizeof(MSG));
+       }
+       _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+       {
+          SetLastNtError(_SEH2_GetExceptionCode());
+          Ret = FALSE;
+       }
+       _SEH2_END;
+    }
+    RETURN( Ret);
+ CLEANUP:
+    DPRINT("Leave NtUserPeekMessage, ret=%i\n",_ret_);
+    UserLeave();
+    END_CLEANUP;
+ }
+ BOOL
+ APIENTRY
+ NtUserCallMsgFilter(
+    LPMSG lpmsg,
+    INT code)
+ {
+    BOOL BadChk = FALSE, Ret = FALSE;
+    MSG Msg;
+    DECLARE_RETURN(BOOL);
+    DPRINT("Enter NtUserCallMsgFilter\n");
+    UserEnterExclusive();
+    if (lpmsg)
+    {
+       _SEH2_TRY
+       {
+          ProbeForRead((PVOID)lpmsg,
+                        sizeof(MSG),
+                                 1);
+          RtlCopyMemory( &Msg,
+                 (PVOID)lpmsg,
+                  sizeof(MSG));
+       }
+       _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+       {
+          BadChk = TRUE;
+       }
+       _SEH2_END;
+    }
+    else
+      RETURN( FALSE);
+    if (BadChk) RETURN( FALSE);
+    if ( ISITHOOKED(WH_SYSMSGFILTER) &&
+         co_HOOK_CallHooks( WH_SYSMSGFILTER, code, 0, (LPARAM)&Msg))
+    {
+       Ret = TRUE;
+    }
+    else
+    {
+       if ( ISITHOOKED(WH_MSGFILTER) )
+       {
+          Ret = co_HOOK_CallHooks( WH_MSGFILTER, code, 0, (LPARAM)&Msg);
+       }
+    }
+    _SEH2_TRY
+    {
+       ProbeForWrite((PVOID)lpmsg,
+                      sizeof(MSG),
+                                1);
+       RtlCopyMemory((PVOID)lpmsg,
+                             &Msg,
+                      sizeof(MSG));
+    }
+    _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+    {
+       BadChk = TRUE;
+    }
+    _SEH2_END;
+    if (BadChk) RETURN( FALSE);
+    RETURN( Ret)
+ CLEANUP:
+    DPRINT("Leave NtUserCallMsgFilter. ret=%i\n", _ret_);
+    UserLeave();
+    END_CLEANUP;
+ }
+ LRESULT APIENTRY
+ NtUserDispatchMessage(PMSG UnsafeMsgInfo)
+ {
+   LRESULT Res = 0;
+   BOOL Hit = FALSE;
+   MSG SafeMsg;
+   UserEnterExclusive();  
+   _SEH2_TRY
+   {
+     ProbeForRead(UnsafeMsgInfo, sizeof(MSG), 1);
+     RtlCopyMemory(&SafeMsg, UnsafeMsgInfo, sizeof(MSG));
+   }
+   _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+   {
+     SetLastNtError(_SEH2_GetExceptionCode());
+     Hit = TRUE;
+   }
+   _SEH2_END;
+   
+   if (!Hit) Res = IntDispatchMessage(&SafeMsg);
+   UserLeave();
+   return Res;
+ }
+ BOOL APIENTRY
+ NtUserTranslateMessage(LPMSG lpMsg,
 -   RETURN( IntTranslateKbdMessage(&SafeMsg, dwhkl));
++                       UINT flags)
+ {
+    NTSTATUS Status;
+    MSG SafeMsg;
+    DECLARE_RETURN(BOOL);
+    DPRINT("Enter NtUserTranslateMessage\n");
+    UserEnterExclusive();
+    Status = MmCopyFromCaller(&SafeMsg, lpMsg, sizeof(MSG));
+    if(!NT_SUCCESS(Status))
+    {
+       SetLastNtError(Status);
+       RETURN( FALSE);
+    }
++   RETURN( IntTranslateKbdMessage(&SafeMsg, flags));
+ CLEANUP:
+    DPRINT("Leave NtUserTranslateMessage: ret=%i\n",_ret_);
+    UserLeave();
+    END_CLEANUP;
+ }
  
  BOOL APIENTRY
  NtUserMessageCall(
@@@ -217,9 -210,7 +210,7 @@@ NtUserCallOneParam
                 RETURN(0);
              }
  
-             ObDereferenceObject(WinSta);
 -            RETURN((DWORD)CurIcon->Self);
 +            RETURN((DWORD_PTR)CurIcon->Self);
           }
  
        case ONEPARAM_ROUTINE_GETCURSORPOSITION:
@@@ -261,9 -261,10 +261,8 @@@ ${call RBUILD_intermediate_path_noext,$
  ${call RBUILD_intermediate_path_noext,$(2)}_c: $(2) $(3) $$(widl_TARGET) | ${call RBUILD_intermediate_dir,$(2)}
        $$(ECHO_WIDL)
        $$(Q)$$(widl_TARGET) ${call RBUILD_midlflags,$(1),$(4),-I${call RBUILD_dir,$(2)}} -h -H ${call RBUILD_intermediate_path_noext,$(2)}_c.h -c -C ${call RBUILD_intermediate_path_noext,$(2)}_c.c $(2)
-       $${touch} $$@>$(NUL)
- ${call RBUILD_CC,$(1),${call RBUILD_intermediate_path_noext,$(2)}_c.c,,,${call RBUILD_intermediate_path_noext,$(2)}_c.o}
+       $${checkpoint} $$@>$(NUL)
  
 -${call RBUILD_CC,$(1),${call RBUILD_intermediate_path_noext,$(2)}_c.c,,-fno-unit-at-a-time,${call RBUILD_intermediate_path_noext,$(2)}_c.o}
 -
  endef
  
  #(module, source, dependencies, cflags)
@@@ -276,9 -277,10 +275,8 @@@ ${call RBUILD_intermediate_path_noext,$
  ${call RBUILD_intermediate_path_noext,$(2)}_s: $(2) $(3) $$(widl_TARGET) | ${call RBUILD_intermediate_dir,$(2)}
        $$(ECHO_WIDL)
        $$(Q)$$(widl_TARGET) ${call RBUILD_midlflags,$(1),$(4),-I${call RBUILD_dir,$(2)}} -h -H ${call RBUILD_intermediate_path_noext,$(2)}_s.h -s -S ${call RBUILD_intermediate_path_noext,$(2)}_s.c $(2)
-       $${touch} $$@>$(NUL)
- ${call RBUILD_CC,$(1),${call RBUILD_intermediate_path_noext,$(2)}_s.c,,,${call RBUILD_intermediate_path_noext,$(2)}_s.o}
+       $${checkpoint} $$@>$(NUL)
  
 -${call RBUILD_CC,$(1),${call RBUILD_intermediate_path_noext,$(2)}_s.c,,-fno-unit-at-a-time,${call RBUILD_intermediate_path_noext,$(2)}_s.o}
 -
  endef
  
  #(module, source, dependencies, cflags)
@@@ -291,9 -293,10 +289,8 @@@ ${call RBUILD_intermediate_path_noext,$
  ${call RBUILD_intermediate_path_noext,$(2)}_p: $(2) $(3) $$(widl_TARGET) | ${call RBUILD_intermediate_dir,$(2)}
        $$(ECHO_WIDL)
        $$(Q)$$(widl_TARGET) ${call RBUILD_midlflags,$(1),$(4),-I${call RBUILD_dir,$(2)}} -h -H ${call RBUILD_intermediate_path_noext,$(2)}_p.h -p -P ${call RBUILD_intermediate_path_noext,$(2)}_p.c $(2)
-       $${touch} $$@>$(NUL)
- ${call RBUILD_CC,$(1),${call RBUILD_intermediate_path_noext,$(2)}_p.c,,,${call RBUILD_intermediate_path_noext,$(2)}_p.o}
+       $${checkpoint} $$@>$(NUL)
  
 -${call RBUILD_CC,$(1),${call RBUILD_intermediate_path_noext,$(2)}_p.c,,-fno-unit-at-a-time,${call RBUILD_intermediate_path_noext,$(2)}_p.o}
 -
  endef
  
  #(module, source, dependencies, cflags)
@@@ -999,251 -943,6 +943,6 @@@ VCProjMaker::_generate_makefile_configu
        fprintf ( OUT, "\t\t\t\tForcedUsingAssemblies=\"\"\r\n");
        fprintf ( OUT, "\t\t\t\tCompileAsManaged=\"\"\r\n");
  
 -      fprintf ( OUT, "\t\t\t/>\r\n" );
 -      fprintf ( OUT, "\t\t</Configuration>\r\n" );
 -}
 +                      fprintf ( OUT, "\t\t\t/>\r\n" );
 +                      fprintf ( OUT, "\t\t</Configuration>\r\n" );
 +              }
- std::string
- MSVCBackend::_strip_gcc_deffile(std::string Filename, std::string sourcedir, std::string objdir)
- {
-       std::string NewFilename = Environment::GetIntermediatePath () + "\\" + objdir + "\\" + Filename;
-       // we don't like infinite loops - so replace it in two steps
-       NewFilename = _replace_str(NewFilename, ".def", "_msvc.de");
-       NewFilename = _replace_str(NewFilename, "_msvc.de", "_msvc.def");
-       Filename = sourcedir + "\\" + Filename;
-       Directory dir(objdir);
-       dir.GenerateTree(IntermediateDirectory, false);
-       std::fstream in_file(Filename.c_str(), std::ios::in);
-       std::fstream out_file(NewFilename.c_str(), std::ios::out);
-       std::string::size_type pos;
-       DWORD i = 0;
-       std::string line;
-       while (std::getline(in_file, line))
-       {
-               pos = line.find("@", 0);
-               while (std::string::npos != pos)
-               {
-                       if (pos > 1)
-                       {
-                               // make sure it is stdcall and no ordinal
-                               if (line[pos -1] != ' ')
-                               {
-                                       i = 0;
-                                       while (true)
-                                       {
-                                               i++;
-                                               if ((line[pos + i] < '0') || (line[pos + i] > '9'))
-                                                       break;
-                                       }
-                                       line.replace(pos, i, "");
-                               }
-                       }
-                       pos = line.find("@", pos + 1);
-               }
-               line += "\n";
-               out_file << line;
-       }
-       in_file.close();
-       out_file.close();
-       return NewFilename;
- }
- std::string
- MSVCBackend::_replace_str(std::string string1, const std::string &find_str, const std::string &replace_str)
- {
-       std::string::size_type pos = string1.find(find_str, 0);
-       int intLen = find_str.length();
-       while(std::string::npos != pos)
-       {
-               string1.replace(pos, intLen, replace_str);
-               pos = string1.find(find_str, intLen + pos);
-       }
-       return string1;
- }
- std::string
- MSVCBackend::_get_solution_version ( void )
- {
-       string version;
-       if (configuration.VSProjectVersion.empty())
-               configuration.VSProjectVersion = MS_VS_DEF_VERSION;
-       else if (configuration.VSProjectVersion == "7.00")
-               version = "7.00";
-       else if (configuration.VSProjectVersion == "7.10")
-               version = "8.00";
-       else if (configuration.VSProjectVersion == "8.00")
-               version = "9.00";
-       else if (configuration.VSProjectVersion == "9.00")
-               version = "10.00";
-       else if (configuration.VSProjectVersion == "10.00")
-               version = "11.00";
-       return version;
- }
- std::string
- MSVCBackend::_get_studio_version ( void )
- {
-       string version;
-       if (configuration.VSProjectVersion.empty())
-               configuration.VSProjectVersion = MS_VS_DEF_VERSION;
-       else if (configuration.VSProjectVersion == "7.00")
-               version = "2002";
-       else if (configuration.VSProjectVersion == "7.10")
-               version = "2003";
-       else if (configuration.VSProjectVersion == "8.00")
-               version = "2005";
-       else if (configuration.VSProjectVersion == "9.00")
-               version = "2008";
-       else if (configuration.VSProjectVersion == "10.00")
-               version = "2010";
-       return version;
- }
- void
- MSVCBackend::_generate_sln_header ( FILE* OUT )
- {
-       fprintf ( OUT, "Microsoft Visual Studio Solution File, Format Version %s\r\n", _get_solution_version().c_str() );
-       fprintf ( OUT, "# Visual Studio %s\r\n", _get_studio_version().c_str() );
-       fprintf ( OUT, "\r\n" );
- }
- void
- MSVCBackend::_generate_sln_project (
-       FILE* OUT,
-       const Module& module,
-       std::string vcproj_file,
-       std::string sln_guid,
-       std::string vcproj_guid,
-       const std::vector<Library*>& libraries )
- {
-       vcproj_file = DosSeparator ( std::string(".\\") + vcproj_file );
-       fprintf ( OUT, "Project(\"%s\") = \"%s\", \"%s\", \"%s\"\r\n", sln_guid.c_str() , module.name.c_str(), vcproj_file.c_str(), vcproj_guid.c_str() );
-       //FIXME: only omit ProjectDependencies in VS 2005 when there are no dependencies
-       //NOTE: VS 2002 do not use ProjectSection; it uses GlobalSection instead
-       if ((configuration.VSProjectVersion == "7.10") || (libraries.size() > 0)) {
-               fprintf ( OUT, "\tProjectSection(ProjectDependencies) = postProject\r\n" );
-               for ( size_t i = 0; i < libraries.size(); i++ )
-               {
-                       const Module& module = *libraries[i]->importedModule;
-                       fprintf ( OUT, "\t\t%s = %s\r\n", module.guid.c_str(), module.guid.c_str() );
-               }
-               fprintf ( OUT, "\tEndProjectSection\r\n" );
-       }
-       fprintf ( OUT, "EndProject\r\n" );
- }
- void
- MSVCBackend::_generate_sln_footer ( FILE* OUT )
- {
-       fprintf ( OUT, "Global\r\n" );
-       fprintf ( OUT, "\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\r\n" );
-       for ( size_t i = 0; i < m_configurations.size(); i++ )
-               fprintf ( OUT, "\t\t%s = %s\r\n", m_configurations[i]->name.c_str(), m_configurations[i]->name.c_str() );
-       fprintf ( OUT, "\tEndGlobalSection\r\n" );
-       fprintf ( OUT, "\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\r\n" );
-       for( std::map<std::string, Module*>::const_iterator p = ProjectNode.modules.begin(); p != ProjectNode.modules.end(); ++ p )
-       {
-               Module& module = *p->second;
-               std::string guid = module.guid;
-               _generate_sln_configurations ( OUT, guid.c_str() );
-       }
-       fprintf ( OUT, "\tEndGlobalSection\r\n" );
- /*
-       fprintf ( OUT, "\tGlobalSection(ExtensibilityGlobals) = postSolution\r\n" );
-       fprintf ( OUT, "\tEndGlobalSection\r\n" );
-       fprintf ( OUT, "\tGlobalSection(ExtensibilityAddIns) = postSolution\r\n" );
-       fprintf ( OUT, "\tEndGlobalSection\r\n" );
- */
-       if (configuration.VSProjectVersion == "7.00") {
-               fprintf ( OUT, "\tGlobalSection(ProjectDependencies) = postSolution\r\n" );
-               //FIXME: Add dependencies for VS 2002
-               fprintf ( OUT, "\tEndGlobalSection\r\n" );
-       }
-       else {
-               fprintf ( OUT, "\tGlobalSection(SolutionProperties) = preSolution\r\n" );
-               fprintf ( OUT, "\t\tHideSolutionNode = FALSE\r\n" );
-               fprintf ( OUT, "\tEndGlobalSection\r\n" );
-       }
-       fprintf ( OUT, "EndGlobal\r\n" );
-       fprintf ( OUT, "\r\n" );
- }
- void
- MSVCBackend::_generate_sln_configurations ( FILE* OUT, std::string vcproj_guid )
- {
-       for ( size_t i = 0; i < m_configurations.size (); i++)
-       {
-               const MSVCConfiguration& cfg = *m_configurations[i];
-               fprintf ( OUT, "\t\t%s.%s|Win32.ActiveCfg = %s|Win32\r\n", vcproj_guid.c_str(), cfg.name.c_str(), cfg.name.c_str() );
-               fprintf ( OUT, "\t\t%s.%s|Win32.Build.0 = %s|Win32\r\n", vcproj_guid.c_str(), cfg.name.c_str(), cfg.name.c_str() );
-       }
- }
- void
- MSVCBackend::_generate_sln ( FILE* OUT )
- {
-       string sln_guid = "{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}";
-       vector<string> guids;
-       _generate_sln_header(OUT);
-       // TODO FIXME - is it necessary to sort them?
-       for( std::map<std::string, Module*>::const_iterator p = ProjectNode.modules.begin(); p != ProjectNode.modules.end(); ++ p )
-       {
-               Module& module = *p->second;
-               std::string vcproj_file = VcprojFileName ( module );
-               _generate_sln_project ( OUT, module, vcproj_file, sln_guid, module.guid, module.non_if_data.libraries );
-       }
-       _generate_sln_footer ( OUT );
- }
- const Property*
- MSVCBackend::_lookup_property ( const Module& module, const std::string& name ) const
- {
-       std::map<std::string, Property*>::const_iterator p;
-       /* Check local values */
-       p = module.non_if_data.properties.find(name);
-       if ( p != module.non_if_data.properties.end() )
-               return p->second;
-       // TODO FIXME - should we check local if-ed properties?
-       p = module.project.non_if_data.properties.find(name);
-       if ( p != module.project.non_if_data.properties.end() )
-               return p->second;
-       // TODO FIXME - should we check global if-ed properties?
-       return NULL;
- }
Simple merge