question on _lclose16

Ove Kaaven ovehk at ping.uio.no
Sun Jul 28 16:21:14 CDT 2002


On Sat, 27 Jul 2002, Rafael Kitover wrote:

> In files/file.c, line 1351:
> 
> HFILE16 WINAPI _lclose16( HFILE16 hFile )
> {
>     if (hFile < 5)
>     {
>         FIXME("stdio handle closed, need proper conversion\n" );
>         SetLastError( ERROR_INVALID_HANDLE );
>         return HFILE_ERROR16;
>     }
> ....
> 
> 
> What does this mean? Taking it out doesn't seem to hurt anything. I 
> understand from this block:
> 
> static void FILE_InitProcessDosHandles( void )
> {
>     dos_handles[0] = GetStdHandle(STD_INPUT_HANDLE);
>     dos_handles[1] = GetStdHandle(STD_OUTPUT_HANDLE);
>     dos_handles[2] = GetStdHandle(STD_ERROR_HANDLE);
>     dos_handles[3] = GetStdHandle(STD_ERROR_HANDLE);
>     dos_handles[4] = GetStdHandle(STD_ERROR_HANDLE);
> }
> 
> why we don't want to close those handles probably.

Actually I guess it could be fixed by making the dos_handles[x]
*duplicates* of the standard win32 handles, i.e.
DuplicateHandle(GetCurrentProcess(), GetStdHandle(...), ...). If then a
dos app tries to close those standard handles, only the duplicate will be
closed, not the win32 std handle itself.

> But why would I see that message, do sloppy windows programs try to
> close a range of handle numbers or something?

Yeah, I've seen some apps do just that. But it could also be trying to
close a stdin/out handle in preparation for doing redirection.




More information about the wine-devel mailing list