[PATCH] GetFileAttributes
gerard patel
gerard.patel at asi.fr
Thu Feb 15 15:03:09 CST 2001
A recent patch has disabled the file not found return error code for
GetFileAttributes. Some apps (ForteFreeAgent16, Word viewer 16 bits)
don't like it.
I have removed the SetLastError in GetFileAttributes and to keep
the same functionality added it in DOSFS_GetFullName;
ERROR_BAD_PATHNAME is used because it's the value used by the
initial patch. It's not the error code returned by my NT 4 but I don't
think it matters much - any app relying on such specific error codes
is probably too ambitious to run under Windows. OTOH
ERROR_FILE_NOT_FOUND *is* tested by Win apps.
I have changed slightly the init code else with the default profile
being empty it always displays an error message on the
console.
ChangeLog:
* files/file.c, dos_fs.c, directory.c
Gives back the ERROR_FILE_NOT_FOUND to GetFileAttributes
-------------- next part --------------
Index: files/directory.c
===================================================================
RCS file: /home/wine/wine/files/directory.c,v
retrieving revision 1.35
diff -u -r1.35 directory.c
--- files/directory.c 2001/02/12 18:10:43 1.35
+++ files/directory.c 2001/02/14 21:44:31
@@ -44,7 +44,7 @@
* Get a path name from the wine.ini file and make sure it is valid.
*/
static int DIR_GetPath( const char *keyname, const char *defval,
- DOS_FULL_NAME *full_name )
+ DOS_FULL_NAME *full_name, BOOL warn )
{
char path[MAX_PATHNAME_LEN];
BY_HANDLE_FILE_INFORMATION info;
@@ -55,7 +55,8 @@
(!FILE_Stat( full_name->long_name, &info ) && (mess=strerror(errno)))||
(!(info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && (mess="not a directory")))
{
- MESSAGE("Invalid path '%s' for %s directory: %s\n", path, keyname, mess);
+ if (warn)
+ MESSAGE("Invalid path '%s' for %s directory: %s\n", path, keyname, mess);
return 0;
}
return 1;
@@ -90,9 +91,9 @@
DRIVE_Chdir( drive, cwd );
}
- if (!(DIR_GetPath( "windows", "c:\\windows", &DIR_Windows )) ||
- !(DIR_GetPath( "system", "c:\\windows\\system", &DIR_System )) ||
- !(DIR_GetPath( "temp", "c:\\windows", &tmp_dir )))
+ if (!(DIR_GetPath( "windows", "c:\\windows", &DIR_Windows, TRUE )) ||
+ !(DIR_GetPath( "system", "c:\\windows\\system", &DIR_System, TRUE )) ||
+ !(DIR_GetPath( "temp", "c:\\windows", &tmp_dir, TRUE )))
{
PROFILE_UsageWineIni();
return 0;
@@ -147,7 +148,7 @@
TRACE("Cwd = %c:\\%s\n",
'A' + drive, DRIVE_GetDosCwd( drive ) );
- if (DIR_GetPath( "profile", "", &profile_dir ))
+ if (DIR_GetPath( "profile", "", &profile_dir, FALSE ))
{
TRACE("USERPROFILE= %s\n", profile_dir.short_name );
SetEnvironmentVariableA( "USERPROFILE", profile_dir.short_name );
Index: files/dos_fs.c
===================================================================
RCS file: /home/wine/wine/files/dos_fs.c,v
retrieving revision 1.76
diff -u -r1.76 dos_fs.c
--- files/dos_fs.c 2001/01/17 01:55:04 1.76
+++ files/dos_fs.c 2001/02/14 21:44:34
@@ -843,6 +843,12 @@
TRACE("%s (last=%d)\n", name, check_last );
+ if ((!*name) || (*name=='\n'))
+ { /* error code for Win98 */
+ SetLastError(ERROR_BAD_PATHNAME);
+ return FALSE;
+ }
+
if ((full->drive = DOSFS_GetPathDrive( &name )) == -1) return FALSE;
flags = DRIVE_GetFlags( full->drive );
Index: files/file.c
===================================================================
RCS file: /home/wine/wine/files/file.c,v
retrieving revision 1.89
diff -u -r1.89 file.c
--- files/file.c 2001/02/14 00:26:46 1.89
+++ files/file.c 2001/02/14 21:44:36
@@ -589,11 +589,8 @@
SetLastError( ERROR_INVALID_PARAMETER );
return -1;
}
- if (!*name || !DOSFS_GetFullName( name, TRUE, &full_name ))
- {
- SetLastError( ERROR_BAD_PATHNAME );
+ if (!DOSFS_GetFullName( name, TRUE, &full_name) )
return -1;
- }
if (!FILE_Stat( full_name.long_name, &info )) return -1;
return info.dwFileAttributes;
}
-------------- next part --------------
More information about the wine-patches
mailing list