[USER32]
authorTimo Kreuzer <timo.kreuzer@reactos.org>
Sun, 27 Jun 2010 22:19:17 +0000 (22:19 +0000)
committerTimo Kreuzer <timo.kreuzer@reactos.org>
Sun, 27 Jun 2010 22:19:17 +0000 (22:19 +0000)
Merge from amd64 branch:

36987:
- Fix user32 compilation errors. (Samuel Serapion)
36988:
- Make user32 compile and link by defining Get/SetClass/WindowLongPtrA/W (Stefan Ginsberg)
41480:
- Fix 64bit issues, add a wine compatibility hack (Timo Kreuzer)
41540:
- Make parameters for NtUserCallOneParam and NtUserCallTwoParam DWORD_PTR instead of DWORD (Timo Kreuzer)
43965:  (Samuel Serapion)
- Fix several user32 warnings.
- Sync GetWindow*A/W with wine and unify all versions, commenting out a wine hack.
- As a bonus implement GetWindowLongPtrA/W.
- Tested to work in trunk.
43992:
- Fix user32 build.  (Samuel Serapion)
45124:
- Fix user32 build. (Samuel Serapion)
47472:
- Remove wine hack and allow user32 to compile again. (Samuel Serapion)
47878: (Timo Kreuzer)
- Use UlongToHandle instead of LongToHandle
- case to ULONG_PTR instead of using HandleToUlong
- SetSysColorsTemp: don't truncate the pointer sized n value, remove a comment
- IntGetClsWndProc: fix a bug
- IntGetWindowLong: pass !unicode to IntGetWndProc
47882:
- Make the uiLo and uiHi members of the KMDDELPARAM structure UINT_PTRs (Timo Kreuzer)

svn path=/trunk/; revision=47884

22 files changed:
reactos/dll/win32/user32/controls/listbox.c
reactos/dll/win32/user32/controls/scrollbar.c
reactos/dll/win32/user32/include/ntwrapper.h
reactos/dll/win32/user32/include/user32p.h
reactos/dll/win32/user32/include/window.h
reactos/dll/win32/user32/misc/exit.c
reactos/dll/win32/user32/misc/misc.c
reactos/dll/win32/user32/misc/resources.c
reactos/dll/win32/user32/misc/stubs.c
reactos/dll/win32/user32/misc/winhelp.c
reactos/dll/win32/user32/windows/class.c
reactos/dll/win32/user32/windows/clipboard.c
reactos/dll/win32/user32/windows/dialog.c
reactos/dll/win32/user32/windows/hook.c
reactos/dll/win32/user32/windows/menu.c
reactos/dll/win32/user32/windows/message.c
reactos/dll/win32/user32/windows/messagebox.c
reactos/dll/win32/user32/windows/nonclient.c
reactos/dll/win32/user32/windows/prop.c
reactos/dll/win32/user32/windows/spy.c
reactos/dll/win32/user32/windows/window.c
reactos/include/reactos/win32k/ntuser.h

index 0f66305..13c679c 100644 (file)
@@ -44,7 +44,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(listbox);
 #define WS_EX_DRAGDETECT    0x00000002L
 #define WM_BEGINDRAG        0x022C
 
-UINT WINAPI SetSystemTimer(HWND,UINT_PTR,UINT,TIMERPROC);
+UINT_PTR WINAPI SetSystemTimer(HWND,UINT_PTR,UINT,TIMERPROC);
 BOOL WINAPI KillSystemTimer(HWND,UINT_PTR);
 
 /* End of hack section -------------------------------- */
index 0854bd9..ad0f4f2 100644 (file)
@@ -68,7 +68,7 @@ static BOOL ScrollTrackVertical;
 
 HBRUSH DefWndControlColor(HDC hDC, UINT ctlType);
 
