X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f From: zandro_arceo AT support DOT trendmicro DOT com (IeperNaum) Newsgroups: comp.os.msdos.djgpp Subject: Re: Hooking INT 2F Date: 5 Mar 2002 21:01:55 -0800 Organization: http://groups.google.com/ Lines: 81 Message-ID: References: NNTP-Posting-Host: 202.138.160.6 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1015390915 4380 127.0.0.1 (6 Mar 2002 05:01:55 GMT) X-Complaints-To: groups-abuse AT google DOT com NNTP-Posting-Date: 6 Mar 2002 05:01:55 GMT To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Eli Zaretskii wrote in message news:... > On 5 Mar 2002, IeperNaum wrote: > > > i tried to build the sample tsr, and it worked. then i changed the > > interrupt from int 8 to 2f, modified the int2f handler to make the > > program beep. > > > > but it did not work. > > Int 2Fh is a software interrupt, not a hardware interrupt. Software > interrupts are not reflected to protected-mode handlers (says the DPMI > spec), so you need either to hook them in real mode or to use real-mode > callbacks, as explained in section 18.9 of the DJGPP FAQ list. thanks for the info. now i was able to make it call the handler. another question. i am currently working on a network redirector project. so i need to hook int 2f. but now i have a problem. i read on this group that DJGPP has no provision for interrupt chaining in real mode. how can i work things out. i tried to use _go32_dpmi_simulate_fcall_iret() but it did not work. i will greatly appreciate any help. thanks. _go32_dpmi_seginfo old_vector; void int2f(_go32_dpmi_registers* r) { printf("INT 2F Invoked r->h.ah = %X\r\n", r->h.ah); if (r->h.ah != 0x11) { printf("Do Control\r\n", r->h.ah); //other processing here return; } r->x.ss = NULL; r->x.sp = NULL; r->x.flags = NULL; r->x.cs = old_vector.rm_segment; r->x.ip = old_vector.rm_offset; _go32_dpmi_simulate_fcall_iret(r); } int main(int argc, char* argv[]) { __dpmi_regs r; _go32_dpmi_seginfo info; _go32_dpmi_get_real_mode_interrupt_vector(0x2f, &old_vector); info.pm_offset = (unsigned long)int2f; _go32_dpmi_allocate_real_mode_callback_iret(&info, &g_r); _go32_dpmi_set_real_mode_interrupt_vector(0x2f, &info); r.x.ax = 0x252F; r.x.ds = info.rm_segment; r.x.dx = info.rm_offset; __dpmi_int(0x21, &r); _write(2,"Installing TSR\r\n",16); //__djgpp_exception_toggle(); // Only needed if exceptions linked r.x.ax = 0x3100; r.x.dx = 256 / 16; // paragraphs __dpmi_int(0x21, &r); printf("Hey\n"); _go32_dpmi_set_real_mode_interrupt_vector(0x2f, &old_vector); _go32_dpmi_free_real_mode_callback(&info); }