Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!rpi!dali.cs.montana.edu!milton!uw-beaver!sumax!thebes!amc-gw!jwbirdsa From: jwbirdsa@amc-gw.amc.com (James Birdsall) Newsgroups: comp.sys.ibm.pc.misc Subject: Re: Dumping Expanded Memory Message-ID: <4303@amc-gw.amc.com> Date: 30 Nov 90 17:29:56 GMT References: <1990Nov26.164506.24237@contact.uucp> Reply-To: jwbirdsa@europa.amc.com (James Birdsall) Organization: Applied Microsystems, Redmond, WA Lines: 52 In article <1990Nov26.164506.24237@contact.uucp> yung@contact.uucp () writes: >I am writing a TSR software which requires dumping the expanded memory to >the hard disk. As a side issue, I assume you are taking appropriate precautions for writing to disk from within a TSR? Since you mention being able to look at the file, you probably are (or you're lucky). >1) Check to make sure EMM is present. Good. >2) Find out the total EMS pages exist. Probably unnecessary. Depends on what else you're doing. >3) Find out the page frame address for the first physical page. >4) Save the current page map to a buffer. Good. >5) Allocate one page and get a handle. THIS is the problem. When you get a handle/allocate pages, you are getting pages not used by any other handle. Hence, you wind up dumping the contents of unused memory to disk, and of course these contents are random. What you should be doing is: 5) Get information on all handles presently in use (there is a call to do this) which tells you what the handles are and how many pages are allocated for each. 6) For each of those handles, dump each logical page to the disk by mapping it to the first physical page and doing a disk write. This is possible because EMM handles are global; the EMM does not care whether the program using the handle is the same program that the handle was allocated to. >11) Close the storage file. Good. >13) Restore the page map from the buffer. Good. If you need more information, feel free to contact me. -- James W. Birdsall | amc-gw!jwbirdsa@uunet.uu.net | For it is the doom of =======================| 71261.1731@compuserve.com | men that they forget. jwbirdsa@amc.com | CompuServe: 71261,1731 | --Merlin uunet!amc-gw!jwbirdsa | GEnie: J.BIRDSALL2 |======================