You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At the moment it is not possible to set the file protection mode of a stream to a value which enables FILE_SHARE_DELETE. But from my point of view, for no reasons.
My suggestion is to change the code inside of the _get_create_flags method (fileio_win32.cpp: 126) from
// C++ specifies what permissions to deny, Windows which permissions to give,
dwShareMode = 0x3;
switch (prot)
{
case _SH_DENYRW: dwShareMode = 0x0; break;
case _SH_DENYWR: dwShareMode = 0x1; break;
case _SH_DENYRD: dwShareMode = 0x2; break;
}
to
// C++ specifies what permissions to deny, Windows which permissions to give,
dwShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE;
switch (prot)
{
case _SH_DENYRW: dwShareMode = 0x0; break;
case _SH_DENYWR: dwShareMode = FILE_SHARE_READ; break;
case _SH_DENYRD: dwShareMode = FILE_SHARE_WRITE; break;
}
It is debatable if _SH_DENYRD and _SH_DENYRW enable FILE_SHARE_DELETE as well. But I expect in case of _SH_DENYNO (that is the default mode of cpprest), that no restrictions are left. Additionally, after this change, the behaving of this library would be the same under Unix and Windows. At the moment it is not, because under windows I can not remove/rename a file with open file stream but under Unix that is possible.
The text was updated successfully, but these errors were encountered:
For platform consistency, it might be that including FILE_SHARE_DELETE always would be the way to go, though the behaviour is still not identical to Linux and macOS. See golang/go#32088.
At the moment it is not possible to set the file protection mode of a stream to a value which enables FILE_SHARE_DELETE. But from my point of view, for no reasons.
My suggestion is to change the code inside of the
_get_create_flags
method (fileio_win32.cpp
: 126) fromto
It is debatable if _SH_DENYRD and _SH_DENYRW enable FILE_SHARE_DELETE as well. But I expect in case of _SH_DENYNO (that is the default mode of cpprest), that no restrictions are left. Additionally, after this change, the behaving of this library would be the same under Unix and Windows. At the moment it is not, because under windows I can not remove/rename a file with open file stream but under Unix that is possible.
The text was updated successfully, but these errors were encountered: