Windows 10 Pro - FSUTIL VOLUME DISKFREE Output

C

c.g.miller

I am currently running Windows 10 Pro (Version 1809 OS Build 17663.316).


I have recently run into an issue that I am hoping to find a workaround for. A Windows Update within the last month or two has changed the output of one FSUTIL Windows Utility, which is resulting in crashes with proprietary legacy software.


The issue:


At my workplace, we have a legacy system that uses a customized bundle of Apache+MySQL+Tomcat to provide a web interface for some systems that we install on customer sites. We have this system installed on our workstations here at the office in order to test and develop them in-house before deployment. The system in question is legacy; the company that supported it is no longer around, and while I have access to the partial source code for some of the application, I do not have enough to recompile it, meaning that I cannot make any changes to the application's functionality.


When the Tomcat application starts up, the proprietary code runs a check to verify that there is a minimum amount of free space on the disk, for logging and other purposes. The way the application determines the amount of total free space is implemented in the following way:


1. Execute the command 'cmd.exe /c fsutil volume diskfree C:\ | find "Total # of bytes"'

2. Split the output at the ":" (colon) character, take the second value, trimming the output of whitespace before and after it. This effectively takes the value part of the output, disregarding the colon and everything before it in the output line

3. Convert this do a Long (Java) using the Long.parseLong() method.


This works with no issue in previous versions of Windows 10 and Windows 7 - the output for the 'cmd.exe /c fsutil volume diskfree C:\ | find "Total # of bytes"' command looks like this:

Total # of bytes : 1985612570624


Per the code, it would end up converting the String value of "1985612570624" into a numerical value, and everything continues without issue.


However, sometime in the past month or so, my Windows 10 has updated, and the output of the 'cmd.exe /c fsutil volume diskfree C:\ | find "Total # of bytes"' command looks like this:

Total # of bytes : 1985612570624 (1849.25GB)

The "(1849.25GB)" part of the output, something that has changed between the FSUTIL.EXE build 10.0.17763.1 (the one on my workstation), and the FSUTIL.exe build 10.0.17134.1 (the FSUTIL.EXE application on a coworker's Windows 10 machine) that has added in the GB calculation in the output. As the code in the legacy application does not take that into consideration, it ends up throwing an error (NumberFormatException in Java, as the output is directly passed to Long.parseLong()), and the application will not start, rendering the application unusable on my workstation.


What I am looking for:

As I am unable to modify the application source code (because I cannot recompile it), and as I cannot contact the company that would support it, as they are no longer around to contact, is there any way that I can "roll back" or modify the FSUTIL utility to output with just the byte count, without the GB calculation? I have attempted to replace my FSUTIL.EXE file in the C:\Windows\System32 folder with the older version that my coworker has, along with the FSUTILEXT.DLL and other files that showed up in a Dependency Walker. None of these were successful in doing what I needed; they either threw errors or output nothing at all. I have since replaced all files back to the original ones included with my build of Windows 10.


I need the FSUTIL utility to output the raw number of bytes WITHOUT the calculated GB after it, like the previous versions did.


Additionally, I cannot roll back to a previous version of Windows, and any updates that I have uninstalled from the Uninstall Updates menu has not resolved the issue.


I am worried that if there is no solution for this, when my coworkers' workstations end up updating automatically (as Windows 10 forces updates eventually), we will no longer be able to perform work on this system in the office, as we are all on Windows 10.


Any advice would be appreciated. Thank you.

Continue reading...
 
Back
Top Bottom