Hi all,
FILE_CreateFile() does:
SetLastError(0);
err = server_call( REQ_CREATE_FILE );
/* If write access failed, retry without GENERIC_WRITE */
if ((req->handle == -1) && !fail_read_only && (access & GENERIC_WRITE))
{
if ((err == ERROR_ACCESS_DENIED) || (err == ERROR_WRITE_PROTECT))
{
TRACE("Write access failed for file '%s', trying without "
"write access", filename);
access &= ~GENERIC_WRITE;
goto restart;
}
}
The problem with that is that the server_call() *returns* STATUS_xxx error
codes, so "err" contains these, not ERROR_xxx !!
ERROR_xxx as tested here is only SetLastError()ed.
Doing a err = GetLastError() before the ERROR_ACCESS_DENIED check lets
my app come up as expected.
Should I insert that GetLastError() line or maybe better check for the
corresponding STATUS_xxx codes instead ?
I really wonder why this bug hasn't been found **MUCH** earlier...
Andreas Mohr