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
This commit is contained in:
kichik 2008-04-18 21:55:57 +00:00
parent 6146a9015e
commit 6503959ddb

View file

@ -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);