Sync with trunk r43123
authorTimo Kreuzer <timo.kreuzer@reactos.org>
Wed, 23 Sep 2009 21:01:57 +0000 (21:01 +0000)
committerTimo Kreuzer <timo.kreuzer@reactos.org>
Wed, 23 Sep 2009 21:01:57 +0000 (21:01 +0000)
svn path=/branches/ros-amd64-bringup/; revision=43125

39 files changed:
1  2 
reactos/dll/ntdll/def/ntdll_i386.def
reactos/dll/ntdll/ldr/startup.c
reactos/dll/ntdll/rtl/libsupp.c
reactos/dll/win32/advapi32/sec/misc.c
reactos/dll/win32/shell32/shfldr_printers.c
reactos/dll/win32/user32/include/ntwrapper.h
reactos/dll/win32/user32/include/user32.h
reactos/dll/win32/user32/include/user32p.h
reactos/dll/win32/user32/misc/stubs.c
reactos/dll/win32/user32/windows/class.c
reactos/dll/win32/user32/windows/defwnd.c
reactos/dll/win32/user32/windows/draw.c
reactos/dll/win32/user32/windows/paint.c
reactos/dll/win32/user32/windows/window.c
reactos/dll/win32/ws2_32/misc/stubs.c
reactos/drivers/network/tcpip/datalink/lan.c
reactos/drivers/network/tcpip/tcpip/dispatch.c
reactos/hal/halx86/generic/timer.c
reactos/hal/halx86/mp/apic.c
reactos/include/crt/setjmp.h
reactos/include/reactos/win32k/ntuser.h
reactos/lib/inflib/infget.c
reactos/lib/inflib/infpriv.h
reactos/ntoskrnl/config/i386/cmhardwr.c
reactos/ntoskrnl/include/internal/ke.h
reactos/ntoskrnl/kd/kdmain.c
reactos/ntoskrnl/kdbg/kdb.c
reactos/ntoskrnl/kdbg/kdb_symbols.c
reactos/ntoskrnl/ke/freeldr.c
reactos/ntoskrnl/ke/i386/cpu.c
reactos/ntoskrnl/mm/anonmem.c
reactos/subsystems/win32/csrss/win32csr/dllmain.c
reactos/subsystems/win32/win32k/ntuser/callback.c
reactos/subsystems/win32/win32k/ntuser/class.c
reactos/subsystems/win32/win32k/ntuser/hook.c
reactos/subsystems/win32/win32k/ntuser/message.c
reactos/subsystems/win32/win32k/ntuser/painting.c
reactos/subsystems/win32/win32k/ntuser/simplecall.c
reactos/tools/rbuild/backend/mingw/mingw.cpp

Simple merge
Simple merge
@@@ -14,8 -14,7 +14,9 @@@
  #include <debug.h>
  
  SIZE_T RtlpAllocDeallocQueryBufferSize = PAGE_SIZE;
+ PTEB LdrpTopLevelDllBeingLoadedTeb = NULL;
 +#define IMAGE_DOS_MAGIC 0x5a4d
 +#define IMAGE_PE_MAGIC 0x00004550
  
  /* FUNCTIONS ***************************************************************/
  
@@@ -208,19 -204,13 +209,26 @@@ RtlpCaptureStackLimits(IN ULONG_PTR Ebp
      return TRUE;
  }
  
 +#ifdef _AMD64_
 +VOID
 +NTAPI
 +RtlpGetStackLimits(
 +    OUT PULONG_PTR LowLimit,
 +    OUT PULONG_PTR HighLimit)
 +{
 +    *LowLimit = (ULONG_PTR)NtCurrentTeb()->Tib.StackLimit;
 +    *HighLimit = (ULONG_PTR)NtCurrentTeb()->Tib.StackBase;
 +    return;
 +}
 +#endif
 +
+ BOOLEAN
+ NTAPI
+ RtlIsThreadWithinLoaderCallout(VOID)
+ {
+     return LdrpTopLevelDllBeingLoadedTeb == NtCurrentTeb();
+ }
  /* RTL Atom Tables ************************************************************/
  
  typedef struct _RTL_ATOM_HANDLE
Simple merge
    (BOOL)NtUserCallHwndParam(hWnd, dwContextHelpId, HWNDPARAM_ROUTINE_SETWNDCONTEXTHLPID)
  
  #define NtUserSetCaretPos(X, Y) \
 -  (BOOL)NtUserCallTwoParam((DWORD)X, (DWORD)Y, TWOPARAM_ROUTINE_SETCARETPOS)
 +  (BOOL)NtUserCallTwoParam((DWORD_PTR)X, (DWORD_PTR)Y, TWOPARAM_ROUTINE_SETCARETPOS)
  
  #define NtUserSetGUIThreadHandle(field, hwnd) \
 -  (BOOL)NtUserCallTwoParam((DWORD)field, (DWORD)hwnd, TWOPARAM_ROUTINE_SETGUITHRDHANDLE)
 +  (BOOL)NtUserCallTwoParam((DWORD_PTR)field, (DWORD_PTR)hwnd, TWOPARAM_ROUTINE_SETGUITHRDHANDLE)
  
