[*] 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();
}
// Request OP lock
bool NTWatchObject::ScheduleOnce()
{
bool firstTime = !this->ntOverlapped.hEvent;
this->ntOverlapped.hEvent = (HANDLE)this->parent->ntEvent_->GetHandle();
bool bFirstTime = !this->ntOverlapped.hEvent;
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_CURRENT_VERSION,
sizeof(REQUEST_OPLOCK_INPUT_BUFFER),
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;
if (DeviceIoControl(this->hFileHandle, FSCTL_REQUEST_OPLOCK, &input, sizeof(input), &whoAsked_, sizeof(whoAsked_), &bytesReturned, &this->ntOverlapped))
DWORD dwBytesReturned;
if (::DeviceIoControl(this->hFileHandle,
FSCTL_REQUEST_OPLOCK,
&input, sizeof(input),
&whoAsked_, sizeof(whoAsked_),
&dwBytesReturned,
&this->ntOverlapped))
{
this->CheckBroken();
return true;
}
else
{
if (GetLastError() != ERROR_IO_PENDING)
if (::GetLastError() == ERROR_IO_PENDING)
{
SysPushErrorIO();
return false;
return true;
}
}
}
else if (pNtNotifyChangeDirectoryFile)
if (pNtNotifyChangeDirectoryFile)
{
auto dwRet = pNtNotifyChangeDirectoryFile(this->hFileHandle,
this->ntOverlapped.hEvent,
@ -430,7 +440,7 @@ namespace Aurora::IO::FS
}
else
{
CheckBroken();
this->CheckBroken();
}
}