Should use LONG_PTR for plugin code due to Win64. b=472025 r=josh sr=jst
authorMakoto Kato <m_kato@ga2.so-net.ne.jp>
Tue, 13 Jan 2009 13:15:39 -0500
changeset 23614 23adb1fb2e1b66d20982f057947954676b095426
parent 23613 6e089951b91535c9bdd7ea9b752dc01ac53e2be7
child 23615 8056ab7076d58341448552e65ff1c97afdd3f5a0
push id4638
push userjosh@mozilla.com
push dateTue, 13 Jan 2009 18:15:51 +0000
treeherdermozilla-central@23adb1fb2e1b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjosh, jst
bugs472025
milestone1.9.2a1pre
Should use LONG_PTR for plugin code due to Win64. b=472025 r=josh sr=jst
modules/plugin/base/public/nsplugindefs.h
modules/plugin/base/src/nsPluginNativeWindowWin.cpp
modules/plugin/default/windows/dialogs.cpp
modules/plugin/default/windows/plugin.cpp
modules/plugin/sdk/samples/basic/windows/plugin.cpp
modules/plugin/sdk/samples/npruntime/plugin.cpp
modules/plugin/sdk/samples/testevents/npevents.cpp
modules/plugin/tools/spy/windows/gui_advanced.cpp
modules/plugin/tools/spy/windows/gui_fiter.cpp
modules/plugin/tools/spy/windows/gui_general.cpp
modules/plugin/tools/spy/windows/gui_log.cpp
modules/plugin/tools/spy/windows/gui_main.cpp
modules/plugin/tools/tester/windows/dlgauto.cpp
modules/plugin/tools/tester/windows/dlgman.cpp
modules/plugin/tools/tester/windows/dlgtstr.cpp
modules/plugin/tools/tester/windows/guihlp.cpp
--- a/modules/plugin/base/public/nsplugindefs.h
+++ b/modules/plugin/base/public/nsplugindefs.h
@@ -326,18 +326,23 @@ struct nsPluginEvent {
 
 #elif defined(XP_OS2)
     uint32      event;
     uint32      wParam;
     uint32      lParam;
 
 #elif defined(XP_WIN)
     uint16      event;
+#if defined(_WIN64)
+    uint64      wParam;
+    uint64      lParam;
+#else
     uint32      wParam;
     uint32      lParam;
+#endif /* _WIN64 */
 
 #elif defined(XP_UNIX) && defined(MOZ_X11)
     XEvent      event;
 #else
     void        *event;
 #endif
 };
 
--- a/modules/plugin/base/src/nsPluginNativeWindowWin.cpp
+++ b/modules/plugin/base/src/nsPluginNativeWindowWin.cpp
@@ -485,17 +485,17 @@ nsresult nsPluginNativeWindowWin::CallSe
 #ifndef WINCE
   if (!aPluginInstance) {
     UndoSubclassAndAssociateWindow();
     mPrevWinProc = NULL;
   }
 
   // We need WndProc before plug-ins do subclass in nsPluginNativeWindow::CallSetWindow.
   if (aPluginInstance) {
-    WNDPROC currentWndProc = (WNDPROC)::GetWindowLong((HWND)window, GWL_WNDPROC);
+    WNDPROC currentWndProc = (WNDPROC)::GetWindowLongPtr((HWND)window, GWLP_WNDPROC);
     if (currentWndProc != PluginWndProc)
       mPrevWinProc = currentWndProc;
   }
 #endif
 
   nsPluginNativeWindow::CallSetWindow(aPluginInstance);
 
 #ifndef WINCE
@@ -513,21 +513,21 @@ nsresult nsPluginNativeWindowWin::Subcla
   if (type != nsPluginWindowType_Window)
     return NS_ERROR_FAILURE;
 
   HWND hWnd = (HWND)window;
   if (!hWnd)
     return NS_ERROR_FAILURE;
 
   // check if we need to re-subclass
-  WNDPROC currentWndProc = (WNDPROC)::GetWindowLong(hWnd, GWL_WNDPROC);
+  WNDPROC currentWndProc = (WNDPROC)::GetWindowLongPtr(hWnd, GWLP_WNDPROC);
   if (PluginWndProc == currentWndProc)
     return NS_OK;
 
