cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Pizzamampf
Level 4

Getting the size of a folder with huge files

Hi there, I once again ran into a little problem with my BasicMSI installation (InstallShield 2019 Professional).

I need to determine the size of a folder containing several huge files (can be up to 30 GB per file and >300 GB for the whole folder).
The standard code snippets you can find everywhere are usually only capable of handling a total folder size < 2 GB because that's the limit of a single NUMBER variable.
I found the function GetAndAddAllFilesCost and tried the following (source and target directory are same since I only need to check size without moving files):

GetAndAddAllFilesCost(szDirectory, "*", szDirectory, 0, nvSizeHigh, nvSizeLow, nvCostUninstall);

For "small" folders (e.g. 500 MB total size) it works perfectly returning 0 for nvSizeHigh and the folder size in bytes for nvSizeLow.

For the huge folder (3.3 GB in my test scenario with no single file exceeding 2 GB) it still returned 0 for nvSizeHigh and -742141952 for nvSizeLow. Obviously it still tried to store the whole value in nvSizeLow and then resulting in an overflow continuing from -2 GB. The result is pretty much where 3.3 GB would bring me.

To me it seems to be a bug in InstallShield since the function according to documentation should be able to handle large numbers; apparently it only separates high/low values for a single file, but then tries to sum up high for all files and low for all files which can't work.

Is there any better working way without having to manually do the calculation between high and low? If I'd have to manually sum up the values and consider overflow it would end up very ugly.

Labels (1)
0 Kudos
(0) Replies