summaryrefslogtreecommitdiff
path: root/Source/Core/DiscIO
diff options
context:
space:
mode:
authorNolan Check <Nolan.Check@gmail.com>2009-07-30 22:30:30 +0000
committerNolan Check <Nolan.Check@gmail.com>2009-07-30 22:30:30 +0000
commit48365b5daa269f3f25918b032d1021f424107da5 (patch)
treedf7e7e15247521b01353e7009bc4fc2ba79d06e6 /Source/Core/DiscIO
parent8ab4814d73215271f0baaccf5cc51e7eba2b9c17 (diff)
Use slightly different Windows file functions.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3910 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core/DiscIO')
-rw-r--r--Source/Core/DiscIO/Src/FileBlob.cpp21
1 files changed, 9 insertions, 12 deletions
diff --git a/Source/Core/DiscIO/Src/FileBlob.cpp b/Source/Core/DiscIO/Src/FileBlob.cpp
index 60c5b641c7..ae828325a0 100644
--- a/Source/Core/DiscIO/Src/FileBlob.cpp
+++ b/Source/Core/DiscIO/Src/FileBlob.cpp
@@ -32,9 +32,7 @@ namespace DiscIO
PlainFileReader::PlainFileReader(HANDLE hFile_)
{
hFile = hFile_;
- DWORD size_low, size_high;
- size_low = GetFileSize(hFile, &size_high);
- size = ((u64)size_low) | ((u64)size_high << 32);
+ GetFileSizeEx(hFile, (PLARGE_INTEGER)&size);
}
PlainFileReader* PlainFileReader::Create(const char* filename)
@@ -55,17 +53,16 @@ PlainFileReader::~PlainFileReader()
bool PlainFileReader::Read(u64 offset, u64 nbytes, u8* out_ptr)
{
- LONG offset_high = (LONG)(offset >> 32);
- SetFilePointer(hFile, (DWORD)(offset & 0xFFFFFFFF), &offset_high, FILE_BEGIN);
-
- if (nbytes >= 0x100000000ULL)
- return false; // WTF, does windows really have this limitation?
+ if (!SetFilePointerEx(hFile, *(LARGE_INTEGER*)&offset, NULL, FILE_BEGIN))
+ return false;
- DWORD unused = 0;
- if (!ReadFile(hFile, out_ptr, DWORD(nbytes & 0xFFFFFFFF), &unused, NULL))
+ DWORD bytesRead = 0;
+ if (!ReadFile(hFile, out_ptr, (DWORD)nbytes, &bytesRead, NULL))
return false;
- else
- return true;
+ if (bytesRead != nbytes)
+ return false;
+
+ return true;
}
#else // POSIX