[comp.os.msdos.programmer] How to write a TSR in C ?

chu@pioneer.arc.nasa.gov (Susie Chu RCS) (06/16/91)

Does anyone have experience in writing a TSR utility in C ? 
If yes, would you help me by telling me how, giving me a sample, or
directing me to a book.  Thanks in advance.
---Susie Chu

net address: chu@pioneer.arc.nasa.gov
UUCP: {ihnp4,ucbvax,nike,lll-crg}!ames!pioneer!chu
Disclaimer: NASA is in no way responsible for the content of the previous mes-
    sag I take full and sole responsibility.

ekalenda@cup.portal.com (Edward John Kalenda) (06/18/91)

>Does anyone have experience in writing a TSR utility in C ? 
>If yes, would you help me by telling me how, giving me a sample, or
>directing me to a book.  Thanks in advance.
>---Susie Chu

If you're using MSC 6.0, there is an example called ALARM.C in the
QuickHelp database. Type QH ALARM.C to see what it does. A word of
caution though: They made a SERIOUS mistake in the sample program
where they call _dos_free() with the segment number of the PSP. If
you do this your program memory space will be freed. What they meant
to do was free the environment memory block but blew it. I've used
their example (leaving out the call to free the PSP) and it worked
OK.

Feel free to email me with more detailed questions if you do get
involved with this. I'll take a stab at answers as time permits. (I'm
a semi-independant consultant/contractor and get busy at times.)

Ed
ekalenda@cup.portal.com

jvb7u@fermi.clas.Virginia.EDU (Jon Brinkmann) (06/21/91)

In article <1991Jun15.231057.27928@news.arc.nasa.gov> chu@pioneer.arc.nasa.gov (Susie Chu RCS) writes:
#Does anyone have experience in writing a TSR utility in C ? 
#If yes, would you help me by telling me how, giving me a sample, or
#directing me to a book.  Thanks in advance.

Try:
	Christian, Kaare, "Using MicroSoft C Version 5.1 to Write
	Terminate-and-Stay-Resident Programs", MicroSoft Systems
	Journal, September 1988, Volume 3, Number 5, pages 47 - 57.

The software examples in this article are available from
SIMTEL in the file PD1:<MSDOS.MSJOURNAL>MSJV3-5.ARC.

Or:
	Stevens, Al, "Writing Terminate-and-Stay-Resident Programs",
	Computer Language, February 1988, pages 37 - 48, March 1988,
	pages 67 - 76.


The software examples in this article are available from
SIMTEL in the file PD1:<MSDOS.C>TSRC.ARC.

The latter article does a better job of handling DOS's shortcomings.

Jon
--
Jon Brinkmann					Astronomy Department
Internet:	jvb7u@Virginia.EDU		University of Virginia
UUCP:		...!uunet!virginia!jvb7u	P.O. Box 3818
SPAN/HEPnet:	6654::jvb7u			Charlottesville, VA 22903-0818

kevin@loki.une.oz.au (Kevin Pollard) (06/24/91)

From article <1991Jun20.232051.16087@murdoch.acc.Virginia.EDU>, by jvb7u@fermi.clas.Virginia.EDU (Jon Brinkmann):
> In article <1991Jun15.231057.27928@news.arc.nasa.gov> chu@pioneer.arc.nasa.gov (Susie Chu RCS) writes:
> #Does anyone have experience in writing a TSR utility in C ? 
> #If yes, would you help me by telling me how, giving me a sample, or
> #directing me to a book.  Thanks in advance.
> 
Try:
	C Power User's Guide - Herbert Schildt    (Osborne McGraw-Hill)
		This book has a chapter in it called "Terminate and
		Stay Resident Pop-up Programs". I found the programs
		actually did what they were supposed to! - no mean
		acheivment with TSR's. I was able to understand it too!!!!
		I bought the book out here in Australia about 2 years ago.

Kevin Pollard

-- 
-------------------------------------------------------------------------
'Aard-vark  a very difficult word which you don't need to know.'
---------------------------------------- The Oxfod Simplified Dictionary.