diff options
author | 2016-03-18 13:37:49 -0400 | |
---|---|---|
committer | 2016-03-18 13:37:49 -0400 | |
commit | 603d5509df7e3d0455d048ab5ec71397183ac44c (patch) | |
tree | 3d91130d58818631ff16049905d792735b6204c0 /src/osd/modules/file/winfile.cpp | |
parent | 4e214fd08df1a0f633eb057b393c0f72be1d7754 (diff) |
Update Windows OSD file functions to preferred more modern versions. All still available on XP and later.
Diffstat (limited to 'src/osd/modules/file/winfile.cpp')
-rw-r--r-- | src/osd/modules/file/winfile.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/osd/modules/file/winfile.cpp b/src/osd/modules/file/winfile.cpp index 894ce5b58bb..787a90957ae 100644 --- a/src/osd/modules/file/winfile.cpp +++ b/src/osd/modules/file/winfile.cpp @@ -57,8 +57,8 @@ public: virtual error read(void *buffer, std::uint64_t offset, std::uint32_t length, std::uint32_t &actual) override { // attempt to set the file pointer - LONG upper(std::uint32_t(offset >> 32)); - DWORD result(SetFilePointer(m_handle, std::uint32_t(offset), &upper, FILE_BEGIN)); + LARGE_INTEGER largeOffset = { offset }; + DWORD result(SetFilePointerEx(m_handle, largeOffset, NULL, FILE_BEGIN)); if (INVALID_SET_FILE_POINTER == result) { DWORD const err(GetLastError()); @@ -77,8 +77,8 @@ public: virtual error write(void const *buffer, std::uint64_t offset, std::uint32_t length, std::uint32_t &actual) override { // attempt to set the file pointer - LONG upper(std::uint32_t(offset >> 32)); - DWORD result(SetFilePointer(m_handle, std::uint32_t(offset), &upper, FILE_BEGIN)); + LARGE_INTEGER largeOffset = { offset }; + DWORD result(SetFilePointerEx(m_handle, largeOffset, NULL, FILE_BEGIN)); if (INVALID_SET_FILE_POINTER == result) { DWORD const err(GetLastError()); @@ -97,8 +97,8 @@ public: virtual error truncate(std::uint64_t offset) override { // attempt to set the file pointer - LONG upper(std::uint32_t(offset >> 32)); - DWORD const result(SetFilePointer(m_handle, std::uint32_t(offset), &upper, FILE_BEGIN)); + LARGE_INTEGER largeOffset = { offset }; + DWORD const result(SetFilePointerEx(m_handle, largeOffset, NULL, FILE_BEGIN)); if (INVALID_SET_FILE_POINTER == result) { DWORD const err(GetLastError()); @@ -163,7 +163,8 @@ DWORD create_path_recursive(TCHAR *path) } // if the path already exists, we're done - if (GetFileAttributes(path) != INVALID_FILE_ATTRIBUTES) + WIN32_FILE_ATTRIBUTE_DATA fileinfo; + if (GetFileAttributesEx(path, GetFileExInfoStandard, &fileinfo) != INVALID_FILE_ATTRIBUTES) return NO_ERROR; else if (!CreateDirectory(path, NULL)) return GetLastError(); @@ -376,12 +377,12 @@ osd_directory_entry *osd_stat(const std::string &path) { // need to do special logic for root directories memset(&find_data, 0, sizeof(find_data)); - find_data.dwFileAttributes = GetFileAttributes(t_path); + GetFileAttributesEx(t_path, GetFileExInfoStandard, &find_data.dwFileAttributes); } else { // attempt to find the first file - find = FindFirstFile(t_path, &find_data); + find = FindFirstFileEx(t_path, FindExInfoStandard, &find_data, FindExSearchNameMatch, NULL, 0); if (find == INVALID_HANDLE_VALUE) goto done; } |