我正在尝试获取当前系统文件缓存大小,如下所示.但是,当我运行此代码时,没有任何内容返回,有人可以看到我出错的地方吗?仅供参考,链接是GetSystemFileCache.
[DllImport("kernel32", SetLastError = true, CharSet = CharSet.Unicode)]
public static extern bool GetSystemFileCacheSize(
ref IntPtr lpMinimumFileCacheSize,
ref IntPtr lpMaximumFileCacheSize,
ref IntPtr lpFlags
);
static void Main(string[] args)
{
IntPtr lpMinimumFileCacheSize = IntPtr.Zero;
IntPtr lpMaximumFileCacheSize = IntPtr.Zero;
IntPtr lpFlags = IntPtr.Zero;
bool b = GetSystemFileCacheSize(ref lpMinimumFileCacheSize, ref lpMaximumFileCacheSize, ref lpFlags);
}
Run Code Online (Sandbox Code Playgroud)
bool b = GetSystemFileCacheSize(ref lpMinimumFileCacheSize, ref lpMaximumFileCacheSize, ref lpFlags);
Console.WriteLine(lpMinimumFileCacheSize);
Console.WriteLine(lpMaximumFileCacheSize);
Run Code Online (Sandbox Code Playgroud)
对我来说很好.
输出:
1048576
2143289344
Run Code Online (Sandbox Code Playgroud)
Windows 7 Pro x32