Hello, Kevin!
KC> Does anyone know how to inset information into the environment block
KC> (eg: SET Bob=C:\Bob\), inside a C++ program in a way that the
KC> information will remain, even when the program exits, or, the program
KC> quits using dos_keep() (a TSR).
TC> I suggest you read SNIPPETS ENVIRON.TXT file. That will give you
TC> more info. Its kind of impossible to do, unless you're willing to
TC> back up and rewrite the user's AUTOEXEC.BAT file to reflect the
TC> change and have the user reboot. That's about the only way I can
TC> see it would work.
There is an undocumented way to obtain pointer to the MS-DOS "master"
environment. I've used it to set PATH variable to length more than 128 bytes.
And it works. At least under MS-DOS 6.22.
The idea comes from "UNDOCUMENTED DOS" by
Andrew Schulman
andrew@pharlap.com
uunet!pharlap!andrew
CIS: 76320,302
(files last updated at 23 January 1990)
And here is the part of my source:
-------------------
REGS r1;
SREGS r2;
r1.x.ax=0x352e;
int86x(0x21,&r1,&r1,&r2);
int E2VectSeg=r2.es;
unsigned *EnvSegPointer=(unsigned *)MK_FP(E2VectSeg,0x002c);
char *EnvPointer=(char *)MK_FP(*EnvSegPointer,0); /*pointer to master
environment */
unsigned EnvSize=(*(int *)MK_FP(*EnvSegPointer-1,3))*0x10; //size of
master environment according to its MCB */
-------------------
I hope it will help.
Good bye.
Max
---
---------------
* Origin: (2:463/321.1023)
|