// If the version of the ntfs.sys driver shows that the KB2731284 hotfix or a later update // is installed, zeroing out data files is unnecessary. The file version numbers used below // are taken from the Hotfix File Information at http://support.microsoft.com/kb/2731284. bool isKB2731284OrLaterUpdateInstalled() { UINT pathBufferSize = GetSystemDirectoryA(NULL, 0); if (pathBufferSize == 0) { DWORD gle = GetLastError(); warning() << "GetSystemDirectoryA failed with " << errnoWithDescription(gle); return false; } std::unique_ptr<char[]> systemDirectory(new char[pathBufferSize]); UINT systemDirectoryPathLen; systemDirectoryPathLen = GetSystemDirectoryA(systemDirectory.get(), pathBufferSize); if (systemDirectoryPathLen == 0) { DWORD gle = GetLastError(); warning() << "GetSystemDirectoryA failed with " << errnoWithDescription(gle); return false; } if (systemDirectoryPathLen != pathBufferSize - 1) { warning() << "GetSystemDirectoryA returned unexpected path length"; return false; } string ntfsDotSysPath = systemDirectory.get(); if (ntfsDotSysPath.back() != '\\') { ntfsDotSysPath.append("\\"); } ntfsDotSysPath.append("drivers\\ntfs.sys"); DWORD fileVersionMS; DWORD fileVersionLS; if (getFileVersion(ntfsDotSysPath.c_str(), fileVersionMS, fileVersionLS)) { WORD fileVersionFirstNumber = HIWORD(fileVersionMS); WORD fileVersionSecondNumber = LOWORD(fileVersionMS); WORD fileVersionThirdNumber = HIWORD(fileVersionLS); WORD fileVersionFourthNumber = LOWORD(fileVersionLS); if (fileVersionFirstNumber == 6 && fileVersionSecondNumber == 1 && fileVersionThirdNumber == 7600 && fileVersionFourthNumber >= 21296 && fileVersionFourthNumber <= 21999) { return true; } else if (fileVersionFirstNumber == 6 && fileVersionSecondNumber == 1 && fileVersionThirdNumber == 7601 && fileVersionFourthNumber >= 22083 && fileVersionFourthNumber <= 22999) { return true; } } return false; }
status_t DecorInfoUtility::ScanDecorators() { status_t result; BPath systemPath; result = find_directory(B_SYSTEM_ADDONS_DIRECTORY, &systemPath); if (result == B_OK) result = systemPath.Append("decorators"); if (result == B_OK) { BDirectory systemDirectory(systemPath.Path()); result = systemDirectory.InitCheck(); if (result == B_OK) { result = _ScanDecorators(systemDirectory); if (result != B_OK) { fprintf(stderr, "DecorInfoUtility::ScanDecorators()\tERROR: %s\n", strerror(result)); return result; } } } BPath systemNonPackagedPath; result = find_directory(B_SYSTEM_NONPACKAGED_ADDONS_DIRECTORY, &systemNonPackagedPath); if (result == B_OK) result = systemNonPackagedPath.Append("decorators"); if (result == B_OK) { BDirectory systemNonPackagedDirectory(systemNonPackagedPath.Path()); result = systemNonPackagedDirectory.InitCheck(); if (result == B_OK) { result = _ScanDecorators(systemNonPackagedDirectory); if (result != B_OK) { fprintf(stderr, "DecorInfoUtility::ScanDecorators()\tERROR: %s\n", strerror(result)); return result; } } } BPath userPath; result = find_directory(B_USER_ADDONS_DIRECTORY, &userPath); if (result == B_OK) result = userPath.Append("decorators"); if (result == B_OK) { BDirectory userDirectory(userPath.Path()); result = userDirectory.InitCheck(); if (result == B_OK) { result = _ScanDecorators(userDirectory); if (result != B_OK) { fprintf(stderr, "DecorInfoUtility::ScanDecorators()\tERROR: %s\n", strerror(result)); return result; } } } BPath userNonPackagedPath; result = find_directory(B_USER_NONPACKAGED_ADDONS_DIRECTORY, &userNonPackagedPath); if (result == B_OK) result = userNonPackagedPath.Append("decorators"); if (result == B_OK) { BDirectory userNonPackagedDirectory(userNonPackagedPath.Path()); result = userNonPackagedDirectory.InitCheck(); if (result == B_OK) { result = _ScanDecorators(userNonPackagedDirectory); if (result != B_OK) { fprintf(stderr, "DecorInfoUtility::ScanDecorators()\tERROR: %s\n", strerror(result)); return result; } } } fHasScanned = true; return B_OK; }