VDD file handle calls

HANDLE VDDRetrieveNtHandle(ULONG pPDB,SHORT hFile,PVOID* ppSFT,PVOID* ppJFT); 
SHORT  VDDAllocateDosHandle(ULONG pPDB, PVOID* ppSFT, PVOID* ppJFT);
VOID   VDDAssociateNtHandle(PVOID pSFT, HANDLE h32File, WORD wAccess);
BOOL   VDDReleaseDosHandle (ULONG pPDB, SHORT hFile);

THe following prototypes can be found in <vddsvc.h> in NT DDK 4.0
Unfortunately no additional information is available on the use of
these calls. This is what I found myself out

HANDLE 				NT file HANDLE 
VDDRetrieveNtHandle(
	ULONG pPDB, 		(real mode ptr) MK_FP(program PSP, 0)
	SHORT hFile,            DOS file handle
	PVOID* ppSFT,           pointer to pointer to DOS SFT table
	PVOID* ppJFT);          pointer to pointer to DOS program JFT table,
				pointer to JFT table is stored in program PSP

This function associates a new NT file HANDLE with an existing DOS file handle.
No call to CloseHandle needs to be made once the HANDLE is no
longer used. It is freed by NTVDM upon DOS close file call.

SHORT  
VDDAllocateDosHandle(
	ULONG pPDB,             (real mode ptr) MK_FP(program PSP, 0)
	PVOID* ppSFT,           pointer to pointer to DOS SFT table         
	PVOID* ppJFT);          pointer to pointer to DOS program JFT table,
                                pointer to JFT table is stored in program PSP

This functions allocates a new DOS handle. The handle can be used to real files
only. 

BOOL   
VDDReleaseDosHandle
	(ULONG pPDB,            (real mode ptr) MK_FP(program PSP, 0)
	SHORT hFile);           DOS handle allocated using VDDAllocateDosHandle

This functions deallocates a DOS handle allocated by VDDAllocateDosHandle
Since a close file DOS call deallocates that handle anyway then it is probably 
not necessary to use this function.

VOID   
VDDAssociateNtHandle(
	PVOID pSFT,             pointer to DOS SFT table
	HANDLE h32File, 	existing NT file handle
	WORD wAccess);          existing DOS file handle

This call associates existing NT handle with a fresh DOS handle so that DOS handle
can refer to a file pointed to by NT handle This call could be used as follows

if (handle = CreateFile( ... )) != INVALID_HANDLE_VALUE) 
{
	if (!(*pwDOSHandle = VDDAllocateDosHandle(pPDB, ppSFT, ppJFT))) {
			return GetLastError();	
	VDDAssociateNtHandle(*ppSFT, handle, *pwDOSHandle);	
}