-UINT WINAPI SetSystemTimer(HWND,UINT_PTR,UINT,TIMERPROC);
+UINT_PTR WINAPI SetSystemTimer(HWND,UINT_PTR,UINT,TIMERPROC);
 BOOL WINAPI KillSystemTimer(HWND,UINT_PTR);
 
 /*********************************************************************
index a021b89..b10b5e6 100644 (file)
@@ -85,7 +85,7 @@ RegisterTasklist(DWORD x)
 }
 
 EXTINLINE DWORD WINAPI
-DragObject(HWND hwnd1, HWND hwnd2, UINT u1, DWORD dw1, HCURSOR hc1)
+DragObject(HWND hwnd1, HWND hwnd2, UINT u1, ULONG_PTR dw1, HCURSOR hc1)
 {
     return NtUserDragObject(hwnd1, hwnd2, u1, dw1, hc1);
 }
index 1ab637e..0227e8e 100644 (file)
@@ -93,7 +93,7 @@
   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 NtUserSetCursorPos(x, y) \
   (BOOL)NtUserCallTwoParam((DWORD)x, (DWORD)y, TWOPARAM_ROUTINE_SETCURSORPOS)
index 5fa8fdf..3b604e2 100644 (file)
@@ -65,5 +65,5 @@ User32CreateWindowEx(DWORD dwExStyle,
                BOOL Unicode);
 
 HWND* WIN_ListChildren (HWND hWndparent);
-ULONG_PTR FASTCALL IntGetWndProc(PWND, BOOL);
+WNDPROC FASTCALL IntGetWndProc(PWND, BOOL);
 DWORD WINAPI GetRealWindowOwner(HWND);
index a395bb0..3c16521 100644 (file)
@@ -1,5 +1,4 @@
-/* $Id$
- *
+/* 
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS user32.dll
  * FILE:            lib/user32/misc/exit.c
@@ -101,7 +100,7 @@ RegisterServicesProcess(DWORD ServicesProcessId)
   NTSTATUS Status;
 
   CsrRequest = MAKE_CSR_API(REGISTER_SERVICES_PROCESS, CSR_GUI);
-  Request.Data.RegisterServicesProcessRequest.ProcessId = (HANDLE)ServicesProcessId;
+  Request.Data.RegisterServicesProcessRequest.ProcessId = UlongToHandle(ServicesProcessId);
 
   Status = CsrClientCallServer(&Request,
                    NULL,
index 3243836..e71c7a3 100644 (file)
@@ -267,7 +267,7 @@ TestWindowProcess(PWND Wnd)
       return TRUE;
    else
       return (NtUserQueryWindow(Wnd->head.h, QUERY_WINDOW_UNIQUE_PROCESS_ID) ==
-              (DWORD)NtCurrentTeb()->ClientId.UniqueProcess );
+              (DWORD_PTR)NtCurrentTeb()->ClientId.UniqueProcess );
 }
 
 BOOL
@@ -293,7 +293,7 @@ GetUser32Handle(HANDLE handle)
     INT Index;
     USHORT generation;
 
-    Index = (((UINT)handle & 0xffff) - FIRST_USER_HANDLE) >> 1;
+    Index = (((UINT_PTR)handle & 0xffff) - FIRST_USER_HANDLE) >> 1;
 
     if (Index < 0 || Index >= gHandleTable->nb_handles)
         return NULL;
@@ -301,7 +301,7 @@ GetUser32Handle(HANDLE handle)
     if (!gHandleEntries[Index].type || !gHandleEntries[Index].ptr)
         return NULL;
 
-    generation = (UINT)handle >> 16;
+    generation = (UINT_PTR)handle >> 16;
 
     if (generation == gHandleEntries[Index].generation || !generation || generation == 0xffff)
         return &gHandleEntries[Index];
index 171494c..bc7db00 100644 (file)
@@ -174,7 +174,7 @@ UnregisterDeviceNotification(HDEVNOTIFY Handle)
         return FALSE;
     }
 
-    ConfigRet  = UnRegNotify((ULONGHandle );
+    ConfigRet  = UnRegNotify((ULONG_PTR)Handle );
     if (ConfigRet != CR_SUCCESS)
     {
         switch (ConfigRet)
index 06608d8..13697c5 100644 (file)
@@ -197,7 +197,7 @@ SetSysColorsTemp(const COLORREF *pPens,
     }
     if (!pPens && !pBrushes) /* "restore" call */
     {
-        LPVOID pOldCol = (LPVOID)n; /* FIXME: not 64-bit safe */
+        LPVOID pOldCol = (LPVOID)n;
         LPVOID p = pOldCol;
         DWORD nCount = *(DWORD *)p;
         p = (char*)p + sizeof(DWORD);
index 4017410..fb79ea7 100644 (file)
@@ -16,8 +16,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id$
- *
+/* 
  * PROJECT:         ReactOS user32.dll
  * FILE:            lib/user32/misc/winhelp.c
  * PURPOSE:         WinHelp
@@ -51,7 +50,7 @@ typedef struct
  */
 BOOL
 WINAPI
-WinHelpA(HWND hWnd, LPCSTR lpszHelp, UINT uCommand, DWORD dwData)
+WinHelpA(HWND hWnd, LPCSTR lpszHelp, UINT uCommand, DWORD_PTR dwData)
 {
        static WORD WM_WINHELP = 0;
        HWND hDest;
@@ -137,7 +136,7 @@ WinHelpA(HWND hWnd, LPCSTR lpszHelp, UINT uCommand, DWORD dwData)
  */
 BOOL
 WINAPI
-WinHelpW(HWND hWnd, LPCWSTR lpszHelp, UINT uCommand, DWORD dwData)
+WinHelpW(HWND hWnd, LPCWSTR lpszHelp, UINT uCommand, DWORD_PTR dwData)
 {
     INT len;
     LPSTR file;
index 1c66fd7..cf45f18 100644 (file)
@@ -266,11 +266,11 @@ IntGetClsWndProc(PWND pWnd, PCLS Class, BOOL Ansi)
 //
 // Based on IntGetClsWndProc
 //
-ULONG_PTR FASTCALL
+WNDPROC FASTCALL
 IntGetWndProc(PWND pWnd, BOOL Ansi)
 {
   INT i;
-  ULONG_PTR gcpd, Ret = 0;
+  WNDPROC gcpd, Ret = 0;
   PCLS Class = DesktopPtrToUser(pWnd->pcls);
 
   if (!Class) return Ret;
@@ -282,9 +282,9 @@ IntGetWndProc(PWND pWnd, BOOL Ansi)
          if (GETPFNSERVER(i) == pWnd->lpfnWndProc)
          {
             if (Ansi)
-               Ret = (ULONG_PTR)GETPFNCLIENTA(i);
+               Ret = GETPFNCLIENTA(i);
             else
-               Ret = (ULONG_PTR)GETPFNCLIENTW(i);
+               Ret = GETPFNCLIENTW(i);
          }
      }
      return Ret;
@@ -296,36 +296,36 @@ IntGetWndProc(PWND pWnd, BOOL Ansi)
       is treated specially.
    */
   if (Class->fnid == FNID_EDIT)
-     Ret = (ULONG_PTR)pWnd->lpfnWndProc;
+     Ret = pWnd->lpfnWndProc;
   else
   {
      // Set return proc.
-     Ret = (ULONG_PTR)pWnd->lpfnWndProc;
+     Ret = pWnd->lpfnWndProc;
 
      if (Class->fnid <= FNID_GHOST && Class->fnid >= FNID_BUTTON)
      {
         if (Ansi)
         {
            if (GETPFNCLIENTW(Class->fnid) == pWnd->lpfnWndProc)
-              Ret = (ULONG_PTR)GETPFNCLIENTA(Class->fnid);
+              Ret = GETPFNCLIENTA(Class->fnid);
         }
         else
         {
            if (GETPFNCLIENTA(Class->fnid) == pWnd->lpfnWndProc)
-              Ret = (ULONG_PTR)GETPFNCLIENTW(Class->fnid);
+              Ret = GETPFNCLIENTW(Class->fnid);
         }
      }
      // Return on the change.
-     if ( Ret != (ULONG_PTR)pWnd->lpfnWndProc)
+     if ( Ret != pWnd->lpfnWndProc)
         return Ret;
   }
 
   if ( Ansi == !!(pWnd->state & WNDS_ANSIWINDOWPROC) )
      return Ret;
 
-  gcpd = NtUserGetCPD( UserHMGetHandle(pWnd),
-                      (Ansi ? UserGetCPDA2U : UserGetCPDU2A )|UserGetCPDWindow,
-                       Ret);
+  gcpd = (WNDPROC)NtUserGetCPD( UserHMGetHandle(pWnd),
+                                (Ansi ? UserGetCPDA2U : UserGetCPDU2A )|UserGetCPDWindow,
+                                (ULONG_PTR)Ret);
 
   return (gcpd ? gcpd : Ret);
 }
@@ -538,6 +538,32 @@ GetClassLongW ( HWND hWnd, int nIndex )
     return Ret;
 }
 
+#ifdef _WIN64
+/*
+ * @unimplemented
+ */
+ULONG_PTR
+WINAPI
+GetClassLongPtrA(HWND hWnd,
+                 INT nIndex)
+{
+    UNIMPLEMENTED;
+    return 0;
+}
+
+/*
+ * @unimplemented
+ */
+ULONG_PTR
+WINAPI
+GetClassLongPtrW(HWND hWnd,
+                 INT nIndex)
+{
+    UNIMPLEMENTED;
+    return 0;
+}
+#endif
+
 
 /*
  * @implemented
@@ -627,64 +653,74 @@ GetClassWord(
 }
 
 
-/*
- * @implemented
- */
-LONG
-WINAPI
-GetWindowLongA ( HWND hWnd, int nIndex )
+LONG_PTR IntGetWindowLong( HWND hwnd, INT offset, UINT size, BOOL unicode )
 {
-    PWND Wnd;
+    LONG_PTR retvalue = 0;
+    WND *wndPtr;
 
-    Wnd = ValidateHwnd(hWnd);
-    if (Wnd == NULL)
+    if (offset == GWLP_HWNDPARENT)
+    {
+        HWND parent = GetAncestor( hwnd, GA_PARENT );
+        if (parent == GetDesktopWindow()) parent = GetWindow( hwnd, GW_OWNER );
+        return (ULONG_PTR)parent;
+    }
+
+    if (!(wndPtr = ValidateHwnd( hwnd )))
+    {
+        SetLastError( ERROR_INVALID_WINDOW_HANDLE );
         return 0;
+    }
 
-    if (nIndex >= 0)
+    if (offset >= 0)
     {
-        if ((DWORD)nIndex + sizeof(LONG) > Wnd->cbwndExtra)
+        if (offset > (int)(wndPtr->cbwndExtra - size))
         {
-            SetLastError(ERROR_INVALID_PARAMETER);
+            WARN("Invalid offset %d\n", offset );
+            SetLastError( ERROR_INVALID_INDEX );
             return 0;
         }
-        return *((LONG *)((PCHAR)(Wnd + 1) + nIndex));
+        retvalue = *((LONG_PTR *)((PCHAR)(wndPtr + 1) + offset));
+
+        /* WINE: special case for dialog window procedure */
+        //if ((offset == DWLP_DLGPROC) && (size == sizeof(LONG_PTR)) && (wndPtr->flags & WIN_ISDIALOG))
+        //    retvalue = (LONG_PTR)IntGetWndProc( (WNDPROC)retvalue, unicode );
+        return retvalue;
     }
-    else
-    {
-        switch (nIndex)
-        {
-            case GWL_EXSTYLE:
-                return Wnd->ExStyle;
-            case GWL_STYLE:
-                return Wnd->style;
-            case GWL_HINSTANCE:
-                return (LONG)Wnd->hModule;
-            case GWL_ID:
-                return Wnd->IDMenu;
-            case GWL_USERDATA:
-                return Wnd->dwUserData;
-
-            case GWL_HWNDPARENT:
-            {
-                HWND parent = GetAncestor( hWnd, GA_PARENT );
-                if (parent == GetDesktopWindow()) parent = GetWindow( hWnd, GW_OWNER );
-                return (LONG)parent;
-            }
-            case GWL_WNDPROC:
-                if (!TestWindowProcess(Wnd))
-                {
-                   SetLastError(ERROR_ACCESS_DENIED);
-                   return 0;
-                }
-                return IntGetWndProc(Wnd, TRUE);
 
-            default:
-                SetLastError(ERROR_INVALID_PARAMETER);
-                return 0;
-        }
+    switch(offset)
+    {
+    case GWLP_USERDATA:  retvalue = wndPtr->dwUserData; break;
+    case GWL_STYLE:      retvalue = wndPtr->style; break;
+    case GWL_EXSTYLE:    retvalue = wndPtr->ExStyle; break;
+    case GWLP_ID:        retvalue = wndPtr->IDMenu; break;
+    case GWLP_HINSTANCE: retvalue = (ULONG_PTR)wndPtr->hModule; break;
+    case GWLP_WNDPROC:
+       {
+               if (!TestWindowProcess(wndPtr))
+               {
+                       SetLastError(ERROR_ACCESS_DENIED);
+                       retvalue = 0;
+               }
+               retvalue = (ULONG_PTR)IntGetWndProc(wndPtr, !unicode);
+        break;
+       }
+    default:
+        WARN("Unknown offset %d\n", offset );
+        SetLastError( ERROR_INVALID_INDEX );
+        break;
     }
-}
+    return retvalue;
 
+}
+/*
+ * @implemented
+ */
+LONG
+WINAPI
+GetWindowLongA ( HWND hWnd, int nIndex )
+{
+    return IntGetWindowLong( hWnd, nIndex, sizeof(LONG), FALSE );
+}
 
 /*
  * @implemented
@@ -693,75 +729,57 @@ LONG
 WINAPI
 GetWindowLongW(HWND hWnd, int nIndex)
 {
-    PWND Wnd;
-
-    Wnd = ValidateHwnd(hWnd);
-    if (Wnd == NULL)
-        return 0;
-
-    if (nIndex >= 0)
-    {
-        if ((DWORD)nIndex + sizeof(LONG) > Wnd->cbwndExtra)
-        {
-            SetLastError(ERROR_INVALID_PARAMETER);
-            return 0;
-        }
-        return *((LONG *)((PCHAR)(Wnd + 1) + nIndex));
-    }
-    else
-    {
-        switch (nIndex)
-        {
-            case GWL_EXSTYLE:
-                return Wnd->ExStyle;
-            case GWL_STYLE:
-                return Wnd->style;
-            case GWL_HINSTANCE:
-                return (LONG)Wnd->hModule;
-            case GWL_ID:
-                return Wnd->IDMenu;
-            case GWL_USERDATA:
-                return Wnd->dwUserData;
-
-            case GWL_HWNDPARENT:
-            {
-                HWND parent = GetAncestor( hWnd, GA_PARENT );
-                if (parent == GetDesktopWindow()) parent = GetWindow( hWnd, GW_OWNER );
-                return (LONG)parent;
-            }
-            case GWL_WNDPROC:
-                if (!TestWindowProcess(Wnd))
-                {
-                   SetLastError(ERROR_ACCESS_DENIED);
-                   return 0;
-                }
-                return IntGetWndProc(Wnd, FALSE);
+    return IntGetWindowLong( hWnd, nIndex, sizeof(LONG), TRUE );
+}
 
-            default:
-                SetLastError(ERROR_INVALID_PARAMETER);
-                return 0;
-        }
-    }
+#ifdef _WIN64
+/*
+ * @implemented
+ */
+LONG_PTR
+WINAPI
+GetWindowLongPtrA(HWND hWnd,
+                  INT nIndex)
+{
+    return IntGetWindowLong( hWnd, nIndex, sizeof(LONG_PTR), FALSE );
 }
 
 /*
  * @implemented
  */
-WORD
+LONG_PTR
 WINAPI
-GetWindowWord(HWND hWnd, int nIndex)
+GetWindowLongPtrW(HWND hWnd,
+                  INT nIndex)
 {
-  return (WORD)GetWindowLongW(hWnd, nIndex);
+    return IntGetWindowLong( hWnd, nIndex, sizeof(LONG_PTR), TRUE );
+
 }
+#endif // _WIN64
 
 /*
  * @implemented
  */
 WORD
 WINAPI
-SetWindowWord ( HWND hWnd,int nIndex,WORD wNewWord )
+GetWindowWord(HWND hWnd, int nIndex)
 {
-  return (WORD)NtUserSetWindowLong ( hWnd, nIndex, (LONG)wNewWord, TRUE );
+    switch(nIndex)
+    {
+    case GWLP_ID:
+    case GWLP_HINSTANCE:
+    case GWLP_HWNDPARENT:
+        break;
+    default:
+        if (nIndex < 0)
+        {
+            WARN("Invalid offset %d\n", nIndex );
+            SetLastError( ERROR_INVALID_INDEX );
+            return 0;
+        }
+        break;
+    }
+    return IntGetWindowLong( hWnd, nIndex, sizeof(WORD), FALSE );
 }
 
 /*
@@ -1167,7 +1185,7 @@ SetClassLongA (HWND hWnd,
                int nIndex,
                LONG dwNewLong)
 {
-    PSTR lpStr = (PSTR)dwNewLong;
+    PSTR lpStr = (PSTR)(ULONG_PTR)dwNewLong;
     UNICODE_STRING Value = {0};
     BOOL Allocated = FALSE;
     DWORD Ret;
@@ -1190,7 +1208,7 @@ SetClassLongA (HWND hWnd,
         else
             Value.Buffer = (PWSTR)lpStr;
 
-        dwNewLong = (LONG)&Value;
+        dwNewLong = (LONG_PTR)&Value;
     }
     else if (nIndex == GCW_ATOM && lpStr != NULL)
     {
@@ -1208,7 +1226,7 @@ SetClassLongA (HWND hWnd,
         else
             Value.Buffer = (PWSTR)lpStr;
 
-        dwNewLong = (LONG)&Value;
+        dwNewLong = (LONG_PTR)&Value;
     }
 
     Ret = (DWORD)NtUserSetClassLong(hWnd,
@@ -1234,7 +1252,7 @@ SetClassLongW(HWND hWnd,
               int nIndex,
               LONG dwNewLong)
 {
-    PWSTR lpStr = (PWSTR)dwNewLong;
+    PWSTR lpStr = (PWSTR)(ULONG_PTR)dwNewLong;
     UNICODE_STRING Value = {0};
 
     TRACE("%p %d %lx\n", hWnd, nIndex, dwNewLong);
@@ -1251,7 +1269,7 @@ SetClassLongW(HWND hWnd,
         else
             Value.Buffer = lpStr;
 
-        dwNewLong = (LONG)&Value;
+        dwNewLong = (LONG_PTR)&Value;
     }
     else if (nIndex == GCW_ATOM && lpStr != NULL)
     {
@@ -1263,7 +1281,7 @@ SetClassLongW(HWND hWnd,
         else
             Value.Buffer = lpStr;
 
-        dwNewLong = (LONG)&Value;
+        dwNewLong = (LONG_PTR)&Value;
     }
 
     return (DWORD)NtUserSetClassLong(hWnd,
@@ -1272,6 +1290,33 @@ SetClassLongW(HWND hWnd,
                                      FALSE);
 }
 
+#ifdef _WIN64
+/*
+ * @unimplemented
+ */
+ULONG_PTR
+WINAPI
+SetClassLongPtrA(HWND hWnd,
+                 INT nIndex,
+                 LONG_PTR dwNewLong)
+{
+    UNIMPLEMENTED;
+    return 0;
+}
+
+/*
+ * @unimplemented
+ */
+ULONG_PTR
+WINAPI
+SetClassLongPtrW(HWND hWnd,
+                 INT nIndex,
+                 LONG_PTR dwNewLong)
+{
+    UNIMPLEMENTED;
+    return 0;
+}
+#endif // _WIN64
 
 /*
  * @implemented
@@ -1292,6 +1337,30 @@ SetClassWord(
     return (WORD) SetClassLongW ( hWnd, nIndex, wNewWord );
 }
 
+/*
+ * @implemented
+ */
+WORD
+WINAPI
+SetWindowWord ( HWND hWnd,int nIndex,WORD wNewWord )
+{
+    switch(nIndex)
+    {
+    case GWLP_ID:
+    case GWLP_HINSTANCE:
+    case GWLP_HWNDPARENT:
+        break;
+    default:
+        if (nIndex < 0)
+        {
+            WARN("Invalid offset %d\n", nIndex );
+            SetLastError( ERROR_INVALID_INDEX );
+            return 0;
+        }
+        break;
+    }
+    return NtUserSetWindowLong( hWnd, nIndex, wNewWord, FALSE );
+}
 
 /*
  * @implemented
@@ -1306,7 +1375,6 @@ SetWindowLongA(
   return NtUserSetWindowLong(hWnd, nIndex, dwNewLong, TRUE);
 }
 
-
 /*
  * @implemented
  */
@@ -1320,6 +1388,31 @@ SetWindowLongW(
   return NtUserSetWindowLong(hWnd, nIndex, dwNewLong, FALSE);
 }
 
+#ifdef _WIN64
+/*
+ * @implemented
+ */
+LONG_PTR
+WINAPI
+SetWindowLongPtrA(HWND hWnd,
+                  INT nIndex,
+                  LONG_PTR dwNewLong)
+{
+  return NtUserSetWindowLong(hWnd, nIndex, dwNewLong, FALSE);
+}
+
+/*
+ * @implemented
+ */
+LONG_PTR
+WINAPI
+SetWindowLongPtrW(HWND hWnd,
+                  INT nIndex,
+                  LONG_PTR dwNewLong)
+{
+  return NtUserSetWindowLong(hWnd, nIndex, dwNewLong, FALSE);
+}
+#endif
 
 /*
  * @implemented
index fb2fff7..3634e65 100644 (file)
@@ -54,19 +54,19 @@ GetClipboardData(UINT uFormat)
 {
     HGLOBAL hGlobal = NULL;
     PVOID pGlobal = NULL;
-    DWORD size = 0;
+    DWORD_PTR size = 0;
 
     /* dealing with bitmap object */
     if (uFormat != CF_BITMAP)
     {
-        size = (DWORD)NtUserGetClipboardData(uFormat, NULL);
+        size = (DWORD_PTR)NtUserGetClipboardData(uFormat, NULL);
 
         if (size)
         {
             hGlobal = GlobalAlloc(GMEM_DDESHARE | GMEM_MOVEABLE, size);
             pGlobal = GlobalLock(hGlobal);
 
-            size = (DWORD)NtUserGetClipboardData(uFormat, pGlobal);
+            size = (DWORD_PTR)NtUserGetClipboardData(uFormat, pGlobal);
 
             GlobalUnlock(hGlobal);
         }
index eec7b45..2e812fc 100644 (file)
@@ -159,7 +159,7 @@ DIALOGINFO * DIALOG_get_info( HWND hWnd, BOOL create )
 
             SETDLGINFO( hWnd, dlgInfo );
 
-            NtUserCallHwndParam( hWnd, (DWORD)dlgInfo, HWNDPARAM_ROUTINE_SETDIALOGPOINTER );
+            NtUserCallHwndParam( hWnd, (DWORD_PTR)dlgInfo, HWNDPARAM_ROUTINE_SETDIALOGPOINTER );
         }
         else
         {
@@ -342,7 +342,7 @@ static BOOL DIALOG_CreateControls32( HWND hwnd, LPCSTR template, const DLG_TEMPL
                                         MulDiv(info.y, dlgInfo->yBaseUnit, 8),
                                         MulDiv(info.cx, dlgInfo->xBaseUnit, 4),
                                         MulDiv(info.cy, dlgInfo->yBaseUnit, 8),
-                                        hwnd, (HMENU)info.id,
+                                        hwnd, (HMENU)(ULONG_PTR)info.id,
                                         hInst, (LPVOID)info.data );
         }
         else
@@ -373,7 +373,7 @@ static BOOL DIALOG_CreateControls32( HWND hwnd, LPCSTR template, const DLG_TEMPL
                                             MulDiv(info.y, dlgInfo->yBaseUnit, 8),
                                             MulDiv(info.cx, dlgInfo->xBaseUnit, 4),
                                             MulDiv(info.cy, dlgInfo->yBaseUnit, 8),
-                                            hwnd, (HMENU)info.id,
+                                            hwnd, (HMENU)(ULONG_PTR)info.id,
                                             hInst, (LPVOID)info.data );
             }
             else
