[*] NT ReadFile: replace GENERIC_READ, FILE_SHARE_READ
with GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE
[*] ByteBuffer::IsValid() will now return true if there is no underlying buffer so long as the object is marked with the dynamic scaling flag (no contents isnt an invalid state; alloc failure on construct and ad-hoc failure is. latterly, specify the write flag on failure in the ByteBuffer::Write method.) the alloc error can be safely unwound by state raii helpers bc realloc and frens will not free or dirty the state. write-fail-aware may roll back the write head, like how readers can roll back the read head if the stream is incomplete.
This commit is contained in:
parent
6ac4fd61ab
commit
1de0bdb4e7
@ -96,6 +96,7 @@ namespace Aurora::Memory
|
||||
{
|
||||
if (!Resize(offset + requestLength))
|
||||
{
|
||||
this->flagWriteError = true;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -117,7 +117,7 @@ namespace Aurora::Memory
|
||||
|
||||
bool ByteBuffer::IsValid() const
|
||||
{
|
||||
return !IsEmpty() && !HasStreamError();
|
||||
return (!IsEmpty() || this->flagExpandable) && !HasStreamError();
|
||||
}
|
||||
|
||||
bool ByteBuffer::IsEmpty() const
|
||||
|
@ -247,7 +247,7 @@ namespace Aurora::IO::FS
|
||||
return false;
|
||||
}
|
||||
|
||||
auto fileHandle = CreateFileW(win32Path.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
auto fileHandle = CreateFileW(win32Path.c_str(), GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
if (fileHandle == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
SysPushErrorIO("Couldn't open handle: {}", path);
|
||||
@ -263,7 +263,8 @@ namespace Aurora::IO::FS
|
||||
writeView = buffer.GetOrAllocateLinearWriteable(length.QuadPart);
|
||||
if (!writeView)
|
||||
{
|
||||
return {};
|
||||
SysPushErrorMem();
|
||||
goto out;
|
||||
}
|
||||
|
||||
while (length.QuadPart)
|
||||
|
Loading…
Reference in New Issue
Block a user