SetFileAttributes fix
Jukka Heinonen
jhei at iki.fi
Sun Feb 10 07:42:51 CST 2002
After this patch, Fallouts work again. I added some documentation
that should now make it clear why an error is not returned.
Changelog:
SetFileAttributes retuns now an error if target file is on CDROM.
Index: wine/win32/file.c
===================================================================
RCS file: /home/wine/wine/win32/file.c,v
retrieving revision 1.32
diff -u -r1.32 file.c
--- wine/win32/file.c 2002/01/01 00:24:34 1.32
+++ wine/win32/file.c 2002/02/10 11:42:05
@@ -91,10 +91,23 @@
lpFileName,attributes);
if (-1==chmod(full_name.long_name,buf.st_mode))
{
- FILE_SetDosError();
- MESSAGE("Wine ERROR: Couldn't set file attributes for existing file \"%s\".\n"
- "Check permissions or set VFAT \"quiet\" mount flag\n", full_name.long_name);
- return TRUE;
+ if(GetDriveTypeA(lpFileName) == DRIVE_CDROM) {
+ SetLastError( ERROR_ACCESS_DENIED );
+ return FALSE;
+ }
+
+ /*
+ * FIXME: We don't return FALSE here because of differences between
+ * Linux and Windows privileges. Under Linux only the owner of
+ * the file is allowed to change file attributes. Under Windows,
+ * applications expect that if you can write to a file, you can also
+ * change its attributes (see GENERIC_WRITE). We could try to be
+ * clever here but that would break multi-user installations where
+ * users share read-only DLLs. This is because some installers like
+ * to change attributes of already installed DLLs.
+ */
+ FIXME("Couldn't set file attributes for existing file \"%s\".\n"
+ "Check permissions or set VFAT \"quiet\" mount flag\n", full_name.long_name);
}
return TRUE;
}
--
Jukka Heinonen <http://www.iki.fi/jhei/>
More information about the wine-patches
mailing list