www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/02/11/17:21:11

From: Robert Gorichanaz <wraith AT hollywood DOT cinenet DOT net>
Subject: Allocating DOS memory ???
To: djgpp AT delorie DOT com
Date: Sun, 11 Feb 1996 14:07:38 -0800 (PST)
MIME-Version: 1.0

I'm sure this is/was a FAQ, so if you would be so kind as to point me towards
it....


Anyways, my question is on "How to" allocate and USE a chunk of dos 
conventional memory from protected mode.

Basically, what I want to do is allocate a number of pages of dos memory,
load the contents of a file into that memory, and return a pointer that I 
can later use to free the section.

I've tried something like this:

	long filesz = someval /* used fseek/ftel to get file size */
	int  pages  = (filesz+15)>>4 /*number of pages */
	int  selector, *selptr;

	selptr = selector;
	location = __dpmi_allocate_dos_memory( page, selptr );

	...

and then fread the file in using "location". (sorry for the rough code, 
I'm typing it from memory - don't have multiple windows)


This, of course, completely locks the machine up.


Umm.... anyone want to flame me?


-=bob=-

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019