+static
+BOOL
+GetProfileSize(
+ PWSTR pszProfilePath,
+ PULONGLONG pullProfileSize)
+{
+ HANDLE hFile = INVALID_HANDLE_VALUE;
+ WIN32_FIND_DATA FindData;
+ DWORD dwProfilePathLength;
+ ULARGE_INTEGER Size;
+ BOOL bResult = TRUE;
+
+ dwProfilePathLength = wcslen(pszProfilePath);
+
+ wcscat(pszProfilePath, L"\\*.*");
+
+ hFile = FindFirstFileW(pszProfilePath, &FindData);
+ if (hFile == INVALID_HANDLE_VALUE)
+ {
+ if ((GetLastError() != ERROR_FILE_NOT_FOUND) &&
+ (GetLastError() != ERROR_PATH_NOT_FOUND))
+ bResult = FALSE;
+
+ goto done;
+ }
+
+ do
+ {
+ if (FindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
+ {
+ if ((_wcsicmp(FindData.cFileName, L".") == 0) ||
+ (_wcsicmp(FindData.cFileName, L"..") == 0))
+ continue;
+
+ pszProfilePath[dwProfilePathLength + 1] = UNICODE_NULL;
+ wcscat(pszProfilePath, FindData.cFileName);
+
+ if (!GetProfileSize(pszProfilePath, pullProfileSize))
+ {
+ bResult = FALSE;
+ goto done;
+ }
+ }
+ else
+ {
+ Size.u.LowPart = FindData.nFileSizeLow;
+ Size.u.HighPart = FindData.nFileSizeHigh;
+ *pullProfileSize += Size.QuadPart;
+ }
+ }
+ while (FindNextFile(hFile, &FindData));
+
+done:
+ pszProfilePath[dwProfilePathLength] = UNICODE_NULL;
+
+ if (hFile != INVALID_HANDLE_VALUE)
+ FindClose(hFile);
+
+ return bResult;
+}
+
+