@@ -618,7 +618,7 @@ static LPCSTR DIALOG_ParseTemplate32( LPCSTR template, DLG_TEMPLATE * result )
             p++;
             break;
         case 0xffff:
-            result->menuName = (LPCWSTR)(UINT)GET_WORD( p + 1 );
+            result->menuName = (LPCWSTR)(UINT_PTR)GET_WORD( p + 1 );
             p += 2;
             break;
         default:
@@ -636,7 +636,7 @@ static LPCSTR DIALOG_ParseTemplate32( LPCSTR template, DLG_TEMPLATE * result )
             p++;
             break;
         case 0xffff:
-            result->className = (LPCWSTR)(UINT)GET_WORD( p + 1 );
+            result->className = (LPCWSTR)(UINT_PTR)GET_WORD( p + 1 );
             p += 2;
             break;
         default:
index 4abff2a..304f932 100644 (file)
@@ -441,12 +441,12 @@ User32CallHookProcFromKernel(PVOID Arguments, ULONG ArgumentLength)
           if (NULL != CbtCreatewndExtra->Cs.lpszName)
           {
               Csw.lpszName = (LPCWSTR)((PCHAR) CbtCreatewndExtra
-                                       + (ULONG) CbtCreatewndExtra->Cs.lpszName);
+                                       + (ULONG_PTR) CbtCreatewndExtra->Cs.lpszName);
           }
           if (0 != HIWORD(CbtCreatewndExtra->Cs.lpszClass))
           {
               Csw.lpszClass = (LPCWSTR)((PCHAR) CbtCreatewndExtra
-                                         + LOWORD((ULONG) CbtCreatewndExtra->Cs.lpszClass));
+                                         + LOWORD((ULONG_PTR) CbtCreatewndExtra->Cs.lpszClass));
           }
           wParam = Common->wParam;
           if (Common->Ansi)
