diff --git a/xpcom/io/nsLocalFileWin.cpp b/xpcom/io/nsLocalFileWin.cpp index 0d886cb4cd8..453d89e5d12 100644 --- a/xpcom/io/nsLocalFileWin.cpp +++ b/xpcom/io/nsLocalFileWin.cpp @@ -1458,16 +1458,20 @@ nsLocalFile::CopySingleFile(nsIFile *sourceFile, nsIFile *destParent, rv = ConvertWinError(GetLastError()); #ifndef WINCE - if(move) //Set security permissions to inherit from parent. + else if (move) // Set security permissions to inherit from parent. { - ACL empty_acl; - if (InitializeAcl(&empty_acl, (DWORD) sizeof(ACL), ACL_REVISION)) - { - ::SetNamedSecurityInfoW((LPWSTR)destPath.get(), SE_FILE_OBJECT, - DACL_SECURITY_INFORMATION | - UNPROTECTED_DACL_SECURITY_INFORMATION, - NULL, NULL, &empty_acl, NULL); - } + PACL pOldDACL = NULL; + PSECURITY_DESCRIPTOR pSD = NULL; + ::GetNamedSecurityInfoW((LPWSTR)destPath.get(), SE_FILE_OBJECT, + DACL_SECURITY_INFORMATION, + NULL, NULL, &pOldDACL, NULL, &pSD); + if (pOldDACL) + ::SetNamedSecurityInfoW((LPWSTR)destPath.get(), SE_FILE_OBJECT, + DACL_SECURITY_INFORMATION | + UNPROTECTED_DACL_SECURITY_INFORMATION, + NULL, NULL, pOldDACL, NULL); + if (pSD) + LocalFree((HLOCAL)pSD); } #endif return rv;