VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2015-01-30 00:57:22 +0100
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2015-02-08 10:07:38 +0100
commitf98a691933c6faa9fb6098d9242d1081d616396e (patch)
tree8b78842c2dc2a1ccf0ef3d5b52dae9e4021e18cf /src
parent35497f87a7893a921a0d34aede02184c4ac72c82 (diff)
downloadVeraCrypt-f98a691933c6faa9fb6098d9242d1081d616396e.tar.gz
VeraCrypt-f98a691933c6faa9fb6098d9242d1081d616396e.zip
Windows Setup: implement removal of non-empty directories to avoid errors during uninstall.
Diffstat (limited to 'src')
-rw-r--r--src/Setup/Setup.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/Setup/Setup.c b/src/Setup/Setup.c
index 0e404431..9f5fbfdd 100644
--- a/src/Setup/Setup.c
+++ b/src/Setup/Setup.c
@@ -101,7 +101,25 @@ BOOL StatRemoveDirectory (char *lpszDir)
struct __stat64 st;
if (_stat64 (lpszDir, &st) == 0)
- return RemoveDirectory (lpszDir);
+ {
+ BOOL bStatus = RemoveDirectory (lpszDir);
+ if (!bStatus)
+ {
+ /* force removal of the non empty directory */
+ char szOpPath[TC_MAX_PATH + 1] = {0};
+ SHFILEOPSTRUCTA op;
+
+ StringCbCopyA(szOpPath, sizeof(szOpPath)-1, lpszDir);
+ ZeroMemory(&op, sizeof(op));
+ op.wFunc = FO_DELETE;
+ op.pFrom = szOpPath;
+ op.fFlags = FOF_SILENT | FOF_NOCONFIRMATION | FOF_NOERRORUI | FOF_NOCONFIRMMKDIR;
+
+ if ((0 == SHFileOperation(&op)) && (!op.fAnyOperationsAborted))
+ bStatus = TRUE;
+ }
+ return bStatus;
+ }
else
return TRUE;
}