/*static char *SCCSID = "@(#)dosvdh.c   6.1 90/11/17";*/

#define SCCSID "@(#)dosvdh.c    13.21  90/07/29"

#define FNO_NUM  FNO_DOSVDH_C
#include <fnomvdm.h>

#define INCL_NONE               // for mvdm.h
#define INCL_TYPES              // include basic types
#define INCL_MVDMTYPES          // include mvdm types
#define INCL_VDHALL             // include VDH services


#ifdef MMIOPH                   // MMIO dekko hooks
  #include <mmph.h>
#endif
#include <mvdm.h>
#include <osmac.h>
#include <ostypes.h>
#include <mi.h>
#include <infoseg.h>
#include <dossymc.h>
#include <sigdef.h>
#include <except.h>
#include <pgexport.h>
#include <vmexport.h>
#include <selxport.h>
#include <seldesc.h>
#include <tkexport.h>
#include <curdir.h>
#include <screen.h>
#include <dirent.h>
#include <find.h>
#include <sem.h>
#include <sft.h>
#include <tkptda.h>
#include <mvdmexp.h>

#pragma BEGIN_MVDM_SWAP_INSTANCE

/***LD  vpDosDDHead - Head of DOS DD List from VDD's
 *
 *      This is the head of a list of DOS DD's which are inserted
 *      by Virtual Device Drivers.
 */

VPDOSDDTYPE vpDosDDHead = DOSDDEOL;

#pragma END_MVDM_SWAP_INSTANCE

//#pragma BEGIN_MVDM_SWAP_CODE
#pragma code_seg("SWAP32_23","CODE")

/***EP+ VDHSetDosDevice - Register DOS device drivers
 *
 *      Installs a region of memory as a DOS device driver.
 *
 *      ENTRY
 *          vpDosDD - V86FAR address of the DOS device driver header.
 *                      This header (and any headers chained to it)
 *                      are entered into the DOS device driver list
 *                      for this VDM.
 *
 *      EXIT-SUCCESS
 *          returns TRUE
 *
 *      EXIT-FAILURE
 *          returns FALSE
 *
 *      VDM TERMINATION IMPLICATIONS
 *          None.
 *
 *      CONTEXT
 *          VDM Task (VDM Create only)
 */

BOOL VDHENTRY VDHSetDosDevice(vpdosddtype)
VPDOSDDTYPE vpdosddtype;
/*end*/
{
    register PDOSDDTYPE pdosddtype;

#ifdef MMIOPH
    MMPHPreVDHSetDosDevice()
#endif
    pdosddtype = PFROMVP(vpdosddtype);
    while(pdosddtype->ddd_vpdosddtype != DOSDDEOL) {
        pdosddtype = PFROMVP(pdosddtype->ddd_vpdosddtype);
    }
    pdosddtype->ddd_vpdosddtype = vpDosDDHead;
    vpDosDDHead = vpdosddtype;
#ifdef MMIOPH
    MMPHPostVDHSetDosDevice()
#endif
    return(TRUE);
}
#pragma code_seg()
//#pragma END_MVDM_SWAP_CODE
