/***************************************************************************
 *                                                                         *
 *   UNDWIN.C                                                              *
 *                                                                         *
 *   Copyright (c) 1993-1997 Galacticomm, Inc.    All Rights Reserved.     *
 *                                                                         *
 *   This is the function to find out whether or not you're under Windows. *
 *                                                                         *
 *                                             - Chris Robert 08/02/93     *
 *                                                                         *
 ***************************************************************************/

#include "gcomm.h"

#define FILREV "$Revision: 5 $"

GBOOL                              /*   returns TRUE=under Windows         */
undwin(VOID)                       /* are we under Windows?                */
{
#ifdef GCDOS
     INT ax;
#ifdef GCDOSP
     REGS16 r;

     setmem(&r,sizeof(REGS16),0);
     r.ax=0x1600;
     if (DosRealIntr(0x2F,&r,0L,0) != 0) {
          return(0);
     }
     ax=r.ax;
#else
     union REGS regs;

     regs.x.ax=0x1600;
     int86(0x2F,&regs,&regs);
     ax=regs.x.ax;
#endif // GCDOSP
     return((ax&0x007F) ? 1 : 0);
#else
     return(FALSE);
#endif // GCDOS
}
