diff options
author | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2024-11-25 00:05:50 +0100 |
---|---|---|
committer | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2024-11-25 00:05:50 +0100 |
commit | 0c5fcf2286c912e087e6c3c5a25464fcfc107c89 (patch) | |
tree | 21315173722e02a2f312a8f34be5b130f4f1d4e5 /src/Common/Dlgcode.h | |
parent | 8ad9e7d769057d622d447ba4122bc499a70bd238 (diff) | |
download | VeraCrypt-0c5fcf2286c912e087e6c3c5a25464fcfc107c89.tar.gz VeraCrypt-0c5fcf2286c912e087e6c3c5a25464fcfc107c89.zip |
Windows Setup: Fix "Access Denied" issue during VeraCrypt update after a Windows upgrade
During a Windows upgrade, ownership of veracrypt.sys is set to TrustedInstaller, preventing VeraCrypt from accessing the file during an update.
This commit resolves the issue by temporarily taking ownership of the file to rename it, allowing the new file to be copied. The setup process now obtains additional privileges for this operation, which are properly dropped once the file copying is complete.
Diffstat (limited to 'src/Common/Dlgcode.h')
-rw-r--r-- | src/Common/Dlgcode.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/Common/Dlgcode.h b/src/Common/Dlgcode.h index ecf1bbd4..2bc95ae9 100644 --- a/src/Common/Dlgcode.h +++ b/src/Common/Dlgcode.h @@ -598,6 +598,27 @@ DWORD FastResizeFile (const wchar_t* filePath, __int64 fileSize); void GetAppRandomSeed (unsigned char* pbRandSeed, size_t cbRandSeed); #endif BOOL IsInternetConnected(); +#if defined(SETUP) && !defined (PORTABLE) +typedef struct _SECURITY_INFO_BACKUP { + PSID pOrigOwner; + PSID pOrigGroup; + PACL pOrigDacl; + PACL pOrigSacl; +} SECURITY_INFO_BACKUP, * PSECURITY_INFO_BACKUP; + +typedef struct _PRIVILEGE_STATE { + BOOL takeOwnership; + BOOL backup; + BOOL restore; +} PRIVILEGE_STATE, * PPRIVILEGE_STATE; + +BOOL RestoreSecurityInfo(const wchar_t* filePath, PSECURITY_INFO_BACKUP pBackup); +void FreeSecurityBackup(PSECURITY_INFO_BACKUP pBackup); +BOOL SaveCurrentPrivilegeState(PPRIVILEGE_STATE state); +BOOL RestorePrivilegeState(const PPRIVILEGE_STATE state); +BOOL EnableRequiredSetupPrivileges(PPRIVILEGE_STATE currentState); +BOOL ModifyFileSecurityPermissions(const wchar_t* filePath, PSECURITY_INFO_BACKUP pBackup); +#endif #ifdef __cplusplus } |