- #define NtUserSetMenuItemRect(menu, mir) \
-   (BOOL)NtUserCallTwoParam((DWORD_PTR)menu, (DWORD_PTR)mir, TWOPARAM_ROUTINE_SETMENUITEMRECT)
  #define NtUserSetMenuBarHeight(menu, height) \
 -  (BOOL)NtUserCallTwoParam((DWORD)menu, (DWORD)height, TWOPARAM_ROUTINE_SETMENUBARHEIGHT)
 +  (BOOL)NtUserCallTwoParam((DWORD_PTR)menu, (DWORD_PTR)height, TWOPARAM_ROUTINE_SETMENUBARHEIGHT)
  
  #define NtUserRegisterLogonProcess(hproc, x) \
 -  (BOOL)NtUserCallTwoParam((DWORD)hproc, (DWORD)x, TWOPARAM_ROUTINE_REGISTERLOGONPROC)
 +  (BOOL)NtUserCallTwoParam((DWORD_PTR)hproc, (DWORD_PTR)x, TWOPARAM_ROUTINE_REGISTERLOGONPROC)
  
  #define NtUserGetSysColorBrushes(HBrushes, count) \
 -  (BOOL)NtUserCallTwoParam((DWORD)(HBrushes), (DWORD)(count), TWOPARAM_ROUTINE_GETSYSCOLORBRUSHES)
 +  (BOOL)NtUserCallTwoParam((DWORD_PTR)(HBrushes), (DWORD_PTR)(count), TWOPARAM_ROUTINE_GETSYSCOLORBRUSHES)
  
  #define NtUserGetSysColors(ColorRefs, count) \
 -  (BOOL)NtUserCallTwoParam((DWORD)(ColorRefs), (DWORD)(count), TWOPARAM_ROUTINE_GETSYSCOLORS)
 +  (BOOL)NtUserCallTwoParam((DWORD_PTR)(ColorRefs), (DWORD_PTR)(count), TWOPARAM_ROUTINE_GETSYSCOLORS)
  
  #define NtUserSetCaretBlinkTime(uMSeconds) \
 -  (BOOL)NtUserCallOneParam((DWORD)uMSeconds, ONEPARAM_ROUTINE_SETCARETBLINKTIME)
 +  (BOOL)NtUserCallOneParam((DWORD_PTR)uMSeconds, ONEPARAM_ROUTINE_SETCARETBLINKTIME)
  
  /*
  #define NtUserEnumClipboardFormats(format) \
  */
  
  #define NtUserWindowFromDC(hDC) \
 -  (HWND)NtUserCallOneParam((DWORD)hDC, ONEPARAM_ROUTINE_WINDOWFROMDC)
 +  (HWND)NtUserCallOneParam((DWORD_PTR)hDC, ONEPARAM_ROUTINE_WINDOWFROMDC)
  
  #define NtUserSwitchCaretShowing(CaretInfo) \
 -  (BOOL)NtUserCallOneParam((DWORD)CaretInfo, ONEPARAM_ROUTINE_SWITCHCARETSHOWING)
 +  (BOOL)NtUserCallOneParam((DWORD_PTR)CaretInfo, ONEPARAM_ROUTINE_SWITCHCARETSHOWING)
  
  #define NtUserSwapMouseButton(fSwap) \
 -  (BOOL)NtUserCallOneParam((DWORD)fSwap, ONEPARAM_ROUTINE_SWAPMOUSEBUTTON)
 +  (BOOL)NtUserCallOneParam((DWORD_PTR)fSwap, ONEPARAM_ROUTINE_SWAPMOUSEBUTTON)
  
- #define NtUserGetMenu(hWnd) \
-   (HMENU)NtUserCallOneParam((DWORD_PTR)hWnd, ONEPARAM_ROUTINE_GETMENU)
  #define NtUserSetMessageExtraInfo(lParam) \
 -  (LPARAM)NtUserCallOneParam((DWORD)lParam, ONEPARAM_ROUTINE_SETMESSAGEEXTRAINFO)
 +  (LPARAM)NtUserCallOneParam((DWORD_PTR)lParam, ONEPARAM_ROUTINE_SETMESSAGEEXTRAINFO)
  
- #define NtUserIsWindowUnicode(hWnd) \
-   (BOOL)NtUserCallOneParam((DWORD_PTR)hWnd, ONEPARAM_ROUTINE_ISWINDOWUNICODE)
  #define NtUserGetWindowContextHelpId(hwnd) \
 -  NtUserCallOneParam((DWORD)hwnd, ONEPARAM_ROUTINE_GETWNDCONTEXTHLPID)
 +  NtUserCallOneParam((DWORD_PTR)hwnd, ONEPARAM_ROUTINE_GETWNDCONTEXTHLPID)
  
