From: eddie AT lvp DOT nl (Eddie Penninkhof) Newsgroups: comp.os.msdos.djgpp Subject: Problem with DPMI / NT4.0 Date: Thu, 03 Sep 1998 14:14:01 GMT Organization: L.V.P. b.v. Lines: 78 Message-ID: <35eea126.699595@news.worldonline.nl> NNTP-Posting-Host: vp233-2.worldonline.nl 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 Precedence: bulk I'm trying to access a 32 bit 'TSR' djgpp program from a 16 bits DOS program. I'm using a ('software') interrupt to achieve this. This works fine in a OS/2 or Windows 95 DOS-box, but crashes in a Windows NT 4.0 (SP3) DOS-box. It gives a SIGSEGV in the djgpp-program and a '16 bit MS-DOS Subsystem' popup: 'X#=0D, CS=00C7 IP=00004989. The NTVDM CPU has encountered an unhandled exception.' Is this a bug in NT (probably) or in DJGPP? Does anybody have a way to circumvent it? Tnx, Eddie. This is the (sample) program (note: for brevity I removed the checking of returncodes, but none of the dpmi-functions gives an errorcode...). ------8<------8<------8<------8<------8<------8< #include #include #include #include typedef struct { _go32_dpmi_registers regs; _go32_dpmi_seginfo orgaddr; _go32_dpmi_seginfo newaddr; } TData; TData data; void inthandler(void) { } static void inthandler_lock(void) { } unsigned char rgCode[7] = { 0xCD, 0x64, /* INT 64H */ 0xB8, 0x00, 0x4C, /* MOV AX,4C00 */ 0xCD, 0x21 /* INT 21H */ }; int main(void) { int ret = 0; FILE *f; int intno = 100; /* Create a small .com-file that calls interrupt 100 */ f = fopen("int100.com", "wb"); fwrite(rgCode, 7, 1, f); fclose(f); /* Lock the code/data of the interrupt-handler */ _go32_dpmi_lock_data(&data, sizeof(TData)); _go32_dpmi_lock_code(inthandler, (unsigned long)(inthandler_lock - inthandler)); /* Save the previous interrupt-handler */ _go32_dpmi_get_real_mode_interrupt_vector(intno, &data.orgaddr); /* Set the new handler for interrupt 100. */ data.newaddr.pm_selector = _go32_my_cs(); data.newaddr.pm_offset = (int) inthandler; _go32_dpmi_allocate_real_mode_callback_iret(&data.newaddr, &data.regs); _go32_dpmi_set_real_mode_interrupt_vector(intno, &data.newaddr); /* Call a 16 bit program that calls interrupt 100 */ ret = spawnl(P_WAIT, "int100.com", "int100.com", NULL); /* Restore the original interrupt handler. */ _go32_dpmi_set_real_mode_interrupt_vector(intno, &data.orgaddr); _go32_dpmi_free_real_mode_callback(&data.newaddr); return (0); } ------8<------8<------8<------8<------8<------8<------8<------8<