-  mPluginWinProc = SubclassWindow(hWnd, (LONG)PluginWndProc);
+  mPluginWinProc = SubclassWindow(hWnd, (LONG_PTR)PluginWndProc);
   if (!mPluginWinProc)
     return NS_ERROR_FAILURE;
 
   nsPluginNativeWindowWin * win = (nsPluginNativeWindowWin *)::GetProp(hWnd, NS_PLUGIN_WINDOW_PROPERTY_ASSOCIATION);
   NS_ASSERTION(!win || (win == this), "plugin window already has property and this is not us");
   
   if (!::SetProp(hWnd, NS_PLUGIN_WINDOW_PROPERTY_ASSOCIATION, (HANDLE)this))
     return NS_ERROR_FAILURE;
@@ -543,19 +543,19 @@ nsresult nsPluginNativeWindowWin::UndoSu
   // remove window property
   HWND hWnd = (HWND)window;
   if (IsWindow(hWnd))
     ::RemoveProp(hWnd, NS_PLUGIN_WINDOW_PROPERTY_ASSOCIATION);
 
   // restore the original win proc
   // but only do this if this were us last time
   if (mPluginWinProc) {
-    WNDPROC currentWndProc = (WNDPROC)::GetWindowLong(hWnd, GWL_WNDPROC);
+    WNDPROC currentWndProc = (WNDPROC)::GetWindowLongPtr(hWnd, GWLP_WNDPROC);
     if (currentWndProc == PluginWndProc)
-      SubclassWindow(hWnd, (LONG)mPluginWinProc);
+      SubclassWindow(hWnd, (LONG_PTR)mPluginWinProc);
   }
 
   return NS_OK;
 }
 #endif // WINCE
 
 nsresult PLUG_NewPluginNativeWindow(nsPluginNativeWindow ** aPluginNativeWindow)
 {
--- a/modules/plugin/default/windows/dialogs.cpp
+++ b/modules/plugin/default/windows/dialogs.cpp
@@ -41,17 +41,17 @@
 
 #include "resource.h"
 
 #include "plugin.h"
 #include "utils.h"
 
 static void onCommand(HWND hWnd, int id, HWND hWndCtl, UINT codeNotify)
 {
-  CPlugin * pPlugin = (CPlugin *)GetWindowLong(hWnd, DWL_USER);
+  CPlugin * pPlugin = (CPlugin *)GetWindowLongPtr(hWnd, DWLP_USER);
   switch (id)
   {
     case IDC_GET_PLUGIN:
       DestroyWindow(hWnd);
       if(pPlugin !=NULL)
       {
         pPlugin->m_hWndDialog = NULL;
         pPlugin->getPlugin();
@@ -70,17 +70,17 @@ static void onCommand(HWND hWnd, int id,
 
 static BOOL onInitDialog(HWND hWnd, HWND hWndFocus, LPARAM lParam)
 {
   CPlugin * pPlugin = (CPlugin *)lParam;
   assert(pPlugin != NULL);
   if(pPlugin == NULL)
     return TRUE;
 
-  SetWindowLong(hWnd, DWL_USER, (LONG)pPlugin);
+  SetWindowLongPtr(hWnd, DWLP_USER, (LONG_PTR)pPlugin);
 
   pPlugin->m_hWndDialog = hWnd;
   
   char szString[512];
   LoadString(hInst, IDS_TITLE, szString, sizeof(szString));
   SetWindowText(hWnd, szString);
 
   LoadString(hInst, IDS_INFO, szString, sizeof(szString));
--- a/modules/plugin/default/windows/plugin.cpp
+++ b/modules/plugin/default/windows/plugin.cpp
@@ -722,24 +722,24 @@ void CPlugin::onPaint(HWND hWnd)
   EndPaint (hWnd, &ps);
 }
 
 //**************************
 // Plugin window procedure
 //**************************
 static LRESULT CALLBACK NP_LOADDS PluginWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
 {
-  CPlugin *pPlugin = (CPlugin *)GetWindowLong(hWnd, GWL_USERDATA);
+  CPlugin *pPlugin = (CPlugin *)GetWindowLongPtr(hWnd, GWLP_USERDATA);
                         
   switch(message)
   {
     case WM_CREATE:
       pPlugin = (CPlugin *)(((CREATESTRUCT FAR*)lParam)->lpCreateParams);
       assert(pPlugin != NULL);
-      SetWindowLong(hWnd, GWL_USERDATA, (LONG)pPlugin);
+      SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)pPlugin);
       pPlugin->onCreate(hWnd);
       return 0L;
     case WM_LBUTTONUP:
       HANDLE_WM_LBUTTONUP(hWnd, wParam, lParam, pPlugin->onLButtonUp);
       return 0L;
     case WM_RBUTTONUP:
       HANDLE_WM_RBUTTONUP(hWnd, wParam, lParam, pPlugin->onRButtonUp);
       return 0L;
--- a/modules/plugin/sdk/samples/basic/windows/plugin.cpp
+++ b/modules/plugin/sdk/samples/basic/windows/plugin.cpp
@@ -101,17 +101,17 @@ NPBool nsPluginInstance::init(NPWindow* 
     return FALSE;
 
   // subclass window so we can intercept window messages and
   // do our drawing to it
   lpOldProc = SubclassWindow(mhWnd, (WNDPROC)PluginWinProc);
 
   // associate window with our nsPluginInstance object so we can access 
   // it in the window procedure
-  SetWindowLong(mhWnd, GWL_USERDATA, (LONG)this);
+  SetWindowLongPtr(mhWnd, GWLP_USERDATA, (LONG_PTR)this);
 
   mInitialized = TRUE;
   return TRUE;
 }
 
 void nsPluginInstance::shut()
 {
   // subclass it back
@@ -138,17 +138,17 @@ static LRESULT CALLBACK PluginWinProc(HW
         // draw a frame and display the string
         PAINTSTRUCT ps;
         HDC hdc = BeginPaint(hWnd, &ps);
         RECT rc;
         GetClientRect(hWnd, &rc);
         FrameRect(hdc, &rc, GetStockBrush(BLACK_BRUSH));
 
         // get our plugin instance object and ask it for the version string
-        nsPluginInstance *plugin = (nsPluginInstance *)GetWindowLong(hWnd, GWL_USERDATA);
+        nsPluginInstance *plugin = (nsPluginInstance *)GetWindowLongPtr(hWnd, GWLP_USERDATA);
         if (plugin) {
           const char * string = plugin->getVersion();
           DrawText(hdc, string, strlen(string), &rc, DT_SINGLELINE | DT_CENTER | DT_VCENTER);
         }
         else {
           char string[] = "Error occured";
           DrawText(hdc, string, strlen(string), &rc, DT_SINGLELINE | DT_CENTER | DT_VCENTER);
         }
--- a/modules/plugin/sdk/samples/npruntime/plugin.cpp
+++ b/modules/plugin/sdk/samples/npruntime/plugin.cpp
@@ -630,17 +630,17 @@ NPBool CPlugin::init(NPWindow* pNPWindow
     return false;
 
   // subclass window so we can intercept window messages and
   // do our drawing to it
   lpOldProc = SubclassWindow(m_hWnd, (WNDPROC)PluginWinProc);
 
   // associate window with our CPlugin object so we can access 
   // it in the window procedure
-  SetWindowLong(m_hWnd, GWL_USERDATA, (LONG)this);
+  SetWindowLongPtr(m_hWnd, GWLP_USERDATA, (LONG_PTR)this);
 #endif
 
   m_Window = pNPWindow;
 
   m_bInitialized = true;
   return true;
 }
 
@@ -741,17 +741,17 @@ static LRESULT CALLBACK PluginWinProc(HW
     case WM_PAINT:
       {
         // draw a frame and display the string
         PAINTSTRUCT ps;
         HDC hdc = BeginPaint(hWnd, &ps);
         RECT rc;
         GetClientRect(hWnd, &rc);
         FrameRect(hdc, &rc, GetStockBrush(BLACK_BRUSH));
-        CPlugin * p = (CPlugin *)GetWindowLong(hWnd, GWL_USERDATA);
+        CPlugin * p = (CPlugin *)GetWindowLongPtr(hWnd, GWLP_USERDATA);
         if(p) {
           if (p->m_String[0] == 0) {
             strcpy("foo", p->m_String);
           }
 
           DrawText(hdc, p->m_String, strlen(p->m_String), &rc, DT_SINGLELINE | DT_CENTER | DT_VCENTER);
         }
 
--- a/modules/plugin/sdk/samples/testevents/npevents.cpp
+++ b/modules/plugin/sdk/samples/testevents/npevents.cpp
@@ -765,17 +765,17 @@ void EventsPluginInstance::PlatformNew(v
 
 nsresult EventsPluginInstance::PlatformDestroy(void) {
 	wChild = 0;
 	return NS_OK;
 }
 
 nsresult EventsPluginInstance::PlatformCreateWindow(nsPluginWindow* window) {
 	// Remember parent wndproc.
-	fPlatform.fParentWindowProc = (WNDPROC)::GetWindowLong(wMain, GWL_WNDPROC);
+	fPlatform.fParentWindowProc = (WNDPROC)::GetWindowLongPtr(wMain, GWLP_WNDPROC);
 	NS_ABORT_IF_FALSE(fPlatform.fParentWindowProc!=NULL, "Couldn't get the parent WNDPROC");
 
 	// Create the child window that fills our nsWindow 
 	RECT rc;
 	::GetWindowRect(wMain, &rc);
 
 	wChild = ::CreateWindow("Edit", // class - standard Windows edit control.
 							"", // title
@@ -786,32 +786,32 @@ nsresult EventsPluginInstance::PlatformC
 							0, // instance
 							NULL); //creation data.
 	NS_ABORT_IF_FALSE(wChild != NULL, "Failed to create the child window!");
 	if (!wChild)
 		return NS_ERROR_FAILURE;
 	// Stash away our "this" pointer so our WNDPROC can talk to us.
 	::SetProp(wChild, gInstanceLookupString, (HANDLE)this);
 	fPlatform.fOldChildWindowProc =
-		(WNDPROC)::SetWindowLong( wChild,
-								GWL_WNDPROC, 
-								(LONG)EventsPluginInstance::WndProcChild);
+		(WNDPROC)::SetWindowLongPtr( wChild,
+								GWLP_WNDPROC, 
+								(LONG_PTR)EventsPluginInstance::WndProcChild);
 	return NS_OK;
 }
 
 int16 EventsPluginInstance::PlatformHandleEvent(nsPluginEvent * /*event*/) {
 	return NS_OK;
 }
 
 void EventsPluginInstance::PlatformResetWindow() {
 #ifdef EVENTSPLUGIN_DEBUG
 	printf("EventsPluginInstance::PlatformResetWindow\n");
 #endif
 	fPlatform.fParentWindowProc = NULL;
-	::SetWindowLong(wChild, GWL_WNDPROC, (LONG)fPlatform.fOldChildWindowProc);
+	::SetWindowLongPtr(wChild, GWLP_WNDPROC, (LONG_PTR)fPlatform.fOldChildWindowProc);
 	fPlatform.fOldChildWindowProc = NULL;
 	wChild = NULL;
 	wMain = NULL;
 }
 
 void EventsPluginInstance::PlatformResizeWindow(nsPluginWindow* window) {
 #ifdef EVENTSPLUGIN_DEBUG
 	printf("EventsPluginInstance::PlatformResizeWindow with new size (%d,%d)\n", window->width, window->height);
--- a/modules/plugin/tools/spy/windows/gui_advanced.cpp
+++ b/modules/plugin/tools/spy/windows/gui_advanced.cpp
@@ -40,17 +40,17 @@
 
 #include "windowsxx.h"
 
 #include "resource.h"
 #include "logger.h"
 
 static void onApply(HWND hWnd)
 {
-  Logger * logger = (Logger *)GetWindowLong(hWnd, DWL_USER);
+  Logger * logger = (Logger *)GetWindowLongPtr(hWnd, DWLP_USER);
   if(!logger)
     return;
 
   logger->bSPALID = (BST_CHECKED == IsDlgButtonChecked(hWnd, IDC_CHECK_SPALID));
   logger->bSaveSettings = TRUE;
 }
 
 static void onNotify(HWND hWnd, int idCtrl, LPNMHDR lpNMHdr)
@@ -67,17 +67,17 @@ static void onNotify(HWND hWnd, int idCt
 
 static BOOL onInitDialog(HWND hWnd, HWND hWndFocus, LPARAM lParam)
 {
   Logger * logger = NULL;
 
   if(lParam)
   {
     logger = (Logger *)(((PROPSHEETPAGE *)lParam)->lParam);
-    SetWindowLong(hWnd, DWL_USER, (long)logger);
+    SetWindowLongPtr(hWnd, DWLP_USER, (LONG_PTR)logger);
   }
 
   if(logger)
   {
     CheckDlgButton(hWnd, IDC_CHECK_SPALID, logger->bSPALID ? BST_CHECKED : BST_UNCHECKED);
   }
 
   return TRUE;
--- a/modules/plugin/tools/spy/windows/gui_fiter.cpp
+++ b/modules/plugin/tools/spy/windows/gui_fiter.cpp
@@ -61,17 +61,17 @@ static void onCommand(HWND hWnd, int id,
     }
     default:
       break;
   }
 }
 
 static void onApply(HWND hWnd)
 {
-  Logger * logger = (Logger *)GetWindowLong(hWnd, DWL_USER);
+  Logger * logger = (Logger *)GetWindowLongPtr(hWnd, DWLP_USER);
   if(!logger)
     return;
 
   BOOL mutedcalls[TOTAL_NUMBER_OF_API_CALLS];
 
   mutedcalls[0] = FALSE; // for invalid call
 
   // we assume that checkbox ids start with IDC_CHECK_NPN_VERSION and are consequitive
@@ -96,17 +96,17 @@ static void onNotify(HWND hWnd, int idCt
 
 static BOOL onInitDialog(HWND hWnd, HWND hWndFocus, LPARAM lParam)
 {
   Logger * logger = NULL;
 
   if(lParam)
   {
     logger = (Logger *)(((PROPSHEETPAGE *)lParam)->lParam);
-    SetWindowLong(hWnd, DWL_USER, (long)logger);
+    SetWindowLongPtr(hWnd, DWLP_USER, (LONG_PTR)logger);
   }
 
   BOOL * mutedcalls = logger->getMutedCalls();
 
   if(mutedcalls)
   {
     // we assume that checkbox ids start with IDC_CHECK_NPN_VERSION and are consequitive
     for(int i = IDC_CHECK_NPN_VERSION; i < IDC_CHECK_NPN_VERSION + TOTAL_NUMBER_OF_API_CALLS - 1; i++)
--- a/modules/plugin/tools/spy/windows/gui_general.cpp
+++ b/modules/plugin/tools/spy/windows/gui_general.cpp
@@ -40,17 +40,17 @@
 
 #include "windowsxx.h"
 
 #include "resource.h"
 #include "logger.h"
 
 static void onApply(HWND hWnd)
 {
-  Logger * logger = (Logger *)GetWindowLong(hWnd, DWL_USER);
+  Logger * logger = (Logger *)GetWindowLongPtr(hWnd, DWLP_USER);
   if(!logger)
     return;
 
   logger->bOnTop = (BST_CHECKED == IsDlgButtonChecked(hWnd, IDC_CHECK_ONTOP));
   logger->bSaveSettings = TRUE;
 }
 
 static void onNotify(HWND hWnd, int idCtrl, LPNMHDR lpNMHdr)
@@ -67,17 +67,17 @@ static void onNotify(HWND hWnd, int idCt
 
 static BOOL onInitDialog(HWND hWnd, HWND hWndFocus, LPARAM lParam)
 {
   Logger * logger = NULL;
 
   if(lParam)
   {
     logger = (Logger *)(((PROPSHEETPAGE *)lParam)->lParam);
-    SetWindowLong(hWnd, DWL_USER, (long)logger);
+    SetWindowLongPtr(hWnd, DWLP_USER, (LONG_PTR)logger);
   }
 
   if(logger)
   {
     CheckDlgButton(hWnd, IDC_CHECK_ONTOP, logger->bOnTop ? BST_CHECKED : BST_UNCHECKED);
   }
 
   return TRUE;
--- a/modules/plugin/tools/spy/windows/gui_log.cpp
+++ b/modules/plugin/tools/spy/windows/gui_log.cpp
@@ -41,17 +41,17 @@
 #include "windowsxx.h"
 
 #include "resource.h"
 #include "logger.h"
 #include "dirpick.h"
 
 static void onChooseDir(HWND hWnd)
 {
-  Logger * logger = (Logger *)GetWindowLong(hWnd, DWL_USER);
+  Logger * logger = (Logger *)GetWindowLongPtr(hWnd, DWLP_USER);
   if(!logger)
     return;
 
   char string[_MAX_PATH];
   char name[_MAX_PATH];
 
   GetDlgItemText(hWnd, IDC_EDIT_FILE, string, strlen(string));
   char * p = NULL;
@@ -92,17 +92,17 @@ static void onCommand(HWND hWnd, int id,
       break;
     default:
       break;
   }
 }
 
 static void onApply(HWND hWnd)
 {
-  Logger * logger = (Logger *)GetWindowLong(hWnd, DWL_USER);
+  Logger * logger = (Logger *)GetWindowLongPtr(hWnd, DWLP_USER);
   if(!logger)
     return;
 
   logger->bToWindow = (BST_CHECKED == IsDlgButtonChecked(hWnd, IDC_CHECK_TOWINDOW));
   logger->bToConsole = (BST_CHECKED == IsDlgButtonChecked(hWnd, IDC_CHECK_TOCONSOLE));
 
   char filename[_MAX_PATH];
   GetDlgItemText(hWnd, IDC_EDIT_FILE, filename, strlen(filename));
@@ -125,17 +125,17 @@ static void onNotify(HWND hWnd, int idCt
 
 static BOOL onInitDialog(HWND hWnd, HWND hWndFocus, LPARAM lParam)
 {
   Logger * logger = NULL;
 
   if(lParam)
   {
     logger = (Logger *)(((PROPSHEETPAGE *)lParam)->lParam);
-    SetWindowLong(hWnd, DWL_USER, (long)logger);
+    SetWindowLongPtr(hWnd, DWLP_USER, (LONG_PTR)logger);
   }
 
   if(logger)
   {
     CheckDlgButton(hWnd, IDC_CHECK_TOWINDOW, logger->bToWindow ? BST_CHECKED : BST_UNCHECKED);
     CheckDlgButton(hWnd, IDC_CHECK_TOCONSOLE, logger->bToConsole ? BST_CHECKED : BST_UNCHECKED);
     CheckDlgButton(hWnd, IDC_CHECK_TOFILE, logger->bToFile ? BST_CHECKED : BST_UNCHECKED);
 
--- a/modules/plugin/tools/spy/windows/gui_main.cpp
+++ b/modules/plugin/tools/spy/windows/gui_main.cpp
@@ -140,17 +140,17 @@ static void onOptions(HWND hWnd, Logger 
     SetWindowPos(hWnd, logger->bOnTop ? HWND_TOPMOST : HWND_NOTOPMOST, 0,0,0,0,SWP_NOMOVE|SWP_NOSIZE);
   }
 
   logger->bSaveSettings = FALSE;
 }
 
 static void onCommand(HWND hWnd, int id, HWND hWndCtl, UINT codeNotify)
 {
-  LoggerWin * logger = (LoggerWin *)GetWindowLong(hWnd, DWL_USER);
+  LoggerWin * logger = (LoggerWin *)GetWindowLongPtr(hWnd, DWLP_USER);
   switch (id)
   {
     case IDC_CHECK_MUTE:
       if(logger)
         logger->bMutedAll = (BST_CHECKED == IsDlgButtonChecked(hWnd, IDC_CHECK_MUTE));
       break;
     case IDC_BUTTON_OPTIONS:
       onOptions(hWnd, logger);
@@ -162,17 +162,17 @@ static void onCommand(HWND hWnd, int id,
     default:
       break;
   }
 }
 
 static BOOL onInitDialog(HWND hWnd, HWND hWndFocus, LPARAM lParam)
 {
   LoggerWin * logger = (LoggerWin *)lParam;
-  SetWindowLong(hWnd, DWL_USER, (long)logger);
+  SetWindowLongPtr(hWnd, DWLP_USER, (LONG_PTR)logger);
   SetWindowText(hWnd, szAppName);
   HFONT hFont = GetStockFont(ANSI_FIXED_FONT);
   SetWindowFont(GetDlgItem(hWnd, IDC_MAIN_OUTPUT), hFont, FALSE);
 
   if(logger)
   {
     CheckDlgButton(hWnd, IDC_CHECK_MUTE, logger->bMutedAll ? BST_CHECKED : BST_UNCHECKED);
     if(logger->width && logger->height)
@@ -180,17 +180,17 @@ static BOOL onInitDialog(HWND hWnd, HWND
 
     SetWindowPos(hWnd, logger->bOnTop ? HWND_TOPMOST : HWND_NOTOPMOST, 0,0,0,0, SWP_NOMOVE | SWP_NOSIZE);
   }
   return TRUE;
 }
 
 static void onDestroy(HWND hWnd)
 {
-  LoggerWin * logger = (LoggerWin *)GetWindowLong(hWnd, DWL_USER);
+  LoggerWin * logger = (LoggerWin *)GetWindowLongPtr(hWnd, DWLP_USER);
   if(logger)
     logger->onDestroyWindow();
 }
 
 static void onSize(HWND hWnd, UINT state, int cx, int cy)
 {
   long bu = GetDialogBaseUnits();
   int bux = LOWORD(bu);
--- a/modules/plugin/tools/tester/windows/dlgauto.cpp
+++ b/modules/plugin/tools/tester/windows/dlgauto.cpp
@@ -47,17 +47,17 @@
 #include "logger.h"
 #include "xp.h"
 
 extern CLogger * pLogger;
 static CScripter * pScripter = NULL;
 
 static void onCommand(HWND hWnd, int id, HWND hWndCtl, UINT codeNotify)
 {
-  CPlugin * pPlugin = (CPlugin *)GetWindowLong(hWnd, DWL_USER);
+  CPlugin * pPlugin = (CPlugin *)GetWindowLongPtr(hWnd, DWLP_USER);
   if(!pPlugin)
     return;
 
   switch (id)
   {
     case IDC_EDIT_SCRIPT_FILE_NAME:
     {
       if(codeNotify != EN_CHANGE)
@@ -192,17 +192,17 @@ static void onCommand(HWND hWnd, int id,
     default:
       break;
   }
 }
 
 static BOOL onInitDialog(HWND hWnd, HWND hWndFocus, LPARAM lParam)
 {
   CPlugin * pPlugin = (CPlugin *)lParam;
-  SetWindowLong(hWnd, DWL_USER, (long)pPlugin);
+  SetWindowLongPtr(hWnd, DWLP_USER, (LONG_PTR)pPlugin);
 
   int iTopMargin = 188;
   SetWindowPos(hWnd, NULL, 0,iTopMargin, 0,0, SWP_NOZORDER | SWP_NOSIZE);
 
   if (pPlugin)
     Edit_SetText(GetDlgItem(hWnd, IDC_EDIT_SCRIPT_FILE_NAME), (LPCSTR)pPlugin->m_Pref_szScriptFile);
 
   Static_SetText(GetDlgItem(hWnd, IDC_STATIC_REPETITIONS_LEFT), "");
--- a/modules/plugin/tools/tester/windows/dlgman.cpp
+++ b/modules/plugin/tools/tester/windows/dlgman.cpp
@@ -47,17 +47,17 @@
 #include "guiprefs.h"
 #include "winutils.h"
 #include "xp.h"
 
 extern CLogger * pLogger;
 
 static void onCommand(HWND hWnd, int id, HWND hWndCtl, UINT codeNotify)
 {
-  CPlugin * pPlugin = (CPlugin *)GetWindowLong(hWnd, DWL_USER);
+  CPlugin * pPlugin = (CPlugin *)GetWindowLongPtr(hWnd, DWLP_USER);
   if (!pPlugin)
     return;
 
   switch (id)
   {
     case IDC_COMBO_API_CALL:
       if(codeNotify != CBN_SELCHANGE)
         break;
@@ -174,17 +174,17 @@ static void onCommand(HWND hWnd, int id,
     default:
       break;
   }
 }
 
 static BOOL onInitDialog(HWND hWnd, HWND hWndFocus, LPARAM lParam)
 {
   CPlugin * pPlugin = (CPlugin *)lParam;
-  SetWindowLong(hWnd, DWL_USER, (long)pPlugin);
+  SetWindowLongPtr(hWnd, DWLP_USER, (LONG_PTR)pPlugin);
 
   // look at the last used API call if needed
   int iSel = 0;
   if (pPlugin && pPlugin->m_Pref_bRememberLastCall) {
     char szFileName[_MAX_PATH];
     GetINIFileName(pPlugin->getInstance(), szFileName, sizeof(szFileName));
     iSel = XP_GetPrivateProfileInt(SECTION_PREFERENCES, KEY_LAST_API_CALL, 0, szFileName);
   }
@@ -193,17 +193,17 @@ static BOOL onInitDialog(HWND hWnd, HWND
 
   int iTopMargin = 188;
   SetWindowPos(hWnd, NULL, 0,iTopMargin, 0,0, SWP_NOZORDER | SWP_NOSIZE);
   return TRUE;
 }
 
 static void onDestroy(HWND hWnd)
 {
-  CPlugin * pPlugin = (CPlugin *)GetWindowLong(hWnd, DWL_USER);
+  CPlugin * pPlugin = (CPlugin *)GetWindowLongPtr(hWnd, DWLP_USER);
   if(pPlugin && pPlugin->m_Pref_bRememberLastCall) {
     // save last API call if needed
     char szFileName[_MAX_PATH];
     GetINIFileName(pPlugin->getInstance(), szFileName, sizeof(szFileName));
     int iSel = ComboBox_GetCurSel(GetDlgItem(hWnd, IDC_COMBO_API_CALL));
     XP_WritePrivateProfileInt(SECTION_PREFERENCES, KEY_LAST_API_CALL, iSel, szFileName);
   }
 }
--- a/modules/plugin/tools/tester/windows/dlgtstr.cpp
+++ b/modules/plugin/tools/tester/windows/dlgtstr.cpp
@@ -43,17 +43,17 @@
 
 #include "plugin.h"
 #include "logger.h"
 
 extern CLogger * pLogger;
 
 static void onCommand(HWND hWnd, int id, HWND hWndCtl, UINT codeNotify)
 {
-  CPlugin * pPlugin = (CPlugin *)GetWindowLong(hWnd, DWL_USER);
+  CPlugin * pPlugin = (CPlugin *)GetWindowLongPtr(hWnd, DWLP_USER);
   if(!pPlugin)
     return;
 
   switch (id)
   {
     case IDC_RADIO_MODE_MANUAL:
       if((codeNotify == BN_CLICKED) && (IsDlgButtonChecked(hWnd, IDC_RADIO_MODE_MANUAL) == BST_CHECKED))
       {
@@ -123,17 +123,17 @@ static void onCommand(HWND hWnd, int id,
 
 BOOL CALLBACK NP_LOADDS ManualDlgProc(HWND, UINT, WPARAM, LPARAM);
 BOOL CALLBACK NP_LOADDS AutoDlgProc(HWND, UINT, WPARAM, LPARAM);
 
 static BOOL onInitDialog(HWND hWnd, HWND hWndFocus, LPARAM lParam)
 {
   CPlugin * pPlugin = (CPlugin *)lParam;
 
-  SetWindowLong(hWnd, DWL_USER, (long)pPlugin);
+  SetWindowLongPtr(hWnd, DWLP_USER, (LONG_PTR)pPlugin);
 
   SetWindowPos(hWnd, NULL, 0,0, 0,0, SWP_NOZORDER | SWP_NOSIZE);
 
   HINSTANCE hInst = pPlugin->getInstance();
   HWND hWndManual = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_DIALOG_MANUAL), hWnd, (DLGPROC)ManualDlgProc, (LPARAM)pPlugin);
   HWND hWndAuto = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_DIALOG_AUTO), hWnd, (DLGPROC)AutoDlgProc, (LPARAM)pPlugin);
 
   CheckRadioButton(hWnd, IDC_RADIO_MODE_MANUAL, IDC_RADIO_MODE_AUTO, 
@@ -158,17 +158,17 @@ static BOOL onInitDialog(HWND hWnd, HWND
 
   pPlugin->showGUI(pPlugin->m_Pref_ShowGUI);
 
   return TRUE;
 }
 
 static void onDestroy(HWND hWnd)
 {
-  CPlugin * pPlugin = (CPlugin *)GetWindowLong(hWnd, DWL_USER);
+  CPlugin * pPlugin = (CPlugin *)GetWindowLongPtr(hWnd, DWLP_USER);
   pPlugin->onDestroy();
 }
 
 BOOL CALLBACK NP_LOADDS TesterDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
 {
   switch(msg)
   {
     case WM_INITDIALOG:
--- a/modules/plugin/tools/tester/windows/guihlp.cpp
+++ b/modules/plugin/tools/tester/windows/guihlp.cpp
@@ -164,17 +164,17 @@ static void replaceEditWithCombo(HWND hW
     ShowWindow(GetDlgItem(hWnd, IDC_COMBO_ARG6), SW_SHOW);
   }
 }
 
 #define NS_SAMPLE_URL "http://mozilla.org"
 
 void updateUI(HWND hWnd)
 {
-  CPlugin * pPlugin = (CPlugin *)GetWindowLong(hWnd, DWL_USER);
+  CPlugin * pPlugin = (CPlugin *)GetWindowLongPtr(hWnd, DWLP_USER);
   assert(pPlugin != NULL);
 
   DWORD dwNPInstance = (DWORD)pPlugin->getNPInstance();
   char szNPInstance[16];
   wsprintf(szNPInstance, "%#08lx", dwNPInstance);
   Static_SetText(GetDlgItem(hWnd, IDC_STATIC_INFO), "");
   ShowWindow(GetDlgItem(hWnd, IDC_STATIC_INFO), SW_HIDE);
 
@@ -432,17 +432,17 @@ NPByteRange g_npByteRangeList[] = {
    {100, 100, npByteRangeList + 1},
    {200, 100, npByteRangeList + 2},
    {300, 100, 0}
 };
 */
 
 void onGo(HWND hWnd)
 {
-  CPlugin * pPlugin = (CPlugin *)GetWindowLong(hWnd, DWL_USER);
+  CPlugin * pPlugin = (CPlugin *)GetWindowLongPtr(hWnd, DWLP_USER);
   assert(pPlugin != NULL);
 
   char szString[80];
   char sz1[128];
   char sz2[128];
   char sz3[128];
   char sz4[128];
   BOOL bTranslated = FALSE;