- #define NtUserGetWindowInstance(hwnd) \
-   (HINSTANCE)NtUserCallOneParam((DWORD_PTR)hwnd, ONEPARAM_ROUTINE_GETWINDOWINSTANCE)
  #define NtUserGetCursorPos(lpPoint) \
 -  (BOOL)NtUserCallOneParam((DWORD)lpPoint, ONEPARAM_ROUTINE_GETCURSORPOSITION)
 +  (BOOL)NtUserCallOneParam((DWORD_PTR)lpPoint, ONEPARAM_ROUTINE_GETCURSORPOSITION)
  
  #define NtUserIsWindowInDestroy(hWnd) \
 -  (BOOL)NtUserCallOneParam((DWORD)hWnd, ONEPARAM_ROUTINE_ISWINDOWINDESTROY)
 +  (BOOL)NtUserCallOneParam((DWORD_PTR)hWnd, ONEPARAM_ROUTINE_ISWINDOWINDESTROY)
  
  #define NtUserEnableProcessWindowGhosting(bEnable) \
 -  NtUserCallOneParam((DWORD)bEnable, ONEPARAM_ROUTINE_ENABLEPROCWNDGHSTING)
 +  NtUserCallOneParam((DWORD_PTR)bEnable, ONEPARAM_ROUTINE_ENABLEPROCWNDGHSTING)
  
  #define NtUserShowCursor(bShow) \
 -  NtUserCallOneParam((DWORD)bShow, ONEPARAM_ROUTINE_SHOWCURSOR)
 +  NtUserCallOneParam((DWORD_PTR)bShow, ONEPARAM_ROUTINE_SHOWCURSOR)
  
  #define NtUserGetDesktopMapping(Ptr) \
 -  (PVOID)NtUserCallOneParam((DWORD)Ptr, ONEPARAM_ROUTINE_GETDESKTOPMAPPING)
 +  (PVOID)NtUserCallOneParam((DWORD_PTR)Ptr, ONEPARAM_ROUTINE_GETDESKTOPMAPPING)
  
  #define ShowCaret(hwnd) \
    NtUserShowCaret(hwnd)
Simple merge
Simple merge
@@@ -48,7 -48,7 +48,7 @@@ HalpInitializeClock(VOID
      PKPRCB Prcb = KeGetCurrentPrcb();
      ULONG Increment;
      USHORT RollOver;
-     ULONG_PTR Flags = 0;
 -    ULONG Flags;
++    ULONG_PTR Flags;
  
      /* Check the CPU Type */
      if (Prcb->CpuType <= 4)
@@@ -92,10 -92,10 +92,10 @@@ NTAP
  HalCalibratePerformanceCounter(IN volatile PLONG Count,
                                 IN ULONGLONG NewCount)
  {
-     ULONG_PTR Flags = 0;
 -    ULONG Flags;
++    ULONG_PTR Flags;
  
      /* Disable interrupts */
-     Ke386SaveFlags(Flags);
+     Flags = __readeflags();
      _disable();
  
      /* Do a decrement for this CPU */
Simple merge
@@@ -140,8 -130,7 +140,8 @@@ extern "C" 
  #define _JMP_BUF_DEFINED
  #endif
  
-   void * __cdecl __attribute__ ((__nothrow__)) mingw_getsp(void);
 +#if 0
+   void * __cdecl __MINGW_NOTHROW mingw_getsp(void);
  
  #ifdef USE_MINGW_SETJMP_TWO_ARGS
  #ifndef _INC_SETJMPEX
  #ifndef _INC_SETJMPEX
  #define setjmp _setjmp
  #endif
-   int __cdecl __attribute__ ((__nothrow__)) setjmp(jmp_buf _Buf);
+   int __cdecl __MINGW_NOTHROW setjmp(jmp_buf _Buf);
  #endif
  
 +#endif // 0
 +
+   __declspec(noreturn) __MINGW_NOTHROW void __cdecl ms_longjmp(jmp_buf _Buf,int _Value)/* throw(...)*/;
+   __declspec(noreturn) __MINGW_NOTHROW void __cdecl longjmp(jmp_buf _Buf,int _Value);
 +  int __cdecl setjmp(jmp_buf _Buf);
  
-   __declspec(noreturn) __attribute__ ((__nothrow__)) void __cdecl ms_longjmp(jmp_buf _Buf,int _Value)/* throw(...)*/;
-   __declspec(noreturn) __attribute__ ((__nothrow__)) void __cdecl longjmp(jmp_buf _Buf,int _Value);
  #ifdef __cplusplus
  }
  #endif
Simple merge
Simple merge
Simple merge
@@@ -195,28 -201,27 +201,29 @@@ KdbpKdbTrapFrameToTrapFrame
  }
  
  static VOID
