This is an automated email from the ASF dual-hosted git repository.

jimjag pushed a commit to branch AOO50X
in repository https://gitbox.apache.org/repos/asf/openoffice.git

commit 4cd91ec9534d0d629332c553b1949653af5116ca
Author: Peter <[email protected]>
AuthorDate: Sat Nov 14 22:58:30 2026 +0100

    Win64: do not cut pointers stored with windows and menu items to 32 bits
    
    Playing a sound in Impress and right-clicking the Quickstarter tray icon
    crashed; crashrep and embedserv had the same pattern.
    
    Only the Win64 hunks of the Win7 floor change are taken.
    (cherry picked from commit c34c9f813125780dafc52d725b4057487d838338)
---
 main/avmedia/source/win/player.cxx            | 6 +++---
 main/avmedia/source/win/window.cxx            | 6 +++---
 main/crashrep/source/win32/soreport.cpp       | 2 +-
 main/embedserv/source/embed/syswinwrapper.cxx | 6 +++---
 main/sfx2/source/appl/shutdowniconw32.cxx     | 2 +-
 5 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/main/avmedia/source/win/player.cxx 
b/main/avmedia/source/win/player.cxx
index 94e75e781a..a24f3d9e4d 100644
--- a/main/avmedia/source/win/player.cxx
+++ b/main/avmedia/source/win/player.cxx
@@ -50,7 +50,7 @@ namespace avmedia { namespace win {
 
 LRESULT CALLBACK MediaPlayerWndProc_2( HWND hWnd,UINT nMsg, WPARAM nPar1, 
LPARAM nPar2 )
 {
-    Player* pPlayer = (Player*) ::GetWindowLong( hWnd, 0 );
+    Player* pPlayer = reinterpret_cast< Player* >( ::GetWindowLongPtr( hWnd, 0 
) );
     bool    bProcessed = true;
 
     if( pPlayer )
@@ -277,7 +277,7 @@ void SAL_CALL Player::start(  )
 
                                memset( mpWndClass, 0, sizeof( *mpWndClass ) );
                                mpWndClass->hInstance = GetModuleHandle( NULL );
-                               mpWndClass->cbWndExtra = sizeof( DWORD );
+                               mpWndClass->cbWndExtra = sizeof( LONG_PTR );
                                mpWndClass->lpfnWndProc = MediaPlayerWndProc_2;
                                mpWndClass->lpszClassName = 
"com_sun_star_media_Sound_Player";
                                mpWndClass->hbrBackground = (HBRUSH) 
::GetStockObject( BLACK_BRUSH );
@@ -294,7 +294,7 @@ void SAL_CALL Player::start(  )
                                if ( mnFrameWnd )
                                {
                                        ::ShowWindow((HWND) mnFrameWnd, 
SW_HIDE);
-                                       ::SetWindowLong( (HWND) mnFrameWnd, 0, 
(DWORD) this );
+                                       ::SetWindowLongPtr( (HWND) mnFrameWnd, 
0, reinterpret_cast< LONG_PTR >( this ) );
                                        // mpVW->put_Owner( (OAHWND) mnFrameWnd 
);
                                        setNotifyWnd( mnFrameWnd );
                                }
diff --git a/main/avmedia/source/win/window.cxx 
b/main/avmedia/source/win/window.cxx
index 026fd3536b..fa4172a26d 100644
--- a/main/avmedia/source/win/window.cxx
+++ b/main/avmedia/source/win/window.cxx
@@ -75,7 +75,7 @@ static ::osl::Mutex& ImplGetOwnStaticMutex()
 
 LRESULT CALLBACK MediaPlayerWndProc( HWND hWnd,UINT nMsg, WPARAM nPar1, LPARAM 
nPar2 )
 {
-    Window* pWindow = (Window*) ::GetWindowLong( hWnd, 0 );
+    Window* pWindow = reinterpret_cast< Window* >( ::GetWindowLongPtr( hWnd, 0 
) );
     bool    bProcessed = true;
 
     if( pWindow )
@@ -184,7 +184,7 @@ WNDCLASS* lcl_getWndClass()
 
         memset( s_pWndClass, 0, sizeof( *s_pWndClass ) );
         s_pWndClass->hInstance = GetModuleHandle( NULL );
-        s_pWndClass->cbWndExtra = sizeof( DWORD );
+        s_pWndClass->cbWndExtra = sizeof( LONG_PTR );
         s_pWndClass->lpfnWndProc = MediaPlayerWndProc;
         s_pWndClass->lpszClassName = "com_sun_star_media_PlayerWnd";
         s_pWndClass->hbrBackground = (HBRUSH) ::GetStockObject( BLACK_BRUSH );
@@ -342,7 +342,7 @@ bool Window::create( const uno::Sequence< uno::Any >& 
rArguments )
 
         if( mnFrameWnd )
         {
-            ::SetWindowLong( (HWND) mnFrameWnd, 0, (DWORD) this );
+            ::SetWindowLongPtr( (HWND) mnFrameWnd, 0, reinterpret_cast< 
LONG_PTR >( this ) );
 
 #ifdef DDRAW_TEST_OUTPUT
             IDirectDraw7*           pDDraw;
diff --git a/main/crashrep/source/win32/soreport.cpp 
b/main/crashrep/source/win32/soreport.cpp
index 850f5111bb..7a8005cdfc 100644
--- a/main/crashrep/source/win32/soreport.cpp
+++ b/main/crashrep/source/win32/soreport.cpp
@@ -1392,7 +1392,7 @@ INT_PTR CALLBACK DialogProc( HWND hwndDlg, UINT uMsg, 
WPARAM wParam, LPARAM lPar
                        HINSTANCE       hInstance = 
(HINSTANCE)GetWindowLongPtr(hwndDlg, GWLP_HINSTANCE );
                        TCHAR           szBuffer[FORMATBUFSIZE];
 
-                       SetWindowLongPtr( hwndDlg, GWLP_USERDATA, (LONG)lParam 
);
+                       SetWindowLongPtr( hwndDlg, GWLP_USERDATA, 
(LONG_PTR)lParam );
                        hwndPages[0] = CreateDialog(
                                hInstance,
                                MAKEINTRESOURCE(IDD_WELCOME_PAGE),
diff --git a/main/embedserv/source/embed/syswinwrapper.cxx 
b/main/embedserv/source/embed/syswinwrapper.cxx
index 1910e9e14f..d81618ca99 100644
--- a/main/embedserv/source/embed/syswinwrapper.cxx
+++ b/main/embedserv/source/embed/syswinwrapper.cxx
@@ -43,7 +43,7 @@ using namespace winwrap;
 
 //Notification codes for WM_COMMAND messages
 #define HWN_BORDERDOUBLECLICKED         1
-#define CBHATCHWNDEXTRA                 (sizeof(LONG))
+#define CBHATCHWNDEXTRA                 (sizeof(LONG_PTR))
 #define SZCLASSHATCHWIN                 TEXT("hatchwin")
 #define SendCommand(hWnd, wID, wCode, hControl)                     \
             SendMessage(hWnd, WM_COMMAND, MAKEWPARAM(wID, wCode)    \
@@ -402,14 +402,14 @@ LRESULT APIENTRY winwrap::HatchWndProc(
     HDC         hDC;
     PAINTSTRUCT ps;
 
-    phw=(PCHatchWin)GetWindowLong(hWnd, HWWL_STRUCTURE);
+    phw=(PCHatchWin)GetWindowLongPtr(hWnd, HWWL_STRUCTURE);
     POINT ptMouse;
 
     switch (iMsg)
     {
         case WM_CREATE:
             phw=(PCHatchWin)((LPCREATESTRUCT)lParam)->lpCreateParams;
-            SetWindowLong(hWnd, HWWL_STRUCTURE, (LONG)phw);
+            SetWindowLongPtr(hWnd, HWWL_STRUCTURE, (LONG_PTR)phw);
             break;
         case WM_PAINT:
             hDC=BeginPaint(hWnd,&ps);
diff --git a/main/sfx2/source/appl/shutdowniconw32.cxx 
b/main/sfx2/source/appl/shutdowniconw32.cxx
index 42965e9bce..8c455ca6e2 100644
--- a/main/sfx2/source/appl/shutdowniconw32.cxx
+++ b/main/sfx2/source/appl/shutdowniconw32.cxx
@@ -173,7 +173,7 @@ static void addMenuItem( HMENU hMenu, UINT id, UINT iconId, 
const OUString& text
             pMyItem->text = text;
             pMyItem->iconId = iconId;
             pMyItem->module = module;
-            mi.dwItemData = (DWORD) pMyItem;
+            mi.dwItemData = reinterpret_cast< ULONG_PTR >( pMyItem );
         }
         else
         {

Reply via email to