sal/osl/w32/file_dirvol.cxx |   53 --------------------------------------------
 1 file changed, 53 deletions(-)

New commits:
commit a3dad8129ffc20df67e2b5ca47366f21ab996375
Author:     Xisco Fauli <[email protected]>
AuthorDate: Thu Feb 19 16:28:41 2026 +0100
Commit:     Christian Lohmaier <[email protected]>
CommitDate: Fri Feb 20 11:43:24 2026 +0100

    tdf#170297: Revert "tdf#150118 check file permissions on windows if have no 
readonly" (26.2 only)
    
    This reverts commit 1b5d039d8b5861b5ea21ef00ff521c6e2565105f.
    
    Change-Id: I5577b131f4a8328719e93ecb1b485aafb46a0ba5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199795
    Tested-by: Christian Lohmaier <[email protected]>
    Reviewed-by: Christian Lohmaier <[email protected]>
    Reviewed-by: Xisco Fauli <[email protected]>

diff --git a/sal/osl/w32/file_dirvol.cxx b/sal/osl/w32/file_dirvol.cxx
index d2a87fbaac21..ad92c6f05087 100644
--- a/sal/osl/w32/file_dirvol.cxx
+++ b/sal/osl/w32/file_dirvol.cxx
@@ -21,7 +21,6 @@
 
 #include <systools/win32/extended_max_path.hxx>
 #include <systools/win32/uwinapi.h>
-#include <aclapi.h>
 
 #include "file_url.hxx"
 #include "filetime.hxx"
@@ -1526,56 +1525,6 @@ oslFileError SAL_CALL osl_getFileStatus(
     // 
https://learn.microsoft.com/en-us/windows/desktop/FileIO/file-attribute-constants
     if (pStatus->uAttributes & FILE_ATTRIBUTE_DIRECTORY)
         pStatus->uAttributes &= ~sal_uInt64(FILE_ATTRIBUTE_READONLY);
-
-    // tdf#150118: if there is no Read Only attribute set, lets check if the 
user has write access on the file
-    if ( (pStatus->uAttributes & (FILE_ATTRIBUTE_READONLY | 
FILE_ATTRIBUTE_DIRECTORY)) == 0 )
-    {
-        HANDLE hProcessToken = nullptr;
-        OpenProcessToken(GetCurrentProcess(), TOKEN_DUPLICATE | TOKEN_QUERY, 
&hProcessToken);
-
-        HANDLE hImpersonationToken = nullptr;
-        DuplicateToken(hProcessToken, SecurityImpersonation, 
&hImpersonationToken);
-
-        PSECURITY_DESCRIPTOR pSD = nullptr;
-        // 
https://learn.microsoft.com/en-us/windows/win32/api/aclapi/nf-aclapi-getnamedsecurityinfow
-        DWORD aResult = GetNamedSecurityInfoW(
-            o3tl::toW(sFullPath.getStr()), SE_FILE_OBJECT,
-            OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION | 
DACL_SECURITY_INFORMATION,
-            nullptr, nullptr, nullptr, nullptr, &pSD);
-
-        if (aResult == ERROR_SUCCESS)
-        {
-            GENERIC_MAPPING mapping
-                = { FILE_GENERIC_READ, FILE_GENERIC_WRITE, 
FILE_GENERIC_EXECUTE, FILE_ALL_ACCESS };
-            DWORD grantedAccess = 0;
-            BOOL accessStatus = TRUE;
-
-            // 
https://learn.microsoft.com/en-us/windows/win32/api/securitybaseapi/nf-securitybaseapi-accesscheck
-            BOOL bResult = AccessCheck(pSD, hImpersonationToken, 
FILE_GENERIC_WRITE, &mapping,
-                                       nullptr, nullptr, &grantedAccess, 
&accessStatus);
-
-            if (bResult)
-            {
-                if (!accessStatus)
-                {
-                    // User does NOT have write access: set Read Only attribute
-                    pStatus->uAttributes |= 
sal_uInt64(FILE_ATTRIBUTE_READONLY);
-                }
-            }
-            else
-            {
-                SAL_WARN("AccessCheck API failed with: ", 
oslTranslateFileError(GetLastError()));
-            }
-            LocalFree(pSD); // free memory
-        }
-        else
-        {
-            SAL_WARN("GetNamedSecurityInfoW API failed with: ", aResult);
-        }
-        CloseHandle(hImpersonationToken); // free memory
-        CloseHandle(hProcessToken); // free memory
-    }
-
     pStatus->uValidFields |= osl_FileStatus_Mask_Attributes;
 
     pStatus->uFileSize = 
static_cast<sal_uInt64>(pItemImpl->FindData.nFileSizeLow) + 
(static_cast<sal_uInt64>(pItemImpl->FindData.nFileSizeHigh) << 32);
commit a043a8b4eda3ae8145f7342cd9d1336ae01594a8
Author:     Xisco Fauli <[email protected]>
AuthorDate: Thu Feb 19 16:27:33 2026 +0100
Commit:     Christian Lohmaier <[email protected]>
CommitDate: Fri Feb 20 11:43:15 2026 +0100

    tdf#170297: Revert "tdf#150118: fix call to AccessCheck" (26.2 only)
    
    This reverts commit 1a4f72f03b1bd49d486e52135e78971242fae649.
    
    Change-Id: I142da287cb3765cc7c6d845aefff45218104e0f3
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199763
    Reviewed-by: Xisco Fauli <[email protected]>
    Tested-by: Jenkins
    Signed-off-by: Xisco Fauli <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199794
    Tested-by: Christian Lohmaier <[email protected]>
    Reviewed-by: Christian Lohmaier <[email protected]>

diff --git a/sal/osl/w32/file_dirvol.cxx b/sal/osl/w32/file_dirvol.cxx
index 748a431dd4f9..d2a87fbaac21 100644
--- a/sal/osl/w32/file_dirvol.cxx
+++ b/sal/osl/w32/file_dirvol.cxx
@@ -1549,12 +1549,10 @@ oslFileError SAL_CALL osl_getFileStatus(
                 = { FILE_GENERIC_READ, FILE_GENERIC_WRITE, 
FILE_GENERIC_EXECUTE, FILE_ALL_ACCESS };
             DWORD grantedAccess = 0;
             BOOL accessStatus = TRUE;
-            PRIVILEGE_SET privSet;
-            DWORD privSetSize = sizeof(privSet);
 
             // 
https://learn.microsoft.com/en-us/windows/win32/api/securitybaseapi/nf-securitybaseapi-accesscheck
             BOOL bResult = AccessCheck(pSD, hImpersonationToken, 
FILE_GENERIC_WRITE, &mapping,
-                                       &privSet, &privSetSize, &grantedAccess, 
&accessStatus);
+                                       nullptr, nullptr, &grantedAccess, 
&accessStatus);
 
             if (bResult)
             {
@@ -1566,13 +1564,13 @@ oslFileError SAL_CALL osl_getFileStatus(
             }
             else
             {
-                SAL_WARN("sal.osl", "AccessCheck API failed with: " << 
GetLastError());
+                SAL_WARN("AccessCheck API failed with: ", 
oslTranslateFileError(GetLastError()));
             }
             LocalFree(pSD); // free memory
         }
         else
         {
-            SAL_WARN("sal.osl", "GetNamedSecurityInfoW API failed with: " << 
aResult);
+            SAL_WARN("GetNamedSecurityInfoW API failed with: ", aResult);
         }
         CloseHandle(hImpersonationToken); // free memory
         CloseHandle(hProcessToken); // free memory

Reply via email to