- KdbpKdbTrapFrameFromKernelStack(PVOID KernelStack,
-                                 PKDB_KTRAP_FRAME KdbTrapFrame)
+ KdbpKdbTrapFrameFromKernelStack(
+     PVOID KernelStack,
+     PKDB_KTRAP_FRAME KdbTrapFrame)
  {
-    ULONG_PTR *StackPtr;
+     ULONG_PTR *StackPtr;
  
-    RtlZeroMemory(KdbTrapFrame, sizeof(KDB_KTRAP_FRAME));
-    StackPtr = (ULONG_PTR *) KernelStack;
+     RtlZeroMemory(KdbTrapFrame, sizeof(KDB_KTRAP_FRAME));
+     StackPtr = (ULONG_PTR *) KernelStack;
 +#if _M_X86_
-    KdbTrapFrame->Tf.Ebp = StackPtr[3];
-    KdbTrapFrame->Tf.Edi = StackPtr[4];
-    KdbTrapFrame->Tf.Esi = StackPtr[5];
-    KdbTrapFrame->Tf.Ebx = StackPtr[6];
-    KdbTrapFrame->Tf.Eip = StackPtr[7];
-    KdbTrapFrame->Tf.HardwareEsp = (ULONG) (StackPtr + 8);
-    KdbTrapFrame->Tf.HardwareSegSs = KGDT_R0_DATA;
-    KdbTrapFrame->Tf.SegCs = KGDT_R0_CODE;
-    KdbTrapFrame->Tf.SegDs = KGDT_R0_DATA;
-    KdbTrapFrame->Tf.SegEs = KGDT_R0_DATA;
-    KdbTrapFrame->Tf.SegGs = KGDT_R0_DATA;
+     KdbTrapFrame->Tf.Ebp = StackPtr[3];
+     KdbTrapFrame->Tf.Edi = StackPtr[4];
+     KdbTrapFrame->Tf.Esi = StackPtr[5];
+     KdbTrapFrame->Tf.Ebx = StackPtr[6];
+     KdbTrapFrame->Tf.Eip = StackPtr[7];
+     KdbTrapFrame->Tf.HardwareEsp = (ULONG) (StackPtr + 8);
+     KdbTrapFrame->Tf.HardwareSegSs = KGDT_R0_DATA;
+     KdbTrapFrame->Tf.SegCs = KGDT_R0_CODE;
+     KdbTrapFrame->Tf.SegDs = KGDT_R0_DATA;
+     KdbTrapFrame->Tf.SegEs = KGDT_R0_DATA;
+     KdbTrapFrame->Tf.SegGs = KGDT_R0_DATA;
 +#endif
  
-    /* FIXME: what about the other registers??? */
+     /* FIXME: what about the other registers??? */
  }
  
  /*!\brief Overwrites the instruction at \a Address with \a NewInst and stores
@@@ -368,78 -380,79 +382,79 @@@ KdbpStepOverInstruction
   * \retval FALSE  No breakpoint was set.
   */
  BOOLEAN
