[comp.sys.ibm.pc] Current Process in MSDOS

wacey@paul.rutgers.edu ( ) (05/08/89)

Does anyone know of a way to determine the current DOS Process without
using one of the DOS get PSP calls. Any help would be appreciated.

Iain Wacey

dixon@sagittarius.steinmetz (walt dixon) (05/09/89)

The current PSP is stored in a DOS global variable and presumably you could
access its contents directly;  of course this technique is highly dependent
on the DOS version.  I don't understand the reluctance to use the DOS
functions to retrieve this value.  The PSP manipulation services do no stack
switching and are always safe (if properly used) -- at least in all DOS 3.1
and above.  Don't know about DOS 4.0 and 4.0.1.

Walt Dixon			{arpa:		dixon@ge.crd.com	}
				{us mail:	ge crd			}
				{		po box 8		}
				{		schenectady,  ny 12345	}
				{phone:		518-387-5798		}

bcw@rti.UUCP (Bruce Wright) (05/12/89)

In article <13777@steinmetz.ge.com>, dixon@sagittarius.steinmetz (walt dixon) writes:
> The current PSP is stored in a DOS global variable and presumably you could
> access its contents directly;  of course this technique is highly dependent
> on the DOS version.  I don't understand the reluctance to use the DOS
> functions to retrieve this value.  The PSP manipulation services do no stack
> switching and are always safe (if properly used) -- at least in all DOS 3.1
> and above.  Don't know about DOS 4.0 and 4.0.1.

The unfortunate thing about MessyDos is that there have been a series of
half-baked additions to the system.  (caused by an almost total lack of
design in both the original and the subsequent versions).  The PSP 
functions (as well as a number of other useful functions) did not exist 
in earlier versions of the system; they are new (or at least newly 
supported) with 3.0.  Many programs want to do some of those things 
without checking the version number all the time (which is what they 
SHOULD do, but ...).  This has had to be done because the market has 
demanded that most applications work on almost any version of DOS -- 
even the brain-dead V1.0.  

About the only positive thing about MS-DOS is that it unified the PC
environment so that you could be pretty sure that if it was a PC, it
ran MS-DOS.  Simplifies things enormously, both for the developer and
for the user.  It appears that we are going to trade one evil (the
poverty of MS-DOS) for another (a totally fragmented market with each
OS architecture only getting a fraction of the total market).  Offhand
I think I prefer the second - at least you have the possibility of
improving your own situation even if nobody else's - but it's still
not all that attractive.

						Bruce C. Wright

Ralf.Brown@B.GP.CS.CMU.EDU (05/14/89)

In article <2949@rti.UUCP>, bcw@rti.UUCP (Bruce Wright) writes:
}In article <13777@steinmetz.ge.com>, dixon@sagittarius.steinmetz (walt dixon) writes:
}> functions to retrieve this value.  The PSP manipulation services do no stack
}> switching and are always safe (if properly used) -- at least in all DOS 3.1
}> and above.  Don't know about DOS 4.0 and 4.0.1.
}
}The PSP
}functions (as well as a number of other useful functions) did not exist 
}in earlier versions of the system; they are new (or at least newly 
}supported) with 3.0.

They were introduced, but undocumented, in DOS 2.0, and a separate (but
identical) documented "get PSP" call was added with 3.0.  DOS 1.x didn't have
the PSP functions, since it had no notion of a process ID, no memory control
blocks, no DOS calls, etc. that would require knowing the current PSP.

}  Many programs want to do some of those things
}without checking the version number all the time (which is what they 
}SHOULD do, but ...).  This has had to be done because the market has 
}demanded that most applications work on almost any version of DOS -- 
}even the brain-dead V1.0.  

It's been a long time since I've seen a program that runs on DOS 1.x, and the
last one I've seen that did was quite old even then.
--
UUCP: {ucbvax,harvard}!cs.cmu.edu!ralf -=-=-=- Voice: (412) 268-3053 (school)
ARPA: ralf@cs.cmu.edu  BIT: ralf%cs.cmu.edu@CMUCCVMA  FIDO: Ralf Brown 1:129/31
			Disclaimer? I claimed something?
   Intelligence is when you spot a flaw in your boss's reasoning.  Wisdom is
   when you refrain from pointing it out.  --James Dent