[comp.sys.ibm.pc.programmer] Dumping expanded memory

yung@contact.uucp (11/27/90)

Hello, any expert in expanded memory out there???
 
I am writing a TSR software which requires dumping the expanded memory to
the hard disk. So far I have done everything I know about the expanded
memory but the damn thing is still not working. Here is the alogithm that
I used:
 
1) Check to make sure EMM is present.
2) Find out the total EMS pages exist.
3) Find out the page frame address for the first physical page.
4) Save the current page map to a buffer.
5) Allocate one page and get a handle.
6) Open a storage file on hard disk
7) Map the first logical page to the first physical page.
8) Save the physical page to the storage file.
9) Unmap the logical page.
10) Advance to the next logical page and repeat the process until all logical
    page has been saved.
11) Close the storage file.
12) Deallocate the handle.
13) Restore the page map from the buffer.
 
What did I miss? I have examined the file (created while we were running
Desqview and have used up almost all the expanded memory) and found out
that the file was almost entirely made up of 00 and FF's, which should
be source code or data instead.
 
I have worked on it from scratch for almost a month and is now totally
at lost of what goes wrong. I would REALLY appreciate any input.
 
Thanks in advance. Happy computing.
 
-Amos Yung.