Category : Alternate Operating Systems - Quarterdeck DesqView, CP/M, etc
Archive   : DVLOAD.ZIP
Filename : DVLOAD.C

 
Output of file : DVLOAD.C contained in archive : DVLOAD.ZIP
/* dvload.c
by Rod Murillo 303-761-0410 [email protected]
Start a new task in Desqview from the DOS command line.

NOTE: You must have the C API Library to compile this. The
large memory model is recomended. If you are new to the C library
drop me a line if you get frustrated trying to compile your first
program. I was.

This program was compiled with Turbo C 1.5

*/

#undef DEBUG
#include
#include
#include
#include
#include
#include
#include
#include

/* buffers sizes for storing and reading the PIF */

#define PIFSIZE 416
#define BUFFSIZE 512

/* parameter line flag position and mask in PIF */

#define PARAMFLAG 368 /* flag is at offset 368 */
#define PARAMSET 0x40 /* turn this bit on to flag command line presence */

/* error codes from startapp */

#define NODV 1 /* desqview is not loaded */
#define OPENERR 2 /* error on opening PIF */

#define READERR 3 /* error on reading PIF */
#define STARTERR 4 /* error on starting application */
#define PARAMERR 5 /* error in command line options */

#define MAXERR 5

/* command line argument paramters */

#define COMLINE_START 165 /* PIF buffer position for command lines args */
#define COMLINE_END 228 /* end position for start line */

char pifbuff[BUFFSIZE]; /* PIF buffer */

main(argc,argv)
int argc;
char *argv[];
{

/* function prototypes */

int startapp(char *,int, char *); /* handle PIF reading and app start */
void errmesg(int); /* print error messages */

/* declarations */

char *pifspec = "c:\\dv\\00-pif.dvp";
int errcode;

/* begin */

if (argc < 2 || argc > 3) {
puts("usage: dvl prefix [\"parameters\"]");
exit(PARAMERR);
}

/* load the PIF spec code */
pifspec[6] = argv[1][0];
pifspec[7] = argv[1][1];

errcode = startapp(pifspec,argc,argv[2]);

if (errcode != 0)
errmesg(errcode);
exit(errcode);

} /* end of function main() */

/* startapp() */

int startapp(app,argc,args)
char app[];
int argc;
char args[];
{

int i, j, inhandle;
unsigned long int winhan;

if (api_init() == 0)
return(NODV);

if ((inhandle = open(app, O_RDWR | O_BINARY)) < 0)
return(OPENERR);

if ((read(inhandle, pifbuff, BUFFSIZE)) != PIFSIZE)
return(READERR);

close(inhandle);

if (argc == 3) { /* check for a param string */

/* load the param string into the buffer */

for (i=COMLINE_START; i < COMLINE_END - COMLINE_START + 1; i++)
pifbuff[i] = ' ';

for (i=COMLINE_START, j=0; j < strlen(args) && j < COMLINE_END - COMLINE_START; i++, j++) {
pifbuff[i] = args[j];
}
pifbuff[i] = '\0';
pifbuff[PARAMFLAG] = pifbuff[PARAMFLAG] | PARAMSET; /* flag params on */

}

if (app_start(pifbuff,PIFSIZE) == 0)
return(STARTERR);
else
return(0);
}


/* errmesg() */

void errmesg(code)
int code;
{
char *errorstring;
unsigned long int winhan;

switch (code) {
case NODV: /* desqview is not running */
errorstring = "This program must run under DESQview 2.01 or later.";
break;
case OPENERR: /* error on opening PIF */
errorstring = "Error on opening PIF file.";
break;
case READERR: /* error on reading PIF */
errorstring = "Error on reading PIF file.";
break;
case STARTERR: /* error on starting application */
errorstring = "Error in starting application.";
break;
}
if (code != NODV) {
winhan = win_me();
win_disperor(winhan,errorstring,strlen(errorstring),2,30,0,0);
} else
printf("%s\n",errorstring);

return;
}






















  3 Responses to “Category : Alternate Operating Systems - Quarterdeck DesqView, CP/M, etc
Archive   : DVLOAD.ZIP
Filename : DVLOAD.C

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/