Commit d52e1c4b authored by Gerard Patel's avatar Gerard Patel Committed by Alexandre Julliard

Gives back the ERROR_FILE_NOT_FOUND to GetFileAttributes.

parent 4988696c
...@@ -44,7 +44,7 @@ static DOS_FULL_NAME DIR_System; ...@@ -44,7 +44,7 @@ static DOS_FULL_NAME DIR_System;
* Get a path name from the wine.ini file and make sure it is valid. * 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, 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]; char path[MAX_PATHNAME_LEN];
BY_HANDLE_FILE_INFORMATION info; BY_HANDLE_FILE_INFORMATION info;
...@@ -55,7 +55,8 @@ static int DIR_GetPath( const char *keyname, const char *defval, ...@@ -55,7 +55,8 @@ static int DIR_GetPath( const char *keyname, const char *defval,
(!FILE_Stat( full_name->long_name, &info ) && (mess=strerror(errno)))|| (!FILE_Stat( full_name->long_name, &info ) && (mess=strerror(errno)))||
(!(info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && (mess="not a directory"))) (!(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 0;
} }
return 1; return 1;
...@@ -90,9 +91,9 @@ int DIR_Init(void) ...@@ -90,9 +91,9 @@ int DIR_Init(void)
DRIVE_Chdir( drive, cwd ); DRIVE_Chdir( drive, cwd );
} }
if (!(DIR_GetPath( "windows", "c:\\windows", &DIR_Windows )) || if (!(DIR_GetPath( "windows", "c:\\windows", &DIR_Windows, TRUE )) ||
!(DIR_GetPath( "system", "c:\\windows\\system", &DIR_System )) || !(DIR_GetPath( "system", "c:\\windows\\system", &DIR_System, TRUE )) ||
!(DIR_GetPath( "temp", "c:\\windows", &tmp_dir ))) !(DIR_GetPath( "temp", "c:\\windows", &tmp_dir, TRUE )))
{ {
PROFILE_UsageWineIni(); PROFILE_UsageWineIni();
return 0; return 0;
...@@ -147,7 +148,7 @@ int DIR_Init(void) ...@@ -147,7 +148,7 @@ int DIR_Init(void)
TRACE("Cwd = %c:\\%s\n", TRACE("Cwd = %c:\\%s\n",
'A' + drive, DRIVE_GetDosCwd( drive ) ); '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 ); TRACE("USERPROFILE= %s\n", profile_dir.short_name );
SetEnvironmentVariableA( "USERPROFILE", profile_dir.short_name ); SetEnvironmentVariableA( "USERPROFILE", profile_dir.short_name );
......
...@@ -843,6 +843,12 @@ BOOL DOSFS_GetFullName( LPCSTR name, BOOL check_last, DOS_FULL_NAME *full ) ...@@ -843,6 +843,12 @@ BOOL DOSFS_GetFullName( LPCSTR name, BOOL check_last, DOS_FULL_NAME *full )
TRACE("%s (last=%d)\n", name, check_last ); 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; if ((full->drive = DOSFS_GetPathDrive( &name )) == -1) return FALSE;
flags = DRIVE_GetFlags( full->drive ); flags = DRIVE_GetFlags( full->drive );
......
...@@ -589,11 +589,8 @@ DWORD WINAPI GetFileAttributesA( LPCSTR name ) ...@@ -589,11 +589,8 @@ DWORD WINAPI GetFileAttributesA( LPCSTR name )
SetLastError( ERROR_INVALID_PARAMETER ); SetLastError( ERROR_INVALID_PARAMETER );
return -1; return -1;
} }
if (!*name || !DOSFS_GetFullName( name, TRUE, &full_name )) if (!DOSFS_GetFullName( name, TRUE, &full_name) )
{
SetLastError( ERROR_BAD_PATHNAME );
return -1; return -1;
}
if (!FILE_Stat( full_name.long_name, &info )) return -1; if (!FILE_Stat( full_name.long_name, &info )) return -1;
return info.dwFileAttributes; return info.dwFileAttributes;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment