2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
11 #include <afs/param.h>
20 ULONG ExtractPageSize (LPCTSTR psz)
22 LPCTSTR pch = &psz[ lstrlen(psz) ];
23 while ((pch > psz) && (isdigit(pch[-1])))
29 ULONG GetPagingSpace (void)
31 ULONG ckPageSpace = 0;
34 if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, TEXT("SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Memory Management"), 0, KEY_QUERY_VALUE, &hk) == ERROR_SUCCESS)
36 TCHAR mszData[1024] = TEXT("");
37 DWORD dwSize = sizeof(mszData);
38 DWORD dwType = REG_MULTI_SZ;
40 if (RegQueryValueEx (hk, TEXT("PagingFiles"), 0, &dwType, (PBYTE)mszData, &dwSize) == ERROR_SUCCESS)
42 for (LPTSTR psz = mszData; *psz; psz += 1+lstrlen(psz))
44 ckPageSpace += ExtractPageSize (psz);
51 return ckPageSpace * 1024;