How can I find the current pagefile size of a drive?
Priror to windows 7, There used to be a script named pafefileconfig.vba in System32 folder which can be used. But its now removed.
Is it possible to get the details using JNA? If yes, how?
EDIT
This is the code i wrote to get the pagefile info using JNA:
Kernel32 kernel32 = (Kernel32)Native.loadLibrary("kernel32", Kernel32.class);
MEMORYSTATUSEX memInfo = new MEMORYSTATUSEX();
kernel32.GlobalMemoryStatusEx(memInfo);
int toMB = (1024*1024);
float RAM = memInfo.ullTotalPhys.floatValue();
float totalPage = memInfo.ullTotalPageFile.floatValue();
float availPage = memInfo.ullAvailPageFile.floatValue();
float availRam = memInfo.ullAvailPhys.floatValue();
System.out.println(memInfo.dwMemoryLoad);
System.out.println("RAM "+RAM/toMB);
System.out.println("RAM avail "+availRam/toMB);
float ramUsed = RAM-availRam;
System.out.println("RAM used "+ramUsed/toMB);
System.out.println("Total page(RAM+Page) "+(totalPage)/toMB);
float totalPageWithoutRam = totalPage-RAM;
System.out.println("Total page(without RAM) "+(totalPageWithoutRam)/toMB);
System.out.println("Total avail page(With free ram) "+availPage/toMB);
float avialPageWithoutRam = availPage-availRam;
System.out.println("Total page avail(Without ram) "+(avialPageWithoutRam)/toMB);
System.out.println("Page used so far(Without ram) "+(totalPageWithoutRam-avialPageWithoutRam)/toMB);
And this is the output:
82
RAM 12285.582
RAM avail 2167.6758
RAM used 10117.906
Total page(RAM+Page) 24569.348
Total page(without RAM) 12283.766
Total avail page(With free ram) 12115.641
Total page avail(Without ram) 9947.965
Page used so far(Without ram) 2335.8008
I got the same result on using GetPerformanceInfo aswell.
But this looks different from what i get when i run wmic pagefile
wmic:root\cli>pagefile list /format :list
AllocatedBaseSize=12285
CurrentUsage=843
Description=C:\pagefile.sys
InstallDate=20120329043502.876449+330
Name=C:\pagefile.sys
PeakUsage=843
Status=
TempPageFile=FALSE
Why I am seeing a difference?