[librpfile] FileSystem_win32.cpp, filesize_int(): Check for INVALID_HANDLE_VALUE.

This commit is contained in:
David Korth 2025-05-02 19:32:13 -04:00
parent e9dcd3f131
commit 6f9f6b9cff

View File

@ -357,7 +357,7 @@ static off64_t filesize_int(const tstring &tfilename)
HANDLE hFile = CreateFile(tfilename.c_str(),
GENERIC_READ, FILE_SHARE_READ, nullptr,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
if (!hFile) {
if (!hFile || hFile == INVALID_HANDLE_VALUE) {
// Error opening the file.
return -w32err_to_posix(GetLastError());
}
@ -460,7 +460,7 @@ static int get_mtime_int(const tstring &tfilename, time_t *pMtime)
HANDLE hFile = CreateFile(tfilename.c_str(),
GENERIC_READ, FILE_SHARE_READ, nullptr,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
if (!hFile) {
if (!hFile || hFile == INVALID_HANDLE_VALUE) {
// Error opening the file.
return -w32err_to_posix(GetLastError());
}