Commit e4b2a0bb authored by Alexandre Julliard's avatar Alexandre Julliard

Use Get/SetWindowLongPtr instead of Get/SetWindowLong where

appropriate.
parent 4c34d938
......@@ -234,7 +234,7 @@ static void test_subclass(void)
ok_sequence(Sub_AfterDeletedTest, "After Deleted");
pSetWindowSubclass(hwnd, WndProcSub, 2, 0);
origProc3 = (WNDPROC)SetWindowLong(hwnd, GWL_WNDPROC, (LONG)WndProc3);
origProc3 = (WNDPROC)SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG)WndProc3);
SendMessage(hwnd, WM_USER, 1, 0);
SendMessage(hwnd, WM_USER, 2, 0);
ok_sequence(Sub_OldAfterNewTest, "Old after New");
......
......@@ -451,7 +451,7 @@ START_TEST(bitmap)
10, 10, 300, 300,
NULL, NULL, NULL, NULL);
assert(hWnd);
is_win9x = GetWindowLongW(hWnd, GWL_WNDPROC) == 0;
is_win9x = GetWindowLongPtrW(hWnd, GWLP_WNDPROC) == 0;
DestroyWindow(hWnd);
test_createdibitmap();
......
......@@ -251,9 +251,9 @@ static void check_instance( const char *name, HINSTANCE inst, HINSTANCE info_ins
ok( (HINSTANCE)GetClassLongA( hwnd, GCL_HMODULE ) == gcl_inst,
"Wrong GCL instance %p/%p for class %s\n",
(HINSTANCE)GetClassLongA( hwnd, GCL_HMODULE ), gcl_inst, name );
ok( (HINSTANCE)GetWindowLongA( hwnd, GWL_HINSTANCE ) == inst,
ok( (HINSTANCE)GetWindowLongPtrA( hwnd, GWLP_HINSTANCE ) == inst,
"Wrong GWL instance %p/%p for window %s\n",
(HINSTANCE)GetWindowLongA( hwnd, GWL_HINSTANCE ), inst, name );
(HINSTANCE)GetWindowLongPtrA( hwnd, GWLP_HINSTANCE ), inst, name );
ok(!UnregisterClassA(name, inst), "UnregisterClassA should fail while exists a class window\n");
ok(GetLastError() == ERROR_CLASS_HAS_WINDOWS, "GetLastError() should be set to ERROR_CLASS_HAS_WINDOWS not %ld\n", GetLastError());
DestroyWindow(hwnd);
......
......@@ -172,7 +172,7 @@ static void test_menu_ownerdraw(void)
NULL, NULL, NULL, NULL);
ok(hwnd != NULL, "CreateWindowEx failed with error %ld\n", GetLastError());
if( !hwnd) return;
SetWindowLong( hwnd, GWL_WNDPROC, (LONG)menu_ownerdraw_wnd_proc);
SetWindowLongPtr( hwnd, GWLP_WNDPROC, (LONG)menu_ownerdraw_wnd_proc);
hmenu = CreatePopupMenu();
ok(hmenu != NULL, "CreateMenu failed with error %ld\n", GetLastError());
if( !hmenu) { DestroyWindow(hwnd);return;}
......
......@@ -4468,7 +4468,7 @@ static LRESULT WINAPI MsgCheckProcA(HWND hwnd, UINT message, WPARAM wParam, LPAR
{
DWORD style = GetWindowLongA(hwnd, GWL_STYLE);
if (style & WS_CHILD)
lParam = GetWindowLongA(hwnd, GWL_ID);
lParam = GetWindowLongPtrA(hwnd, GWLP_ID);
else if (style & WS_POPUP)
lParam = WND_POPUP_ID;
else
......@@ -4497,7 +4497,7 @@ static LRESULT WINAPI MsgCheckProcA(HWND hwnd, UINT message, WPARAM wParam, LPAR
{
DWORD style = GetWindowLongA(hwnd, GWL_STYLE);
if (style & WS_CHILD)
lParam = GetWindowLongA(hwnd, GWL_ID);
lParam = GetWindowLongPtrA(hwnd, GWLP_ID);
else if (style & WS_POPUP)
lParam = WND_POPUP_ID;
else
......@@ -4788,7 +4788,7 @@ static LRESULT CALLBACK cbt_hook_proc(int nCode, WPARAM wParam, LPARAM lParam)
{
DWORD style = GetWindowLongA((HWND)wParam, GWL_STYLE);
if (style & WS_CHILD)
lParam = GetWindowLongA((HWND)wParam, GWL_ID);
lParam = GetWindowLongPtrA((HWND)wParam, GWLP_ID);
else if (style & WS_POPUP)
lParam = WND_POPUP_ID;
else
......@@ -5743,7 +5743,7 @@ static void test_DispatchMessage(void)
UpdateWindow( hwnd );
while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessage( &msg );
flush_sequence();
SetWindowLongPtrA( hwnd, GWL_WNDPROC, (LONG_PTR)DispatchMessageCheckProc );
SetWindowLongPtrA( hwnd, GWLP_WNDPROC, (LONG_PTR)DispatchMessageCheckProc );
SetRect( &rect, -5, -5, 5, 5 );
RedrawWindow( hwnd, &rect, 0, RDW_INVALIDATE|RDW_ERASE|RDW_FRAME );
......
......@@ -115,7 +115,7 @@ LRESULT CALLBACK Graph_WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lP
hdc = BeginPaint(hWnd, &ps);
WindowId = GetWindowLong(hWnd, GWL_ID);
WindowId = GetWindowLongPtr(hWnd, GWLP_ID);
switch (WindowId)
{
......
......@@ -196,10 +196,10 @@ LRESULT CALLBACK PerformancePageWndProc(HWND hDlg, UINT message, WPARAM wParam,
/*
* Subclass graph buttons
*/
OldGraphWndProc = SetWindowLong(hPerformancePageCpuUsageGraph, GWL_WNDPROC, (LONG)Graph_WndProc);
SetWindowLong(hPerformancePageMemUsageGraph, GWL_WNDPROC, (LONG)Graph_WndProc);
OldGraphCtrlWndProc = SetWindowLong(hPerformancePageMemUsageHistoryGraph, GWL_WNDPROC, (LONG)GraphCtrl_WndProc);
SetWindowLong(hPerformancePageCpuUsageHistoryGraph, GWL_WNDPROC, (LONG)GraphCtrl_WndProc);
OldGraphWndProc = SetWindowLongPtr(hPerformancePageCpuUsageGraph, GWLP_WNDPROC, (LONG_PTR)Graph_WndProc);
SetWindowLongPtr(hPerformancePageMemUsageGraph, GWLP_WNDPROC, (LONG_PTR)Graph_WndProc);
OldGraphCtrlWndProc = SetWindowLongPtr(hPerformancePageMemUsageHistoryGraph, GWLP_WNDPROC, (LONG_PTR)GraphCtrl_WndProc);
SetWindowLongPtr(hPerformancePageCpuUsageHistoryGraph, GWLP_WNDPROC, (LONG_PTR)GraphCtrl_WndProc);
return TRUE;
case WM_COMMAND:
......
......@@ -91,7 +91,7 @@ LRESULT CALLBACK ProcessPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPAR
/*
* Subclass the process list control so we can intercept WM_ERASEBKGND
*/
OldProcessListWndProc = SetWindowLong(hProcessPageListCtrl, GWL_WNDPROC, (LONG)ProcessListWndProc);
OldProcessListWndProc = SetWindowLongPtr(hProcessPageListCtrl, GWLP_WNDPROC, (LONG_PTR)ProcessListWndProc);
/* Start our refresh thread */
CreateThread(NULL, 0, ProcessPageRefreshThread, NULL, 0, NULL);
......
......@@ -65,7 +65,7 @@ static BOOL WINAPI WCUSER_OptionDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPAR
case WM_INITDIALOG:
di = (struct dialog_info*)((PROPSHEETPAGEA*)lParam)->lParam;
di->hDlg = hDlg;
SetWindowLong(hDlg, DWL_USER, (DWORD)di);
SetWindowLongPtr(hDlg, DWLP_USER, (LONG_PTR)di);
if (di->config.cursor_size <= 25) idc = IDC_OPT_CURSOR_SMALL;
else if (di->config.cursor_size <= 50) idc = IDC_OPT_CURSOR_MEDIUM;
......@@ -89,7 +89,7 @@ static BOOL WINAPI WCUSER_OptionDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPAR
DWORD val;
BOOL done;
di = (struct dialog_info*)GetWindowLong(hDlg, DWL_USER);
di = (struct dialog_info*)GetWindowLongPtr(hDlg, DWLP_USER);
switch (nmhdr->code)
{
......@@ -176,7 +176,7 @@ static LRESULT WINAPI WCUSER_FontPreviewProc(HWND hWnd, UINT msg, WPARAM wParam,
struct dialog_info* di;
HFONT hFont, hOldFont;
di = (struct dialog_info*)GetWindowLong(GetParent(hWnd), DWL_USER);
di = (struct dialog_info*)GetWindowLongPtr(GetParent(hWnd), DWLP_USER);
BeginPaint(hWnd, &ps);
font_idx = SendDlgItemMessage(di->hDlg, IDC_FNT_LIST_FONT, LB_GETCURSEL, 0L, 0L);
......@@ -520,7 +520,7 @@ static BOOL WINAPI WCUSER_FontDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM
case WM_INITDIALOG:
di = (struct dialog_info*)((PROPSHEETPAGEA*)lParam)->lParam;
di->hDlg = hDlg;
SetWindowLong(hDlg, DWL_USER, (DWORD)di);
SetWindowLongPtr(hDlg, DWLP_USER, (DWORD_PTR)di);
/* remove dialog from this control, font will be reset when listboxes are filled */
SendDlgItemMessage(hDlg, IDC_FNT_PREVIEW, WM_SETFONT, 0L, 0L);
fill_list_font(di);
......@@ -528,7 +528,7 @@ static BOOL WINAPI WCUSER_FontDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM
SetWindowLong(GetDlgItem(hDlg, IDC_FNT_COLOR_FG), 0, di->config.def_attr & 0x0F);
break;
case WM_COMMAND:
di = (struct dialog_info*)GetWindowLong(hDlg, DWL_USER);
di = (struct dialog_info*)GetWindowLongPtr(hDlg, DWLP_USER);
switch (LOWORD(wParam))
{
case IDC_FNT_LIST_FONT:
......@@ -550,7 +550,7 @@ static BOOL WINAPI WCUSER_FontDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM
NMHDR* nmhdr = (NMHDR*)lParam;
DWORD val;
di = (struct dialog_info*)GetWindowLong(hDlg, DWL_USER);
di = (struct dialog_info*)GetWindowLongPtr(hDlg, DWLP_USER);
switch (nmhdr->code)
{
case PSN_SETACTIVE:
......@@ -600,7 +600,7 @@ static BOOL WINAPI WCUSER_ConfigDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPAR
case WM_INITDIALOG:
di = (struct dialog_info*)((PROPSHEETPAGEA*)lParam)->lParam;
di->hDlg = hDlg;
SetWindowLong(hDlg, DWL_USER, (DWORD)di);
SetWindowLongPtr(hDlg, DWLP_USER, (DWORD_PTR)di);
SetDlgItemInt(hDlg, IDC_CNF_SB_WIDTH, di->config.sb_width, FALSE);
SetDlgItemInt(hDlg, IDC_CNF_SB_HEIGHT, di->config.sb_height, FALSE);
SetDlgItemInt(hDlg, IDC_CNF_WIN_WIDTH, di->config.win_width, FALSE);
......@@ -621,7 +621,7 @@ static BOOL WINAPI WCUSER_ConfigDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPAR
break;
case WM_COMMAND:
di = (struct dialog_info*)GetWindowLong(hDlg, DWL_USER);
di = (struct dialog_info*)GetWindowLongPtr(hDlg, DWLP_USER);
switch (LOWORD(wParam))
{
}
......@@ -632,7 +632,7 @@ static BOOL WINAPI WCUSER_ConfigDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPAR
int win_w, win_h, sb_w, sb_h;
BOOL st1, st2;
di = (struct dialog_info*)GetWindowLong(hDlg, DWL_USER);
di = (struct dialog_info*)GetWindowLongPtr(hDlg, DWLP_USER);
switch (nmhdr->code)
{
case PSN_SETACTIVE:
......
......@@ -1417,7 +1417,7 @@ static void packet_query_monitor_wnd_helper(struct gdb_context* gdbctx, HWND hWn
"%*s%04x%*s%-17.17s %08lx %08lx %.14s\n",
indent, "", (UINT)hWnd, 13 - indent, "",
clsName, GetWindowLong(hWnd, GWL_STYLE),
GetWindowLong(hWnd, GWL_WNDPROC), wndName);
GetWindowLongPtr(hWnd, GWLP_WNDPROC), wndName);
packet_reply_hex_to_str(gdbctx, buffer);
packet_reply_close(gdbctx);
......
......@@ -305,7 +305,7 @@ static void class_walker(HWND hWnd, struct class_walker* cw)
void info_win32_class(HWND hWnd, const char* name)
{
WNDCLASSEXA wca;
HINSTANCE hInst = hWnd ? (HINSTANCE)GetWindowLong(hWnd, GWL_HINSTANCE) : 0;
HINSTANCE hInst = hWnd ? (HINSTANCE)GetWindowLongPtr(hWnd, GWLP_HINSTANCE) : 0;
if (!name)
{
......@@ -369,7 +369,7 @@ static void info_window(HWND hWnd, int indent)
dbg_printf("%*s%08x%*s %-17.17s %08lx %08lx %08lx %.14s\n",
indent, "", (UINT)hWnd, 12 - indent, "",
clsName, GetWindowLong(hWnd, GWL_STYLE),
GetWindowLong(hWnd, GWL_WNDPROC),
GetWindowLongPtr(hWnd, GWLP_WNDPROC),
GetWindowThreadProcessId(hWnd, NULL), wndName);
if ((child = GetWindow(hWnd, GW_CHILD)) != 0)
......@@ -416,12 +416,12 @@ void info_win32_window(HWND hWnd, BOOL detailed)
GetParent(hWnd),
GetWindow(hWnd, GW_OWNER),
clsName,
(HINSTANCE)GetWindowLong(hWnd, GWL_HINSTANCE),
(HINSTANCE)GetWindowLongPtr(hWnd, GWLP_HINSTANCE),
GetLastActivePopup(hWnd),
GetWindowLong(hWnd, GWL_ID),
GetWindowLongPtr(hWnd, GWLP_ID),
GetWindowLong(hWnd, GWL_STYLE),
GetWindowLong(hWnd, GWL_EXSTYLE),
GetWindowLong(hWnd, GWL_WNDPROC),
GetWindowLongPtr(hWnd, GWLP_WNDPROC),
wndName,
clientRect.left, clientRect.top, clientRect.right, clientRect.bottom,
windowRect.left, windowRect.top, windowRect.right, windowRect.bottom,
......
......@@ -1616,7 +1616,7 @@ static LRESULT CALLBACK CBTProc(int code, WPARAM wparam, LPARAM lparam)
newchild = NULL;
child->hwnd = (HWND) wparam;
SetWindowLong(child->hwnd, GWL_USERDATA, (LPARAM)child);
SetWindowLongPtr(child->hwnd, GWLP_USERDATA, (LPARAM)child);
}
return CallNextHookEx(hcbthook, code, wparam, lparam);
......@@ -1696,7 +1696,7 @@ static INT_PTR CALLBACK DestinationDlgProc(HWND hwnd, UINT nmsg, WPARAM wparam,
switch(nmsg) {
case WM_INITDIALOG:
SetWindowLong(hwnd, GWL_USERDATA, lparam);
SetWindowLongPtr(hwnd, GWLP_USERDATA, lparam);
SetWindowText(GetDlgItem(hwnd, 201), (LPCTSTR)lparam);
return 1;
......@@ -1705,7 +1705,7 @@ static INT_PTR CALLBACK DestinationDlgProc(HWND hwnd, UINT nmsg, WPARAM wparam,
switch(id) {
case IDOK: {
LPTSTR dest = (LPTSTR) GetWindowLong(hwnd, GWL_USERDATA);
LPTSTR dest = (LPTSTR) GetWindowLongPtr(hwnd, GWLP_USERDATA);
GetWindowText(GetDlgItem(hwnd, 201), dest, MAX_PATH);
EndDialog(hwnd, id);
break;}
......@@ -2083,7 +2083,7 @@ static BOOL activate_drive_window(LPCTSTR path)
/* search for a already open window for the same drive */
for(child_wnd=GetNextWindow(Globals.hmdiclient,GW_CHILD); child_wnd; child_wnd=GetNextWindow(child_wnd, GW_HWNDNEXT)) {
ChildWnd* child = (ChildWnd*) GetWindowLong(child_wnd, GWL_USERDATA);
ChildWnd* child = (ChildWnd*) GetWindowLongPtr(child_wnd, GWLP_USERDATA);
if (child) {
_tsplitpath(child->root.path, drv2, 0, 0, 0);
......@@ -2108,7 +2108,7 @@ static BOOL activate_fs_window(LPCTSTR filesys)
/* search for a already open window of the given file system name */
for(child_wnd=GetNextWindow(Globals.hmdiclient,GW_CHILD); child_wnd; child_wnd=GetNextWindow(child_wnd, GW_HWNDNEXT)) {
ChildWnd* child = (ChildWnd*) GetWindowLong(child_wnd, GWL_USERDATA);
ChildWnd* child = (ChildWnd*) GetWindowLongPtr(child_wnd, GWLP_USERDATA);
if (child) {
if (!lstrcmpi(child->root.fs, filesys)) {
......@@ -2253,7 +2253,7 @@ static LRESULT CALLBACK FrameWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM
/* change font in all open child windows */
for(childWnd=GetWindow(Globals.hmdiclient,GW_CHILD); childWnd; childWnd=GetNextWindow(childWnd,GW_HWNDNEXT)) {
ChildWnd* child = (ChildWnd*) GetWindowLong(childWnd, GWL_USERDATA);
ChildWnd* child = (ChildWnd*) GetWindowLongPtr(childWnd, GWLP_USERDATA);
SetWindowFont(child->left.hwnd, Globals.hfont, TRUE);
SetWindowFont(child->right.hwnd, Globals.hfont, TRUE);
ListBox_SetItemHeight(child->left.hwnd, 1, max(Globals.spaceSize.cy,IMAGE_HEIGHT+3));
......@@ -2860,7 +2860,7 @@ static void create_tree_window(HWND parent, Pane* pane, int id, int id_header, L
LBS_DISABLENOSCROLL|LBS_NOINTEGRALHEIGHT|LBS_OWNERDRAWFIXED|LBS_NOTIFY,
0, 0, 0, 0, parent, (HMENU)id, Globals.hInstance, 0);
SetWindowLong(pane->hwnd, GWL_USERDATA, (LPARAM)pane);
SetWindowLongPtr(pane->hwnd, GWLP_USERDATA, (LPARAM)pane);
g_orgTreeWndProc = SubclassWindow(pane->hwnd, TreeWndProc);
SetWindowFont(pane->hwnd, Globals.hfont, FALSE);
......@@ -4142,7 +4142,7 @@ static HRESULT ShellFolderContextMenu(IShellFolder* shell_folder, HWND hwndParen
static LRESULT CALLBACK ChildWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam)
{
ChildWnd* child = (ChildWnd*) GetWindowLong(hwnd, GWL_USERDATA);
ChildWnd* child = (ChildWnd*) GetWindowLongPtr(hwnd, GWLP_USERDATA);
ASSERT(child);
switch(nmsg) {
......@@ -4165,7 +4165,7 @@ static LRESULT CALLBACK ChildWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM
case WM_NCDESTROY:
free_child_window(child);
SetWindowLong(hwnd, GWL_USERDATA, 0);
SetWindowLongPtr(hwnd, GWLP_USERDATA, 0);
break;
case WM_PAINT: {
......@@ -4524,8 +4524,8 @@ static LRESULT CALLBACK ChildWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM
static LRESULT CALLBACK TreeWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam)
{
ChildWnd* child = (ChildWnd*) GetWindowLong(GetParent(hwnd), GWL_USERDATA);
Pane* pane = (Pane*) GetWindowLong(hwnd, GWL_USERDATA);
ChildWnd* child = (ChildWnd*) GetWindowLongPtr(GetParent(hwnd), GWLP_USERDATA);
Pane* pane = (Pane*) GetWindowLongPtr(hwnd, GWLP_USERDATA);
ASSERT(child);
switch(nmsg) {
......
......@@ -763,8 +763,8 @@ static LRESULT CALLBACK WINHELP_ButtonBoxWndProc(HWND hWnd, UINT msg, WPARAM wPa
Globals.hInstance, 0);
if (button->hWnd) {
if (Globals.button_proc == NULL)
Globals.button_proc = (WNDPROC) GetWindowLong(button->hWnd, GWL_WNDPROC);
SetWindowLong(button->hWnd, GWL_WNDPROC, (LONG) WINHELP_ButtonWndProc);
Globals.button_proc = (WNDPROC) GetWindowLongPtr(button->hWnd, GWLP_WNDPROC);
SetWindowLongPtr(button->hWnd, GWLP_WNDPROC, (LONG_PTR) WINHELP_ButtonWndProc);
}
}
hDc = GetDC(button->hWnd);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment