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

physfs_platform_windows.c: Use newer APIs when permitted by _WIN32_WINNT #7

Merged
merged 1 commit into from
Oct 16, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/physfs_platform_windows.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ static char *unicodeToUtf8Heap(const WCHAR *w_str)

static inline HANDLE winFindFirstFileW(const WCHAR *path, LPWIN32_FIND_DATAW d)
{
#ifdef PHYSFS_PLATFORM_WINRT
#if defined(PHYSFS_PLATFORM_WINRT) || (_WIN32_WINNT >= 0x0501) // Windows XP+
return FindFirstFileExW(path, FindExInfoStandard, d,
FindExSearchNameMatch, NULL, 0);
#else
Expand All @@ -111,7 +111,7 @@ static inline HANDLE winFindFirstFileW(const WCHAR *path, LPWIN32_FIND_DATAW d)

static inline BOOL winInitializeCriticalSection(LPCRITICAL_SECTION lpcs)
{
#ifdef PHYSFS_PLATFORM_WINRT
#if defined(PHYSFS_PLATFORM_WINRT) || (_WIN32_WINNT >= 0x0600) // Windows Vista+
return InitializeCriticalSectionEx(lpcs, 2000, 0);
#else
InitializeCriticalSection(lpcs);
Expand All @@ -123,7 +123,7 @@ static inline HANDLE winCreateFileW(const WCHAR *wfname, const DWORD mode,
const DWORD creation)
{
const DWORD share = FILE_SHARE_READ | FILE_SHARE_WRITE;
#ifdef PHYSFS_PLATFORM_WINRT
#if defined(PHYSFS_PLATFORM_WINRT) || (_WIN32_WINNT >= 0x0602) // Windows 8+
return CreateFile2(wfname, mode, share, creation, NULL);
#else
return CreateFileW(wfname, mode, share, NULL, creation,
Expand All @@ -134,7 +134,7 @@ static inline HANDLE winCreateFileW(const WCHAR *wfname, const DWORD mode,
static BOOL winSetFilePointer(HANDLE h, const PHYSFS_sint64 pos,
PHYSFS_sint64 *_newpos, const DWORD whence)
{
#ifdef PHYSFS_PLATFORM_WINRT
#if defined(PHYSFS_PLATFORM_WINRT) || (_WIN32_WINNT >= 0x0501) // Windows XP+
LARGE_INTEGER lipos;
LARGE_INTEGER linewpos;
BOOL rc;
Expand All @@ -158,7 +158,7 @@ static BOOL winSetFilePointer(HANDLE h, const PHYSFS_sint64 pos,

static PHYSFS_sint64 winGetFileSize(HANDLE h)
{
#ifdef PHYSFS_PLATFORM_WINRT
#if defined(PHYSFS_PLATFORM_WINRT) || (_WIN32_WINNT >= 0x0600) // Windows Vista+
FILE_STANDARD_INFO info;
const BOOL rc = GetFileInformationByHandleEx(h, FileStandardInfo,
&info, sizeof (info));
Expand Down