Win32HandleToDosFileHandle / DosFileHandleToWin32Handle

Derek Fawcus dfawcus at
Thu Jan 26 18:59:27 CST 2006

I'm looking to do some changes to the wine vdm - or more accurately
to the winedos dll to make the handling for some DOS applications
more useful.  This is mainly driven from a desire to run DOS apps
without a wineconsole,  so using the unix stdin/stdout/stderr as
the DOS file handles.  i.e. ala the BSD doscmd program;  mind it
also has similar issues (plus I'd have to port it :)

There are a few things I'll have to alter wrt to the existing console
handling (within winedos),  but the main part will be using the JFT
within the PSP/PDB and creating SFTs.  i.e. in effect fleshing out
dlls/kernel/file.c:dos_handles to be a pseudo-SFT.  I think I've
figured out more or less where I need to hack^h^h^h^hcode.  

Looking at what's done at the moment,  I see the above two functions
being used.  Now really,  what I'd like to have available is
Win32HandleToDosSFT and DosSFTToWin32Handle;   so I'll have to create
something along those lines.

So a few questions :

a) Is the behaviour of the above two functions correct?  i.e. should they
   be DosFileHandle <-> Win32Handle conversion routines?  Or is this just
   an artifact of how the DOS file handles are currently implemented?
b) Do any real apps (that anyone knows of) depend upon calling them?

I do see that they are used in a number of places for the existing 16 bit

If the behaviour is correct,  then I guess I'll have to adjust them so that
they involve a lookup of the current PSP/PDB and hence indirect through
the JFT.

Does anyone know if there is already a defined set of functions for SFT
handling at the NT abstraction level?  I'd have expected that the NT vdm
would have used it if such was available.


More information about the wine-devel mailing list