Fixed a number of NT status values to be closer to NT behavior.
This commit is contained in:
parent
46b1d49a88
commit
716878c5b1
|
@ -1129,7 +1129,7 @@ static int fork_and_exec( const char *filename, const WCHAR *cmdline,
|
|||
|
||||
if (pipe(fd) == -1)
|
||||
{
|
||||
FILE_SetDosError();
|
||||
SetLastError( ERROR_TOO_MANY_OPEN_FILES );
|
||||
return -1;
|
||||
}
|
||||
fcntl( fd[1], F_SETFD, 1 ); /* set close on exec */
|
||||
|
@ -1247,14 +1247,14 @@ static BOOL create_process( HANDLE hFile, LPCWSTR filename, LPWSTR cmd_line, LPW
|
|||
|
||||
if (pipe( startfd ) == -1)
|
||||
{
|
||||
FILE_SetDosError();
|
||||
SetLastError( ERROR_TOO_MANY_OPEN_FILES );
|
||||
RtlDestroyProcessParameters( params );
|
||||
if (extra_env) HeapFree( GetProcessHeap(), 0, extra_env );
|
||||
return FALSE;
|
||||
}
|
||||
if (pipe( execfd ) == -1)
|
||||
{
|
||||
FILE_SetDosError();
|
||||
SetLastError( ERROR_TOO_MANY_OPEN_FILES );
|
||||
close( startfd[0] );
|
||||
close( startfd[1] );
|
||||
RtlDestroyProcessParameters( params );
|
||||
|
|
|
@ -711,7 +711,11 @@ static NTSTATUS find_file_in_dir( char *unix_name, int pos, const WCHAR *name, i
|
|||
}
|
||||
#endif /* VFAT_IOCTL_READDIR_BOTH */
|
||||
|
||||
if (!(dir = opendir( unix_name ))) return FILE_GetNtStatus();
|
||||
if (!(dir = opendir( unix_name )))
|
||||
{
|
||||
if (errno == ENOENT) return STATUS_OBJECT_PATH_NOT_FOUND;
|
||||
else return FILE_GetNtStatus();
|
||||
}
|
||||
unix_name[pos - 1] = '/';
|
||||
str.Buffer = buffer;
|
||||
str.MaximumLength = sizeof(buffer);
|
||||
|
@ -756,7 +760,7 @@ not_found:
|
|||
}
|
||||
}
|
||||
unix_name[pos - 1] = 0;
|
||||
return is_last ? STATUS_NO_SUCH_FILE : STATUS_OBJECT_PATH_NOT_FOUND;
|
||||
return is_last ? STATUS_OBJECT_NAME_NOT_FOUND : STATUS_OBJECT_PATH_NOT_FOUND;
|
||||
}
|
||||
|
||||
|
||||
|
@ -789,9 +793,9 @@ NTSTATUS DIR_nt_to_unix( const UNICODE_STRING *nameW, ANSI_STRING *unix_name_ret
|
|||
static const WCHAR uncW[] = {'U','N','C','\\'};
|
||||
static const WCHAR invalid_charsW[] = { INVALID_NT_CHARS, 0 };
|
||||
|
||||
NTSTATUS status = STATUS_NO_SUCH_FILE;
|
||||
NTSTATUS status = STATUS_OBJECT_NAME_NOT_FOUND;
|
||||
const char *config_dir = wine_get_config_dir();
|
||||
const WCHAR *end, *name, *p;
|
||||
const WCHAR *name, *p;
|
||||
struct stat st;
|
||||
char *unix_name;
|
||||
int pos, ret, name_len, unix_len, used_default;
|
||||
|
@ -810,12 +814,12 @@ NTSTATUS DIR_nt_to_unix( const UNICODE_STRING *nameW, ANSI_STRING *unix_name_ret
|
|||
if (name_len > 4 && !memicmpW( name, uncW, 4 ))
|
||||
{
|
||||
FIXME( "UNC name %s not supported\n", debugstr_us(nameW) );
|
||||
return STATUS_NO_SUCH_FILE;
|
||||
return STATUS_OBJECT_NAME_NOT_FOUND;
|
||||
}
|
||||
|
||||
/* make sure we have a drive letter */
|
||||
if (name_len < 3 || !isalphaW(name[0]) || name[1] != ':' || !IS_SEPARATOR(name[2]))
|
||||
return STATUS_NO_SUCH_FILE;
|
||||
return STATUS_OBJECT_NAME_NOT_FOUND;
|
||||
name += 2; /* skip drive letter */
|
||||
name_len -= 2;
|
||||
|
||||
|
@ -835,7 +839,7 @@ NTSTATUS DIR_nt_to_unix( const UNICODE_STRING *nameW, ANSI_STRING *unix_name_ret
|
|||
}
|
||||
else /* no DOS prefix, assume NT native name, map directly to Unix */
|
||||
{
|
||||
if (!name_len || !IS_SEPARATOR(name[0])) return STATUS_NO_SUCH_FILE;
|
||||
if (!name_len || !IS_SEPARATOR(name[0])) return STATUS_OBJECT_NAME_INVALID;
|
||||
unix_len = ntdll_wcstoumbs( 0, name, name_len, NULL, 0, NULL, NULL );
|
||||
unix_len += MAX_DIR_ENTRY_LEN + 3;
|
||||
if (!(unix_name = RtlAllocateHeap( GetProcessHeap(), 0, unix_len )))
|
||||
|
@ -854,25 +858,33 @@ NTSTATUS DIR_nt_to_unix( const UNICODE_STRING *nameW, ANSI_STRING *unix_name_ret
|
|||
for (p = unix_name + pos ; *p; p++) if (*p == '\\') *p = '/';
|
||||
if (!stat( unix_name, &st )) goto done;
|
||||
}
|
||||
|
||||
while (name_len && IS_SEPARATOR(*name))
|
||||
{
|
||||
name++;
|
||||
name_len--;
|
||||
}
|
||||
if (!name_len) /* empty name -> drive root doesn't exist */
|
||||
{
|
||||
RtlFreeHeap( GetProcessHeap(), 0, unix_name );
|
||||
return STATUS_OBJECT_PATH_NOT_FOUND;
|
||||
}
|
||||
if (check_case && check_last)
|
||||
{
|
||||
RtlFreeHeap( GetProcessHeap(), 0, unix_name );
|
||||
return STATUS_NO_SUCH_FILE;
|
||||
return STATUS_OBJECT_NAME_NOT_FOUND;
|
||||
}
|
||||
|
||||
/* now do it component by component */
|
||||
|
||||
for (;;)
|
||||
while (name_len)
|
||||
{
|
||||
while (name_len && IS_SEPARATOR(*name))
|
||||
{
|
||||
name++;
|
||||
name_len--;
|
||||
}
|
||||
if (!name_len) break;
|
||||
const WCHAR *end, *next;
|
||||
|
||||
end = name;
|
||||
while (end < name + name_len && !IS_SEPARATOR(*end)) end++;
|
||||
next = end;
|
||||
while (next < name + name_len && IS_SEPARATOR(*next)) next++;
|
||||
|
||||
/* grow the buffer if needed */
|
||||
|
||||
|
@ -889,7 +901,7 @@ NTSTATUS DIR_nt_to_unix( const UNICODE_STRING *nameW, ANSI_STRING *unix_name_ret
|
|||
}
|
||||
|
||||
status = find_file_in_dir( unix_name, pos, name, end - name,
|
||||
(end - name == name_len), check_last, check_case );
|
||||
(next - name == name_len), check_last, check_case );
|
||||
if (status != STATUS_SUCCESS)
|
||||
{
|
||||
/* couldn't find it at all, fail */
|
||||
|
@ -899,8 +911,8 @@ NTSTATUS DIR_nt_to_unix( const UNICODE_STRING *nameW, ANSI_STRING *unix_name_ret
|
|||
}
|
||||
|
||||
pos += strlen( unix_name + pos );
|
||||
name_len -= end - name;
|
||||
name = end;
|
||||
name_len -= next - name;
|
||||
name = next;
|
||||
}
|
||||
|
||||
WARN( "%s -> %s required a case-insensitive search\n",
|
||||
|
|
|
@ -222,33 +222,32 @@ static void fileio_async_cleanup( struct async_private *ovp )
|
|||
NTSTATUS FILE_GetNtStatus(void)
|
||||
{
|
||||
int err = errno;
|
||||
DWORD nt;
|
||||
|
||||
TRACE( "errno = %d\n", errno );
|
||||
switch (err)
|
||||
{
|
||||
case EAGAIN: nt = STATUS_SHARING_VIOLATION; break;
|
||||
case EBADF: nt = STATUS_INVALID_HANDLE; break;
|
||||
case ENOSPC: nt = STATUS_DISK_FULL; break;
|
||||
case EAGAIN: return STATUS_SHARING_VIOLATION;
|
||||
case EBADF: return STATUS_INVALID_HANDLE;
|
||||
case ENOSPC: return STATUS_DISK_FULL;
|
||||
case EPERM:
|
||||
case EROFS:
|
||||
case EACCES: nt = STATUS_ACCESS_DENIED; break;
|
||||
case ENOENT: nt = STATUS_OBJECT_NAME_NOT_FOUND; break;
|
||||
case EISDIR: nt = STATUS_FILE_IS_A_DIRECTORY; break;
|
||||
case EACCES: return STATUS_ACCESS_DENIED;
|
||||
case ENOTDIR: return STATUS_OBJECT_PATH_NOT_FOUND;
|
||||
case ENOENT: return STATUS_OBJECT_NAME_NOT_FOUND;
|
||||
case EISDIR: return STATUS_FILE_IS_A_DIRECTORY;
|
||||
case EMFILE:
|
||||
case ENFILE: nt = STATUS_NO_MORE_FILES; break;
|
||||
case EINVAL:
|
||||
case ENOTEMPTY: nt = STATUS_DIRECTORY_NOT_EMPTY; break;
|
||||
case EPIPE: nt = STATUS_PIPE_BROKEN; break;
|
||||
case EIO: nt = STATUS_DEVICE_NOT_READY; break;
|
||||
case ENOEXEC: /* ?? */
|
||||
case ESPIPE: /* ?? */
|
||||
case EEXIST: /* ?? */
|
||||
case ENFILE: return STATUS_TOO_MANY_OPENED_FILES;
|
||||
case EINVAL: return STATUS_INVALID_PARAMETER;
|
||||
case ENOTEMPTY: return STATUS_DIRECTORY_NOT_EMPTY;
|
||||
case EPIPE: return STATUS_PIPE_BROKEN;
|
||||
case EIO: return STATUS_DEVICE_NOT_READY;
|
||||
case ENOEXEC: /* ?? */
|
||||
case ESPIPE: /* ?? */
|
||||
case EEXIST: /* ?? */
|
||||
default:
|
||||
FIXME( "Converting errno %d to STATUS_UNSUCCESSFUL\n", err );
|
||||
nt = STATUS_UNSUCCESSFUL;
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
return nt;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
|
|
@ -353,7 +353,7 @@ void file_set_error(void)
|
|||
case EROFS: set_error( STATUS_MEDIA_WRITE_PROTECTED ); break;
|
||||
case EBUSY: set_error( STATUS_FILE_LOCK_CONFLICT ); break;
|
||||
case ENOENT: set_error( STATUS_NO_SUCH_FILE ); break;
|
||||
case EISDIR: set_win32_error( ERROR_CANNOT_MAKE ); break;
|
||||
case EISDIR: set_error( STATUS_FILE_IS_A_DIRECTORY ); break;
|
||||
case ENFILE:
|
||||
case EMFILE: set_error( STATUS_NO_MORE_FILES ); break;
|
||||
case EEXIST: set_error( STATUS_OBJECT_NAME_COLLISION ); break;
|
||||
|
|
|
@ -3115,7 +3115,6 @@ static const char *get_status_name( unsigned int status )
|
|||
NAME(TIMEOUT),
|
||||
NAME(USER_APC),
|
||||
NAME(WAS_LOCKED),
|
||||
NAME_WIN32(ERROR_CANNOT_MAKE),
|
||||
NAME_WIN32(ERROR_INVALID_INDEX),
|
||||
NAME_WIN32(ERROR_NEGATIVE_SEEK),
|
||||
NAME_WIN32(ERROR_SEEK),
|
||||
|
|
Loading…
Reference in New Issue