From 014ed77130f1812d76f8086e5507e11a880799e4 Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Tue, 11 Jul 2023 21:21:18 +0200 Subject: Windows: when overwriting an existing file container, add its current size to the available free space --- src/Format/Tcformat.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src') diff --git a/src/Format/Tcformat.c b/src/Format/Tcformat.c index e98a25da..368c7d9e 100644 --- a/src/Format/Tcformat.c +++ b/src/Format/Tcformat.c @@ -3462,6 +3462,13 @@ BOOL QueryFreeSpace (HWND hwndDlg, HWND hwndTextBox, BOOL display, LONGLONG *pFr else { LARGE_INTEGER lDiskFree; + // if the file pointed by szFileName already exists, we must add its size to the free space since it will be overwritten durig the volume creation + __int64 lFileSize = GetFileSize64(szFileName); + if (lFileSize != -1) + { + free.QuadPart += lFileSize; + } + lDiskFree.QuadPart = free.QuadPart; if (pFreeSpaceValue) -- cgit v1.2.3