home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-386-Vol-2of3.iso / b / bc3.zip / DPMIHOST.CPP < prev    next >
C/C++ Source or Header  |  1992-02-13  |  1KB  |  79 lines

  1. //
  2. // (c) Copyright 1992, Qualitas, Inc.  All Rights Reserved
  3. //
  4. // dpmihost.h - member functions for DPMIhost class
  5. //
  6. #include <dos.h>
  7. #include "dpmihost.h"
  8.  
  9. //
  10. // DPMIhost constructor
  11. //
  12. // Locates the mode switch entry point, and stores host information 
  13. //
  14. DPMIhost::DPMIhost(void)
  15. {
  16.     int dpmiStat;
  17.  
  18.     majorVersion=minorVersion=0;
  19.     processor=0;
  20.  
  21.     dpmiStat=DPMIObtainSwitchEntryPoint(&flags, &processor, &majorVersion,
  22.             &minorVersion, &nPrivateDataParas, &entryAddress);
  23.  
  24.     if (dpmiStat == 0)
  25.         status = DPMIok;
  26.     else
  27.         status = DPMInotOk;
  28.  
  29. }
  30.  
  31. //
  32. // Enter protected mode - this member makes the initial switch into
  33. // protected mode.  If the return value is TRUE, the caller is then
  34. // running in protected mode.
  35. //
  36. boolean DPMIhost::enterProtectedMode(uChar bitness)
  37. {
  38.     int dpmiStat;
  39.  
  40.     if ((bitness != 16) && (bitness != 32))
  41.         return FALSE;
  42.  
  43.     if ((bitness == 32) && ((flags & 1) == 0))
  44.         return FALSE;
  45.  
  46.     dpmiStat=DPMIEnterProtectedMode(entryAddress, (bitness==32)?1:0,
  47.             nPrivateDataParas);
  48.  
  49.     if (dpmiStat == 0)
  50.     {
  51.         selectorDelta = DPMIGetSelectorDelta();
  52.         status = DPMIok;
  53.     }
  54.     else
  55.         status = DPMInotOk;
  56.  
  57.     return (status == DPMIok) ? TRUE:FALSE;
  58. }
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76.  
  77.  
  78.  
  79.