From c75dc44cea1877d8ec3783fb5201a2ba0f4a8d83 Mon Sep 17 00:00:00 2001 From: DRC Date: Thu, 20 May 2010 07:44:49 +0000 Subject: [PATCH] Fix 64-bit Windows issues git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4061 3789f03b-4d11-0410-bbf8-ca57d06f2519 --- win/rfb_win32/CurrentUser.cxx | 2 +- win/rfb_win32/Dialog.cxx | 13 +++++++------ win/rfb_win32/Dialog.h | 5 +++-- win/rfb_win32/MsgWindow.cxx | 7 ++++--- win/vncviewer/ConnectingDialog.cxx | 9 +++++---- win/vncviewer/DesktopWindow.cxx | 13 +++++++------ 6 files changed, 27 insertions(+), 22 deletions(-) diff --git a/win/rfb_win32/CurrentUser.cxx b/win/rfb_win32/CurrentUser.cxx index 7562d29b..21531de8 100644 --- a/win/rfb_win32/CurrentUser.cxx +++ b/win/rfb_win32/CurrentUser.cxx @@ -98,7 +98,7 @@ CurrentUserToken::CurrentUserToken() : isSafe_(false) { // Try to find the Shell Tray Icon window and take its token // NB: This will only work under NT/2K (and later, but they're dealt with above) // NB: If the shell is not running then this will return an Unsafe Null token. - EnumDesktops(GetProcessWindowStation(), enumDesktops, (LONG)&h); + EnumDesktops(GetProcessWindowStation(), enumDesktops, (LPARAM)&h); isSafe_ = (h != 0); } else { // Try to open the security token for the User-Mode process diff --git a/win/rfb_win32/Dialog.cxx b/win/rfb_win32/Dialog.cxx index 90e7075f..70a5fb56 100644 --- a/win/rfb_win32/Dialog.cxx +++ b/win/rfb_win32/Dialog.cxx @@ -1,4 +1,5 @@ /* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved. + * Copyright (C) 2010 D. R. Commander. All Rights Reserved. * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -106,13 +107,13 @@ void Dialog::enableItem(int id, bool state) { -BOOL CALLBACK Dialog::staticDialogProc(HWND hwnd, UINT msg, +INT_PTR CALLBACK Dialog::staticDialogProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { if (msg == WM_INITDIALOG) - SetWindowLong(hwnd, GWL_USERDATA, (LONG)lParam); + SetWindowLongPtr(hwnd, GWLP_USERDATA, lParam); - LONG self = GetWindowLong(hwnd, GWL_USERDATA); + LONG_PTR self = GetWindowLongPtr(hwnd, GWLP_USERDATA); if (!self) return FALSE; return ((Dialog*)self)->dialogProc(hwnd, msg, wParam, lParam); @@ -165,13 +166,13 @@ PropSheetPage::~PropSheetPage() { } -BOOL CALLBACK PropSheetPage::staticPageProc(HWND hwnd, UINT msg, +INT_PTR CALLBACK PropSheetPage::staticPageProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { if (msg == WM_INITDIALOG) - SetWindowLong(hwnd, GWL_USERDATA, ((PROPSHEETPAGE*)lParam)->lParam); + SetWindowLongPtr(hwnd, GWLP_USERDATA, ((PROPSHEETPAGE*)lParam)->lParam); - LONG self = GetWindowLong(hwnd, GWL_USERDATA); + LONG_PTR self = GetWindowLongPtr(hwnd, GWLP_USERDATA); if (!self) return FALSE; return ((PropSheetPage*)self)->dialogProc(hwnd, msg, wParam, lParam); diff --git a/win/rfb_win32/Dialog.h b/win/rfb_win32/Dialog.h index 9784ba46..cb23baff 100644 --- a/win/rfb_win32/Dialog.h +++ b/win/rfb_win32/Dialog.h @@ -1,4 +1,5 @@ /* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved. + * Copyright (C) 2010 D. R. Commander. All Rights Reserved. * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -87,7 +88,7 @@ namespace rfb { void enableItem(int id, bool state); protected: - static BOOL CALLBACK staticDialogProc(HWND hwnd, UINT msg, + static INT_PTR CALLBACK staticDialogProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); virtual BOOL dialogProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); HINSTANCE inst; @@ -145,7 +146,7 @@ namespace rfb { protected: void setPropSheet(PropSheet* ps) {propSheet = ps;}; - static BOOL CALLBACK staticPageProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); + static INT_PTR CALLBACK staticPageProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); virtual BOOL dialogProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); PROPSHEETPAGE page; PropSheet* propSheet; diff --git a/win/rfb_win32/MsgWindow.cxx b/win/rfb_win32/MsgWindow.cxx index 1f2299eb..4c50c2fd 100644 --- a/win/rfb_win32/MsgWindow.cxx +++ b/win/rfb_win32/MsgWindow.cxx @@ -1,4 +1,5 @@ /* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved. + * Copyright (C) 2010 D. R. Commander. All Rights Reserved. * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -46,10 +47,10 @@ LRESULT CALLBACK MsgWindowProc(HWND wnd, UINT msg, WPARAM wParam, LPARAM lParam) LRESULT result = 0; if (msg == WM_CREATE) - SetWindowLong(wnd, GWL_USERDATA, (long)((CREATESTRUCT*)lParam)->lpCreateParams); + SetWindowLongPtr(wnd, GWLP_USERDATA, (LONG_PTR)((CREATESTRUCT*)lParam)->lpCreateParams); else if (msg == WM_DESTROY) - SetWindowLong(wnd, GWL_USERDATA, 0); - MsgWindow* _this = (MsgWindow*) GetWindowLong(wnd, GWL_USERDATA); + SetWindowLongPtr(wnd, GWLP_USERDATA, 0); + MsgWindow* _this = (MsgWindow*) GetWindowLongPtr(wnd, GWLP_USERDATA); if (!_this) { vlog.info("null _this in %x, message %x", wnd, msg); return SafeDefWindowProc(wnd, msg, wParam, lParam); diff --git a/win/vncviewer/ConnectingDialog.cxx b/win/vncviewer/ConnectingDialog.cxx index d2aec7c3..7f52e991 100644 --- a/win/vncviewer/ConnectingDialog.cxx +++ b/win/vncviewer/ConnectingDialog.cxx @@ -1,4 +1,5 @@ /* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved. + * Copyright (C) 2010 D. R. Commander. All Rights Reserved. * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -31,11 +32,11 @@ using namespace rfb::win32; // ConnectingDialog callback -static BOOL CALLBACK ConnectingDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam ) { - bool* activePtr = (bool*)GetWindowLong(hwnd, GWL_USERDATA); +static INT_PTR CALLBACK ConnectingDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam ) { + bool* activePtr = (bool*)GetWindowLongPtr(hwnd, GWLP_USERDATA); switch (uMsg) { case WM_INITDIALOG: - SetWindowLong(hwnd, GWL_USERDATA, lParam); + SetWindowLongPtr(hwnd, GWLP_USERDATA, lParam); return TRUE; case WM_COMMAND: switch (LOWORD(wParam)) { @@ -118,7 +119,7 @@ network::Socket* ConnectingDialog::connect(const char* hostAndPort) { dialogId = ++nextDialogId; dialogs[dialogId] = this; dialog = CreateDialogParam(GetModuleHandle(0), - MAKEINTRESOURCE(IDD_CONNECTING_DLG), 0, &ConnectingDlgProc, (long)&active); + MAKEINTRESOURCE(IDD_CONNECTING_DLG), 0, &ConnectingDlgProc, (LONG_PTR)&active); ShowWindow(dialog, SW_SHOW); ResetEvent(readyEvent); } diff --git a/win/vncviewer/DesktopWindow.cxx b/win/vncviewer/DesktopWindow.cxx index 49b6c3fa..d60ff8fe 100644 --- a/win/vncviewer/DesktopWindow.cxx +++ b/win/vncviewer/DesktopWindow.cxx @@ -1,4 +1,5 @@ /* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved. + * Copyright (C) 2010 D. R. Commander. All Rights Reserved. * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -63,10 +64,10 @@ public: LRESULT CALLBACK DesktopWindowProc(HWND wnd, UINT msg, WPARAM wParam, LPARAM lParam) { LRESULT result = 0; if (msg == WM_CREATE) - SetWindowLong(wnd, GWL_USERDATA, (long)((CREATESTRUCT*)lParam)->lpCreateParams); + SetWindowLongPtr(wnd, GWLP_USERDATA, (LONG_PTR)((CREATESTRUCT*)lParam)->lpCreateParams); else if (msg == WM_DESTROY) - SetWindowLong(wnd, GWL_USERDATA, 0); - DesktopWindow* _this = (DesktopWindow*) GetWindowLong(wnd, GWL_USERDATA); + SetWindowLongPtr(wnd, GWLP_USERDATA, 0); + DesktopWindow* _this = (DesktopWindow*) GetWindowLongPtr(wnd, GWLP_USERDATA); if (!_this) { vlog.info("null _this in %x, message %u", wnd, msg); return rfb::win32::SafeDefWindowProc(wnd, msg, wParam, lParam); @@ -133,10 +134,10 @@ public: LRESULT CALLBACK FrameProc(HWND wnd, UINT msg, WPARAM wParam, LPARAM lParam) { LRESULT result = 0; if (msg == WM_CREATE) - SetWindowLong(wnd, GWL_USERDATA, (long)((CREATESTRUCT*)lParam)->lpCreateParams); + SetWindowLongPtr(wnd, GWLP_USERDATA, (LONG_PTR)((CREATESTRUCT*)lParam)->lpCreateParams); else if (msg == WM_DESTROY) - SetWindowLong(wnd, GWL_USERDATA, 0); - DesktopWindow* _this = (DesktopWindow*) GetWindowLong(wnd, GWL_USERDATA); + SetWindowLongPtr(wnd, GWLP_USERDATA, 0); + DesktopWindow* _this = (DesktopWindow*) GetWindowLongPtr(wnd, GWLP_USERDATA); if (!_this) { vlog.info("null _this in %x, message %u", wnd, msg); return rfb::win32::SafeDefWindowProc(wnd, msg, wParam, lParam); -- 2.39.5