- KdbpStepIntoInstruction(ULONG_PTR Eip)
+ KdbpStepIntoInstruction(
+     ULONG_PTR Eip)
  {
      KDESCRIPTOR Idtr = {0};
-    UCHAR Mem[2];
-    INT IntVect;
-    ULONG IntDesc[2];
-    ULONG_PTR TargetEip;
+     UCHAR Mem[2];
+     INT IntVect;
+     ULONG IntDesc[2];
+     ULONG_PTR TargetEip;
  
-    /* Read memory */
-    if (!NT_SUCCESS(KdbpSafeReadMemory(Mem, (PVOID)Eip, sizeof (Mem))))
-    {
-       /*KdbpPrint("Couldn't access memory at 0x%p\n", Eip);*/
-       return FALSE;
-    }
+     /* Read memory */
+     if (!NT_SUCCESS(KdbpSafeReadMemory(Mem, (PVOID)Eip, sizeof (Mem))))
+     {
+         /*KdbpPrint("Couldn't access memory at 0x%p\n", Eip);*/
+         return FALSE;
+     }
  
-    /* Check for INT instruction */
-    /* FIXME: Check for iret */
-    if (Mem[0] == 0xcc)
-       IntVect = 3;
-    else if (Mem[0] == 0xcd)
-       IntVect = Mem[1];
-    else if (Mem[0] == 0xce && KdbCurrentTrapFrame->Tf.EFlags & (1<<11)) /* 1 << 11 is the overflow flag */
-       IntVect = 4;
-    else
-       return FALSE;
-    if (IntVect < 32) /* We should be informed about interrupts < 32 by the kernel, no need to breakpoint them */
-    {
-       return FALSE;
-    }
+     /* Check for INT instruction */
+     /* FIXME: Check for iret */
+     if (Mem[0] == 0xcc)
+         IntVect = 3;
+     else if (Mem[0] == 0xcd)
+         IntVect = Mem[1];
+     else if (Mem[0] == 0xce && KdbCurrentTrapFrame->Tf.EFlags & (1<<11)) /* 1 << 11 is the overflow flag */
+         IntVect = 4;
+     else
+         return FALSE;
+     if (IntVect < 32) /* We should be informed about interrupts < 32 by the kernel, no need to breakpoint them */
+     {
+         return FALSE;
+     }
  
-    /* Read the interrupt descriptor table register  */
-    Ke386GetInterruptDescriptorTable(*(PKDESCRIPTOR)&Idtr.Limit);
-    if (IntVect >= (Idtr.Limit + 1) / 8)
-    {
-       /*KdbpPrint("IDT does not contain interrupt vector %d\n.", IntVect);*/
-       return TRUE;
-    }
+     /* Read the interrupt descriptor table register  */
+     __sidt(&Idtr.Limit);
+     if (IntVect >= (Idtr.Limit + 1) / 8)
+     {
+         /*KdbpPrint("IDT does not contain interrupt vector %d\n.", IntVect);*/
+         return TRUE;
+     }
  
-    /* Get the interrupt descriptor */
-    if (!NT_SUCCESS(KdbpSafeReadMemory(IntDesc, (PVOID)(ULONG_PTR)(Idtr.Base + (IntVect * 8)), sizeof (IntDesc))))
-    {
-       /*KdbpPrint("Couldn't access memory at 0x%p\n", (ULONG_PTR)Idtr.Base + (IntVect * 8));*/
-       return FALSE;
-    }
+     /* Get the interrupt descriptor */
 -    if (!NT_SUCCESS(KdbpSafeReadMemory(IntDesc, (PVOID)(Idtr.Base + (IntVect * 8)), sizeof (IntDesc))))
++    if (!NT_SUCCESS(KdbpSafeReadMemory(IntDesc, (PVOID)(ULONG_PTR)(Idtr.Base + (IntVect * 8)), sizeof (IntDesc))))
+     {
+         /*KdbpPrint("Couldn't access memory at 0x%p\n", (ULONG_PTR)Idtr.Base + (IntVect * 8));*/
+         return FALSE;
+     }
  
-    /* Check descriptor and get target eip (16 bit interrupt/trap gates not supported) */
-    if ((IntDesc[1] & (1 << 15)) == 0) /* not present */
-    {
-       return FALSE;
-    }
-    if ((IntDesc[1] & 0x1f00) == 0x0500) /* Task gate */
-    {
-       /* FIXME: Task gates not supported */
-       return FALSE;
-    }
-    else if (((IntDesc[1] & 0x1fe0) == 0x0e00) || /* 32 bit Interrupt gate */
-             ((IntDesc[1] & 0x1fe0) == 0x0f00))   /* 32 bit Trap gate */
-    {
-       /* FIXME: Should the segment selector of the interrupt gate be checked? */
-       TargetEip = (IntDesc[1] & 0xffff0000) | (IntDesc[0] & 0x0000ffff);
-    }
-    else
-    {
-       return FALSE;
-    }
+     /* Check descriptor and get target eip (16 bit interrupt/trap gates not supported) */
+     if ((IntDesc[1] & (1 << 15)) == 0) /* not present */
+     {
+         return FALSE;
+     }
+     if ((IntDesc[1] & 0x1f00) == 0x0500) /* Task gate */
+     {
+         /* FIXME: Task gates not supported */
+         return FALSE;
+     }
+     else if (((IntDesc[1] & 0x1fe0) == 0x0e00) || /* 32 bit Interrupt gate */
+              ((IntDesc[1] & 0x1fe0) == 0x0f00))   /* 32 bit Trap gate */
+     {
+         /* FIXME: Should the segment selector of the interrupt gate be checked? */
+         TargetEip = (IntDesc[1] & 0xffff0000) | (IntDesc[0] & 0x0000ffff);
+     }
+     else
+     {
+         return FALSE;
+     }
  
-    /* Insert breakpoint */
-    if (!NT_SUCCESS(KdbpInsertBreakPoint(TargetEip, KdbBreakPointTemporary, 0, 0, NULL, FALSE, NULL)))
-       return FALSE;
+     /* Insert breakpoint */
+     if (!NT_SUCCESS(KdbpInsertBreakPoint(TargetEip, KdbBreakPointTemporary, 0, 0, NULL, FALSE, NULL)))
+         return FALSE;
  
-    return TRUE;
+     return TRUE;
  }
  
  /*!\brief Gets the number of the next breakpoint >= Start.
@@@ -1068,73 -1118,74 +1120,74 @@@ KdbpSetEnterCondition
   */
  BOOLEAN
  KdbpAttachToThread(
-    PVOID ThreadId)
+     PVOID ThreadId)
  {
-    PETHREAD Thread = NULL;
-    PEPROCESS Process;
+     PETHREAD Thread = NULL;
+     PEPROCESS Process;
  
-    /* Get a pointer to the thread */
-    if (!NT_SUCCESS(PsLookupThreadByThreadId(ThreadId, &Thread)))
-    {
-       KdbpPrint("Invalid thread id: 0x%08x\n", (ULONG_PTR)ThreadId);
-       return FALSE;
-    }
-    Process = Thread->ThreadsProcess;
+     /* Get a pointer to the thread */
+     if (!NT_SUCCESS(PsLookupThreadByThreadId(ThreadId, &Thread)))
+     {
 -        KdbpPrint("Invalid thread id: 0x%08x\n", (ULONG)ThreadId);
++        KdbpPrint("Invalid thread id: 0x%08x\n", (ULONG_PTR)ThreadId);
+         return FALSE;
+     }
+     Process = Thread->ThreadsProcess;
  
-    if (KeIsExecutingDpc() && Process != KdbCurrentProcess)
-    {
-       KdbpPrint("Cannot attach to thread within another process while executing a DPC.\n");
-       ObDereferenceObject(Thread);
-       return FALSE;
-    }
+     if (KeIsExecutingDpc() && Process != KdbCurrentProcess)
+     {
+         KdbpPrint("Cannot attach to thread within another process while executing a DPC.\n");
+         ObDereferenceObject(Thread);
+         return FALSE;
+     }
  
-    /* Save the current thread's context (if we previously attached to a thread) */
-    if (KdbCurrentThread != KdbOriginalThread)
-    {
-       ASSERT(KdbCurrentTrapFrame == &KdbThreadTrapFrame);
-       /* Actually, we can't save the context, there's no guarantee that there
-        * was a trap frame */
-    }
-    else
-    {
-       ASSERT(KdbCurrentTrapFrame == &KdbTrapFrame);
-    }
+     /* Save the current thread's context (if we previously attached to a thread) */
+     if (KdbCurrentThread != KdbOriginalThread)
+     {
+         ASSERT(KdbCurrentTrapFrame == &KdbThreadTrapFrame);
+         /* Actually, we can't save the context, there's no guarantee that there was a trap frame */
+     }
+     else
+     {
+         ASSERT(KdbCurrentTrapFrame == &KdbTrapFrame);
+     }
  
-    /* Switch to the thread's context */
-    if (Thread != KdbOriginalThread)
-    {
-       /* The thread we're attaching to isn't the thread on which we entered
-        * kdb and so the thread we're attaching to is not running. There
-        * is no guarantee that it actually has a trap frame. So we have to
-        * peek directly at the registers which were saved on the stack when the
-        * thread was preempted in the scheduler */
-       KdbpKdbTrapFrameFromKernelStack(Thread->Tcb.KernelStack,
-                                       &KdbThreadTrapFrame);
-       KdbCurrentTrapFrame = &KdbThreadTrapFrame;
-    }
-    else /* Switching back to original thread */
-    {
-       KdbCurrentTrapFrame = &KdbTrapFrame;
-    }
-    KdbCurrentThread = Thread;
+     /* Switch to the thread's context */
+     if (Thread != KdbOriginalThread)
+     {
+         /* The thread we're attaching to isn't the thread on which we entered
+          * kdb and so the thread we're attaching to is not running. There
+          * is no guarantee that it actually has a trap frame. So we have to
+          * peek directly at the registers which were saved on the stack when the
+          * thread was preempted in the scheduler */
+         KdbpKdbTrapFrameFromKernelStack(Thread->Tcb.KernelStack,
+                                         &KdbThreadTrapFrame);
+         KdbCurrentTrapFrame = &KdbThreadTrapFrame;
+     }
+     else /* Switching back to original thread */
+     {
+         KdbCurrentTrapFrame = &KdbTrapFrame;
+     }
+     KdbCurrentThread = Thread;
  
-    /* Attach to the thread's process */
-    ASSERT(KdbCurrentProcess == PsGetCurrentProcess());
-    if (KdbCurrentProcess != Process)
-    {
-       if (KdbCurrentProcess != KdbOriginalProcess) /* detach from previously attached process */
-       {
-          KeUnstackDetachProcess(&KdbApcState);
-       }
-       if (KdbOriginalProcess != Process)
-       {
-          KeStackAttachProcess(&Process->Pcb, &KdbApcState);
-       }
-       KdbCurrentProcess = Process;
-    }
+     /* Attach to the thread's process */
+     ASSERT(KdbCurrentProcess == PsGetCurrentProcess());
+     if (KdbCurrentProcess != Process)
+     {
+         if (KdbCurrentProcess != KdbOriginalProcess) /* detach from previously attached process */
+         {
+             KeUnstackDetachProcess(&KdbApcState);
+         }
+         if (KdbOriginalProcess != Process)
+         {
+             KeStackAttachProcess(&Process->Pcb, &KdbApcState);
+         }
  
-    ObDereferenceObject(Thread);
-    return TRUE;
+         KdbCurrentProcess = Process;
+     }
+     ObDereferenceObject(Thread);
+     return TRUE;
  }
  
  /*!\brief Switches to another process/thread context
   */
  BOOLEAN
  KdbpAttachToProcess(
-    PVOID ProcessId)
+     PVOID ProcessId)
  {
-    PEPROCESS Process = NULL;
-    PETHREAD Thread;
-    PLIST_ENTRY Entry;
+     PEPROCESS Process = NULL;
+     PETHREAD Thread;
+     PLIST_ENTRY Entry;
  
-    /* Get a pointer to the process */
-    if (!NT_SUCCESS(PsLookupProcessByProcessId(ProcessId, &Process)))
-    {
-       KdbpPrint("Invalid process id: 0x%08x\n", (ULONG_PTR)ProcessId);
-       return FALSE;
-    }
+     /* Get a pointer to the process */
+     if (!NT_SUCCESS(PsLookupProcessByProcessId(ProcessId, &Process)))
+     {
 -        KdbpPrint("Invalid process id: 0x%08x\n", (ULONG)ProcessId);
++        KdbpPrint("Invalid process id: 0x%08x\n", (ULONG_PTR)ProcessId);
+         return FALSE;
+     }
  
-    Entry = Process->ThreadListHead.Flink;
-    ObDereferenceObject(Process);
-    if (Entry == &KdbCurrentProcess->ThreadListHead)
-    {
-       KdbpPrint("No threads in process 0x%p, cannot attach to process!\n", ProcessId);
-       return FALSE;
-    }
+     Entry = Process->ThreadListHead.Flink;
+     ObDereferenceObject(Process);
+     if (Entry == &KdbCurrentProcess->ThreadListHead)
+     {
 -        KdbpPrint("No threads in process 0x%08x, cannot attach to process!\n", (ULONG)ProcessId);
++        KdbpPrint("No threads in process 0x%p, cannot attach to process!\n", ProcessId);
+         return FALSE;
+     }
  
-    Thread = CONTAINING_RECORD(Entry, ETHREAD, ThreadListEntry);
+     Thread = CONTAINING_RECORD(Entry, ETHREAD, ThreadListEntry);
  
-    return KdbpAttachToThread(Thread->Cid.UniqueThread);
+     return KdbpAttachToThread(Thread->Cid.UniqueThread);
  }
  
  /*!\brief Calls the main loop ...
@@@ -1189,35 -1240,35 +1242,35 @@@ KdbpCallMainLoop(VOID
  static VOID
  KdbpInternalEnter()
  {
-    PETHREAD Thread;
-    PVOID SavedInitialStack, SavedStackBase, SavedKernelStack;
-    ULONG SavedStackLimit;
+     PETHREAD Thread;
+     PVOID SavedInitialStack, SavedStackBase, SavedKernelStack;
+     ULONG SavedStackLimit;
  
-    KbdDisableMouse();
-    if (KdpDebugMode.Screen)
-    {
-       InbvAcquireDisplayOwnership();
-    }
+     KbdDisableMouse();
+     if (KdpDebugMode.Screen)
+     {
+         InbvAcquireDisplayOwnership();
+     }
  
-    /* Call the interface's main loop on a different stack */
-    Thread = PsGetCurrentThread();
-    SavedInitialStack = Thread->Tcb.InitialStack;
-    SavedStackBase = Thread->Tcb.StackBase;
-    SavedStackLimit = Thread->Tcb.StackLimit;
-    SavedKernelStack = Thread->Tcb.KernelStack;
-    Thread->Tcb.InitialStack = Thread->Tcb.StackBase = (char*)KdbStack + KDB_STACK_SIZE;
-    Thread->Tcb.StackLimit = (ULONG_PTR)KdbStack;
-    Thread->Tcb.KernelStack = (char*)KdbStack + KDB_STACK_SIZE;
-    /*KdbpPrint("Switching to KDB stack 0x%08x-0x%08x (Current Stack is 0x%08x)\n", Thread->Tcb.StackLimit, Thread->Tcb.StackBase, Esp);*/
-    KdbpStackSwitchAndCall(KdbStack + KDB_STACK_SIZE - sizeof(ULONG), KdbpCallMainLoop);
-    Thread->Tcb.InitialStack = SavedInitialStack;
-    Thread->Tcb.StackBase = SavedStackBase;
-    Thread->Tcb.StackLimit = SavedStackLimit;
-    Thread->Tcb.KernelStack = SavedKernelStack;
-    KbdEnableMouse();
+     /* Call the interface's main loop on a different stack */
+     Thread = PsGetCurrentThread();
+     SavedInitialStack = Thread->Tcb.InitialStack;
+     SavedStackBase = Thread->Tcb.StackBase;
+     SavedStackLimit = Thread->Tcb.StackLimit;
+     SavedKernelStack = Thread->Tcb.KernelStack;
+     Thread->Tcb.InitialStack = Thread->Tcb.StackBase = (char*)KdbStack + KDB_STACK_SIZE;
 -    Thread->Tcb.StackLimit = (ULONG)KdbStack;
