mirror of
https://github.com/veracrypt/VeraCrypt.git
synced 2025-11-11 02:58:02 -06:00
Windows Setup: Fix the implementation of backup/restore of file permission during update
This commit is contained in:
@@ -15828,7 +15828,6 @@ BOOL EnableRequiredSetupPrivileges(PPRIVILEGE_STATE currentState)
|
|||||||
BOOL BackupSecurityInfo(const wchar_t* filePath, PSECURITY_INFO_BACKUP pBackup)
|
BOOL BackupSecurityInfo(const wchar_t* filePath, PSECURITY_INFO_BACKUP pBackup)
|
||||||
{
|
{
|
||||||
BOOL result = FALSE;
|
BOOL result = FALSE;
|
||||||
PSECURITY_DESCRIPTOR pSD = NULL;
|
|
||||||
DWORD dwRes;
|
DWORD dwRes;
|
||||||
|
|
||||||
ZeroMemory(pBackup, sizeof(SECURITY_INFO_BACKUP));
|
ZeroMemory(pBackup, sizeof(SECURITY_INFO_BACKUP));
|
||||||
@@ -15843,7 +15842,7 @@ BOOL BackupSecurityInfo(const wchar_t* filePath, PSECURITY_INFO_BACKUP pBackup)
|
|||||||
&pBackup->pOrigGroup,
|
&pBackup->pOrigGroup,
|
||||||
&pBackup->pOrigDacl,
|
&pBackup->pOrigDacl,
|
||||||
&pBackup->pOrigSacl,
|
&pBackup->pOrigSacl,
|
||||||
&pSD);
|
&pBackup->pOrigSD);
|
||||||
|
|
||||||
if (dwRes == ERROR_SUCCESS)
|
if (dwRes == ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
@@ -15852,9 +15851,6 @@ BOOL BackupSecurityInfo(const wchar_t* filePath, PSECURITY_INFO_BACKUP pBackup)
|
|||||||
result = TRUE;
|
result = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pSD)
|
|
||||||
LocalFree(pSD);
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -15891,14 +15887,8 @@ BOOL RestoreSecurityInfo(const wchar_t* filePath, PSECURITY_INFO_BACKUP pBackup)
|
|||||||
// Helper function to free security backup
|
// Helper function to free security backup
|
||||||
void FreeSecurityBackup(PSECURITY_INFO_BACKUP pBackup)
|
void FreeSecurityBackup(PSECURITY_INFO_BACKUP pBackup)
|
||||||
{
|
{
|
||||||
if (pBackup->pOrigOwner)
|
if (pBackup->pOrigSD)
|
||||||
LocalFree(pBackup->pOrigOwner);
|
LocalFree(pBackup->pOrigSD);
|
||||||
if (pBackup->pOrigGroup)
|
|
||||||
LocalFree(pBackup->pOrigGroup);
|
|
||||||
if (pBackup->pOrigDacl)
|
|
||||||
LocalFree(pBackup->pOrigDacl);
|
|
||||||
if (pBackup->pOrigSacl)
|
|
||||||
LocalFree(pBackup->pOrigSacl);
|
|
||||||
ZeroMemory(pBackup, sizeof(SECURITY_INFO_BACKUP));
|
ZeroMemory(pBackup, sizeof(SECURITY_INFO_BACKUP));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -604,6 +604,7 @@ typedef struct _SECURITY_INFO_BACKUP {
|
|||||||
PSID pOrigGroup;
|
PSID pOrigGroup;
|
||||||
PACL pOrigDacl;
|
PACL pOrigDacl;
|
||||||
PACL pOrigSacl;
|
PACL pOrigSacl;
|
||||||
|
PSECURITY_DESCRIPTOR pOrigSD;
|
||||||
} SECURITY_INFO_BACKUP, * PSECURITY_INFO_BACKUP;
|
} SECURITY_INFO_BACKUP, * PSECURITY_INFO_BACKUP;
|
||||||
|
|
||||||
typedef struct _PRIVILEGE_STATE {
|
typedef struct _PRIVILEGE_STATE {
|
||||||
|
|||||||
Reference in New Issue
Block a user