[*] Remove explicit Windows version check assuming certain file systems and platforms can be stupid

This commit is contained in:
Reece Wilson 2023-09-12 01:35:54 +01:00
parent 6062a16d9c
commit b46390f83a

View File

@ -370,37 +370,47 @@ namespace Aurora::IO::FS
return ScheduleOnce(); return ScheduleOnce();
} }
// Request OP lock
bool NTWatchObject::ScheduleOnce() bool NTWatchObject::ScheduleOnce()
{ {
bool firstTime = !this->ntOverlapped.hEvent; bool bFirstTime = !this->ntOverlapped.hEvent;
this->ntOverlapped.hEvent = (HANDLE)this->parent->ntEvent_->GetHandle();
if (bFirstTime)
{
this->ntOverlapped.hEvent = (HANDLE)this->parent->ntEvent_->GetHandle();
}
if (AuSwInfo::IsWindows8OrGreater()) if (!this->bWin7Mode &&
AuSwInfo::IsWindows8OrGreater())
{ {
REQUEST_OPLOCK_INPUT_BUFFER input REQUEST_OPLOCK_INPUT_BUFFER input
{ {
REQUEST_OPLOCK_CURRENT_VERSION, REQUEST_OPLOCK_CURRENT_VERSION,
sizeof(REQUEST_OPLOCK_INPUT_BUFFER), sizeof(REQUEST_OPLOCK_INPUT_BUFFER),
OPLOCK_LEVEL_CACHE_READ | OPLOCK_LEVEL_CACHE_HANDLE, OPLOCK_LEVEL_CACHE_READ | OPLOCK_LEVEL_CACHE_HANDLE,
firstTime ? REQUEST_OPLOCK_INPUT_FLAG_REQUEST : REQUEST_OPLOCK_INPUT_FLAG_ACK, bFirstTime ? REQUEST_OPLOCK_INPUT_FLAG_REQUEST : REQUEST_OPLOCK_INPUT_FLAG_ACK,
}; };
DWORD bytesReturned; DWORD dwBytesReturned;
if (DeviceIoControl(this->hFileHandle, FSCTL_REQUEST_OPLOCK, &input, sizeof(input), &whoAsked_, sizeof(whoAsked_), &bytesReturned, &this->ntOverlapped)) if (::DeviceIoControl(this->hFileHandle,
FSCTL_REQUEST_OPLOCK,
&input, sizeof(input),
&whoAsked_, sizeof(whoAsked_),
&dwBytesReturned,
&this->ntOverlapped))
{ {
this->CheckBroken(); this->CheckBroken();
return true;
} }
else else
{ {
if (GetLastError() != ERROR_IO_PENDING) if (::GetLastError() == ERROR_IO_PENDING)
{ {
SysPushErrorIO(); return true;
return false;
} }
} }
} }
else if (pNtNotifyChangeDirectoryFile)
if (pNtNotifyChangeDirectoryFile)
{ {
auto dwRet = pNtNotifyChangeDirectoryFile(this->hFileHandle, auto dwRet = pNtNotifyChangeDirectoryFile(this->hFileHandle,
this->ntOverlapped.hEvent, this->ntOverlapped.hEvent,
@ -430,7 +440,7 @@ namespace Aurora::IO::FS
} }
else else
{ {
CheckBroken(); this->CheckBroken();
} }
} }