From 6503959ddb2cd8b4e49a9b6258f6b185dca66398 Mon Sep 17 00:00:00 2001 From: kichik Date: Fri, 18 Apr 2008 21:55:57 +0000 Subject: [PATCH] partial fix for bug #1946112 - Wrong free space calculation still need to get the lowest existing directory so C:\mount-point\non-existent-dir still works git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@5601 212acab6-be3b-0410-9dea-997c60f758d6 --- Source/exehead/Ui.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Source/exehead/Ui.c b/Source/exehead/Ui.c index 2d89cf80..ee7989ea 100644 --- a/Source/exehead/Ui.c +++ b/Source/exehead/Ui.c @@ -982,7 +982,6 @@ static BOOL CALLBACK DirProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar if (uMsg == WM_IN_UPDATEMSG || uMsg == WM_NOTIFY_START) { static char s[NSIS_MAX_STRLEN]; - char *p; int error = 0; int available_set = 0; unsigned total, available = 0xFFFFFFFF; @@ -992,9 +991,6 @@ static BOOL CALLBACK DirProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar error = NSIS_INSTDIR_INVALID; mystrcpy(s,dir); - p=skip_root(s); - if (p) - *p=0; // Test for and use the GetDiskFreeSpaceEx API { @@ -1020,6 +1016,12 @@ static BOOL CALLBACK DirProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar { // GetDiskFreeSpaceEx is not available DWORD spc, bps, fc, tc; + + // GetDiskFreeSpaceEx accepts any path, but GetDiskFreeSpace accepts only the root + char *p=skip_root(s); + if (p) + *p=0; + if (GetDiskFreeSpace(s, &spc, &bps, &fc, &tc)) { available = (int)MulDiv(bps * spc, fc, 1 << 10);