CloseHandle with 0xffffffff parameter
Marcus Meissner
marcus at jet.franken.de
Wed Aug 1 05:14:00 CDT 2001
On Wed, Aug 01, 2001 at 12:06:14PM +0200, Marco Bizzarri wrote:
> Hi All.
>
> While trying to make an application working under wine, I've stumped
> into the following trace fragment, obtained with --debugmsg +relay:
>
>
>
> 081612c8:Call kernel32.CreateFileA(405f6454
> "c:\\rs\\project\\apitest\\vc\\32\\apitestvc60\\debug\\ret_dll.pdb",80000000,00000001,00000000,00000003,00000080,00000000)
> ret=404aa001
> 081612c8:Ret kernel32.CreateFileA() retval=ffffffff ret=404aa001
> 081612c8:Call kernel32.CloseHandle(ffffffff) ret=404aa0bd
> 081612c8:Ret kernel32.CloseHandle() retval=00000000 ret=404aa0bd
>
> As you can see, the program is trying to open a file, which is not
> found. An invalid handle (ffffffff) is returned. The program however
> closes the handle.
>
> My question is: is this correct? Should the CloseHandle check to see if
> it is a correct handle?
Nope. Just bad checks in the debugger.
Ciao, Marcus
Changelog:
Check for -1 as the undefined value for handles before CloseHandle.
Index: msc.c
===================================================================
RCS file: /home/wine/wine/debugger/msc.c,v
retrieving revision 1.41
diff -u -r1.41 msc.c
--- msc.c 2001/07/23 00:04:00 1.41
+++ msc.c 2001/08/01 10:22:33
@@ -119,8 +119,8 @@
static void DEBUG_UnmapDebugInfoFile(HANDLE hFile, HANDLE hMap, void* addr)
{
if (addr) UnmapViewOfFile(addr);
- if (hMap) CloseHandle(hMap);
- if (hFile) CloseHandle(hFile);
+ if (hMap!=INVALID_HANDLE_VALUE) CloseHandle(hMap);
+ if (hFile!=INVALID_HANDLE_VALUE) CloseHandle(hFile);
}
More information about the wine-patches
mailing list