Skip to content

Commit

Permalink
modify getVolumeSpace function
Browse files Browse the repository at this point in the history
  • Loading branch information
litz-a committed Jan 18, 2016
1 parent 780c367 commit 652887e
Showing 1 changed file with 23 additions and 6 deletions.
29 changes: 23 additions & 6 deletions GLDUserInfoUtils/GLDDiskInfoUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,13 265,30 @@ namespace GLDDISKINFO

if (pGetDiskFreeSpaceEx)
{
fResult = pGetDiskFreeSpaceEx(dir.toStdString().c_str(), (PULARGE_INTEGER)&ri64FreeBytesToCaller,
(PULARGE_INTEGER)&ri64TotalBytes, (PULARGE_INTEGER)&i64FreeBytes);
fResult = pGetDiskFreeSpaceEx(dir.toStdString().c_str(),
(PULARGE_INTEGER)&ri64FreeBytesToCaller,
(PULARGE_INTEGER)&ri64TotalBytes,
(PULARGE_INTEGER)&i64FreeBytes);

ri64FreeBytesToCaller = (DWORD)(ri64FreeBytesToCaller / 1024 / 1024);
ri64TotalBytes = (DWORD)(ri64TotalBytes / 1024 / 1024);

return fResult;
if (fResult)
{
ri64FreeBytesToCaller = (DWORD)(ri64FreeBytesToCaller / 1024 / 1024);
ri64TotalBytes = (DWORD)(ri64TotalBytes / 1024 / 1024);
}
}
else
{
DWORD dwSectPerClust, dwBytesPerSect, dwFreeClusters, dwTotalClusters;
fResult = GetDiskFreeSpaceA(dir.toStdString().c_str(),
&dwSectPerClust,
&dwBytesPerSect,
&dwFreeClusters,
&dwTotalClusters);
if (fResult)
{
ri64TotalBytes = (qulonglong)(dwTotalClusters * dwSectPerClust * dwBytesPerSect /(1024 * 1024));
ri64FreeBytesToCaller = (qulonglong)(dwFreeClusters * dwSectPerClust * dwBytesPerSect / (1024 * 1024));
}
}

return fResult;
Expand Down

0 comments on commit 652887e

Please sign in to comment.