Category : Assembly Language Source Code
Archive   : UNDOC2E.ZIP
Filename : UNDOC.C

 
Output of file : UNDOC.C contained in archive : UNDOC2E.ZIP
/*
* Program Description:
* This programs shows the usage of the undocumented DOS interrupt
* 2eh. By executing this interrupt, you can permanently modify the
* DOS environment variables.
*
* Compilation:
* CL /c /Ox /Zp /Gs /AS undoc.c
*
* Linking:
* LINK undoc+int2e;
*
* Execution:
* UNDOC env-variable=new-value
* where env-variable is the variable to set
* new-value is the new value of the environment variable
*
* Example: UNDOC PATH=C:\DOS
*/

/*
* make sure we use the standard functions properly
* by including function prototypes for common routines
*/
#include
#include
#include

/*
* make a prototype for int_2e()
*/
extern void int_2e(char *);

/*
* this string holds the command to execute via int 2eh
*/
static char command_to_execute[129];

/*
* main program entry point
*/
main(int argc, char *argv[])
{

/*
* if the user doesn't know how to use this utility, tough shit . . .
*/
if (argc != 2)
{
printf("Syntax error\n");
exit(1);
}

/*
* see if we are running under small model
*/
if (sizeof(char *) != sizeof(int))
{
printf("Only works under small model!\n");
exit(1);
}

/*
* byte zero needs the string length of the command
*/
command_to_execute[0] = strlen(argv[1]) + 5;
strcpy(&command_to_execute[1],"SET ");
strcat(command_to_execute,argv[1]);

/*
* we need to terminate the string with a
*/
command_to_execute[command_to_execute[0]+1] = 0x0d;

/*
* call the undocumented interrupt
*/
int_2e(command_to_execute);

/*
* terminate program
*/
exit(0);

}


  3 Responses to “Category : Assembly Language Source Code
Archive   : UNDOC2E.ZIP
Filename : UNDOC.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/