kernel32: Properly check the NtQueryDirectoryFile return status.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2016-04-29 23:19:16 +09:00
parent 9fef5dc839
commit 02f80187f0
1 changed files with 11 additions and 11 deletions

View File

@ -2077,7 +2077,6 @@ HANDLE WINAPI FindFirstFileExW( LPCWSTR filename, FINDEX_INFO_LEVELS level,
}
else
{
IO_STATUS_BLOCK io;
BOOL has_wildcard = strpbrkW( info->mask.Buffer, wildcardsW ) != NULL;
info->data_size = has_wildcard ? 8192 : max_entry_size * 2;
@ -2091,12 +2090,12 @@ HANDLE WINAPI FindFirstFileExW( LPCWSTR filename, FINDEX_INFO_LEVELS level,
return INVALID_HANDLE_VALUE;
}
NtQueryDirectoryFile( info->handle, 0, NULL, NULL, &io, info->data, info->data_size,
status = NtQueryDirectoryFile( info->handle, 0, NULL, NULL, &io, info->data, info->data_size,
FileBothDirectoryInformation, FALSE, &info->mask, TRUE );
if (io.u.Status)
if (status)
{
FindClose( info );
SetLastError( RtlNtStatusToDosError( io.u.Status ) );
SetLastError( RtlNtStatusToDosError( status ) );
return INVALID_HANDLE_VALUE;
}
@ -2148,6 +2147,7 @@ BOOL WINAPI FindNextFileW( HANDLE handle, WIN32_FIND_DATAW *data )
FIND_FIRST_INFO *info;
FILE_BOTH_DIR_INFORMATION *dir_info;
BOOL ret = FALSE;
NTSTATUS status;
TRACE("%p %p\n", handle, data);
@ -2173,15 +2173,15 @@ BOOL WINAPI FindNextFileW( HANDLE handle, WIN32_FIND_DATAW *data )
IO_STATUS_BLOCK io;
if (info->data_size)
NtQueryDirectoryFile( info->handle, 0, NULL, NULL, &io, info->data, info->data_size,
status = NtQueryDirectoryFile( info->handle, 0, NULL, NULL, &io, info->data, info->data_size,
FileBothDirectoryInformation, FALSE, &info->mask, FALSE );
else
io.u.Status = STATUS_NO_MORE_FILES;
status = STATUS_NO_MORE_FILES;
if (io.u.Status)
if (status)
{
SetLastError( RtlNtStatusToDosError( io.u.Status ) );
if (io.u.Status == STATUS_NO_MORE_FILES)
SetLastError( RtlNtStatusToDosError( status ) );
if (status == STATUS_NO_MORE_FILES)
{
CloseHandle( info->handle );
HeapFree( GetProcessHeap(), 0, info->data );