vm: use FILE_READ_ATTRIBUTES to make exists? faster.
parent
08dd854b15
commit
0d6096df0a
|
@ -37,15 +37,14 @@ void factor_vm::ffi_dlclose(dll* dll) {
|
|||
|
||||
BOOL factor_vm::windows_stat(vm_char* path) {
|
||||
BY_HANDLE_FILE_INFORMATION bhfi;
|
||||
HANDLE h = CreateFileW(path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, NULL,
|
||||
HANDLE h = CreateFileW(path, FILE_READ_ATTRIBUTES, 0, NULL,
|
||||
OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL);
|
||||
|
||||
if (h == INVALID_HANDLE_VALUE) {
|
||||
// FindFirstFile is the only call that can stat c:\pagefile.sys
|
||||
WIN32_FIND_DATA st;
|
||||
HANDLE h;
|
||||
|
||||
if (INVALID_HANDLE_VALUE == (h = FindFirstFile(path, &st)))
|
||||
h = FindFirstFile(path, &st);
|
||||
if (h == INVALID_HANDLE_VALUE)
|
||||
return false;
|
||||
FindClose(h);
|
||||
return true;
|
||||
|
|
Loading…
Reference in New Issue