mirror of
https://github.com/holub/mame
synced 2025-06-29 15:38:53 +03:00
Implemented GetFileSize and and proper winrt file open (nw)
This commit is contained in:
parent
b73126e85a
commit
f999805738
@ -232,9 +232,7 @@ osd_file::error osd_file::open(std::string const &orig_path, uint32_t openflags,
|
|||||||
// get the file size
|
// get the file size
|
||||||
FILE_STANDARD_INFO file_info;
|
FILE_STANDARD_INFO file_info;
|
||||||
GetFileInformationByHandleEx(h, FileStandardInfo, &file_info, sizeof(file_info));
|
GetFileInformationByHandleEx(h, FileStandardInfo, &file_info, sizeof(file_info));
|
||||||
auto lower = file_info.EndOfFile.QuadPart;
|
if (INVALID_FILE_SIZE == file_info.EndOfFile.LowPart)
|
||||||
|
|
||||||
if (INVALID_FILE_SIZE == lower)
|
|
||||||
{
|
{
|
||||||
DWORD const err = GetLastError();
|
DWORD const err = GetLastError();
|
||||||
if (NO_ERROR != err)
|
if (NO_ERROR != err)
|
||||||
@ -247,7 +245,7 @@ osd_file::error osd_file::open(std::string const &orig_path, uint32_t openflags,
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
file = std::make_unique<win_osd_file>(h);
|
file = std::make_unique<win_osd_file>(h);
|
||||||
filesize = lower;
|
filesize = file_info.EndOfFile.QuadPart;
|
||||||
return error::NONE;
|
return error::NONE;
|
||||||
}
|
}
|
||||||
catch (...)
|
catch (...)
|
||||||
|
@ -93,6 +93,12 @@ extern "C" {
|
|||||||
_Out_opt_ LPDWORD lpFileSizeHigh
|
_Out_opt_ LPDWORD lpFileSizeHigh
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return 0;
|
FILE_STANDARD_INFO file_info;
|
||||||
|
GetFileInformationByHandleEx(hFile, FileStandardInfo, &file_info, sizeof(file_info));
|
||||||
|
if(lpFileSizeHigh!=nullptr)
|
||||||
|
{
|
||||||
|
*lpFileSizeHigh = file_info.EndOfFile.HighPart;
|
||||||
|
}
|
||||||
|
return file_info.EndOfFile.LowPart;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user