PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Exporting ROM DLLs from the device

Does anyone know how to export DLLS that are stored in ROM?

I can see them with the remote file viewer tool, but I am unable to export them.

Using explorer (both desktop and on the device), I can't see these DLLs.

I though there was a way, but nothing will do here. Any help appreciated.

I am particularly interested on exporting AYGSHELL.DLL and CORE.DLL.
If you want to copy them over to your PC, TotalCommander can do it, I believe. It's an (ugly as hell) free file explorer for PocketPC.

http://www.ghisler.com/pocketpc.htm
It's not possible. ROM files are protected at the lowest level by the OS itself.

Dan East
Never mind, Totalcommander can't do it.

Dan: I specifically remember using this program to copy out iTask.exe onto my desktop. The program had this ugly dark blue background to it, 2 split columns vertically. I can't remember the name though.

[edit] Never mind, the program is CE FileCommander. Got the iTask files and Nevo.exe out of there, but not aygshell.dll
Thanks for your help guys. Basically I was trying to figure out what GAPI links to. There is basically around 20 functions in Core.DLL that I was able to identify. From the look of it, GAPI simply hook the window proc and use some driver escape code(s) to access the framebuffer.

There is a single function being call in aygshell.dll that I can't positively identify. But I think it's a safe bet to say that's our friend SHFullScreen().

Now on to some hooking madness =)
It must be possible (though technically "interesting" ;)); I've seen DLLs from iPAQs around and about on the Internet.
Your best bet is extracting them from the iPaq ROM updates.

Dan East
The ROM updates don't contain the full ROM image anymore, so you may not have the file you want on there. (You can't restore WinCE from Linux using a ROM update)
Sergey Chaban · 18 Jun 2003, 16:13 UTC
Thierry,
You don't need actual DLLs to map ordinals to symbols.
Just use dumpbin or similar tool on the lib file for the DLL.
E.g. dumpbin /all aygshell.lib > aygshell.defs
Then look for "Ordinal : xyz" records in the resulting file.
For coredll it's even easier because Microsoft distributes linker def file for it, it included with PB, or CE kernel sources (e.g. in the CE.NET emu edition) etc.
COREDLL contains some arch-specific exports (like e.g. div* functions on ARM), so it's important to use correct lib file, but for other DLLs arch doesn't matter.
Here is the record for the aygshell function imported by GAPI (#65):
Version : 0
Machine : 1C0 (ARM)
TimeDateStamp: 3BCFB22B Fri Oct 19 07:55:07 2001
SizeOfData : 0000001A
DLL name : AYGSHELL.dll
Symbol name : SHFullScreen
Type : code
Name type : ordinal
Ordinal : 65

So it's SHFullScreen indeed.

Also this may be useful: GAPI looks for gxdma.dll (the "GAPI driver"), loads it dynamically if present and uses its API to copy backbuffer to the screen.

HTH
Thanks Sergey. I am getting old and completely forgot about dumpbin. The sad part is I use it every month on the desktop PC.

So have you figured out the entry points for GXDMA.DLL? As far as I can tell, GX.DLL will use LoadLibrary() and then one or more GetProcAddress() to access it.

While on the subject, did anyone try to hook DLLs on the PPC using a technique similar to Bugslayer? (Hooking the import records.)
Sergey Chaban · 18 Jun 2003, 20:38 UTC
The API for GXDMA is something like this:
void DMAVramToDram(RECT viewport);
void DMADramToVram(RECT viewport);
int IsDMAReady(void);
I'll try to lookup some more info on how it's used in the GAPI etc.
Did you have time to look up for more info Sergey?

I am particularly interested in the driver escape codes that GX.DLL is using. I am about to try hooking the DLL, but if you have the info handy, it would save me some time.
Sergey Chaban · 24 Jun 2003, 17:12 UTC
Here is some additional info, but it's still somewhat incomplete.
Here is the esc code to get the framebuffer info.
EXT_FRAMEBUFF_INFO = 0x20000
The name is something different, but I can't find the actual doc/definition for this.
So this is how to get framebuffer ptr using ExtEscape.

Code:

#define EXT_FRAMEBUFF_INFO 0x20000
struct FrameBuffAddr {
DWORD size;
DWORD addr;
char pad[0x7C];
};

HDC screenDC = ::GetDC(NULL);
FrameBuffAddr addr;
addr.size = sizeof(FrameBuffAddr);
ExtEscape(screenDC, EXT_FRAMEBUFF_INFO, 0, 0, sizeof(FrameBuffAddr), &addr);
DWORD fbPtr = addr.addr;
::ReleaseDC(NULL, screenDC);


Actual code used in GAPI is more complex, i.e. it's necessary to check if EXT_FRAMEBUFF_INFO is actually supported by the driver (and escape code to check the range of accepted codes is another driver code used by GAPI.dll, I believe it's documented in the standard SDK docs, but I don't have the docs handy right now to check this).
Also struct passed to ExtEscape is more complex than that (contains alignment, BPL, orientation etc. info), but I can't find actual definition either :(
Padding is necessary because some drivers seems to ignore size settings and always use fixed size for the struct.

GAPI works like this (more or less):
1. Check if there is GAPI DMA driver. If found use it for transfers.
2. See if video driver supports FRAMEBUFF_INFO code. If it's supported use it to get the info.
3. If none of the above is found, there are some hardcoded addresses for some devices (J580 & Aero).

Step 1 ensures that the same GAPI dll (search for GAPI driver) could be used on the future/non-standard devices.

HTH,
SC
Crickey, that's great info - how on earth did you figure out it was 0x20000 ?!?!

Disassembly of gx.dll?
Sergey Chaban · 24 Jun 2003, 19:48 UTC
Yep, disassembly in this case - but this stuff is in fact documented somewhere, either DDK or docs that came with older PB something like this, I just can't find these docs now.

SC
That's great stuff Sergey. The only thing I don't have all figured out yet is the usage of the GXDMA.DLL.

You named three functions:

Sergey Chaban wrote:
The API for GXDMA is something like this:
void DMAVramToDram(RECT viewport);
void DMADramToVram(RECT viewport);
int IsDMAReady(void);


These are easy to understand. But there is obviously more to it:

1) How do you initialize/shutdown the DLL?
2) Who allocates the DRAM buffer and how do you access/specify it?

Do you have any more info?

Thanks again!
2) Who allocates the DRAM buffer and how do you access/specify it?


From my investigations last year, the most common way of having this set up was for the vendor to define the DRAM buffer as a block of memory in Platform Builder - i.e. it's embedded (deep) into each individual platform/device's OS configuration. It's "best" to do it that way because the buffer must be contiguous in physical memory to be DMA-able.
So the only remaining question would be how to retrieve that Dram memory pointer?
Alexander · 23 Jul 2003, 20:55 UTC — Well...
How odd. My friend simply copied Microsoft Reader straight from my ROM to his SD card, on my e330.
A tool that could be useful to extract some files from the updates : http://www.xs4all.nl/~itsme/projects/xd ... ayout.html