jwbirdsa@amc-gw.amc.com (James Birdsall) (12/01/90)
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 |======================
yung@contact.uucp (12/05/90)
Thanks James! Your response sure helped clearing up a lot of confusions! In article <4303@amc-gw.amc.com> jwbirdsa@europa.amc.com (James Birdsall) writes: >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). Yes. They have all been taken care of. >>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. You are probably right. Almost all the response that I've got so far points to this problem. I am trying to fix it and hopefully get it done by the weekend. > If you need more information, feel free to contact me. Don't mind if I do :^) Aside from saving the memory to disk, I would also like to restore in at some latter point as well. Can you suggest a feasible strategy for me? Before I get into this EMM mess, I really didn't expect it would be so difficult. Afterall, all I wanted to do was simple memory dump and restoration. Is there any good book out there about programming expanded memory? I have been looking but there seems to be pitifully little out there. Thanks again for your response. Happy Computing. -Amos Yung