home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / library / os2 / gbdrv / csource / gbootdrv / gbootdrv.c next >
Encoding:
C/C++ Source or Header  |  1993-03-15  |  1.4 KB  |  32 lines

  1. /* ____________________________________________________________________
  2.  
  3.    GetBootDrive - REXX
  4.    Copyright (C) 1993 Bruce E. Högman.  All Rights Reserved.
  5.    This program is dedicated to the Public Domain by the author.
  6.  
  7.    Function:  GetBootDrive returns the letter of the drive used to
  8.    boot the system.  It uses DosQuerySysInfo to return the boot drive
  9.    number from OS/2.
  10.    ____________________________________________________________________
  11. */
  12. #define INCL_DOSFILEMGR
  13. #define INCL_RXFUNC
  14. #include <rexxsaa.h>
  15. #include <os2.h>
  16. static unsigned long const DataBufLen=16;
  17. static unsigned char const DriveLtr[28]="0ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  18. RexxFunctionHandler GetBootDrive;
  19. ULONG GetBootDrive(
  20.      PUCHAR    Name,                   /* name of the function       */
  21.      ULONG     Argc,                   /* number of arguments        */
  22.      RXSTRING  Argv[],                 /* list of argument strings   */
  23.      PSZ       Queuename,              /* current queue name         */
  24.      PRXSTRING Retstr)                 /* returned result string     */
  25. { ULONG  rc;                           /* Return code of function    */
  26.   CHAR   DataBuf[16]=""; ULONG *pBoot=(ULONG *) DataBuf;
  27.   rc = DosQuerySysInfo( 5,5, DataBuf, DataBufLen);
  28.   Retstr->strlength=1;
  29.   *(Retstr->strptr)=DriveLtr[*pBoot];
  30.   return 0;                            /* successful completion      */
  31. }
  32.