Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[windows] drop FindFirstFileExW(...) workaround for Vista #11960

Merged
merged 1 commit into from
Apr 13, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 1 addition & 4 deletions xbmc/filesystem/win32/Win32Directory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,7 @@ bool CWin32Directory::GetDirectory(const CURL& url, CFileItemList &items)
HANDLE hSearch;
WIN32_FIND_DATAW findData = {};

if (g_sysinfo.IsWindowsVersionAtLeast(CSysInfo::WindowsVersionWin7))
hSearch = FindFirstFileExW(searchMask.c_str(), FindExInfoBasic, &findData, FindExSearchNameMatch, NULL, FIND_FIRST_EX_LARGE_FETCH);
else
hSearch = FindFirstFileExW(searchMask.c_str(), FindExInfoStandard, &findData, FindExSearchNameMatch, NULL, 0);
hSearch = FindFirstFileExW(searchMask.c_str(), FindExInfoBasic, &findData, FindExSearchNameMatch, NULL, FIND_FIRST_EX_LARGE_FETCH);

if (hSearch == INVALID_HANDLE_VALUE)
return GetLastError() == ERROR_FILE_NOT_FOUND ? Exists(url) : false; // return true if directory exist and empty
Expand Down
5 changes: 1 addition & 4 deletions xbmc/filesystem/win32/Win32File.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -479,10 +479,7 @@ int CWin32File::Stat(const CURL& url, struct __stat64* statData)
// get maximum information about file from search function
HANDLE hSearch;
WIN32_FIND_DATAW findData;
if (CSysInfo::IsWindowsVersionAtLeast(CSysInfo::WindowsVersionWin7))
hSearch = FindFirstFileExW(pathnameW.c_str(), FindExInfoBasic, &findData, FindExSearchNameMatch, NULL, 0);
else
hSearch = FindFirstFileExW(pathnameW.c_str(), FindExInfoStandard, &findData, FindExSearchNameMatch, NULL, 0);
hSearch = FindFirstFileExW(pathnameW.c_str(), FindExInfoBasic, &findData, FindExSearchNameMatch, NULL, 0);

if (m_smbFile)
m_lastSMBFileErr = GetLastError(); // set real error state
Expand Down
10 changes: 2 additions & 8 deletions xbmc/filesystem/win32/Win32SMBDirectory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,7 @@ bool CWin32SMBDirectory::GetDirectory(const CURL& url, CFileItemList &items)
WIN32_FIND_DATAW findData = {};
CURL authUrl(url); // ConnectAndAuthenticate may update url with username and password

if (g_sysinfo.IsWindowsVersionAtLeast(CSysInfo::WindowsVersionWin7))
hSearch = FindFirstFileExW(searchMask.c_str(), FindExInfoBasic, &findData, FindExSearchNameMatch, NULL, FIND_FIRST_EX_LARGE_FETCH);
else
hSearch = FindFirstFileExW(searchMask.c_str(), FindExInfoStandard, &findData, FindExSearchNameMatch, NULL, 0);
hSearch = FindFirstFileExW(searchMask.c_str(), FindExInfoBasic, &findData, FindExSearchNameMatch, NULL, FIND_FIRST_EX_LARGE_FETCH);

if (hSearch == INVALID_HANDLE_VALUE)
{
Expand All @@ -134,10 +131,7 @@ bool CWin32SMBDirectory::GetDirectory(const CURL& url, CFileItemList &items)

if (ConnectAndAuthenticate(authUrl, (m_flags & DIR_FLAG_ALLOW_PROMPT) != 0))
{
if (g_sysinfo.IsWindowsVersionAtLeast(CSysInfo::WindowsVersionWin7))
hSearch = FindFirstFileExW(searchMask.c_str(), FindExInfoBasic, &findData, FindExSearchNameMatch, NULL, FIND_FIRST_EX_LARGE_FETCH);
else
hSearch = FindFirstFileExW(searchMask.c_str(), FindExInfoStandard, &findData, FindExSearchNameMatch, NULL, 0);
hSearch = FindFirstFileExW(searchMask.c_str(), FindExInfoBasic, &findData, FindExSearchNameMatch, NULL, FIND_FIRST_EX_LARGE_FETCH);
searchErr = GetLastError();
}
if (hSearch == INVALID_HANDLE_VALUE)
Expand Down
12 changes: 2 additions & 10 deletions xbmc/utils/SystemInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -668,12 +668,6 @@ std::string CSysInfo::GetOsPrettyNameWithVersion(void)
{
switch (GetWindowsVersion())
{
case WindowsVersionVista:
if (osvi.wProductType == VER_NT_WORKSTATION)
osNameVer.append("Vista");
else
osNameVer.append("Server 2008");
break;
case WindowsVersionWin7:
if (osvi.wProductType == VER_NT_WORKSTATION)
osNameVer.append("7");
Expand Down Expand Up @@ -841,9 +835,7 @@ CSysInfo::WindowsVersion CSysInfo::GetWindowsVersion()
OSVERSIONINFOEXW osvi = {};
if (sysGetVersionExWByRef(osvi))
{
if (osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 0)
m_WinVer = WindowsVersionVista;
else if (osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 1)
if (osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 1)
m_WinVer = WindowsVersionWin7;
else if (osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 2)
m_WinVer = WindowsVersionWin8;
Expand All @@ -852,7 +844,7 @@ CSysInfo::WindowsVersion CSysInfo::GetWindowsVersion()
else if (osvi.dwMajorVersion == 10 && osvi.dwMinorVersion == 0)
m_WinVer = WindowsVersionWin10;
/* Insert checks for new Windows versions here */
else if ( (osvi.dwMajorVersion == 6 && osvi.dwMinorVersion > 3) || osvi.dwMajorVersion > 6)
else if ( (osvi.dwMajorVersion == 6 && osvi.dwMinorVersion > 3) || osvi.dwMajorVersion > 10)
m_WinVer = WindowsVersionFuture;
}
}
Expand Down
1 change: 0 additions & 1 deletion xbmc/utils/SystemInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ class CSysInfo : public CInfoLoader, public ISubSettings
enum WindowsVersion
{
WindowsVersionUnknown = -1, // Undetected, unsupported Windows version or OS in not Windows
WindowsVersionVista, // Windows Vista, Windows Server 2008
WindowsVersionWin7, // Windows 7, Windows Server 2008 R2
WindowsVersionWin8, // Windows 8, Windows Server 2012
WindowsVersionWin8_1, // Windows 8.1
Expand Down