Ejemplo n.º 1
0
/*
    Return the number of buttons supported.

    In DOSemu (middle mouse button flaky and not supported)
*/
int GetNumSupportedButtons()
{
    static int InDosEmu = 3;
    
    if (InDosEmu == 3)	/* Work around a bug in DOSemu */
    {
	InDosEmu = is_dosemu() != 0;	
    }
    
    return (InDosEmu) ? 2: 3;    
}
Ejemplo n.º 2
0
int get_os (void)
{
      union REGS t_regs;
      long osmajor, osminor;
      unsigned status;

      if (id_os == -1)
      {
         id_os_type = 0;
         id_os = 0;

         /* test for DOS or OS/2 */

         t_regs.h.ah = 0x30;
         int86(0x21, &t_regs, &t_regs);
         osmajor = t_regs.h.al;
         osminor = t_regs.h.ah;

         if (osmajor < 10)
         {
            id_os_ver[DOS].maj = osmajor;
            id_os_ver[DOS].min = osminor;

            /* Look for FreeDOS. */
            if (t_regs.h.bh == 0xfd)
            {
               id_os_ver[FreeDOS].maj = 0;
               id_os_ver[FreeDOS].min = 0;

               id_os_type = is_FreeDOS;
            }
            else
               id_os_type = is_DOS;
         }
         else
         {
            /* OS/2 v1.x DOS Box returns 0x0A */

            id_os_type = id_os_type | is_OS2;

            /* OS/2 v2.x DOS Box returns 0x14 */

            id_os_ver[OS2].maj = osmajor/10;
            id_os_ver[OS2].min = osminor;
         }

         /* test for Windows */

         t_regs.x.ax = 0x1600;         /* check enhanced mode operation    */
         int86(0x2F, &t_regs, &t_regs);
         status = t_regs.h.al;

         if ((0x00 == status) || (0x80 == status))
         {
            /*
            ** Can't trust it...
            **  let's check if 3.1 is running in standard mode or what?
            */

            t_regs.x.ax = 0x160A;
            int86( 0x2F, &t_regs, &t_regs );
            if (0 == t_regs.x.ax)
            {
                  id_os_ver[WINS].maj = t_regs.h.bh;
                  id_os_ver[WINS].min = t_regs.h.bl;
                  id_os_type = id_os_type | is_WINS;
            }
         }
         else if ((0x01 == status) || (0xff == status))
         {
            id_os_ver[WINS].maj = 2;
            id_os_ver[WINS].min = 1;
            id_os_type = id_os_type | is_WINS;
         }
         else
         {
            id_os_ver[WINS].maj = t_regs.h.al;
            id_os_ver[WINS].min = t_regs.h.ah;
            id_os_type = id_os_type | is_WINS;
         }

         /* Test for DESQview */

         t_regs.x.cx = 0x4445;                /* load incorrect date */
         t_regs.x.dx = 0x5351;
         t_regs.x.ax = 0x2B01;                /*  DV set up call     */

         intdos(&t_regs, &t_regs);
         if (t_regs.h.al != 0xFF)
         {
            id_os_type = id_os_type | is_DESQVIEW;
            id_os_ver[DESQVIEW].maj = t_regs.h.bh;
            id_os_ver[DESQVIEW].min = t_regs.h.bl;
         }

         /* Test for linux DOSEMU. */
         if ((osmajor = is_dosemu()) != 0)
         {
            id_os_ver[DOSEMU].maj = osmajor;
            id_os_ver[DOSEMU].min = 0;
            id_os_type = id_os_type | is_DOSEMU;
         }

         if (id_os_type & is_FreeDOS)
            id_os = FreeDOS;
         if (id_os_type & is_DOS)
            id_os = DOS;
         if (id_os_type & is_WINS)
            id_os = WINS;
         if (id_os_type & is_WIN3)
            id_os = WIN3;
         if (id_os_type & is_DESQVIEW)
            id_os = DESQVIEW;
         if (id_os_type & is_OS2)
            id_os = OS2;
         if (id_os_type & is_DOSEMU)
            id_os = DOSEMU;
      }

      return(id_os);
}
Ejemplo n.º 3
0
main(int argc, char **argv)
{
    uint16 ccode;
    uint16 deviceParam;
    unsigned long dversion;

    char deviceStr[MAX_DEVICE_STRING_LENGTH];
    char resourceStr[MAX_RESOURCE_PATH_LENGTH];

    if ((dversion = is_dosemu()) == 0) {
      printf("This program requires DOSEMU to run, aborting\n");
      exit(1);
    }

#define D98min	((98UL << 16) | (7 << 8) | 1)
#define D99min  ((99UL << 16) | (12 << 8) | 1)

    if (((dversion >= D98min) && (dversion < (99UL << 16)))
                                        || (dversion >= D99min)) {
      if ((ccode = CheckForDosc()) != 0) {
        if (ccode <= 1937) {
          printf("You are running the FreeDos kernel.\n"
                 "This has no support for lredir, aborting\n");
          exit(1);
        }
      }
    }

    /* initialize the MFS, just in case the user didn't run EMUFS.SYS */
    InitMFS();

    /* need to parse the command line */
    /* if no parameters, then just show current mappings */
    if (argc == 1) {
      ShowMyRedirections();
      exit(0);
    }

    /* tej one parm is either error or HELP/-help etc */
    if (argc == 2) {
      printf("Usage: LREDIR [drive: LINUX\\FS\\path [R] | HELP]\n");
      printf("Redirect a drive to the Linux file system.\n\n");
      printf("LREDIR X: LINUX\\FS\\tmp\n");
      printf("  Redirect drive X: to /tmp of Linux file system for read/write\n");
      printf("  If R is specified, the drive will be read-only\n");
      printf("  ${home} represents user's home directory\n\n");
      printf("LREDIR DEL drive:\n");
      printf("  delete a drive redirection\n\n");
      printf("LREDIR\n");
      printf("  show current drive redirections\n\n");
      printf("LREDIR HELP\n");
      printf("  show this help screen\n");
      exit(0);
    }

    if (strncmpi(argv[1], KEYWORD_DEL, KEYWORD_DEL_COMPARE_LENGTH) == 0) {
      DeleteDriveRedirection(argv[2]);
      exit(0);
    }

    /* assume the command is to redirect a drive */
    /* read the drive letter and resource string */
    strcpy(deviceStr, argv[1]);
    strcpy(resourceStr, argv[2]);
    deviceParam = DEFAULT_REDIR_PARAM;

    if (argc > 3) {
      if (toupper(argv[3][0]) == 'R') {
        deviceParam = 1;
      }
    }

    /* upper-case both strings */
    strupr(deviceStr);
    strupr(resourceStr);

    /* now actually redirect the drive */
    ccode = RedirectDevice(deviceStr, resourceStr, REDIR_DISK_TYPE,
                           deviceParam);

    /* duplicate redirection: try to reredirect */
    if (ccode == 0x55) {
      DeleteDriveRedirection(deviceStr);     
      ccode = RedirectDevice(deviceStr, resourceStr, REDIR_DISK_TYPE,
                             deviceParam);
    }

    if (ccode) {
      printf("Error %x (%s)\nwhile redirecting drive %s to %s\n",
             ccode, decode_DOS_error(ccode), deviceStr, resourceStr);
      goto MainExit;
    }

    printf("%s = %s  attrib = ", deviceStr, resourceStr);
    switch (deviceParam) {
      case READ_ONLY_DRIVE_ATTRIBUTE:
        printf("READ ONLY\n");
        break;
      default:
        printf("READ/WRITE\n");
        break;
    }

MainExit:
    return (ccode);
}