https://git.reactos.org/?p=reactos.git;a=commitdiff;h=cc8ccc6eb88702bfa471617a1cbb5c9adb349115
commit cc8ccc6eb88702bfa471617a1cbb5c9adb349115 Author: Pierre Schweitzer <pie...@reactos.org> AuthorDate: Sat Jan 6 12:11:02 2018 +0100 [USETUP] When opening the target file for dropping readonly mode only use required access. This avoids the open failing on certain file systems where GENERIC_WRITE access would be denied for a readonly file. This is an addendum to 82f44a2. CORE-14158 --- base/setup/usetup/filesup.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/base/setup/usetup/filesup.c b/base/setup/usetup/filesup.c index 65a372a337..4238557bbe 100644 --- a/base/setup/usetup/filesup.c +++ b/base/setup/usetup/filesup.c @@ -355,9 +355,9 @@ SetupCopyFile( { FILE_BASIC_INFORMATION FileBasicInfo; - /* Reattempt to open it */ + /* Reattempt to open it with limited access */ Status = NtCreateFile(&FileHandleDest, - GENERIC_WRITE | SYNCHRONIZE, + FILE_WRITE_ATTRIBUTES | SYNCHRONIZE, &ObjectAttributes, &IoStatusBlock, NULL, @@ -369,10 +369,7 @@ SetupCopyFile( FILE_SYNCHRONOUS_IO_NONALERT, NULL, 0); - /* Fail for real if we cannot open it that way - * XXX: actually, we should try to refine access rights - * to only have write_attributes, should be enough - */ + /* Fail for real if we cannot open it that way */ if (!NT_SUCCESS(Status)) { DPRINT1("NtCreateFile failed: %x, %wZ\n", Status, &FileName);