home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / asdt32.zip / SAMPLE.C < prev    next >
Text File  |  1992-04-07  |  1KB  |  52 lines

  1. /*
  2.  * This file communicates w/SAMPLEDD.SYS to get at the BIOS data area that
  3.  * contains the number of columns for the screen.
  4.  *
  5.  * Written 3/92 by Jim Christensen.  Altered 4/92 by Dave Evans for ASDT32
  6.  * purposes.
  7.  */
  8.  
  9. #define INCL_DOS
  10. #include <os2.h>
  11.  
  12. #define SAMPLE_IOCTL_CATEGORY  0xE0
  13. #define SAMPLE_IOCTL_FUNC_INIT 0xF0
  14.  
  15. char devName[] = "$SAMPDD";
  16. VOID* columnCountPtr;
  17.  
  18. VOID int3( VOID );
  19.  
  20.   int
  21. main( )
  22. {
  23.   APIRET rc;
  24.   HFILE dev;
  25.   ULONG actionTaken, nBytes, devArgList;
  26.  
  27.   /* Open the device driver */
  28.   if( rc = DosOpen(devName, &dev, &actionTaken,
  29.                    0,                    /* new file size */
  30.                    0,                    /* new file attribute */
  31.                    OPEN_ACTION_OPEN_IF_EXISTS,
  32.                    OPEN_SHARE_DENYNONE + OPEN_FLAGS_NOINHERIT,
  33.                    NULL)                 /* ext.attrib buffer NULL */
  34.  
  35.       )
  36.       DosExit( 1, 1 );
  37.  
  38.   /* Get the address of the BIOS column count from the device */
  39.   nBytes = sizeof(devArgList);
  40.   if( rc = DosDevIOCtl(dev, SAMPLE_IOCTL_CATEGORY, SAMPLE_IOCTL_FUNC_INIT,
  41.                  (PVOID) &devArgList, nBytes, &nBytes, NULL, 0L, NULL)
  42.       )
  43.       DosExit( 1, 1 );
  44.  
  45.   int3();
  46.   /* Convert the returned 16:16 address to a 0:32 address */
  47.   columnCountPtr = (VOID*)(
  48.                          ((devArgList >> 19) << 16) | (devArgList & 0xFFFF) );
  49.  
  50.   DosExit( 0, 0);
  51. }
  52.