- Fix handling of INVALID_HANDLE_VALUE case in FindNextFile.

svn path=/trunk/; revision=10722
This commit is contained in:
Filip Navara 2004-08-28 22:07:51 +00:00
parent 20ab7d6b27
commit 9008b900fe

View file

@ -1,4 +1,4 @@
/* $Id: find.c,v 1.44 2004/05/13 20:32:18 navaraf Exp $ /* $Id: find.c,v 1.45 2004/08/28 22:07:51 navaraf Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries * PROJECT: ReactOS system libraries
@ -50,12 +50,6 @@ InternalFindNextFile (
DPRINT("InternalFindNextFile(%lx)\n", hFindFile); DPRINT("InternalFindNextFile(%lx)\n", hFindFile);
if (hFindFile == NULL)
{
SetLastError (ERROR_INVALID_HANDLE);
return FALSE;
}
IData = (PKERNEL32_FIND_FILE_DATA)hFindFile; IData = (PKERNEL32_FIND_FILE_DATA)hFindFile;
if (IData->pFileInfo->NextEntryOffset != 0) if (IData->pFileInfo->NextEntryOffset != 0)
@ -424,12 +418,14 @@ FindNextFileA (
UNICODE_STRING FileNameU; UNICODE_STRING FileNameU;
ANSI_STRING FileName; ANSI_STRING FileName;
IData = (PKERNEL32_FIND_FILE_DATA)hFindFile; if (hFindFile == INVALID_HANDLE_VALUE)
if (IData == NULL)
{ {
SetLastError (ERROR_INVALID_HANDLE);
DPRINT("Failing request\n");
return FALSE; return FALSE;
} }
IData = (PKERNEL32_FIND_FILE_DATA)hFindFile;
if (!InternalFindNextFile (hFindFile)) if (!InternalFindNextFile (hFindFile))
{ {
DPRINT("InternalFindNextFile() failed\n"); DPRINT("InternalFindNextFile() failed\n");
@ -580,6 +576,13 @@ FindNextFileW (
{ {
PKERNEL32_FIND_FILE_DATA IData; PKERNEL32_FIND_FILE_DATA IData;
if (hFindFile == INVALID_HANDLE_VALUE)
{
SetLastError (ERROR_INVALID_HANDLE);
DPRINT("Failing request\n");
return FALSE;
}
IData = (PKERNEL32_FIND_FILE_DATA)hFindFile; IData = (PKERNEL32_FIND_FILE_DATA)hFindFile;
if (!InternalFindNextFile(hFindFile)) if (!InternalFindNextFile(hFindFile))
{ {