468,496 Members | 1,828 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,496 developers. It's quick & easy.

LOAD AND EXECUTE using D.O.S. interrups

I have been trying to load and execute a .COM file using int 21h DOS interrups (EXEC), but it seems there is a problem with the Parameter Block passed to BX, because executes .COM file but no sends parameters:
Expand|Select|Wrap|Line Numbers
  1.    int len, i, j, retorna;
  2.    union REGS registros;
  3.    struct  parametros {
  4.       int segmento;
  5.       int cmd_ptr_offset;
  6.       int cmd_ptr_segment;
  7.       int fcb1_ptr_offset;
  8.       int fcb1_ptr_segment;
  9.       int fcb2_ptr_offset;
  10.       int fcb2_ptr_segment;
  11.  } par;
  12.  
  13.  
  14.    char* cmd;
  15.    struct SREGS sregs;
  16.  
  17.  
  18.    cmd[0] = (char)  strlen(argv[3]);
  19.    strcpy(&cmd[1],argv[3]);
  20.    strcat(&cmd[1],"\r");
  21.  
  22.    segread(&sregs);
  23.  
  24.    memset(par, 0, sizeof(par));
  25.  
  26.    par.cmd_ptr_offset = (int) cmd;
  27.    par.cmd_ptr_segment = sregs.ds;
  28.    par.fcb1_ptr_offset = 0x5c;
  29.    par.fcb1_ptr_segment = _psp;
  30.    par.fcb2_ptr_offset = 0x6c;
  31.    par.fcb2_ptr_segment = _psp;
  32.    par.segmento = *((int far *)(((long)_psp<<16) | 0x2c));
  33.  
  34.  
  35.      printf("cmd:%s\n",cmd);
  36.  
  37.    registros.h.ah = 0x4b;
  38.    registros.h.al = 0x00;
  39.    registros.x.dx = (int) argv[2];
  40.    registros.x.bx =(int)  &par;
  41.    sregs.es = sregs.ds;
  42.  
  43.    retorna = intdos(&registros,&registros);
  44.  
Mar 21 '08 #1
0 752

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by Arti Potnis | last post: by
3 posts views Thread by grigno | last post: by
3 posts views Thread by claus.hirth | last post: by
2 posts views Thread by Sascha | last post: by
3 posts views Thread by =?Utf-8?B?TGV3aXMgTW90ZW4=?= | last post: by
3 posts views Thread by gieforce | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.