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

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


The following commit(s) were added to refs/heads/trunk by this push:
     new c34c9f8131 Win7 floor trunk (#518)
c34c9f8131 is described below

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

    Win7 floor trunk (#518)
    
    Windows 7 SP1 floor
    
        solenv: Windows API floor _WIN32_WINNT=0x0601; _WIN32_IE no longer 
pinned
        python: Python 3.11 built for Windows 7 SP1
        sal/uwinapi: psapi thunks built with PSAPI_VERSION 1
        instsetoo_native, setup.exe: refuse to install below Windows 7 SP1
        external/vcredist: bundle the VS2019 (14.29) redistributable, the last 
that installs on Windows 7
        installer: keep the build id within the range Windows Installer allows
        lngconvex: fall back to en-US for untranslated strings
        docs: the Windows floor is Windows 7 SP1
    
    Win64 crashes (pointers cut to 32 bits)
    
        avmedia: playing a sound in Impress crashed ("SEH Exception: ACCESS 
VIOLATION")
        sfx2: right-clicking the Quickstarter tray icon crashed and brought up 
document recovery
        crashrep, embedserv: same pattern fixed
    
    These show on Windows 11 but rarely on Windows 7, because only Windows 8 
and later place heap memory above 4 GB.
    Impress
    
        sd: opening a .ppt as the first document crashed right after import. 
The PPT filter library (and msfilter with it) was unloaded while the document 
still held objects whose code lives there. Filter libraries now stay loaded 
once used.
    
    Installer
    
        Require .NET 4 before installing the CLI assemblies; on Windows 7 
without .NET 4 they are skipped instead of failing with error 1304
        Download installer: no welcome or folder page; unpacks to a kept folder 
under ProgramData so repair finds its source; removes installation folders of 
products that are no longer installed
        New "Reset my user profile" checkbox (or RESETUSERPROFILE=1): renames 
the profile to a timestamped backup after a successful install
        Another build of the same version now replaces the installed one 
instead of aborting with "same version already installed"
    
    Co-authored-by: Claude Opus 5.5 <[email protected]>
---
 main/avmedia/source/win/player.cxx                 |   6 +-
 main/avmedia/source/win/window.cxx                 |   6 +-
 main/crashrep/source/win32/soreport.cpp            |   2 +-
 main/desktop/win32/source/setup/setup.cpp          |  51 +--
 main/desktop/win32/source/setup/setup.ulf          |   2 +-
 main/embedserv/source/embed/syswinwrapper.cxx      |   6 +-
 main/external/vcredist/README                      |  37 +-
 .../windows/msi_languages/Control.ulf              |   3 +
 .../windows/msi_languages/LaunchCo.ulf             |   2 +
 .../windows/msi_templates/CheckBox.idt             |   1 +
 .../windows/msi_templates/Control.idt              |   1 +
 .../windows/msi_templates/LaunchCo.idt             |   3 +-
 .../windows/msi_templates/Property.idt             |   2 +-
 main/python/makefile.mk                            |  11 +
 main/python/python-3.11.15-win7.patch              | 414 +++++++++++++++++++++
 main/sal/systools/win32/uwinapi/makefile.mk        |   7 +
 main/scp2/source/ooo/windowscustomaction_ooo.scp   |  14 +
 main/sd/source/filter/sdfilter.cxx                 |  23 +-
 .../customactions/shellextensions/exports.dxp      |   1 +
 .../customactions/shellextensions/makefile.mk      |   3 +-
 .../customactions/shellextensions/resetprofile.cxx | 150 ++++++++
 .../source/win32/nsis/downloadtemplate.nsi         |  81 +++-
 main/sfx2/source/appl/shutdowniconw32.cxx          |   2 +-
 main/shell/source/tools/lngconvex/lngconvex.cxx    |  18 +
 main/solenv/bin/modules/installer/globals.pm       |   5 +-
 main/solenv/bin/modules/installer/windows/file.pm  |   9 +
 .../bin/modules/installer/windows/upgrade.pm       |  14 +-
 main/solenv/gbuild/platform/windows.mk             |   6 +-
 main/solenv/inc/minor.mk                           |  11 +-
 main/solenv/inc/wntmsci11.mk                       |  13 +-
 main/solenv/inc/wntmscx.mk                         |  13 +-
 win10-msvc/README.md                               |  62 +++
 32 files changed, 911 insertions(+), 68 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 5002c4bbf1..8072023adf 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/desktop/win32/source/setup/setup.cpp 
b/main/desktop/win32/source/setup/setup.cpp
index 6e62b818d5..bd589b391d 100644
--- a/main/desktop/win32/source/setup/setup.cpp
+++ b/main/desktop/win32/source/setup/setup.cpp
@@ -67,10 +67,13 @@
 #define ERROR_OS_TO_OLD       -5
 #define ERROR_RUNTIME_FAILED  -6
 
-// Lowest Windows this office can run on.  Not an arbitrary policy: the VC v14
-// redistributable that supplies the runtime the binaries need installs only on
-// Windows 10/11 and Server 2016 and later, so the floor comes with the 
toolset.
-#define REQUIRED_WINDOWS_MAJOR  10
+// Lowest Windows this office can run on: Windows 7 SP1 (6.1 SP1), matching the
+// WINVER/_WIN32_WINNT 0x0601 the office is compiled for and the MSI launch
+// condition.  The bundled VC v14 redistributable must still install there --
+// current releases do not; see external/vcredist/README.
+#define REQUIRED_WINDOWS_MAJOR  6
+#define REQUIRED_WINDOWS_MINOR  1
+#define REQUIRED_WINDOWS_SP     1
 
 #define PARAM_SETUP_USED    TEXT( " SETUP_USED=1 " )
 #define PARAM_PACKAGE       TEXT( "/I " )
@@ -1861,9 +1864,9 @@ boolean SetupApp::IsPatchInstalled( TCHAR* pBaseDir, 
TCHAR* pFileName )
 // as an MSI LaunchCondition, and lives here instead.
 //
 // RtlGetVersion is not subject to that shim.
-static bool GetRealWindowsVersion( DWORD *pMajor, DWORD *pBuild )
+static bool GetRealWindowsVersion( OSVERSIONINFOEXW *pInfo )
 {
-    typedef LONG ( WINAPI *pfnRtlGetVersion_t )( OSVERSIONINFOW * );
+    typedef LONG ( WINAPI *pfnRtlGetVersion_t )( OSVERSIONINFOEXW * );
 
     HMODULE hNtdll = ::GetModuleHandle( TEXT( "ntdll.dll" ) );
     if ( hNtdll == NULL )
@@ -1874,25 +1877,18 @@ static bool GetRealWindowsVersion( DWORD *pMajor, DWORD 
*pBuild )
     if ( pRtlGetVersion == NULL )
         return false;
 
-    OSVERSIONINFOW aInfo;
-    ZeroMemory( &aInfo, sizeof( aInfo ) );
-    aInfo.dwOSVersionInfoSize = sizeof( aInfo );
+    ZeroMemory( pInfo, sizeof( *pInfo ) );
+    pInfo->dwOSVersionInfoSize = sizeof( *pInfo );
 
-    if ( pRtlGetVersion( &aInfo ) != 0 )
-        return false;
-
-    *pMajor = aInfo.dwMajorVersion;
-    *pBuild = aInfo.dwBuildNumber;
-    return true;
+    return pRtlGetVersion( pInfo ) == 0;
 }
 
 //--------------------------------------------------------------------------
 boolean SetupApp::CheckOSVersion()
 {
-    DWORD nMajor = 0;
-    DWORD nBuild = 0;
+    OSVERSIONINFOEXW aInfo;
 
-    if ( !GetRealWindowsVersion( &nMajor, &nBuild ) )
+    if ( !GetRealWindowsVersion( &aInfo ) )
     {
         // Could not determine the version.  Let the install proceed rather 
than
         // refuse on a machine we simply failed to identify -- if the OS 
really is too
@@ -1903,15 +1899,24 @@ boolean SetupApp::CheckOSVersion()
 
     TCHAR sBuf[ 128 ];
 
-    StringCchPrintf( sBuf, 128, TEXT( " Windows major version %u, build 
%u\r\n" ),
-                     nMajor, nBuild );
+    StringCchPrintf( sBuf, 128, TEXT( " Windows version %u.%u build %u, 
service pack %u\r\n" ),
+                     aInfo.dwMajorVersion, aInfo.dwMinorVersion, 
aInfo.dwBuildNumber,
+                     (DWORD)aInfo.wServicePackMajor );
     Log( sBuf );
 
-    if ( nMajor < REQUIRED_WINDOWS_MAJOR )
+    const DWORD nHave = ( aInfo.dwMajorVersion << 16 ) | ( 
aInfo.dwMinorVersion << 8 )
+                        | aInfo.wServicePackMajor;
+    const DWORD nNeed = ( REQUIRED_WINDOWS_MAJOR << 16 ) | ( 
REQUIRED_WINDOWS_MINOR << 8 )
+                        | REQUIRED_WINDOWS_SP;
+
+    if ( nHave < nNeed )
     {
         StringCchPrintf( sBuf, 128,
-                         TEXT( "ERROR: Windows %u is older than the required 
Windows %u.\r\n" ),
-                         nMajor, (DWORD)REQUIRED_WINDOWS_MAJOR );
+                         TEXT( "ERROR: Windows %u.%u SP%u is older than the 
required Windows %u.%u SP%u.\r\n" ),
+                         aInfo.dwMajorVersion, aInfo.dwMinorVersion,
+                         (DWORD)aInfo.wServicePackMajor,
+                         (DWORD)REQUIRED_WINDOWS_MAJOR, 
(DWORD)REQUIRED_WINDOWS_MINOR,
+                         (DWORD)REQUIRED_WINDOWS_SP );
         Log( sBuf );
         SetError( ERROR_OS_TO_OLD );
         return false;
diff --git a/main/desktop/win32/source/setup/setup.ulf 
b/main/desktop/win32/source/setup/setup.ulf
index 1950668380..b0f326d96c 100644
--- a/main/desktop/win32/source/setup/setup.ulf
+++ b/main/desktop/win32/source/setup/setup.ulf
@@ -50,7 +50,7 @@ en-US = "This package requires at least the version '%s' of 
the Windows Installe
 en-US = "This package requires the Windows Installer. \nYou need at least 
Windows Installer '%s' on your system!"
 
 [%OS_TO_OLD%]
-en-US = "This version of %PRODUCTNAME% requires Windows 10 or later. \nIt 
cannot be installed on this version of Windows."
+en-US = "This version of %PRODUCTNAME% requires Windows 7 Service Pack 1 or 
later. \nIt cannot be installed on this version of Windows."
 
 [%RUNTIME_FAILED%]
 en-US = "The Microsoft Visual C++ runtime could not be installed. 
\n%PRODUCTNAME% cannot run without it, so the installation has been stopped."
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/external/vcredist/README b/main/external/vcredist/README
index 1c81afe604..9ee16b48df 100644
--- a/main/external/vcredist/README
+++ b/main/external/vcredist/README
@@ -11,12 +11,16 @@ desktop/win32/source/setup/setup.cpp all refer to the 
vcredist_* spelling.
 
 Which ones
 ----------
-The Visual C++ v14 Redistributable (Visual Studio 2015-2022), latest version:
+The Visual C++ v14 Redistributable that ships with the Visual Studio 2019
+build tools used to compile the office (14.29.x, VS2019 16.11).  It is
+already on the build machine:
 
-    x86  https://aka.ms/vc14/vc_redist.x86.exe
-    x64  https://aka.ms/vc14/vc_redist.x64.exe
+    <VS2019>/VC/Redist/MSVC/14.29.30133/vc_redist.x86.exe
+    <VS2019>/VC/Redist/MSVC/14.29.30133/vc_redist.x64.exe
 
-These are permalinks that always resolve to the current v14 release.
+Do NOT take the "latest" permalinks (https://aka.ms/vc14/vc_redist.x64.exe):
+the current v14 releases no longer install on Windows 7 SP1, which is this
+build's floor -- see below.
 
 The rule is that the redistributable must be the same version as, or newer
 than, the MSVC build tools used to compile the office.  A v14 redistributable
@@ -34,11 +38,20 @@ runtime.
 
 Supported Windows versions
 --------------------------
-The current v14 redistributable supports Windows 10 and 11, and Windows Server
-2016 / 2019 / 2022 / 2025 -- it does not install on anything older.  That is
-what sets the minimum Windows version for a build made with a modern toolset;
-it is not an independent choice.
-
-If an older floor is ever needed, an older v14 servicing release has to be
-pinned here explicitly, and its own supported-OS list checked -- the v14 line
-has raised its floor over time.
+The office is built for Windows 7 SP1 (WINVER/_WIN32_WINNT 0x0601), and both
+setup.exe and the MSI launch condition enforce that floor.  The bundled
+redistributable must therefore install on Windows 7 SP1 too.
+
+The current v14 redistributable supports only Windows 10 and 11 and Windows
+Server 2016 and later -- it does not install on anything older.  The VS2019
+16.11 redistributable (14.29.x) still supports Windows 7 SP1, and because it
+matches the toolset it also satisfies "same version or newer".  If the
+toolset is ever raised, the redistributable has to move with it, and the new
+release's supported-OS list has to be checked against the floor -- the v14
+line has raised its floor over time.
+
+Check what is in this directory before building: the file version of
+vcredist_x64.exe must start with 14., not 9.0.  setup.exe runs it with the v14
+switches "/install /quiet /norestart"; the 2008 package does not understand
+them, fails, and setup.exe stops with "The Microsoft Visual C++ runtime could
+not be installed".
diff --git 
a/main/instsetoo_native/inc_openoffice/windows/msi_languages/Control.ulf 
b/main/instsetoo_native/inc_openoffice/windows/msi_languages/Control.ulf
index 6a1f959824..a7f70e7288 100644
--- a/main/instsetoo_native/inc_openoffice/windows/msi_languages/Control.ulf
+++ b/main/instsetoo_native/inc_openoffice/windows/msi_languages/Control.ulf
@@ -745,6 +745,9 @@ en-US = "Create shortcut on desktop"
 [OOO_CONTROL_320]
 en-US = "Remove all older product versions"
 
+[OOO_CONTROL_321]
+en-US = "Reset my user profile (the current one is kept as a backup)"
+
 [OOO_CONTROL_LANG_1033]
 en-US = "English"
 
diff --git 
a/main/instsetoo_native/inc_openoffice/windows/msi_languages/LaunchCo.ulf 
b/main/instsetoo_native/inc_openoffice/windows/msi_languages/LaunchCo.ulf
index 7f443b1949..9ac0306ab3 100644
--- a/main/instsetoo_native/inc_openoffice/windows/msi_languages/LaunchCo.ulf
+++ b/main/instsetoo_native/inc_openoffice/windows/msi_languages/LaunchCo.ulf
@@ -23,3 +23,5 @@
 en-US = "The Installation Wizard cannot be run properly because you are logged 
in as a user without sufficient administrator rights for this system."
 [OOO_LAUNCH_2]
 en-US = "Please use the file setup.exe to start the installation."
+[OOO_LAUNCH_3]
+en-US = "[ProductName] requires Windows 7 Service Pack 1 or later."
diff --git 
a/main/instsetoo_native/inc_openoffice/windows/msi_templates/CheckBox.idt 
b/main/instsetoo_native/inc_openoffice/windows/msi_templates/CheckBox.idt
index 55fa8776f0..ed7241e756 100644
--- a/main/instsetoo_native/inc_openoffice/windows/msi_templates/CheckBox.idt
+++ b/main/instsetoo_native/inc_openoffice/windows/msi_templates/CheckBox.idt
@@ -4,3 +4,4 @@ CheckBox        Property
 ISCHECKFORPRODUCTUPDATES       1
 CREATEDESKTOPLINK      1
 REMOVEOLDPRODUCTS      1
+RESETUSERPROFILE       1
diff --git 
a/main/instsetoo_native/inc_openoffice/windows/msi_templates/Control.idt 
b/main/instsetoo_native/inc_openoffice/windows/msi_templates/Control.idt
index c3dad2a167..6a0b503b5c 100644
--- a/main/instsetoo_native/inc_openoffice/windows/msi_templates/Control.idt
+++ b/main/instsetoo_native/inc_openoffice/windows/msi_templates/Control.idt
@@ -237,6 +237,7 @@ ReadyToInstall      DlgTitle3       Text    13      6       
257     25      65538           OOO_CONTROL_172
 ReadyToInstall InstallNow      PushButton      230     243     66      17      
3               OOO_CONTROL_173 Cancel  
 ReadyToInstall DesktopLink     CheckBox        21      100     300     10      
3       CREATEDESKTOPLINK       OOO_CONTROL_319         
 ReadyToInstall UpdateCheckBox  CheckBox        21      120     200     10      
3       REMOVEOLDPRODUCTS       OOO_CONTROL_320         
+ReadyToInstall ResetProfile    CheckBox        21      140     330     10      
3       RESETUSERPROFILE        OOO_CONTROL_321         
 ReadyToRemove  Back    PushButton      164     243     66      17      3       
        OOO_CONTROL_174 RemoveNow       
 ReadyToRemove  Banner  Bitmap  0       0       374     44      1048577         
BannerBmp               
 ReadyToRemove  BannerLine      Line    0       44      376     0       1       
                        
diff --git 
a/main/instsetoo_native/inc_openoffice/windows/msi_templates/LaunchCo.idt 
b/main/instsetoo_native/inc_openoffice/windows/msi_templates/LaunchCo.idt
index 3fe0c20621..0ab3f179aa 100644
--- a/main/instsetoo_native/inc_openoffice/windows/msi_templates/LaunchCo.idt
+++ b/main/instsetoo_native/inc_openoffice/windows/msi_templates/LaunchCo.idt
@@ -2,4 +2,5 @@ Condition       Description
 s255   l255
 WINDOWSENCODINGTEMPLATE        LaunchCondition Condition
 Privileged     OOO_LAUNCH_1
-(VersionNT < 600) or (SETUP_USED=1) or Installed       OOO_LAUNCH_2 
\ No newline at end of file
+(VersionNT < 600) or (SETUP_USED=1) or Installed       OOO_LAUNCH_2 
+(VersionNT > 601) or (VersionNT = 601 and ServicePackLevel >= 1) or Installed  
OOO_LAUNCH_3
\ No newline at end of file
diff --git 
a/main/instsetoo_native/inc_openoffice/windows/msi_templates/Property.idt 
b/main/instsetoo_native/inc_openoffice/windows/msi_templates/Property.idt
index 3225f742a9..616247f76d 100644
--- a/main/instsetoo_native/inc_openoffice/windows/msi_templates/Property.idt
+++ b/main/instsetoo_native/inc_openoffice/windows/msi_templates/Property.idt
@@ -43,7 +43,7 @@ Quickstarterlinkname  QUICKSTARTERLINKNAMETEMPLATE
 RebootYesNo    Yes
 ReinstallModeText      omus
 REMOVEOLDPRODUCTS      1
-SecureCustomProperties 
NEWPRODUCTS;SAMEPRODUCTS;OLDPRODUCTS;OLDPRODUCTSSAMEMAJOR;OLDPRODUCTS2;BETAPRODUCTS;STUBPRODUCTS;O2LPAF;O2LPAR;O2LPASIN;O2LPBEBY;O2LPBO;O2LPBG;O2LPBR;O2LPBRX;O2LPBN;O2LPBNBD;O2LPBNIN;O2LPBS;O2LPBY;O2LPCA;O2LPCS;O2LPCY;O2LPDA;O2LPDE;O2LPDGO;O2LPDZ;O2LPEL;O2LPENGB;O2LPENUS;O2LPENZA;O2LPEO;O2LPES;O2LPET;O2LPEU;O2LPFA;O2LPFI;O2LPFR;O2LPGA;O2LPGD;O2LPGL;O2LPGU;O2LPGUIN;O2LPHE;O2LPHI;O2LPHIIN;O2LPHR;O2LPHU;O2LPIS;O2LPIT;O2LPJA;O2LPKID;O2LPKY;O2LPKA;O2LPKK;O2LPKM;O2LPKN;O
 [...]
+SecureCustomProperties 
NEWPRODUCTS;SAMEPRODUCTS;OLDPRODUCTS;OLDPRODUCTSSAMEMAJOR;OLDPRODUCTS2;BETAPRODUCTS;STUBPRODUCTS;O2LPAF;O2LPAR;O2LPASIN;O2LPBEBY;O2LPBO;O2LPBG;O2LPBR;O2LPBRX;O2LPBN;O2LPBNBD;O2LPBNIN;O2LPBS;O2LPBY;O2LPCA;O2LPCS;O2LPCY;O2LPDA;O2LPDE;O2LPDGO;O2LPDZ;O2LPEL;O2LPENGB;O2LPENUS;O2LPENZA;O2LPEO;O2LPES;O2LPET;O2LPEU;O2LPFA;O2LPFI;O2LPFR;O2LPGA;O2LPGD;O2LPGL;O2LPGU;O2LPGUIN;O2LPHE;O2LPHI;O2LPHIIN;O2LPHR;O2LPHU;O2LPIS;O2LPIT;O2LPJA;O2LPKID;O2LPKY;O2LPKA;O2LPKK;O2LPKM;O2LPKN;O
 [...]
 SetupType      Typical
 SELECT_WORD    0
 SELECT_EXCEL   0
diff --git a/main/python/makefile.mk b/main/python/makefile.mk
index 14c307e125..587785203c 100644
--- a/main/python/makefile.mk
+++ b/main/python/makefile.mk
@@ -58,6 +58,17 @@ PATCH_FILES+=python-$(PYVERSION)-selfcontained.patch
 #   through the compiler include/lib search paths instead of the old hard-coded
 #   source edit; see python_CFLAGS/python_LDFLAGS in the UNX branch below.
 
+# Windows 7 SP1, the office's floor, where upstream Python 3.9+ wants
+# Windows 8: PC/pyconfig.h's Py_WINVER/Py_NTDDI lowered to Windows 7, and
+# pythoncore no longer imports pathcch.lib (its API set does not exist on
+# Windows 7, so python311.dll would not even load there) -- PC/pathcch_win7.c
+# calls the real PathCch* functions where KernelBase exports them and falls
+# back to their documented behaviour on Windows 7.  _freeze_module keeps
+# pathcch.lib: it only runs on the build machine.
+.IF "$(GUI)"=="WNT"
+PATCH_FILES += python-$(PYVERSION)-win7.patch
+.ENDIF
+
 # Windows build deferred — Python 3 requires modern MSVC (VS2008/msvs9 not 
supported).
 # The msvs9 patch files below are retained for reference but are NOT applied 
until
 # the Windows toolchain is modernised. See python3 migration notes.
diff --git a/main/python/python-3.11.15-win7.patch 
b/main/python/python-3.11.15-win7.patch
new file mode 100644
index 0000000000..2296e1792b
--- /dev/null
+++ b/main/python/python-3.11.15-win7.patch
@@ -0,0 +1,414 @@
+diff -ruN misc/Python-3.11.15/PC/aoo_win7_compat.h 
misc/build/Python-3.11.15/PC/aoo_win7_compat.h
+--- misc/Python-3.11.15/PC/aoo_win7_compat.h   1970-01-01 00:00:00.000000000 
+0000
++++ misc/build/Python-3.11.15/PC/aoo_win7_compat.h     2025-01-01 
00:00:00.000000000 +0000
+@@ -0,0 +1,48 @@
++/*
++ * Licensed to the Apache Software Foundation (ASF) under one
++ * or more contributor license agreements.  See the NOTICE file
++ * distributed with this work for additional information
++ * regarding copyright ownership.  The ASF licenses this file
++ * to you under the Apache License, Version 2.0 (the
++ * "License"); you may not use this file except in compliance
++ * with the License.  You may obtain a copy of the License at
++ *
++ *   http://www.apache.org/licenses/LICENSE-2.0
++ *
++ * Unless required by applicable law or agreed to in writing,
++ * software distributed under the License is distributed on an
++ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
++ * KIND, either express or implied.  See the License for the
++ * specific language governing permissions and limitations
++ * under the License.
++ */
++
++/*
++ * Force-included into every CPython translation unit 
(PCbuild/pyproject.props,
++ * ForcedIncludeFiles).
++ *
++ * CPython 3.11 is compiled here at the Windows 7 API level (Py_WINVER 0x0601
++ * in PC/pyconfig.h) instead of upstream's Windows 8 one, so the SDK hides 
what it
++ * gates on Windows 8.  Most of that would be a real dependency and must stay 
a
++ * compile error.  What is defined here is only what CPython uses WITHOUT
++ * depending on Windows 8 -- plain constants, never functions -- each with the
++ * use that makes it safe.  The values are the SDK's.
++ *
++ * Found by matching every name the 10.0.19041.0 SDK declares under a Windows 
8
++ * or later guard against the sources this module compiles.
++ */
++
++#ifndef AOO_PYTHON_WIN7_COMPAT_H
++#define AOO_PYTHON_WIN7_COMPAT_H
++
++/* WinNls.h, WINVER >= _WIN32_WINNT_WIN8.  Modules/_winapi.c
++   (_winapi.LCMapStringEx) only uses them to reject these flags with
++   ValueError before calling LCMapStringEx, which itself exists from Vista. */
++#ifndef LCMAP_SORTHANDLE
++#define LCMAP_SORTHANDLE 0x20000000
++#endif
++#ifndef LCMAP_HASH
++#define LCMAP_HASH       0x00040000
++#endif
++
++#endif /* AOO_PYTHON_WIN7_COMPAT_H */
+diff -ruN misc/Python-3.11.15/PC/pathcch.h 
misc/build/Python-3.11.15/PC/pathcch.h
+--- misc/Python-3.11.15/PC/pathcch.h   1970-01-01 00:00:00.000000000 +0000
++++ misc/build/Python-3.11.15/PC/pathcch.h     2025-01-01 00:00:00.000000000 
+0000
+@@ -0,0 +1,63 @@
++/*
++ * Licensed to the Apache Software Foundation (ASF) under one
++ * or more contributor license agreements.  See the NOTICE file
++ * distributed with this work for additional information
++ * regarding copyright ownership.  The ASF licenses this file
++ * to you under the Apache License, Version 2.0 (the
++ * "License"); you may not use this file except in compliance
++ * with the License.  You may obtain a copy of the License at
++ *
++ *   http://www.apache.org/licenses/LICENSE-2.0
++ *
++ * Unless required by applicable law or agreed to in writing,
++ * software distributed under the License is distributed on an
++ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
++ * KIND, either express or implied.  See the License for the
++ * specific language governing permissions and limitations
++ * under the License.
++ */
++
++/*
++ * Stand-in for the Windows SDK's <pathcch.h>, for a Python that must load on
++ * Windows 7 SP1.
++ *
++ * The SDK header declares the PathCch* functions as imports from
++ * api-ms-win-core-path-l1-1-0.dll, an API set that exists from Windows 8 on.
++ * A python311.dll importing it statically cannot be loaded on Windows 7 at
++ * all.  This file lives in PC/, which is on the include path ahead of the 
SDK,
++ * so `#include <pathcch.h>` in getpath.c, posixmodule.c, fileutils.c and
++ * pathconfig.c resolves here instead and the SDK header is never seen.
++ *
++ * Only what those four files use is declared.  The definitions in
++ * PC/pathcch_win7.c call the real functions from KernelBase.dll when it
++ * exports them (Windows 8 and later), so behaviour there is the system's own;
++ * the fallbacks only ever run on Windows 7.
++ */
++
++#ifndef AOO_PYTHON_PATHCCH_H
++#define AOO_PYTHON_PATHCCH_H
++
++#include <windows.h>
++
++#ifdef __cplusplus
++extern "C" {
++#endif
++
++#define PATHCCH_NONE             0x00000000
++#define PATHCCH_ALLOW_LONG_PATHS 0x00000001
++
++/* Largest buffer, in characters, the PathCch functions accept. */
++#define PATHCCH_MAX_CCH          0x8000
++
++HRESULT WINAPI PathCchSkipRoot(PCWSTR pszPath, PCWSTR *ppszRootEnd);
++HRESULT WINAPI PathCchFindExtension(PCWSTR pszPath, size_t cchPath,
++                                    PCWSTR *ppszExt);
++HRESULT WINAPI PathCchCombineEx(PWSTR pszPathOut, size_t cchPathOut,
++                                PCWSTR pszPathIn, PCWSTR pszMore,
++                                ULONG dwFlags);
++
++#ifdef __cplusplus
++}
++#endif
++
++#endif /* AOO_PYTHON_PATHCCH_H */
+diff -ruN misc/Python-3.11.15/PC/pathcch_win7.c 
misc/build/Python-3.11.15/PC/pathcch_win7.c
+--- misc/Python-3.11.15/PC/pathcch_win7.c      1970-01-01 00:00:00.000000000 
+0000
++++ misc/build/Python-3.11.15/PC/pathcch_win7.c        2025-01-01 
00:00:00.000000000 +0000
+@@ -0,0 +1,241 @@
++/*
++ * Licensed to the Apache Software Foundation (ASF) under one
++ * or more contributor license agreements.  See the NOTICE file
++ * distributed with this work for additional information
++ * regarding copyright ownership.  The ASF licenses this file
++ * to you under the Apache License, Version 2.0 (the
++ * "License"); you may not use this file except in compliance
++ * with the License.  You may obtain a copy of the License at
++ *
++ *   http://www.apache.org/licenses/LICENSE-2.0
++ *
++ * Unless required by applicable law or agreed to in writing,
++ * software distributed under the License is distributed on an
++ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
++ * KIND, either express or implied.  See the License for the
++ * specific language governing permissions and limitations
++ * under the License.
++ */
++
++/*
++ * PathCch* for a python311.dll that must load on Windows 7 SP1.  See
++ * PC/pathcch.h for why this exists.
++ *
++ * Each function first asks KernelBase.dll for the real implementation.
++ * KernelBase is mapped into every process from Windows 7 on, so this loads
++ * nothing and searches no directory; from Windows 8 on it exports the PathCch
++ * family and the system's own code runs.  Only when the export is missing --
++ * i.e. on Windows 7 -- does the fallback below run.
++ *
++ * The fallbacks are written from the documented contract of each function,
++ * and cover what Python 3.11 asks of them:
++ *   PathCchSkipRoot      os._path_splitroot (posixmodule.c), _Py_isabs
++ *                        (fileutils.c)
++ *   PathCchFindExtension the ".exe" test in getpath.c's isxfile
++ *   PathCchCombineEx     _Py_join_relfile (fileutils.c), used by getpath
++ * PathCchCombineEx falls back to shlwapi's PathCombineW and so is limited to
++ * MAX_PATH there -- which is the limit Windows 7 itself imposes on the Win32
++ * file API without a \\?\ prefix.
++ */
++
++#include "pathcch.h"
++
++#include <shlwapi.h>
++#include <string.h>
++#include <wchar.h>
++
++typedef HRESULT (WINAPI *skip_root_fn)(PCWSTR, PCWSTR *);
++typedef HRESULT (WINAPI *find_extension_fn)(PCWSTR, size_t, PCWSTR *);
++typedef HRESULT (WINAPI *combine_ex_fn)(PWSTR, size_t, PCWSTR, PCWSTR, ULONG);
++
++/* Looks NAME up in KernelBase.dll once and remembers the answer in *SLOT:
++   0 = not looked up yet, -1 = not exported, otherwise the address.  Two
++   threads racing here store the same value, and a pointer-sized aligned store
++   is atomic on every Windows target, so no lock is needed. */
++static FARPROC
++kernelbase_export(volatile LONG_PTR *slot, const char *name)
++{
++    LONG_PTR value = *slot;
++    if (value == 0) {
++        HMODULE kernelbase = GetModuleHandleW(L"kernelbase.dll");
++        FARPROC proc = kernelbase ? GetProcAddress(kernelbase, name) : NULL;
++        value = proc ? (LONG_PTR)proc : (LONG_PTR)-1;
++        *slot = value;
++    }
++    return value == (LONG_PTR)-1 ? NULL : (FARPROC)value;
++}
++
++/* Advances past one path segment and the backslash ending it, if any. */
++static PCWSTR
++skip_segment(PCWSTR p)
++{
++    while (*p != L'\0' && *p != L'\\') {
++        ++p;
++    }
++    if (*p == L'\\') {
++        ++p;
++    }
++    return p;
++}
++
++static int
++is_drive_letter(WCHAR c)
++{
++    return (c >= L'A' && c <= L'Z') || (c >= L'a' && c <= L'z');
++}
++
++/* "X:" or "X:\" -> the character after it. */
++static PCWSTR
++skip_drive(PCWSTR p)
++{
++    p += 2;
++    if (*p == L'\\') {
++        ++p;
++    }
++    return p;
++}
++
++/* Root forms, as documented for PathCchSkipRoot:
++     C:\path        drive-absolute       root "C:\"
++     C:path         drive-relative       root "C:"
++     \path          rooted               root "\"
++     \\server\share\path                 root "\\server\share\"
++     \\?\C:\path                         root "\\?\C:\"
++     \\?\UNC\server\share\path           root "\\?\UNC\server\share\"
++     \\?\Volume{guid}\path               root "\\?\Volume{guid}\"
++   Anything else -- a relative path -- has no root and is E_INVALIDARG. */
++static HRESULT
++skip_root_fallback(PCWSTR path, PCWSTR *root_end)
++{
++    PCWSTR p;
++
++    if (path == NULL || root_end == NULL || path[0] == L'\0') {
++        return E_INVALIDARG;
++    }
++    *root_end = NULL;
++
++    if (path[0] == L'\\' && path[1] == L'\\') {
++        if (path[2] == L'?') {
++            if (path[3] != L'\\') {
++                return E_INVALIDARG;
++            }
++            p = path + 4;
++            if (_wcsnicmp(p, L"UNC\\", 4) == 0) {
++                p = skip_segment(p + 4);        /* server */
++                p = skip_segment(p);            /* share */
++            }
++            else if (is_drive_letter(p[0]) && p[1] == L':') {
++                p = skip_drive(p);
++            }
++            else if (_wcsnicmp(p, L"Volume{", 7) == 0) {
++                p = skip_segment(p);
++            }
++            else {
++                return E_INVALIDARG;
++            }
++        }
++        else {
++            p = skip_segment(path + 2);         /* server */
++            p = skip_segment(p);                /* share */
++        }
++    }
++    else if (is_drive_letter(path[0]) && path[1] == L':') {
++        p = skip_drive(path);
++    }
++    else if (path[0] == L'\\') {
++        p = path + 1;
++    }
++    else {
++        return E_INVALIDARG;
++    }
++
++    *root_end = p;
++    return S_OK;
++}
++
++/* The extension is the last '.' in the final path segment; with none,
++   *ext is the terminating NUL.  The string must end within cch characters. */
++static HRESULT
++find_extension_fallback(PCWSTR path, size_t cch, PCWSTR *ext)
++{
++    PCWSTR p;
++    PCWSTR dot = NULL;
++
++    if (ext == NULL) {
++        return E_INVALIDARG;
++    }
++    *ext = NULL;
++    if (path == NULL || cch == 0 || cch > PATHCCH_MAX_CCH) {
++        return E_INVALIDARG;
++    }
++    for (p = path; p < path + cch && *p != L'\0'; ++p) {
++        if (*p == L'.') {
++            dot = p;
++        }
++        else if (*p == L'\\') {
++            dot = NULL;
++        }
++    }
++    if (p == path + cch) {
++        return E_INVALIDARG;                    /* not terminated */
++    }
++    *ext = dot != NULL ? dot : p;
++    return S_OK;
++}
++
++static HRESULT
++combine_ex_fallback(PWSTR out, size_t cch, PCWSTR in, PCWSTR more,
++                    ULONG flags)
++{
++    WCHAR combined[MAX_PATH];
++    size_t len;
++
++    (void)flags;        /* long paths do not exist on Windows 7 */
++    if (out == NULL || cch == 0 || cch > PATHCCH_MAX_CCH) {
++        return E_INVALIDARG;
++    }
++    out[0] = L'\0';
++    if (PathCombineW(combined, in, more) == NULL) {
++        return HRESULT_FROM_WIN32(ERROR_FILENAME_EXCED_RANGE);
++    }
++    len = wcslen(combined);
++    if (len >= cch) {
++        return HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
++    }
++    memcpy(out, combined, (len + 1) * sizeof(WCHAR));
++    return S_OK;
++}
++
++static volatile LONG_PTR skip_root_slot;
++static volatile LONG_PTR find_extension_slot;
++static volatile LONG_PTR combine_ex_slot;
++
++HRESULT WINAPI
++PathCchSkipRoot(PCWSTR pszPath, PCWSTR *ppszRootEnd)
++{
++    skip_root_fn real = (skip_root_fn)kernelbase_export(
++        &skip_root_slot, "PathCchSkipRoot");
++    return real != NULL ? real(pszPath, ppszRootEnd)
++                        : skip_root_fallback(pszPath, ppszRootEnd);
++}
++
++HRESULT WINAPI
++PathCchFindExtension(PCWSTR pszPath, size_t cchPath, PCWSTR *ppszExt)
++{
++    find_extension_fn real = (find_extension_fn)kernelbase_export(
++        &find_extension_slot, "PathCchFindExtension");
++    return real != NULL ? real(pszPath, cchPath, ppszExt)
++                        : find_extension_fallback(pszPath, cchPath, ppszExt);
++}
++
++HRESULT WINAPI
++PathCchCombineEx(PWSTR pszPathOut, size_t cchPathOut, PCWSTR pszPathIn,
++                 PCWSTR pszMore, ULONG dwFlags)
++{
++    combine_ex_fn real = (combine_ex_fn)kernelbase_export(
++        &combine_ex_slot, "PathCchCombineEx");
++    return real != NULL
++        ? real(pszPathOut, cchPathOut, pszPathIn, pszMore, dwFlags)
++        : combine_ex_fallback(pszPathOut, cchPathOut, pszPathIn, pszMore,
++                              dwFlags);
++}
+diff -ruN misc/Python-3.11.15/PC/pyconfig.h 
misc/build/Python-3.11.15/PC/pyconfig.h
+--- misc/Python-3.11.15/PC/pyconfig.h  2025-01-01 00:00:00.000000000 +0000
++++ misc/build/Python-3.11.15/PC/pyconfig.h    2025-01-01 00:00:00.000000000 
+0000
+@@ -141,9 +141,12 @@
+ #endif /* MS_WIN64 */
+ 
+ /* set the version macros for the windows headers */
+-/* Python 3.9+ requires Windows 8 or greater */
+-#define Py_WINVER 0x0602 /* _WIN32_WINNT_WIN8 */
+-#define Py_NTDDI NTDDI_WIN8
++/* Upstream Python 3.9+ requires Windows 8 or greater.  Apache OpenOffice
++   builds it for Windows 7 SP1, its own floor: PC/pathcch_win7.c stands in for
++   the PathCch* functions Windows 7 lacks, and PC/aoo_win7_compat.h supplies
++   the few Windows 8 constants used without depending on Windows 8. */
++#define Py_WINVER 0x0601 /* _WIN32_WINNT_WIN7 */
++#define Py_NTDDI NTDDI_WIN7
+ 
+ /* We only set these values when building Python - we don't want to force
+    these values on extensions, as that will affect the prototypes and
+diff -ruN misc/Python-3.11.15/PCbuild/pyproject.props 
misc/build/Python-3.11.15/PCbuild/pyproject.props
+--- misc/Python-3.11.15/PCbuild/pyproject.props        2025-01-01 
00:00:00.000000000 +0000
++++ misc/build/Python-3.11.15/PCbuild/pyproject.props  2025-01-01 
00:00:00.000000000 +0000
+@@ -39,6 +39,7 @@
+     <ClCompile>
+       
<AdditionalIncludeDirectories>$(PySourcePath)Include;$(PySourcePath)Include\internal;$(PySourcePath)PC;$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+       
<PreprocessorDefinitions>WIN32;$(_Py3NamePreprocessorDefinition);$(_PlatformPreprocessorDefinition)$(_DebugPreprocessorDefinition)$(_PydPreprocessorDefinition)%(PreprocessorDefinitions)</PreprocessorDefinitions>
++      
<ForcedIncludeFiles>aoo_win7_compat.h;%(ForcedIncludeFiles)</ForcedIncludeFiles>
+ 
+       <Optimization>MaxSpeed</Optimization>
+       <IntrinsicFunctions>true</IntrinsicFunctions>
+diff -ruN misc/Python-3.11.15/PCbuild/pythoncore.vcxproj 
misc/build/Python-3.11.15/PCbuild/pythoncore.vcxproj
+--- misc/Python-3.11.15/PCbuild/pythoncore.vcxproj     2025-01-01 
00:00:00.000000000 +0000
++++ misc/build/Python-3.11.15/PCbuild/pythoncore.vcxproj       2025-01-01 
00:00:00.000000000 +0000
+@@ -106,7 +106,7 @@
+       <PreprocessorDefinitions 
Condition="$(IncludeExternals)">_Py_HAVE_ZLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+     </ClCompile>
+     <Link>
+-      
<AdditionalDependencies>version.lib;ws2_32.lib;pathcch.lib;bcrypt.lib;%(AdditionalDependencies)</AdditionalDependencies>
++      
<AdditionalDependencies>version.lib;ws2_32.lib;shlwapi.lib;bcrypt.lib;%(AdditionalDependencies)</AdditionalDependencies>
+     </Link>
+   </ItemDefinitionGroup>
+   <ItemGroup>
+@@ -473,6 +473,7 @@
+     <ClCompile Include="..\PC\invalid_parameter_handler.c" />
+     <ClCompile Include="..\PC\winreg.c" />
+     <ClCompile Include="..\PC\config.c" />
++    <ClCompile Include="..\PC\pathcch_win7.c" />
+     <ClCompile Include="..\PC\msvcrtmodule.c" />
+     <ClCompile Include="..\Python\pyhash.c" />
+     <ClCompile Include="..\Python\_warnings.c" />
diff --git a/main/sal/systools/win32/uwinapi/makefile.mk 
b/main/sal/systools/win32/uwinapi/makefile.mk
index d81a02fa02..50419c4c8d 100644
--- a/main/sal/systools/win32/uwinapi/makefile.mk
+++ b/main/sal/systools/win32/uwinapi/makefile.mk
@@ -43,6 +43,13 @@ CXXFLAGS+= $(LFS_CFLAGS)
 CFLAGSCXX+=-Wno-unused-parameter -Wno-return-type
 .ENDIF
 
+# The thunks define the psapi entry points under their classic names, which
+# uwinapi.dxp exports.  From _WIN32_WINNT 0x0601 on psapi.h defaults to
+# PSAPI_VERSION 2 and maps GetModuleFileNameExA/W to K32GetModuleFileNameExA/W,
+# so the definitions would land under the K32 names and the export would not
+# resolve (LNK2001).  Callers elsewhere keep the default and bind to kernel32.
+CDEFS+=-DPSAPI_VERSION=1
+
 .IF "$(COMEX)"=="9"
 .IF "$(PSDK_HOME)"!=""
 # Since the 02/2003 PSDK the "new" linker is needed here.
diff --git a/main/scp2/source/ooo/windowscustomaction_ooo.scp 
b/main/scp2/source/ooo/windowscustomaction_ooo.scp
index 43990b48dd..6327c5a643 100644
--- a/main/scp2/source/ooo/windowscustomaction_ooo.scp
+++ b/main/scp2/source/ooo/windowscustomaction_ooo.scp
@@ -234,6 +234,20 @@ WindowsCustomAction 
gid_Customaction_Check_Install_Directory
        Assignment3 = ("ControlEvent", "CustomSetup", "Next", "DoAction", 
"CheckInstallDirectory", "Not Installed", "2");
 End
 
+// "Reset my user profile" on the ReadyToInstall dialog (or RESETUSERPROFILE=1
+// on the command line).  Immediate and after InstallFinalize, so it runs only
+// after a successful install and impersonated as the installing user, whose
+// AppDataFolder holds the profile.  Return value ignored: a profile that
+// cannot be moved must not fail an install that has already succeeded.
+WindowsCustomAction gid_Customaction_ResetUserProfile
+       Name = "ResetUserProfile";
+       Typ = "65";
+       Source = "shlxtmsi.dll";
+       Target = "ResetUserProfile";
+       Inbinarytable = 1;
+       Assignment1 = ("InstallExecuteSequence", "RESETUSERPROFILE=\"1\" And 
Not REMOVE=\"ALL\"", "behind_InstallFinalize");
+End
+
 WindowsCustomAction gid_Customaction_Dotnetcheck
        Name = "DotNetCheck";
        Typ = "321";
diff --git a/main/sd/source/filter/sdfilter.cxx 
b/main/sd/source/filter/sdfilter.cxx
index 6f3178b989..7865c1307e 100644
--- a/main/sd/source/filter/sdfilter.cxx
+++ b/main/sd/source/filter/sdfilter.cxx
@@ -26,9 +26,11 @@
 #include <com/sun/star/task/XStatusIndicatorFactory.hpp>
 
 #include <memory>
+#include <set>
 
 #include <tools/debug.hxx>
 #include <osl/module.hxx>
+#include <osl/mutex.hxx>
 #include <sfx2/docfile.hxx>
 #include <sfx2/viewfrm.hxx>
 #include <sfx2/progress.hxx>
@@ -87,9 +89,26 @@ extern "C" { static void SAL_CALL thisModule() {} }
 
 ::osl::Module* SdFilter::OpenLibrary( const ::rtl::OUString& rLibraryName ) 
const
 {
+    const ::rtl::OUString aFullName( ImplGetFullLibraryName( rLibraryName ) );
     std::unique_ptr< osl::Module > mod(new osl::Module);
-    return mod->loadRelative(&thisModule, ImplGetFullLibraryName(rLibraryName))
-        ? mod.release() : 0;
+    if ( !mod->loadRelative( &thisModule, aFullName ) )
+        return 0;
+
+    // Callers delete the returned Module, which unloads the library.  But an
+    // import leaves objects in the document whose virtual-function tables live
+    // in the filter library or in a library it pulls in (sdfilt -> msfilter):
+    // once that is unloaded, the next virtual call on such an object jumps 
into
+    // unmapped memory.  Opening a .ppt as the first document crashed that way
+    // in SdrObjListIter right after the import; with any document opened
+    // before, msfilter was still held by another component and survived.
+    // Take one extra reference per library and never release it, so a filter
+    // library stays loaded for the rest of the process once it has been used.
+    static std::set< ::rtl::OUString > aPinned;
+    ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+    if ( aPinned.insert( aFullName ).second )
+        osl_loadModuleRelative( &thisModule, aFullName.pData, 
SAL_LOADMODULE_DEFAULT );
+
+    return mod.release();
 }
 
 // 
-----------------------------------------------------------------------------
diff --git 
a/main/setup_native/source/win32/customactions/shellextensions/exports.dxp 
b/main/setup_native/source/win32/customactions/shellextensions/exports.dxp
index 5826d33927..776e367c78 100644
--- a/main/setup_native/source/win32/customactions/shellextensions/exports.dxp
+++ b/main/setup_native/source/win32/customactions/shellextensions/exports.dxp
@@ -21,3 +21,4 @@ RemovePrgFolder
 IsOfficeRunning
 CheckPatchList
 copyExtensionData
+ResetUserProfile
diff --git 
a/main/setup_native/source/win32/customactions/shellextensions/makefile.mk 
b/main/setup_native/source/win32/customactions/shellextensions/makefile.mk
index d465268a7e..9e7826b61c 100644
--- a/main/setup_native/source/win32/customactions/shellextensions/makefile.mk
+++ b/main/setup_native/source/win32/customactions/shellextensions/makefile.mk
@@ -64,7 +64,8 @@ SLOFILES = \
     $(SLO)$/vistaspecial.obj \
     $(SLO)$/checkrunningoffice.obj \
     $(SLO)$/checkpatches.obj \
-    $(SLO)$/copyextensiondata.obj
+    $(SLO)$/copyextensiondata.obj \
+    $(SLO)$/resetprofile.obj
 
 STDSHL += \
        $(ADVAPI32LIB)\
diff --git 
a/main/setup_native/source/win32/customactions/shellextensions/resetprofile.cxx 
b/main/setup_native/source/win32/customactions/shellextensions/resetprofile.cxx
new file mode 100644
index 0000000000..08a7b66901
--- /dev/null
+++ 
b/main/setup_native/source/win32/customactions/shellextensions/resetprofile.cxx
@@ -0,0 +1,150 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+// ResetUserProfile: move the installing user's profile aside, so that the
+// next start of the office creates a fresh one.  The old profile is renamed,
+// never deleted, so the user can get documents, macros or settings back.
+//
+// The profile location is not hard-coded: it is read from the
+// UserInstallation entry of the bootstrap.ini that was just installed,
+// e.g. "$SYSUSERCONFIG/OpenOffice/5", and $SYSUSERCONFIG is the user's
+// application data folder (AppDataFolder in Windows Installer terms).
+
+#ifdef _MSC_VER
+#pragma warning(push, 1) /* disable warnings within system headers */
+#define WIN32_LEAN_AND_MEAN
+#endif
+#include <windows.h>
+#include <msiquery.h>
+#include <strsafe.h>
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
+
+#include <malloc.h>
+#include <string>
+
+namespace {
+
+std::wstring GetMsiPropertyW( MSIHANDLE handle, const wchar_t* pProperty )
+{
+    std::wstring result;
+    wchar_t szDummy[1] = L"";
+    DWORD nChars = 0;
+
+    if ( MsiGetPropertyW( handle, pProperty, szDummy, &nChars ) == 
ERROR_MORE_DATA )
+    {
+        DWORD nBytes = ++nChars * sizeof(wchar_t);
+        wchar_t* buffer = static_cast<wchar_t*>( _alloca( nBytes ) );
+        ZeroMemory( buffer, nBytes );
+        MsiGetPropertyW( handle, pProperty, buffer, &nChars );
+        result = buffer;
+    }
+
+    return result;
+}
+
+// Write one line to the Windows Installer log (msiexec /l*v).
+void Log( MSIHANDLE handle, const std::wstring& rText )
+{
+    PMSIHANDLE hRecord = MsiCreateRecord( 0 );
+    if ( hRecord )
+    {
+        std::wstring aText( L"ResetUserProfile: " );
+        aText += rText;
+        MsiRecordSetStringW( hRecord, 0, aText.c_str() );
+        MsiProcessMessage( handle, INSTALLMESSAGE_INFO, hRecord );
+    }
+}
+
+void StripTrailingBackslash( std::wstring& rPath )
+{
+    while ( !rPath.empty() && rPath[ rPath.size() - 1 ] == L'\\' )
+        rPath.erase( rPath.size() - 1 );
+}
+
+} // namespace
+
+extern "C" UINT __stdcall ResetUserProfile( MSIHANDLE handle )
+{
+    std::wstring aInstallLocation = GetMsiPropertyW( handle, 
L"INSTALLLOCATION" );
+    std::wstring aAppData = GetMsiPropertyW( handle, L"AppDataFolder" );
+    if ( aInstallLocation.empty() || aAppData.empty() )
+    {
+        Log( handle, L"INSTALLLOCATION or AppDataFolder not set, nothing 
done." );
+        return ERROR_SUCCESS;
+    }
+    StripTrailingBackslash( aInstallLocation );
+    StripTrailingBackslash( aAppData );
+
+    const std::wstring aIni = aInstallLocation + L"\\program\\bootstrap.ini";
+    wchar_t aValue[ MAX_PATH ] = L"";
+    GetPrivateProfileStringW( L"Bootstrap", L"UserInstallation", L"",
+                              aValue, MAX_PATH, aIni.c_str() );
+
+    // Only the shipped form is understood; anything else was edited by an
+    // administrator, and a guessed path could move the wrong directory.
+    const std::wstring aPrefix( L"$SYSUSERCONFIG" );
+    std::wstring aUserInstallation( aValue );
+    if ( aUserInstallation.compare( 0, aPrefix.size(), aPrefix ) != 0 )
+    {
+        Log( handle, L"UserInstallation in " + aIni + L" is \"" + 
aUserInstallation
+                     + L"\", not $SYSUSERCONFIG/...; nothing done." );
+        return ERROR_SUCCESS;
+    }
+
+    std::wstring aProfile = aAppData + aUserInstallation.substr( 
aPrefix.size() );
+    for ( std::wstring::size_type i = 0; i < aProfile.size(); ++i )
+        if ( aProfile[ i ] == L'/' )
+            aProfile[ i ] = L'\\';
+    StripTrailingBackslash( aProfile );
+
+    DWORD nAttributes = GetFileAttributesW( aProfile.c_str() );
+    if ( nAttributes == INVALID_FILE_ATTRIBUTES || !( nAttributes & 
FILE_ATTRIBUTE_DIRECTORY ) )
+    {
+        Log( handle, L"no profile at " + aProfile + L", nothing to reset." );
+        return ERROR_SUCCESS;
+    }
+
+    SYSTEMTIME aNow;
+    GetLocalTime( &aNow );
+    wchar_t aStamp[ 32 ];
+    StringCchPrintfW( aStamp, sizeof( aStamp ) / sizeof( aStamp[ 0 ] ),
+                      L".backup-%04u%02u%02u-%02u%02u%02u",
+                      aNow.wYear, aNow.wMonth, aNow.wDay,
+                      aNow.wHour, aNow.wMinute, aNow.wSecond );
+    const std::wstring aBackup = aProfile + aStamp;
+
+    if ( MoveFileW( aProfile.c_str(), aBackup.c_str() ) )
+    {
+        Log( handle, L"moved " + aProfile + L" to " + aBackup );
+    }
+    else
+    {
+        const DWORD nError = GetLastError();
+        wchar_t aError[ 16 ];
+        StringCchPrintfW( aError, sizeof( aError ) / sizeof( aError[ 0 ] ), 
L"%lu", nError );
+        Log( handle, L"could not move " + aProfile + L" (error " + aError
+                     + L"); is the office still running?" );
+    }
+
+    return ERROR_SUCCESS;
+}
diff --git a/main/setup_native/source/win32/nsis/downloadtemplate.nsi 
b/main/setup_native/source/win32/nsis/downloadtemplate.nsi
index 7d17664fc8..812ead6673 100644
--- a/main/setup_native/source/win32/nsis/downloadtemplate.nsi
+++ b/main/setup_native/source/win32/nsis/downloadtemplate.nsi
@@ -39,7 +39,7 @@ Function .onInit
     "DOWNLOADNAMEPLACEHOLDER options: $\n $\n \
     /S : Silent installation $\n \
     /D=<path> : NSIS installation directory (must be the last option!) $\n \
-    /EXTRACTONLY=ON : NSIS only extracts the PRODUCTNAMEPLACEHOLDER 
PRODUCTVERSIONPLACEHOLDER installation set $\n \
+    /EXTRACTONLY=ON : NSIS only extracts the PRODUCTNAMEPLACEHOLDER 
PRODUCTVERSIONPLACEHOLDER installation set (to the desktop) $\n \
     /INSTALLLOCATION=<path> : PRODUCTNAMEPLACEHOLDER PRODUCTVERSIONPLACEHOLDER 
installation directory $\n \
     /POSTREMOVE=ON : Removes the unpacked installation set after 
PRODUCTNAMEPLACEHOLDER PRODUCTVERSIONPLACEHOLDER installation $\n \
     /INSTALLJAVA=ON : Installs JRE located in sub directory java, if exists 
$\n \
@@ -63,14 +63,77 @@ Function .onInit
   GoTo onInitDone
 
   onInitNoSilent:
+    ; /EXTRACTONLY=ON keeps the visible folder on the desktop: the user
+    ; asked for the installation set itself.
+    Push $1
+    Push "/EXTRACTONLY="
+    Call GetOptions
+    Pop $2
+    StrCmp $2 "ON" onInitExtractOnly onInitKeepSource
+
+  onInitExtractOnly:
     StrCpy $INSTDIR "$DESKTOP\PRODUCTPATHPLACEHOLDER Installation Files"
   GoTo onInitDone
 
+  onInitKeepSource:
+    ; Otherwise unpack without asking, into a folder under ProgramData
+    ; (hidden by default) that is kept.  setup.exe starts the MSI from
+    ; here, so Windows Installer records it as the installation source
+    ; and repair, modify and patching find the cabinet again without
+    ; prompting for the original download.
+    SetShellVarContext all
+    StrCpy $INSTDIR "$APPDATA\PRODUCTPATHPLACEHOLDER Installation Files"
+    SetShellVarContext current
+  GoTo onInitDone
+
   onInitDone:
   pathset:
 
 FunctionEnd
 
+; Remove kept installation sets under ProgramData whose product is no longer
+; installed: the version a major upgrade has just replaced, or an install
+; that was cancelled.  The product is identified by the productcode in the
+; folder's setup.ini, never by the folder name, so a language pack or an
+; install for another user keeps its source.  Only INSTALLSTATE_UNKNOWN (-1)
+; deletes; installed (5), advertised (1) and other-user (2) all keep.
+Function CleanupStaleSources
+
+  Push $R0
+  Push $R1
+  Push $R2
+  Push $R3
+  Push $R4
+
+  SetOutPath "$TEMP"   ; do not hold $INSTDIR open as working directory
+
+  SetShellVarContext all
+  StrCpy $R4 "$APPDATA"
+  SetShellVarContext current
+
+  FindFirst $R0 $R1 "$R4\${PRODUCT_NAME} * Installation Files"
+  cleanuploop:
+    StrCmp $R1 "" cleanupdone
+    IfFileExists "$R4\$R1\setup.ini" 0 cleanupnext
+    ReadINIStr $R2 "$R4\$R1\setup.ini" "setup" "productcode"
+    StrCmp $R2 "" cleanupnext
+    System::Call 'msi::MsiQueryProductStateW(w R2) i .R3'
+    IntCmp $R3 -1 0 cleanupnext cleanupnext
+    RMDir /r "$R4\$R1"
+  cleanupnext:
+    FindNext $R0 $R1
+    Goto cleanuploop
+  cleanupdone:
+  FindClose $R0
+
+  Pop $R4
+  Pop $R3
+  Pop $R2
+  Pop $R1
+  Pop $R0
+
+FunctionEnd
+
 Function GetParameters
 
   Push $R0
@@ -219,9 +282,9 @@ FunctionEnd
 !define MUI_ABORTWARNING
 !define MUI_ICON "SETUPICOPLACEHOLDER"
 
-; Welcome page
-!insertmacro MUI_PAGE_WELCOME
-!insertmacro MUI_PAGE_DIRECTORY
+; No welcome or directory page: the MSI shows its own wizard, and the
+; unpack location is chosen in .onInit (override with /D=<path>).
+; Only the progress page of the unpacking remains.
 !insertmacro MUI_PAGE_INSTFILES
 
 !macro MUI_LANGUAGE_PACK LANGUAGE
@@ -385,6 +448,7 @@ Section -Post
         ExecWait '$INSTDIR\java\WINDOWSJAVAFILENAMEPLACEHOLDER /s /v"/qn 
REBOOT=Suppress"'
       dontinstalljava1:
       ExecWait "$INSTDIR\setup.exe -lang $LANGUAGE $3 $4 $5 $6 $7 
-ignore_running" $0
+      Call CleanupStaleSources
       SetErrorLevel $0
       Quit
       GoTo onPostDone
@@ -394,6 +458,7 @@ Section -Post
         ExecWait '$INSTDIR\java\WINDOWSJAVAFILENAMEPLACEHOLDER /s /v"/qn 
REBOOT=Suppress"'
       dontinstalljava2:
       ExecWait "$INSTDIR\setup.exe -lang $LANGUAGE $3 $4 $5 $6 $7 
-ignore_running" $0
+      Call CleanupStaleSources
       RMDir /r $INSTDIR
       RMDir $INSTDIR
       SetErrorLevel $0
@@ -409,7 +474,12 @@ Section -Post
 
     StrCmp $2 "ON" postremove nopostremove
     nopostremove:
-      Exec "$INSTDIR\setup.exe -lang $LANGUAGE $3 $4 $5 $6"
+      ; Wait for setup.exe (it waits for the MSI) so that the folders of
+      ; products the MSI has just upgraded away can be removed afterwards.
+      HideWindow
+      ExecWait "$INSTDIR\setup.exe -lang $LANGUAGE $3 $4 $5 $6" $0
+      Call CleanupStaleSources
+      SetErrorLevel $0
       Quit
       GoTo onPostDone
     postremove:
@@ -418,6 +488,7 @@ Section -Post
         ExecWait '$INSTDIR\java\WINDOWSJAVAFILENAMEPLACEHOLDER /s /v"/qr 
REBOOT=Suppress"'
       dontinstalljava3:
       ExecWait "$INSTDIR\setup.exe -lang $LANGUAGE $3 $4 $5 $6" $0
+      Call CleanupStaleSources
       RMDir /r $INSTDIR
       RMDir $INSTDIR
       SetErrorLevel $0
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
         {
diff --git a/main/shell/source/tools/lngconvex/lngconvex.cxx 
b/main/shell/source/tools/lngconvex/lngconvex.cxx
index ad3681c939..bb91ba7936 100644
--- a/main/shell/source/tools/lngconvex/lngconvex.cxx
+++ b/main/shell/source/tools/lngconvex/lngconvex.cxx
@@ -273,7 +273,25 @@ public:
                OSL_ASSERT(prt);
                replacement_table_t::iterator iter = prt->find(Text);
                if (iter != prt->end())
+               {
                        Text = iter->second;
+                       return;
+               }
+
+               // Not translated into this language (typically a string newer 
than the
+               // last translation round): fall back to en-US.  Without this 
the raw
+               // placeholder, e.g. "%RUNTIME_FAILED%", ends up in the 
resource and is
+               // what a non-English user sees.  Looked up with find(), not
+               // get_replacement_table(), which would create a table and with 
it an
+               // extra language section in the output.
+               iso_lang_replacement_table_t::iterator en =
+                       iso_lang_replacement_table_.find("en-US");
+               if (en != iso_lang_replacement_table_.end())
+               {
+                       iter = en->second->find(Text);
+                       if (iter != en->second->end())
+                               Text = iter->second;
+               }
        }
 
        void add_substitution(
diff --git a/main/solenv/bin/modules/installer/globals.pm 
b/main/solenv/bin/modules/installer/globals.pm
index 4c0af69214..ce18068708 100644
--- a/main/solenv/bin/modules/installer/globals.pm
+++ b/main/solenv/bin/modules/installer/globals.pm
@@ -113,7 +113,10 @@ BEGIN
        $destdir = "";
        $rootpath = "";
 
-       $required_dotnet_version = "2.0.0.0";
+       # The CLI-UNO assemblies are built for the .NET 4 runtime (CLR 
4.0.30319).
+       # Below that, DotNetCheck sets DOTNET_SUFFICIENT=0 and the assembly
+       # components are skipped instead of failing the GAC install (error 
1304).
+       $required_dotnet_version = "4.0.0.0";
        $productextension = "";
        $languageproduct = undef;
        $build = "";
diff --git a/main/solenv/bin/modules/installer/windows/file.pm 
b/main/solenv/bin/modules/installer/windows/file.pm
index 18f87405e4..f2b083f46d 100644
--- a/main/solenv/bin/modules/installer/windows/file.pm
+++ b/main/solenv/bin/modules/installer/windows/file.pm
@@ -525,6 +525,15 @@ sub get_fileversion
         {
             $vendornumber = $allvariables->{'VENDORPATCHVERSION'};
         }
+               # Windows Installer stores each field of a file version in 16 
bits, so a
+               # build id above 65535 produces a package that every Windows 
machine
+               # rejects at InstallValidate with "Internal Error 2725 -- 
Invalid
+               # database tables".  The failure gives no hint of its cause, so 
refuse to
+               # build such a package rather than shipping one that cannot be 
installed.
+               if (( $installer::globals::buildid =~ /^\d+$/ ) && ( 
$installer::globals::buildid > 65535 ))
+               {
+                       installer::exiter::exit_program("ERROR: build id 
$installer::globals::buildid exceeds 65535, the largest value Windows Installer 
accepts in a version field. Lower BUILD in solenv/inc/minor.mk.", 
"get_fileversion");
+               }
                $fileversion = $libraryversion . "\." . 
$installer::globals::buildid . "\." . $vendornumber;
                if ( $onefile->{'FileVersion'} )
         {
diff --git a/main/solenv/bin/modules/installer/windows/upgrade.pm 
b/main/solenv/bin/modules/installer/windows/upgrade.pm
index 6e0ee516c2..887dc71e82 100644
--- a/main/solenv/bin/modules/installer/windows/upgrade.pm
+++ b/main/solenv/bin/modules/installer/windows/upgrade.pm
@@ -57,7 +57,16 @@ sub create_upgrade_table
        push(@upgradetable, $newline);
 
        # Setting all products, that must be removed.
-       $newline = $installer::globals::upgradecode . "\t" . 
$installer::globals::msimajorproductversion . "\t" . 
$installer::globals::msiproductversion . "\t" . "\t" . "257" . "\t" . "\t" . 
"OLDPRODUCTSSAMEMAJOR" . "\n";
+       # 257 = MigrateFeatures | VersionMinInclusive.  Outside patches the 
current
+       # version is included as well (+512 VersionMaxInclusive): every build 
gets a
+       # new product code, so another build of the SAME version is a different
+       # product, and it is replaced like an older one.  FindRelatedProducts 
never
+       # lists the package's own product code, so re-running the identical 
package
+       # still gets the normal maintenance dialog (modify / repair / remove).
+       # This used to be a SAMEPRODUCTS row whose SameProductFound action 
aborted
+       # with "The same version of ... is already installed".
+       my $samemajorattributes = $installer::globals::patch ? "257" : "769";
+       $newline = $installer::globals::upgradecode . "\t" . 
$installer::globals::msimajorproductversion . "\t" . 
$installer::globals::msiproductversion . "\t" . "\t" . $samemajorattributes . 
"\t" . "\t" . "OLDPRODUCTSSAMEMAJOR" . "\n";
        push(@upgradetable, $newline);
 
        if ( ! $installer::globals::patch )
@@ -66,9 +75,6 @@ sub create_upgrade_table
                $newline = $installer::globals::upgradecode . "\t" . 
$installer::globals::msiproductversion . "\t" . $ooomaxnew . "\t" . "\t" . "2" 
. "\t" . "\t" . "NEWPRODUCTS" . "\n";
                push(@upgradetable, $newline);
 
-               $newline = $installer::globals::upgradecode . "\t" . 
$installer::globals::msiproductversion . "\t" . $ooomaxnew . "\t" . "\t" . 
"258" . "\t" . "\t" . "SAMEPRODUCTS" . "\n";
-               push(@upgradetable, $newline);
-
                if ( $include_ooo_fix )
                {
                        $newline = $installer::globals::upgradecode . "\t" . 
"35.0.0" . "\t" . "36.0.0" . "\t" . "\t" . "1" . "\t" . "\t" . "OLDPRODUCTS2" . 
"\n";
diff --git a/main/solenv/gbuild/platform/windows.mk 
b/main/solenv/gbuild/platform/windows.mk
index 49390ea8f6..3f280ceaef 100644
--- a/main/solenv/gbuild/platform/windows.mk
+++ b/main/solenv/gbuild/platform/windows.mk
@@ -54,9 +54,11 @@ ifneq ($(origin CXX),default)
 gb_CXX := $(CXX)
 endif
 
+# The Windows API floor, Windows 7 SP1 -- the same values as
+# solenv/inc/wntmsci11.mk and wntmscx.mk, see there.
 gb_OSDEFS := \
-       -DWINVER=0x0500 \
-       -D_WIN32_IE=0x0500 \
+       -DWINVER=0x0601 \
+       -D_WIN32_WINNT=0x0601 \
        -DNT351 \
        -DWIN32 \
        -DWNT \
diff --git a/main/solenv/inc/minor.mk b/main/solenv/inc/minor.mk
index e4292755d1..fa821a1612 100644
--- a/main/solenv/inc/minor.mk
+++ b/main/solenv/inc/minor.mk
@@ -19,7 +19,14 @@
 #
 # *************************************************************
 RSCVERSION=510
-RSCREVISION=510m1(Build:99000)
-BUILD=99000
+# The build id ends up in the third field of every file's version in the
+# Windows installer (see get_fileversion() in
+# solenv/bin/modules/installer/windows/file.pm).  Windows Installer limits
+# each version field to 65535, and a package that exceeds it fails at
+# InstallValidate with "Internal Error 2725 -- Invalid database tables",
+# so BUILD must stay <= 65535.
+BUILD=9900
 LAST_MINOR=m1
+# Derived, so the build id is written in exactly one place.
+RSCREVISION=$(RSCVERSION)$(LAST_MINOR)(Build:$(BUILD))
 SOURCEVERSION=AOO510
diff --git a/main/solenv/inc/wntmsci11.mk b/main/solenv/inc/wntmsci11.mk
index e926859535..1011d87f57 100644
--- a/main/solenv/inc/wntmsci11.mk
+++ b/main/solenv/inc/wntmsci11.mk
@@ -218,7 +218,18 @@ CFLAGSWERRCC=-WX
 # settings.mk):
 MODULES_WITH_WARNINGS :=
 
-CDEFS+=-D_MT -DWINVER=0x0500 -D_WIN32_WINNT=0x0500 -D_WIN32_IE=0x0500
+# The Windows API floor: Windows 7 SP1.  Trunk builds only with a VS2015-or-
+# newer toolset (Python 3.11 needs one, and its runtime does not install on
+# anything older than Windows 7 SP1), so the old Windows 2000 values (0x0500)
+# described a platform the result cannot run on.  _WIN32_IE is deliberately not
+# set: the SDK derives it per translation unit from the _WIN32_WINNT that unit
+# ends up with (0x0800 at 0x0601), and a fixed value breaks the files that
+# lower _WIN32_WINNT to NT4 themselves (sal uwinapi, C1189 in sdkddkver.h).
+# A few modules state their own _WIN32_WINNT: fpicker and
+# sal/systools/win32/kill replace it with -U/-D, shell adds a second -D,
+# openssl builds with its own flags.  Python builds with its own project files
+# and gets the same floor from python-3.11.15-win7.patch.
+CDEFS+=-D_MT -DWINVER=0x0601 -D_WIN32_WINNT=0x0601
 .IF "$(COMEX)" == "11"
 _VC_MANIFEST_BASENAME=__VC80
 .ELSE
diff --git a/main/solenv/inc/wntmscx.mk b/main/solenv/inc/wntmscx.mk
index b61b99e574..1d96bccb10 100644
--- a/main/solenv/inc/wntmscx.mk
+++ b/main/solenv/inc/wntmscx.mk
@@ -225,7 +225,18 @@ CFLAGSWERRCC=-WX
 # settings.mk):
 MODULES_WITH_WARNINGS :=
 
-CDEFS+=-D_MT -DWINVER=0x0500 -D_WIN32_WINNT=0x0500 -D_WIN32_IE=0x0500
+# The Windows API floor: Windows 7 SP1.  Trunk builds only with a VS2015-or-
+# newer toolset (Python 3.11 needs one, and its runtime does not install on
+# anything older than Windows 7 SP1), so the old Windows 2000 values (0x0500)
+# described a platform the result cannot run on.  _WIN32_IE is deliberately not
+# set: the SDK derives it per translation unit from the _WIN32_WINNT that unit
+# ends up with (0x0800 at 0x0601), and a fixed value breaks the files that
+# lower _WIN32_WINNT to NT4 themselves (sal uwinapi, C1189 in sdkddkver.h).
+# A few modules state their own _WIN32_WINNT: fpicker and
+# sal/systools/win32/kill replace it with -U/-D, shell adds a second -D,
+# openssl builds with its own flags.  Python builds with its own project files
+# and gets the same floor from python-3.11.15-win7.patch.
+CDEFS+=-D_MT -DWINVER=0x0601 -D_WIN32_WINNT=0x0601
 .IF "$(COMEX)" == "11"
 _VC_MANIFEST_BASENAME=__VC80
 .ELSE
diff --git a/win10-msvc/README.md b/win10-msvc/README.md
index 7be6369716..b46fa7352a 100644
--- a/win10-msvc/README.md
+++ b/win10-msvc/README.md
@@ -247,6 +247,68 @@ Delivered as new `*.patch.ucrt` files listed after the 
existing
 `libxml2` needed nothing — 2.9.10 already guards its own `snprintf` shim on
 `_MSC_VER < 1900`. `nss` needed nothing either.
 
+## The Windows floor: Windows 7 SP1
+
+What a build runs on is no longer chosen by the old platform files: the VS2015+
+runtime does not install below Windows 7 SP1, and Python 3.11 cannot be built
+by VS2008, so trunk has no Windows XP or Windows 2000 build left. The platform
+settings still declared Windows 2000 (`WINVER`/`_WIN32_WINNT`/`_WIN32_IE`
+`0x0500`; gbuild declared no `_WIN32_WINNT` at all). They now declare what the
+result actually needs, with the values the Bazel build compiles and runs at:
+
+| | dmake (`wntmsci11.mk`, `wntmscx.mk`) and gbuild (`platform/windows.mk`) |
+| --- | --- |
+| `WINVER`, `_WIN32_WINNT` | `0x0601` (Windows 7) |
+| `_WIN32_IE` | not set — the SDK derives it per translation unit (`0x0800` at 
`0x0601`) |
+
+Not setting `_WIN32_IE` is load-bearing, and it is what the Bazel build does
+too. `sal/systools/win32/uwinapi`'s `CopyFileEx{A,W}.cpp` define
+`_WIN32_WINNT 0x0400` themselves, and the SDK rejects an NT4 `_WIN32_WINNT`
+next to an IE above 6.0 SP1 (`sdkddkver.h`: C1189 "_WIN32_WINNT settings
+conflicts with _WIN32_IE setting"); a derived value follows whatever the file
+ends up with.
+
+The floor is in the base files, not in `wntmsc14.mk`: there is no VC9 build of
+trunk left for a conditional to protect, so the "VC9 stays byte-identical"
+property of the overlay no longer covers these three defines.
+
+Kept as they were, on purpose:
+
+* **The GUI subsystem version** stays pinned to 5.02 (x64) / 5.01 (x86) in
+  `wntmsc14.mk`. It is *not* a floor setting: 6.00 makes Windows route drops
+  through the brokered drag-and-drop path, which AOO's drop targets fail
+  (drag-and-drop dead in Gallery, Calc and Draw).
+* **Modules that state their own value.** `fpicker` and
+  `sal/systools/win32/kill` replace it with `-U`/`-D`, `shell` adds a second
+  `-D`, `openssl` builds with its own flags — all lower than the floor, so
+  their code keeps using only what it did.
+
+**Python is where the floor is actually decided.** It builds from its own
+`PCbuild` projects, which no solenv define reaches, and upstream 3.9+ targets
+Windows 8: `PC/pyconfig.h` sets `Py_WINVER 0x0602`, and pythoncore links
+`pathcch.lib`, whose API set does not exist on Windows 7 — `python311.dll`
+would not even load there. `python-3.11.15-win7.patch` (Windows only) is the
+support the Bazel build already runs with: `Py_WINVER`/`Py_NTDDI` lowered to
+Windows 7; `PC/pathcch_win7.c` calls the real `PathCch*` functions from
+KernelBase where they exist and falls back to their documented behaviour on
+Windows 7; `PC/aoo_win7_compat.h` supplies the two Windows 8 `LCMAP_*`
+constants `_winapi.c` uses only to reject them. `_freeze_module` keeps
+`pathcch.lib`, since it only runs on the build machine.
+
+**The installer** refuses Windows 7 RTM and anything older
+(`LaunchCo.idt`, `OOO_LAUNCH_3`): `(VersionNT > 601) or (VersionNT = 601 and
+ServicePackLevel >= 1) or Installed`, the last term so that repair and removal
+still work.
+
+What Windows 7 SP1 additionally needs at install time is outside the build:
+the Universal C Runtime update (KB2999226) for the VS2015+ runtime, and
+KB2533623 for the `LOAD_LIBRARY_SEARCH_*` flags Python loads its modules with.
+And the runtime that ships must itself still support Windows 7 — the newest
+VC++ redistributables do not, so the toolset should be no newer than the
+runtime release shipped with it (see the staged-CRT gap below). Nothing here
+has been run on a real Windows 7 machine yet; only the compile-time floor is
+enforced.
+
 ## The old Platform SDK does not go away entirely
 
 `--with-frame-home` must keep pointing at the **Platform SDK v7.0**, whatever

Reply via email to