Xref: news-dnh.mv.net comp.os.msdos.djgpp:1647 Path: news-dnh.mv.net!mv!news.sprintlink.net!news.azstarnet.com!news.cais.net!ringer.cs.utsa.edu!swrinde!tank.news.pipex.net!pipex!dish.news.pipex.net!pipex!sunic!sunic.sunet.se!news.lth.se!news.lu.se!ronneby.hk-r.se!news From: pt93mg AT pt DOT hk-r DOT se (Mats Grahm) Newsgroups: comp.os.msdos.djgpp Subject: Hooking on interrupts Date: 20 Aug 1995 05:43:41 GMT Organization: College University of Karlskrona-Ronneby Lines: 39 Distribution: world Reply-To: pt93mg AT pt DOT hk-r DOT se Nntp-Posting-Host: neptunus.pt.hk-r.se To: djgpp AT sun DOT soe DOT clarkson DOT edu Dj-Gateway: from newsgroup comp.os.msdos.djgpp I'm quite new to protected mode programming, and got some problems when trying to redirect keyboard interrupts to my program. I have a keyboard handler from a book that I have tried to convert to pm. Basicly I just commented out all "far" keywords, and replaced the getvect() and setvect() calls with their go32 equvivalents, doing my best to follow the instructions in the info file: _go32_dpmi_seginfo myhandler; handler.pm_offset = (int) KeyIntHandler; handler.pm_selector = _go32_my_cs(); _go32_dpmi_allocate_iret_wrapper(&handler); _go32_dpmi_set_protected_mode_interrupt_vector(9, &handler); This works, but to be able to restore normal keyboard handling, I want to save the old handler. Should I use the protected or real mode version of _go32_dpmi_get_???_mode_interrupt_vector() ? I have tried both ways. As long as I only restore the keyboard at the end of the program, it doesn't seam to matter, I suppose go32 does some cleanup. But when I temporarily restore to the old handler to allow libgrx GetMouseEvent() to handle simultaneous keyboard and mouse events, I get a segmentation fault. If I treat the vector as realmode it happens in some end() function, if I treat it as pm it happens in int33(). I asume they both are called from somewhere inside the mouse library, since the keyboard is lost when this happens I can't get any further information from gdb. Only thing to do is to reboot. So my two questions are: Should I treat the old keyboard interrupt vector as real or protected? Both ways I get segmentation faults in GetMouseEvent(). Any suggestions why? Thanks in advance for any help! Mats