以下对 SetSystemFileCacheSize() 的调用失败,但是如果将“FILE_CACHE_MIN_HARD_ENABLE”替换为 0,则会通过。
我究竟做错了什么?
SIZE_T dwMinimumFileCacheSize = 1048576; // Exact number reported by SetSystemFileCacheSize.
SIZE_T dwMaximumFileCacheSize = 1099511627776; // Exact number reported by SetSystemFileCacheSize.
int result = SetSystemFileCacheSize(
dwMinimumFileCacheSize, // dwMinimumWorkingSetSize
dwMaximumFileCacheSize, // dwMaximumWorkingSetSize,
FILE_CACHE_MIN_HARD_ENABLE // Works if this flag is set to 0.
);
if (result == 0)
{
// Error is "5" if it fails.
wprintf(L" Error E2469: Could not set size of system cache, error %u.\n", GetLastError());
}
else
{
wprintf(L" Pass.\n");
}