From 9008b900fe0b1f09b39db684a07cd5b9e99baaa3 Mon Sep 17 00:00:00 2001 From: Filip Navara Date: Sat, 28 Aug 2004 22:07:51 +0000 Subject: [PATCH] - Fix handling of INVALID_HANDLE_VALUE case in FindNextFile. svn path=/trunk/; revision=10722 --- reactos/lib/kernel32/file/find.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/reactos/lib/kernel32/file/find.c b/reactos/lib/kernel32/file/find.c index 4ebdf1d4ebd..5c915ad0030 100644 --- a/reactos/lib/kernel32/file/find.c +++ b/reactos/lib/kernel32/file/find.c @@ -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 * PROJECT: ReactOS system libraries @@ -50,12 +50,6 @@ InternalFindNextFile ( DPRINT("InternalFindNextFile(%lx)\n", hFindFile); - if (hFindFile == NULL) - { - SetLastError (ERROR_INVALID_HANDLE); - return FALSE; - } - IData = (PKERNEL32_FIND_FILE_DATA)hFindFile; if (IData->pFileInfo->NextEntryOffset != 0) @@ -424,12 +418,14 @@ FindNextFileA ( UNICODE_STRING FileNameU; ANSI_STRING FileName; - IData = (PKERNEL32_FIND_FILE_DATA)hFindFile; - if (IData == NULL) + if (hFindFile == INVALID_HANDLE_VALUE) { + SetLastError (ERROR_INVALID_HANDLE); + DPRINT("Failing request\n"); return FALSE; } + IData = (PKERNEL32_FIND_FILE_DATA)hFindFile; if (!InternalFindNextFile (hFindFile)) { DPRINT("InternalFindNextFile() failed\n"); @@ -580,6 +576,13 @@ FindNextFileW ( { 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; if (!InternalFindNextFile(hFindFile)) {