Win32HandleToDosFileHandle / DosFileHandleToWin32Handle

Eric Pouech eric.pouech at
Sun Feb 5 09:56:57 CST 2006

Derek Fawcus wrote:
> On Sat, Jan 28, 2006 at 10:52:26AM +0100, Eric Pouech wrote:
>>>I suppose one could do something in the VDM process to mark the file
>>>handles as having multiple references,  and then do proper open / close
>>>handling.  But that would require a valid JFT anyway.
>>yes, what's currently missing is the JFT layer... one can consider that 
>>the Win32HandleToDosHandle (and its friends) to handle the SFT, and 
>>allow to bridge between the DOS world and the Win32 world.
> What I'm suggesting is that as soon as there is a JFT,  and we have to
> store a reference count outside the JFT,  then the place we store it
> is an equivalent to the SFT.
>>>So th JFT gives a way to update a reference count in the SFT.
>>but, you'll have to patch every possible file usage in winedos so that 
>>you don't mixup sft indexes and jft indexes...
> I know :-(  But the majority of it will be where Win32HandleToDosFileHandle
> is called - i.e. the FCB code,  as for a lot of the rest the existing code
> using DosFileHandleToWin32Handle _could_ be retained.
that's true from the winedos point of view, but that's used from some 
other places as well (krnl386.exe for example), where you should also 
know if a FILE16 is a SFT or a JFT handle...
IMO, what could be easily done is:
- a FILE16 is a SFT index
- a DOS fd is a JFT index
- the Win32Handle... functions manipulate SFT indexes...
however, this will work as long as a 16 bit program doesn't open a 
FILE16 handle an pass it down to DOS function, which some of them may do.
therefore, I'd suggest before further testing on this to make all SFT 
and JFT indexes equal

Eric Pouech

More information about the wine-devel mailing list