++    Thread->Tcb.StackLimit = (ULONG_PTR)KdbStack;
+     Thread->Tcb.KernelStack = (char*)KdbStack + KDB_STACK_SIZE;
+     /*KdbpPrint("Switching to KDB stack 0x%08x-0x%08x (Current Stack is 0x%08x)\n", Thread->Tcb.StackLimit, Thread->Tcb.StackBase, Esp);*/
+     KdbpStackSwitchAndCall(KdbStack + KDB_STACK_SIZE - sizeof(ULONG), KdbpCallMainLoop);
+     Thread->Tcb.InitialStack = SavedInitialStack;
+     Thread->Tcb.StackBase = SavedStackBase;
+     Thread->Tcb.StackLimit = SavedStackLimit;
+     Thread->Tcb.KernelStack = SavedKernelStack;
+     KbdEnableMouse();
  }
  
  static ULONG
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -178,37 -178,8 +178,8 @@@ NtUserCallOneParam
               }
           }
  
-       case ONEPARAM_ROUTINE_GETMENU:
-          {
-             PWINDOW_OBJECT Window;
-             DWORD_PTR Result;
-             if(!(Window = UserGetWindowObject((HWND)Param)))
-             {
-                RETURN( FALSE);
-             }
-             Result = Window->Wnd->IDMenu;
-             RETURN( Result);
-          }
-       case ONEPARAM_ROUTINE_ISWINDOWUNICODE:
-          {
-             PWINDOW_OBJECT Window;
-             DWORD_PTR Result;
-             Window = UserGetWindowObject((HWND)Param);
-             if(!Window)
-             {
-                RETURN( FALSE);
-             }
-             Result = Window->Wnd->Unicode;
-             RETURN( Result);
-          }
        case ONEPARAM_ROUTINE_WINDOWFROMDC:
 -         RETURN( (DWORD)IntWindowFromDC((HDC)Param));
 +         RETURN( (DWORD_PTR)IntWindowFromDC((HDC)Param));
  
        case ONEPARAM_ROUTINE_SWAPMOUSEBUTTON:
           {
           }
  
        case ONEPARAM_ROUTINE_SWITCHCARETSHOWING:
 -         RETURN( (DWORD)IntSwitchCaretShowing((PVOID)Param));
 +         RETURN( (DWORD_PTR)IntSwitchCaretShowing((PVOID)Param));
  
        case ONEPARAM_ROUTINE_SETCARETBLINKTIME:
 -         RETURN( (DWORD)IntSetCaretBlinkTime((UINT)Param));
 +         RETURN( (DWORD_PTR)IntSetCaretBlinkTime((UINT)Param));
  