index eed233f..dd8f1ff 100644 (file)
@@ -1804,7 +1804,7 @@ LRESULT WINAPI PopupMenuWndProcA(HWND Wnd, UINT Message, WPARAM wParam, LPARAM l
     case WM_CREATE:
       {
         CREATESTRUCTA *cs = (CREATESTRUCTA *) lParam;
-        SetWindowLongPtrA(Wnd, 0, (LONGcs->lpCreateParams);
+        SetWindowLongPtrA(Wnd, 0, (LONG_PTR)cs->lpCreateParams);
         return 0;
       }
 
@@ -1877,7 +1877,7 @@ PopupMenuWndProcW(HWND Wnd, UINT Message, WPARAM wParam, LPARAM lParam)
     case WM_CREATE:
       {
         CREATESTRUCTW *cs = (CREATESTRUCTW *) lParam;
-        SetWindowLongPtrW(Wnd, 0, (LONGcs->lpCreateParams);
+        SetWindowLongPtrW(Wnd, 0, (LONG_PTR)cs->lpCreateParams);
         return 0;
       }
 
@@ -3722,7 +3722,7 @@ MenuSetItemData(
   {
     mii->fType |= MFT_OWNERDRAW;
     mii->fMask |= MIIM_DATA;
-    mii->dwItemData = (DWORD) NewItem;
+    mii->dwItemData = (DWORD_PTR) NewItem;
   }
   else if (Flags & MF_SEPARATOR)
   {
@@ -4140,7 +4140,7 @@ GetMenu(HWND hWnd)
        if (!Wnd)
                return NULL;
 
-       return (HMENU)Wnd->IDMenu;
+       return UlongToHandle(Wnd->IDMenu);
 }
 
 
index 6c84904..5a045b1 100644 (file)
@@ -172,11 +172,11 @@ MsgiUMToKMMessage(PMSG UMMsg, PMSG KMMsg, BOOL Posted)
               if (0 != HIWORD(DdeLparam->Value.Packed.uiHi))
                 {
                   /* uiHi should contain a hMem from WM_DDE_EXECUTE */
-                  HGLOBAL h = DdeGetPair((HGLOBAL) DdeLparam->Value.Packed.uiHi);
+                  HGLOBAL h = DdeGetPair((HGLOBAL)(ULONG_PTR)DdeLparam->Value.Packed.uiHi);
                   if (NULL != h)
                     {
-                      GlobalFree((HGLOBAL) DdeLparam->Value.Packed.uiHi);
-                      DdeLparam->Value.Packed.uiHi = (UINT) h;
+                      GlobalFree((HGLOBAL)(ULONG_PTR)DdeLparam->Value.Packed.uiHi);
+                      DdeLparam->Value.Packed.uiHi = (UINT_PTR) h;
                     }
                 }
               FreeDDElParam(UMMsg->message, UMMsg->lParam);
@@ -686,7 +686,7 @@ MsgiUnicodeToAnsiMessage(LPMSG AnsiMsg, LPMSG UnicodeMsg)
               return FALSE;
             }
           CsA->lpszName = AnsiString.Buffer;
-          if (HIWORD((ULONG)CsW->lpszClass) != 0)
+          if (HIWORD((ULONG_PTR)CsW->lpszClass) != 0)
             {
               RtlInitUnicodeString(&UnicodeString, CsW->lpszClass);
               Status = RtlUnicodeStringToAnsiString(&AnsiString, &UnicodeString, TRUE);
@@ -850,7 +850,7 @@ MsgiUnicodeToAnsiCleanup(LPMSG AnsiMsg, LPMSG UnicodeMsg)
           Cs = (CREATESTRUCTA*) AnsiMsg->lParam;
           RtlInitAnsiString(&AnsiString, Cs->lpszName);
           RtlFreeAnsiString(&AnsiString);
-          if (HIWORD((ULONG)Cs->lpszClass) != 0)
+          if (HIWORD((ULONG_PTR)Cs->lpszClass) != 0)
             {
               RtlInitAnsiString(&AnsiString, Cs->lpszClass);
               RtlFreeAnsiString(&AnsiString);
@@ -947,7 +947,7 @@ typedef struct tagMSGCONVERSION
   MSG UnicodeMsg;
   MSG AnsiMsg;
   PMSG FinalMsg;
-  ULONG LParamSize;
+  SIZE_T LParamSize;
 } MSGCONVERSION, *PMSGCONVERSION;
 
 static PMSGCONVERSION MsgConversions = NULL;
@@ -2452,7 +2452,7 @@ SendNotifyMessageW(
  * @implemented
  */
 BOOL WINAPI
-TranslateMessageEx(CONST MSG *lpMsg, DWORD unk)
+TranslateMessageEx(CONST MSG *lpMsg, UINT Flags)
 {
     switch (lpMsg->message)
     {
@@ -2460,7 +2460,7 @@ TranslateMessageEx(CONST MSG *lpMsg, DWORD unk)
         case WM_KEYUP:
         case WM_SYSKEYDOWN:
         case WM_SYSKEYUP:
-            return(NtUserTranslateMessage((LPMSG)lpMsg, unk));
+            return(NtUserTranslateMessage((LPMSG)lpMsg, Flags));
 
         default:
             if ( lpMsg->message & ~WM_MAXIMUM )
index 598eabe..7ea0b90 100644 (file)
@@ -423,7 +423,7 @@ MessageBoxTimeoutIndirectW(
     }
 
     /* create static for text */
-    dest = (BYTE*)(((DWORD)dest + 3) & ~3);
+    dest = (BYTE*)(((UINT_PTR)dest + 3) & ~3);
     itxt = (DLGITEMTEMPLATE *)dest;
     itxt->style = WS_CHILD | WS_VISIBLE | SS_NOPREFIX;
     if(lpMsgBoxParams->dwStyle & MB_RIGHT)
@@ -450,7 +450,7 @@ MessageBoxTimeoutIndirectW(
     btnrect.left = btnrect.top = 0;
     for(i = 0; i < nButtons; i++)
     {
-      dest = (BYTE*)(((DWORD)dest + 3) & ~3);
+      dest = (BYTE*)(((UINT_PTR)dest + 3) & ~3);
       ibtn[i] = (DLGITEMTEMPLATE *)dest;
       ibtn[i]->style = WS_CHILD | WS_VISIBLE | WS_TABSTOP;
       if(!defbtn && (i == ((lpMsgBoxParams->dwStyle & MB_DEFMASK) >> 8)))
@@ -699,7 +699,7 @@ MessageBoxIndirectA(
     UNICODE_STRING textW, captionW, iconW;
     int ret;
 
-    if (HIWORD((UINT)lpMsgBoxParams->lpszText))
+    if (HIWORD((UINT_PTR)lpMsgBoxParams->lpszText))
     {
         RtlCreateUnicodeStringFromAsciiz(&textW, (PCSZ)lpMsgBoxParams->lpszText);
         /*
@@ -711,7 +711,7 @@ MessageBoxIndirectA(
     else
         textW.Buffer = (LPWSTR)lpMsgBoxParams->lpszText;
 
-    if (HIWORD((UINT)lpMsgBoxParams->lpszCaption))
+    if (HIWORD((UINT_PTR)lpMsgBoxParams->lpszCaption))
     {
         RtlCreateUnicodeStringFromAsciiz(&captionW, (PCSZ)lpMsgBoxParams->lpszCaption);
         /*
@@ -725,7 +725,7 @@ MessageBoxIndirectA(
 
     if(lpMsgBoxParams->dwStyle & MB_USERICON)
     {
-        if (HIWORD((UINT)lpMsgBoxParams->lpszIcon))
+        if (HIWORD((UINT_PTR)lpMsgBoxParams->lpszIcon))
         {
             RtlCreateUnicodeStringFromAsciiz(&iconW, (PCSZ)lpMsgBoxParams->lpszIcon);
             /*
@@ -753,13 +753,13 @@ MessageBoxIndirectA(
 
     ret = MessageBoxTimeoutIndirectW(&msgboxW, (UINT)-1);
 
-    if (HIWORD((UINT)lpMsgBoxParams->lpszText))
+    if (HIWORD((UINT_PTR)lpMsgBoxParams->lpszText))
         RtlFreeUnicodeString(&textW);
 
-    if (HIWORD((UINT)lpMsgBoxParams->lpszCaption))
+    if (HIWORD((UINT_PTR)lpMsgBoxParams->lpszCaption))
         RtlFreeUnicodeString(&captionW);
 
-    if ((lpMsgBoxParams->dwStyle & MB_USERICON) && HIWORD((UINT)iconW.Buffer))
+    if ((lpMsgBoxParams->dwStyle & MB_USERICON) && HIWORD((UINT_PTR)iconW.Buffer))
         RtlFreeUnicodeString(&iconW);
 
     return ret;
@@ -809,12 +809,12 @@ MessageBoxTimeoutA(
     UNICODE_STRING textW, captionW;
     int ret;
 
-    if (HIWORD((UINT)lpText))
+    if (HIWORD((UINT_PTR)lpText))
         RtlCreateUnicodeStringFromAsciiz(&textW, (PCSZ)lpText);
     else
         textW.Buffer = (LPWSTR)lpText;
 
-    if (HIWORD((UINT)lpCaption))
+    if (HIWORD((UINT_PTR)lpCaption))
         RtlCreateUnicodeStringFromAsciiz(&captionW, (PCSZ)lpCaption);
     else
         captionW.Buffer = (LPWSTR)lpCaption;
index 5460748..b9df442 100644 (file)
@@ -122,13 +122,13 @@ UserGetWindowIcon(HWND hwnd)
 {
    HICON hIcon = 0;
 
-   SendMessageTimeout(hwnd, WM_GETICON, ICON_SMALL2, 0, SMTO_ABORTIFHUNG, 1000, (LPDWORD)&hIcon);
+   SendMessageTimeout(hwnd, WM_GETICON, ICON_SMALL2, 0, SMTO_ABORTIFHUNG, 1000, (PDWORD_PTR)&hIcon);
 
    if (!hIcon)
-      SendMessageTimeout(hwnd, WM_GETICON, ICON_SMALL, 0, SMTO_ABORTIFHUNG, 1000, (LPDWORD)&hIcon);
+      SendMessageTimeout(hwnd, WM_GETICON, ICON_SMALL, 0, SMTO_ABORTIFHUNG, 1000, (PDWORD_PTR)&hIcon);
 
    if (!hIcon)
-      SendMessageTimeout(hwnd, WM_GETICON, ICON_BIG, 0, SMTO_ABORTIFHUNG, 1000, (LPDWORD)&hIcon);
+      SendMessageTimeout(hwnd, WM_GETICON, ICON_BIG, 0, SMTO_ABORTIFHUNG, 1000, (PDWORD_PTR)&hIcon);
 
    if (!hIcon)
       hIcon = (HICON)GetClassLongPtr(hwnd, GCL_HICONSM);
index 4bcc942..16bbbd5 100644 (file)
@@ -377,7 +377,7 @@ GetPropW(HWND hWnd, LPCWSTR lpString)
   }
   else
   {
-     Atom = LOWORD((DWORD)lpString);
+     Atom = LOWORD((DWORD_PTR)lpString);
   }
   Prop = IntGetProp(hWnd, Atom);
   if (Prop != NULL) Data = Prop->Data;
@@ -428,7 +428,7 @@ RemovePropW(HWND hWnd,
     }
   else
     {
-      Atom = LOWORD((DWORD)lpString);
+      Atom = LOWORD((DWORD_PTR)lpString);
     }
   return(NtUserRemoveProp(hWnd, Atom));
 }
@@ -476,7 +476,7 @@ SetPropW(HWND hWnd, LPCWSTR lpString, HANDLE hData)
     }
   else
     {
-      Atom = LOWORD((DWORD)lpString);
+      Atom = LOWORD((DWORD_PTR)lpString);
     }
 
   return(NtUserSetProp(hWnd, Atom, hData));
index c145042..b1720fb 100644 (file)
@@ -2117,7 +2117,7 @@ static void SPY_GetClassName( SPY_INSTANCE *sp_e )
     /* save and restore error code over the next call */
     save_error = GetLastError();
     /* special code to detect a property sheet dialog   */
-    if ((GetClassLongPtrW(sp_e->msg_hwnd, GCW_ATOM) == (LONG)WC_DIALOG) &&
+    if ((GetClassLongPtrW(sp_e->msg_hwnd, GCW_ATOM) == (ULONG_PTR)WC_DIALOG) &&
         (GetPropW(sp_e->msg_hwnd, PropSheetInfoStr))) {
         strcpyW(sp_e->wnd_class, WC_PROPSHEETW);
     }
index 04533ff..5f2826a 100644 (file)
@@ -135,7 +135,7 @@ CloseWindow(HWND hWnd)
 {
     SendMessageA(hWnd, WM_SYSCOMMAND, SC_CLOSE, 0);
 
-    return (BOOL)(hWnd);
+    return HandleToUlong(hWnd);
 }
 
 VOID
@@ -402,7 +402,7 @@ CreateWindowExA(DWORD dwExStyle,
 
         MDI_CalcDefaultChildPos(hWndParent, -1, mPos, 0, &id);
 
-        if (!(dwStyle & WS_POPUP)) hMenu = (HMENU)id;
+        if (!(dwStyle & WS_POPUP)) hMenu = UlongToHandle(id);
 
         if (dwStyle & (WS_CHILD | WS_POPUP))
         {
@@ -532,7 +532,7 @@ CreateWindowExW(DWORD dwExStyle,
 
         MDI_CalcDefaultChildPos(hWndParent, -1, mPos, 0, &id);
 
-        if (!(dwStyle & WS_POPUP)) hMenu = (HMENU)id;
+        if (!(dwStyle & WS_POPUP)) hMenu = UlongToHandle(id);
 
         if (dwStyle & (WS_CHILD | WS_POPUP))
         {
@@ -692,7 +692,7 @@ User32EnumWindows(HDESK hDesktop,
          * Once that's fixed, we shouldn't have to check for a NULL HWND
          * here
          */
-        if (!(ULONG)pHwnd[i]) /* don't enumerate a NULL HWND */
+        if (!pHwnd[i]) /* don't enumerate a NULL HWND */
             continue;
         if (!(*lpfn)(pHwnd[i], lParam))
         {
@@ -1442,8 +1442,8 @@ GetWindowThreadProcessId(HWND hWnd,
         { // We are current.
           //FIXME("Current!\n");
             if (lpdwProcessId)
-                *lpdwProcessId = (DWORD)NtCurrentTeb()->ClientId.UniqueProcess;
-            Ret = (DWORD)NtCurrentTeb()->ClientId.UniqueThread;
+                *lpdwProcessId = (DWORD_PTR)NtCurrentTeb()->ClientId.UniqueProcess;
+            Ret = (DWORD_PTR)NtCurrentTeb()->ClientId.UniqueThread;
         }
         else
         { // Ask kernel for info.
index b8019ac..778cd3d 100644 (file)
@@ -3118,8 +3118,8 @@ typedef struct tagKMDDELPARAM
     {
       struct
         {
-          UINT uiLo;
-          UINT uiHi;
+          UINT_PTR uiLo;
+          UINT_PTR uiHi;
         } Packed;
       LPARAM Unpacked;
     } Value;