diff options
author | 2016-03-18 22:41:17 +0100 | |
---|---|---|
committer | 2016-03-18 22:41:17 +0100 | |
commit | e39daaf5bdcf21d64abf239e1133963643dc6df1 (patch) | |
tree | 1f1b5f333e84bf056ce82c27bebdbad933f26c0d /src/osd/modules/file/winfile.cpp | |
parent | 421656e108e7091ee9e1b14c84f0a3f6efc2ad2e (diff) | |
parent | b79020559ea3617b2d6bd4c92041d314045e2938 (diff) |
Merge remote-tracking branch 'refs/remotes/mamedev/master'
Diffstat (limited to 'src/osd/modules/file/winfile.cpp')
-rw-r--r-- | src/osd/modules/file/winfile.cpp | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/osd/modules/file/winfile.cpp b/src/osd/modules/file/winfile.cpp index 894ce5b58bb..c7032a4e6b5 100644 --- a/src/osd/modules/file/winfile.cpp +++ b/src/osd/modules/file/winfile.cpp @@ -57,8 +57,9 @@ 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; + largeOffset.QuadPart = offset; + DWORD result(SetFilePointerEx(m_handle, largeOffset, NULL, FILE_BEGIN)); if (INVALID_SET_FILE_POINTER == result) { DWORD const err(GetLastError()); @@ -77,8 +78,9 @@ 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; + largeOffset.QuadPart = offset; + DWORD result(SetFilePointerEx(m_handle, largeOffset, NULL, FILE_BEGIN)); if (INVALID_SET_FILE_POINTER == result) { DWORD const err(GetLastError()); @@ -97,8 +99,9 @@ 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; + largeOffset.QuadPart = offset; + DWORD const result(SetFilePointerEx(m_handle, largeOffset, NULL, FILE_BEGIN)); if (INVALID_SET_FILE_POINTER == result) { DWORD const err(GetLastError()); @@ -163,7 +166,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 +380,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; } |