Skip to content

Commit

Permalink
Merge pull request #11960 from Rechi/winDropVista
Browse files Browse the repository at this point in the history
[windows] drop FindFirstFileExW(...) workaround for Vista
  • Loading branch information
MartijnKaijser committed Apr 13, 2017
2 parents 961174f + b1b1164 commit 21f4e3b
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 27 deletions.
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

0 comments on commit 21f4e3b

Please sign in to comment.