From: Neil Stone Newsgroups: comp.os.msdos.djgpp Subject: Hooking int 21h and other stuff Date: Mon, 24 Mar 1997 01:26:19 +0000 Organization: [not set] Lines: 22 Message-ID: <3335D83A.2CC9@CyberServices.Com> NNTP-Posting-Host: n70i056.c1r2.pol.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp I have been trying to hook the DOS interrupt, 21h, but have been unsuccessful in my attempts. I have been able to hook other interrupts of interest, keyboard, timer, etc. But no matter what I do my computer always crashes when hooking the DOS one. Are then any special precautions I should take, what registers do I need to save and restore before calling the old ISR? I haven't actually tried this in DJGPP, I tried it at college - I'm 16, using TC 3.0 but I don't think DJGPP would be much different. From a file I read, not sure which one, I was told it would need to be done in assembler, I don't know much about this but am willing to learn. As the DOS is 16-bit I think my ISR would have to be 16-bit, i.e. real mode, as well. How do I do this? Does it need to be locked? For real mode ISR's in general, can you use the e* registers, eax, ebx, etc., as long as you don't access memory outside conventional. Also, if I have a DOS segment:offset address how do I get a selector:offset and how do I use this selector to access memory. Please give all answers in a not to technical form preferable with commented source code. Thanks in advance. Gareth Wilson