-       case ONEPARAM_ROUTINE_GETWINDOWINSTANCE:
-          {
-             PWINDOW_OBJECT Window;
-             DWORD Result;
-             if(!(Window = UserGetWindowObject((HWND)Param)))
-             {
-                RETURN( FALSE);
-             }
-             Result = (DWORD_PTR)Window->Wnd->hModule;
-             RETURN( Result);
-          }
        case ONEPARAM_ROUTINE_SETMESSAGEEXTRAINFO:
 -         RETURN( (DWORD)MsqSetMessageExtraInfo((LPARAM)Param));
 +         RETURN( (DWORD_PTR)MsqSetMessageExtraInfo((LPARAM)Param));
  
        case ONEPARAM_ROUTINE_CREATECURICONHANDLE:
           {
@@@ -516,38 -454,10 +454,10 @@@ NtUserCallTwoParam
  
  
        case TWOPARAM_ROUTINE_SETCARETPOS:
 -         RETURN( (DWORD)co_IntSetCaretPos((int)Param1, (int)Param2));
 +         RETURN( (DWORD_PTR)co_IntSetCaretPos((int)Param1, (int)Param2));
  
        case TWOPARAM_ROUTINE_REGISTERLOGONPROC:
 -         RETURN( (DWORD)co_IntRegisterLogonProcess((HANDLE)Param1, (BOOL)Param2));
 +         RETURN( (DWORD_PTR)co_IntRegisterLogonProcess((HANDLE)Param1, (BOOL)Param2));
-       case TWOPARAM_ROUTINE_ROS_REGSYSCLASSES:
-       {
-           DWORD_PTR Ret = 0;
-           DWORD Count = Param1;
-           PREGISTER_SYSCLASS RegSysClassArray = (PREGISTER_SYSCLASS)Param2;
-           if (Count != 0 && RegSysClassArray != NULL)
-           {
-               _SEH2_TRY
-               {
-                   ProbeArrayForRead(RegSysClassArray,
-                                     sizeof(RegSysClassArray[0]),
-                                     Count,
-                                     2);
-                   Ret = (DWORD_PTR)UserRegisterSystemClasses(Count,
-                                                          RegSysClassArray);
-               }
-               _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
-               {
-                   SetLastNtError(_SEH2_GetExceptionCode());
-               }
-               _SEH2_END;
-           }
-           RETURN( Ret);
-       }
     }
     DPRINT1("Calling invalid routine number 0x%x in NtUserCallTwoParam(), Param1=0x%x Parm2=0x%x\n",
             Routine, Param1, Param2);