Re: krnl386.exe: Fix last error check for DOS compatibility hack.
Andrew Nguyen <anguyen(a)codeweavers.com> writes:
@@ -1092,7 +1092,7 @@ static BOOL INT21_CreateFile( CONTEXT86 *context, winMode, winAttributes, 0 ); /* DOS allows to open files on a CDROM R/W */ if( winHandle == INVALID_HANDLE_VALUE && - GetLastError()== ERROR_WRITE_PROTECT) { + GetLastError() == ERROR_ACCESS_DENIED) {
You should keep the old error too. -- Alexandre Julliard julliard(a)winehq.org
On 07/29/2010 10:48 AM, Alexandre Julliard wrote:
Andrew Nguyen<anguyen(a)codeweavers.com> writes:
@@ -1092,7 +1092,7 @@ static BOOL INT21_CreateFile( CONTEXT86 *context, winMode, winAttributes, 0 ); /* DOS allows to open files on a CDROM R/W */ if( winHandle == INVALID_HANDLE_VALUE&& - GetLastError()== ERROR_WRITE_PROTECT) { + GetLastError() == ERROR_ACCESS_DENIED) {
You should keep the old error too.
Hmm, is there any situation where CreateFile yields a last error of ERROR_WRITE_PROTECT? If an application requests GENERIC_WRITE access on a file residing on a read-only file system, CreateFile on NT platforms seems to always set the last error to ERROR_ACCESS_DENIED and not ERROR_WRITE_PROTECT.
Andrew Nguyen <anguyen(a)codeweavers.com> writes:
Hmm, is there any situation where CreateFile yields a last error of ERROR_WRITE_PROTECT? If an application requests GENERIC_WRITE access on a file residing on a read-only file system, CreateFile on NT platforms seems to always set the last error to ERROR_ACCESS_DENIED and not ERROR_WRITE_PROTECT.
That depends on the error mapping, but there may well be cases where we want to do that, if not today then at some point in the future. There shouldn't be any harm in keeping the current check. -- Alexandre Julliard julliard(a)winehq.org
participants (2)
-
Alexandre Julliard -
Andrew Nguyen