Newsgroups: comp.os.msdos.djgpp From: Peter Berdeklis Subject: Help! __dpmi_lock_linear_region wont! Message-ID: Nntp-Posting-Host: chinook.physics.utoronto.ca Sender: news AT info DOT physics DOT utoronto DOT ca (System Administrator) Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Organization: University of Toronto - Dept. of Physics Date: Thu, 9 Jan 1997 23:11:00 GMT Lines: 54 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp I'm trying to lock some DOS memory for a real mode interrupt handler and a bunch of DMA buffers, but every call to __dpmi_lock_linear_region returns a -1. Why? This is what I'm doing for all the DOS memory regions (properly allocated with a call to __dpmi_allocate_dos_memory - no error returned). void example() { __dpmi_meminfo vector_mem; int real_mode_int_segment, real_mode_int_selector; int paragraphs = (handler_size + 15)>>4; real_mode_int_segment = __dpmi_allocate_dos_memory( paragraphs, &real_mode_int_selector ); if( real_mode_int_segment == -1 ) exit(-1); // no exit, allocation OK vector_mem.handle = 0; // should be don't care for this call, right? vector_mem.size = handler_size; vector_mem.address = real_mode_int_segment << 4; // dos memory always in // paragraphs so offset=0, // right? if( __dpmi_lock_linear_region( &vector_mem ) == -1 ) exit(-1); // region not locked, exit } I do the same thing for the buffers, and every call to lock memory returns an error (I don't actually exit, so I know this). Why would the DPMI host refuse to lock the memory? I'm using CWSDPMI. Am I making the call correctly? Is the handle a don't care for this (and most, I think) calls? By the way, according to go32-v2.exe I have: DPMI memory available: 1483 Kb DPMI swap space available: 44905 Kb (Yes, I know that pretty sparse on the memory, but it's a small program on an old machine.) Finally, I know that I could lock all the memory with the crt0 flags, but I'ld rather make this work the right way. :) Thanks in advance for your help. --------------- Peter Berdeklis Dept. of Physics, Univ. of Toronto