comctl32/tests: Fix some problems revealed by compilation in 64-bit mode

Dmitry Timoshkov dmitry at codeweavers.com
Thu May 24 03:14:31 CDT 2007


Hello,

Changelog:
    comctl32/tests: Fix some problems revealed by compilation in 64-bit mode.

---
 dlls/comctl32/tests/datetime.c |    8 ++++----
 dlls/comctl32/tests/header.c   |    8 ++++----
 dlls/comctl32/tests/listview.c |   28 ++++++++++++++--------------
 dlls/comctl32/tests/monthcal.c |    8 ++++----
 dlls/comctl32/tests/tab.c      |    6 +++---
 dlls/comctl32/tests/trackbar.c |    6 +++---
 dlls/comctl32/tests/treeview.c |   17 +++++------------
 dlls/comctl32/tests/updown.c   |   16 ++++++++--------
 8 files changed, 45 insertions(+), 52 deletions(-)

diff --git a/dlls/comctl32/tests/datetime.c b/dlls/comctl32/tests/datetime.c
index cdeeed7..e1d810b 100644
--- a/dlls/comctl32/tests/datetime.c
+++ b/dlls/comctl32/tests/datetime.c
@@ -137,7 +137,7 @@ struct subclass_info
 
 static LRESULT WINAPI datetime_subclass_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
 {
-    struct subclass_info *info = (struct subclass_info *)GetWindowLongA(hwnd, GWL_USERDATA);
+    struct subclass_info *info = (struct subclass_info *)GetWindowLongPtrA(hwnd, GWLP_USERDATA);
     static long defwndproc_counter = 0;
     LRESULT ret;
     struct message msg;
@@ -182,9 +182,9 @@ static HWND create_datetime_control(DWORD style, DWORD exstyle)
         return NULL;
     }
 
-    info->oldproc = (WNDPROC)SetWindowLongA(hWndDateTime, GWL_WNDPROC,
-                                            (LONG)datetime_subclass_proc);
-    SetWindowLongA(hWndDateTime, GWL_USERDATA, (LONG)info);
+    info->oldproc = (WNDPROC)SetWindowLongPtrA(hWndDateTime, GWLP_WNDPROC,
+                                            (LONG_PTR)datetime_subclass_proc);
+    SetWindowLongPtrA(hWndDateTime, GWLP_USERDATA, (LONG_PTR)info);
 
     return hWndDateTime;
 }
diff --git a/dlls/comctl32/tests/header.c b/dlls/comctl32/tests/header.c
index bce1d9c..1c4e45e 100644
--- a/dlls/comctl32/tests/header.c
+++ b/dlls/comctl32/tests/header.c
@@ -402,7 +402,7 @@ struct subclass_info
 
 static LRESULT WINAPI header_subclass_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
 {
-    struct subclass_info *info = (struct subclass_info *)GetWindowLongA(hwnd, GWL_USERDATA);
+    struct subclass_info *info = (struct subclass_info *)GetWindowLongPtrA(hwnd, GWLP_USERDATA);
     static long defwndproc_counter = 0;
     LRESULT ret;
     struct message msg;
@@ -533,9 +533,9 @@ static HWND create_custom_header_control(HWND hParent, BOOL preloadHeaderItems)
     SetWindowPos(childHandle, winpos.hwndInsertAfter, winpos.x, winpos.y,
                  winpos.cx, winpos.cy, 0);
 
-    info->oldproc = (WNDPROC)SetWindowLongA(childHandle, GWL_WNDPROC,
-                                    (LONG)header_subclass_proc);
-    SetWindowLongA(childHandle, GWL_USERDATA, (LONG)info);
+    info->oldproc = (WNDPROC)SetWindowLongA(childHandle, GWLP_WNDPROC,
+                                    (LONG_PTR)header_subclass_proc);
+    SetWindowLongPtrA(childHandle, GWLP_USERDATA, (LONG_PTR)info);
     return childHandle;
 }
 
diff --git a/dlls/comctl32/tests/listview.c b/dlls/comctl32/tests/listview.c
index 3a7186b..df1e623 100644
--- a/dlls/comctl32/tests/listview.c
+++ b/dlls/comctl32/tests/listview.c
@@ -212,7 +212,7 @@ static HWND create_parent_window(void)
 
 static LRESULT WINAPI listview_subclass_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
 {
-    struct subclass_info *info = (struct subclass_info *)GetWindowLongA(hwnd, GWL_USERDATA);
+    struct subclass_info *info = (struct subclass_info *)GetWindowLongPtrA(hwnd, GWLP_USERDATA);
     static long defwndproc_counter = 0;
     LRESULT ret;
     struct message msg;
@@ -256,9 +256,9 @@ static HWND create_listview_control(void)
         return NULL;
     }
 
