From 4f46b5de45e18aeefadde87ea4a003f9303012b4 Mon Sep 17 00:00:00 2001 From: Dominik Strasser Date: Fri, 20 Apr 2001 18:38:41 +0000 Subject: [PATCH] Allow illegal handles in FindClose. --- files/dos_fs.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/files/dos_fs.c b/files/dos_fs.c index 400223e78a4..6c5ac7941a1 100644 --- a/files/dos_fs.c +++ b/files/dos_fs.c @@ -105,6 +105,13 @@ typedef struct } FIND_FIRST_INFO; +static WINE_EXCEPTION_FILTER(page_fault) +{ + if (GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION) + return EXCEPTION_EXECUTE_HANDLER; + return EXCEPTION_CONTINUE_SEARCH; +} + /*********************************************************************** * DOSFS_ValidDOSName @@ -1768,8 +1775,18 @@ BOOL WINAPI FindClose( HANDLE handle ) SetLastError( ERROR_INVALID_HANDLE ); return FALSE; } - if (info->dir) DOSFS_CloseDir( info->dir ); - if (info->path) HeapFree( GetProcessHeap(), 0, info->path ); + __TRY + { + if (info->dir) DOSFS_CloseDir( info->dir ); + if (info->path) HeapFree( GetProcessHeap(), 0, info->path ); + } + __EXCEPT(page_fault) + { + WARN("Illegal handle %x\n", handle); + SetLastError( ERROR_INVALID_HANDLE ); + return FALSE; + } + __ENDTRY GlobalUnlock( handle ); GlobalFree( handle ); return TRUE;