Xref: news-dnh.mv.net comp.os.msdos.djgpp:2188 Path: news-dnh.mv.net!mv!news.sprintlink.net!cs.utexas.edu!swrinde!tank.news.pipex.net!pipex!dispatch.news.demon.net!demon!alphdyn.demon.co.uk From: Steve Higgins Newsgroups: comp.os.msdos.djgpp Subject: Re: Locking handlers code Date: Tue, 26 Sep 1995 08:30:28 GMT Lines: 55 References: Nntp-Posting-Host: alphdyn.demon.co.uk To: djgpp AT sun DOT soe DOT clarkson DOT edu Dj-Gateway: from newsgroup comp.os.msdos.djgpp Here are the routines that I use to lock and unlock the program memory. Perhaps someone else could confirm that they will work. #include #include #include __dpmi_meminfo lockRegion; void LockEverything() { unsigned long addr; printf("Locking Program Memory\n"); __dpmi_get_segment_base_address(_go32_my_cs(),&addr); printf("Base Address of Code Selector 0x%lx\n",addr); memset(&lockRegion,0,sizeof(lockRegion)); lockRegion.address = addr + 0x10A8; lockRegion.size = sbrk(0) - 0x10A8; if(__dpmi_lock_linear_region(&lockRegion) == -1) { printf(" Memory Lock Error\n"); printf(" Could not lock %d K of program memory.\n", lockRegion.size/1024+1); exit(0); } else { printf(" Locked %d K of system memory\n",lockRegion.size/1024+1); } } void UnlockEverything() { printf("Unlocking Program Memory\n"); __dpmi_unlock_linear_region(&lockRegion); } -- Steve Higgins