-    info->oldproc = (WNDPROC)SetWindowLongA(hwnd, GWL_WNDPROC,
-                                            (LONG)listview_subclass_proc);
-    SetWindowLongA(hwnd, GWL_USERDATA, (LONG)info);
+    info->oldproc = (WNDPROC)SetWindowLongPtrA(hwnd, GWLP_WNDPROC,
+                                            (LONG_PTR)listview_subclass_proc);
+    SetWindowLongPtrA(hwnd, GWLP_USERDATA, (LONG_PTR)info);
 
     return hwnd;
 }
@@ -286,16 +286,16 @@ static HWND create_custom_listview_control(DWORD style)
         return NULL;
     }
 
-    info->oldproc = (WNDPROC)SetWindowLongA(hwnd, GWL_WNDPROC,
-                                            (LONG)listview_subclass_proc);
-    SetWindowLongA(hwnd, GWL_USERDATA, (LONG)info);
+    info->oldproc = (WNDPROC)SetWindowLongPtrA(hwnd, GWLP_WNDPROC,
+                                            (LONG_PTR)listview_subclass_proc);
+    SetWindowLongPtrA(hwnd, GWLP_USERDATA, (LONG_PTR)info);
 
     return hwnd;
 }
 
 static LRESULT WINAPI header_subclass_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
 {
-    struct subclass_info *info = (struct subclass_info *)GetWindowLongA(hwnd, GWL_USERDATA);
+    struct subclass_info *info = (struct subclass_info *)GetWindowLongPtrA(hwnd, GWLP_USERDATA);
     static long defwndproc_counter = 0;
     LRESULT ret;
     struct message msg;
@@ -326,9 +326,9 @@ static HWND subclass_header(HWND hwndListview)
         return NULL;
 
     hwnd = ListView_GetHeader(hwndListview);
-    info->oldproc = (WNDPROC)SetWindowLongA(hwnd, GWL_WNDPROC,
-                                            (LONG)header_subclass_proc);
-    SetWindowLongA(hwnd, GWL_USERDATA, (LONG)info);
+    info->oldproc = (WNDPROC)SetWindowLongPtrA(hwnd, GWLP_WNDPROC,
+                                            (LONG_PTR)header_subclass_proc);
+    SetWindowLongPtrA(hwnd, GWLP_USERDATA, (LONG_PTR)info);
 
     return hwnd;
 }
@@ -773,13 +773,13 @@ static void test_customdraw(void)
     insert_column(hwnd, 1);
     insert_item(hwnd, 0);
 
-    oldwndproc = (WNDPROC)SetWindowLongPtr(hwndparent, GWL_WNDPROC,
-                                           (INT_PTR)cd_wndproc);
+    oldwndproc = (WNDPROC)SetWindowLongPtr(hwndparent, GWLP_WNDPROC,
+                                           (LONG_PTR)cd_wndproc);
 
     InvalidateRect(hwnd, NULL, TRUE);
     UpdateWindow(hwnd);
 
-    SetWindowLongPtr(hwndparent, GWL_WNDPROC, (INT_PTR)oldwndproc);
+    SetWindowLongPtr(hwndparent, GWLP_WNDPROC, (LONG_PTR)oldwndproc);
 
     DestroyWindow(hwnd);
 }
diff --git a/dlls/comctl32/tests/monthcal.c b/dlls/comctl32/tests/monthcal.c
index 48afb74..de6253b 100644
--- a/dlls/comctl32/tests/monthcal.c
+++ b/dlls/comctl32/tests/monthcal.c
@@ -441,7 +441,7 @@ static HWND create_parent_window(void)
 
 static LRESULT WINAPI monthcal_subclass_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
 {
-    struct subclass_info *info = (struct subclass_info *)GetWindowLongA(hwnd, GWL_USERDATA);
+    struct subclass_info *info = (struct subclass_info *)GetWindowLongPtrA(hwnd, GWLP_USERDATA);
     static long defwndproc_counter = 0;
     LRESULT ret;
     struct message msg;
@@ -487,9 +487,9 @@ static HWND create_monthcal_control(DWORD style, HWND parent_window)
         return NULL;
     }
 
-    info->oldproc = (WNDPROC)SetWindowLongA(hwnd, GWL_WNDPROC,
-                                            (LONG)monthcal_subclass_proc);
-    SetWindowLongA(hwnd, GWL_USERDATA, (LONG)info);
+    info->oldproc = (WNDPROC)SetWindowLongPtrA(hwnd, GWLP_WNDPROC,
+                                            (LONG_PTR)monthcal_subclass_proc);
+    SetWindowLongPtrA(hwnd, GWLP_USERDATA, (LONG_PTR)info);
 
     return hwnd;
 }
diff --git a/dlls/comctl32/tests/tab.c b/dlls/comctl32/tests/tab.c
index 6f7259f..fe75370 100644
--- a/dlls/comctl32/tests/tab.c
+++ b/dlls/comctl32/tests/tab.c
@@ -343,7 +343,7 @@ struct subclass_info
 
 static LRESULT WINAPI tabSubclassProcess(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
 {
-    struct subclass_info *info = (struct subclass_info *)GetWindowLongA(hwnd, GWL_USERDATA);
+    struct subclass_info *info = (struct subclass_info *)GetWindowLongPtrA(hwnd, GWLP_USERDATA);
     static long defwndproc_counter = 0;
     LRESULT ret;
     struct message msg;
@@ -397,8 +397,8 @@ static HWND createFilledTabControl(HWND parent_wnd, DWORD style, DWORD mask, INT
 
     assert(tabHandle);
 
-    info->oldproc = (WNDPROC)SetWindowLongA(tabHandle, GWL_WNDPROC, (LONG)tabSubclassProcess);
-    SetWindowLongA(tabHandle, GWL_USERDATA, (LONG)info);
+    info->oldproc = (WNDPROC)SetWindowLongPtrA(tabHandle, GWLP_WNDPROC, (LONG_PTR)tabSubclassProcess);
+    SetWindowLongPtrA(tabHandle, GWLP_USERDATA, (LONG_PTR)info);
 
     tcNewTab.mask = mask;
 
diff --git a/dlls/comctl32/tests/trackbar.c b/dlls/comctl32/tests/trackbar.c
index 78aacb1..13f56fd 100644
--- a/dlls/comctl32/tests/trackbar.c
+++ b/dlls/comctl32/tests/trackbar.c
@@ -445,7 +445,7 @@ static HWND create_parent_window(void){
 }
 
 static LRESULT WINAPI trackbar_subclass_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam){
-    struct subclass_info *info = (struct subclass_info *) GetWindowLongA(hwnd, GWL_USERDATA);
+    struct subclass_info *info = (struct subclass_info *) GetWindowLongPtrA(hwnd, GWLP_USERDATA);
     static long defwndproc_counter = 0;
     LRESULT ret;
     struct message msg;
@@ -485,9 +485,9 @@ static HWND create_trackbar(DWORD style, HWND parent){
         return NULL;
     }
 
-    info->oldproc = (WNDPROC)SetWindowLongA(hWndTrack, GWL_WNDPROC, (LONG)trackbar_subclass_proc);
+    info->oldproc = (WNDPROC)SetWindowLongPtrA(hWndTrack, GWLP_WNDPROC, (LONG_PTR)trackbar_subclass_proc);
 
-    SetWindowLongA(hWndTrack, GWL_USERDATA, (LONG)info);
+    SetWindowLongPtrA(hWndTrack, GWLP_USERDATA, (LONG_PTR)info);
 
     return hWndTrack;
 }
diff --git a/dlls/comctl32/tests/treeview.c b/dlls/comctl32/tests/treeview.c
index 3b33eab..4f99e0d 100644
--- a/dlls/comctl32/tests/treeview.c
+++ b/dlls/comctl32/tests/treeview.c
@@ -574,7 +574,7 @@ static LRESULT WINAPI TreeviewWndProc(HWND hwnd, UINT message, WPARAM wParam, LP
     static long defwndproc_counter = 0;
     LRESULT ret;
     struct message msg;
-    WNDPROC *lpOldProc = (WNDPROC*)GetWindowLongA(hwnd, GWL_USERDATA);
+    WNDPROC lpOldProc = (WNDPROC)GetWindowLongPtrA(hwnd, GWLP_USERDATA);
 
     msg.message = message;
     msg.flags = sent|wparam|lparam;
@@ -584,7 +584,7 @@ static LRESULT WINAPI TreeviewWndProc(HWND hwnd, UINT message, WPARAM wParam, LP
     add_message(MsgSequences, LISTVIEW_SEQ_INDEX, &msg);
 
     defwndproc_counter++;
-    ret = CallWindowProcA(*lpOldProc, hwnd, message, wParam, lParam);
+    ret = CallWindowProcA(lpOldProc, hwnd, message, wParam, lParam);
     defwndproc_counter--;
 
     return ret;
@@ -592,7 +592,7 @@ static LRESULT WINAPI TreeviewWndProc(HWND hwnd, UINT message, WPARAM wParam, LP
 
 static LRESULT CALLBACK MyWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
 {
-    WNDPROC *pOldWndProc;
+    WNDPROC pOldWndProc;
 
     switch(msg) {
 
@@ -604,16 +604,9 @@ static LRESULT CALLBACK MyWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPa
 
         SetFocus(hTree);
 
-        pOldWndProc = HeapAlloc(GetProcessHeap(), 0, sizeof(WNDPROC));
-        if ( !ok(pOldWndProc != NULL, "Failed to allocate memory for subclass_info.\n") )
-        {
-            PostQuitMessage(1);
-            break;
-        }
-
         /* Record the old WNDPROC so we can call it after recording the messages */
-        *pOldWndProc = (WNDPROC)SetWindowLongA(hTree, GWL_WNDPROC, (LONG)TreeviewWndProc);
-        SetWindowLongA(hTree, GWL_USERDATA, (LONG)pOldWndProc);
+        pOldWndProc = (WNDPROC)SetWindowLongPtrA(hTree, GWLP_WNDPROC, (LONG_PTR)TreeviewWndProc);
+        SetWindowLongPtrA(hTree, GWLP_USERDATA, (LONG_PTR)pOldWndProc);
 
         return 0;
     }
diff --git a/dlls/comctl32/tests/updown.c b/dlls/comctl32/tests/updown.c
index fb1a522..4a7fff6 100644
--- a/dlls/comctl32/tests/updown.c
+++ b/dlls/comctl32/tests/updown.c
@@ -259,7 +259,7 @@ struct subclass_info
 
 static LRESULT WINAPI edit_subclass_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
 {
-    struct subclass_info *info = (struct subclass_info *)GetWindowLongA(hwnd, GWL_USERDATA);
+    struct subclass_info *info = (struct subclass_info *)GetWindowLongPtrA(hwnd, GWLP_USERDATA);
     static long defwndproc_counter = 0;
     LRESULT ret;
     struct message msg;
@@ -298,16 +298,16 @@ static HWND create_edit_control(void)
         return NULL;
     }
 
-    info->oldproc = (WNDPROC)SetWindowLongA(edit, GWL_WNDPROC,
-                                            (LONG)edit_subclass_proc);
-    SetWindowLongA(edit, GWL_USERDATA, (LONG)info);
+    info->oldproc = (WNDPROC)SetWindowLongPtrA(edit, GWLP_WNDPROC,
+                                            (LONG_PTR)edit_subclass_proc);
+    SetWindowLongPtrA(edit, GWLP_USERDATA, (LONG_PTR)info);
 
     return edit;
 }
 
 static LRESULT WINAPI updown_subclass_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
 {
-    struct subclass_info *info = (struct subclass_info *)GetWindowLongA(hwnd, GWL_USERDATA);
+    struct subclass_info *info = (struct subclass_info *)GetWindowLongPtrA(hwnd, GWLP_USERDATA);
     static long defwndproc_counter = 0;
     LRESULT ret;
     struct message msg;
@@ -348,9 +348,9 @@ static HWND create_updown_control(void)
         return NULL;
     }
 
-    info->oldproc = (WNDPROC)SetWindowLongA(updown, GWL_WNDPROC,
-                                            (LONG)updown_subclass_proc);
-    SetWindowLongA(updown, GWL_USERDATA, (LONG)info);
+    info->oldproc = (WNDPROC)SetWindowLongPtrA(updown, GWLP_WNDPROC,
+                                            (LONG_PTR)updown_subclass_proc);
+    SetWindowLongPtrA(updown, GWLP_USERDATA, (LONG_PTR)info);
 
     return updown;
 }
-- 
1.5.1.6






More information about the wine-patches mailing list