Introducing XDA:DevCon – A Conference For Developers By Developers
XDA Developers Android and Mobile Development Forum
Forgot your password?
 
Post Reply+
Tip us?
 
nick.sturrock
Old
#1  
Junior Member - OP
Thanks Meter 0
Posts: 6
Join Date: Mar 2003
Location: London
Default Copying files out of ROM

Does anyone have or know of a utility for copying files out of ROM on the PocketPC so that I can look at them on my desktop? I know that the Grundle File Explorer utility can do this but I don't want to have to buy a copy when I'll probably only ever do this once.

If not, does anyone know of a utility to do a symbol-dump on an in-ROM file on the PPC? I just want to see what the full list of functions in the ccoreutl.dll library is, and it's not documented anywhere that I can find.

thanks,

nick.
 
itsme
Old
#2  
Developer / Recognized Developer
Thanks Meter 2
Posts: 652
Join Date: Mar 2003
Location: delft 52'00N 4'22E
all grundle file explorer allows you to do is filter the directory listing
to only display rom-files.
UnKnOwN Old
#3  
Guest
Thanks Meter
Posts: n/a
Since the Files in ROM are speparated into parts (data sections, code sections, etc) they don't exist like on a normal file system. The splitting of the files is done for "XIP" (execute in place). Whenever you "launch" an executable or load a library only the "data sections" will be "copied" into RAM (each process will have it's own data section). The code sections will remain in ROM and executed there (so there is no RAM usage for ROM code).

If you wan't to copy files out of ROM you have to assemble the files back (first all code sections of all files are sotred in ROM and then all data sections will be stored compressed). Unfortunately there is no complete documentation of the ROM filesystem (it seems it's a kind of Object Store). So even you dump the ROM content (something like VirtualMem.... will do it) you will not be able to extract complete files.

UnKnOwN
 
itsme
Old
#4  
Developer / Recognized Developer
Thanks Meter 2
Posts: 652
Join Date: Mar 2003
Location: delft 52'00N 4'22E
here is microsoft's description of XIP
http://msdn.microsoft.com/library/de...ymgmtwince.asp

and this (winceemul41.exe )
http://www.microsoft.com/downloads/d...DisplayLang=en

contains most (if not all) of the source code to the wince.net kernel.
WINCE410\PUBLIC\COMMON\OAK\INC\romldr.h
contains definitions of all structures related to the rom-filesystem,

WINCE410\PRIVATE\WINCEOS\COREOS\NK\KERNEL
has files like 'loader.c' and 'resource.c' which show how the kernel
handles them.
...

I think these files should contain enough information to write a tool
to extract the files.

And I think the wince.Net code is quite similar to how it works
in wince.300 ( the interesting header files for
wince300 are not publicly available, but are in the
wince-platformbuilder)
 
W4XY
Old
#5  
Senior Member
Thanks Meter 0
Posts: 137
Join Date: Jan 2003
Location: Earth... I think
Default tool in progress

Quote:
Originally Posted by XDA developer Itsme

I think these files should contain enough information to write a tool
to extract the files.

And I think the wince.Net code is quite similar to how it works
in wince.300 ( the interesting header files for
wince300 are not publicly available, but are in the
wince-platformbuilder)
Actually I'm working on such a tool. It is about 50% done. I can currently extract most sections per file of all files from a ROM image file. I'm not sure if it is possible to recreate executables and dll's such that they function normally. But it should be fine to create definition files for DLL's and such. Also for reverse engineering it should be fine. Current problem I ran into is that I do not have public source for the compression used in PocketPC to compress data sections in the ROM.
W4XY
UnKnOwN Old
#6  
Guest
Thanks Meter
Posts: n/a
Not sure but it looks like a simple LZSS compression

UnKnOwN
 
W4XY
Old
#7  
Senior Member
Thanks Meter 0
Posts: 137
Join Date: Jan 2003
Location: Earth... I think
Quote:
Originally Posted by UnKnOwN
Not sure but it looks like a simple LZSS compression

UnKnOwN
I thought it might be called LZX, but I'm not much of a compression guru. I did find an open source cab-extractor that implements LZX and I could try that, but haven't gotten to it yet. Another option is to extract the binary code from the emulator and use that, but I find that that is getting messy.
W4XY
UnKnOwN Old
#8  
Guest
Thanks Meter
Posts: n/a
Just found something interesting in

WINCE410\PRIVATE\WINCEOS\COREOS\NK\KERNEL\compr2.c

WINCE provides two different functions to the KERNEL (binary and string (de)compression).

They both use the buildin CECompress() / CEDecompress() functions...

UnKnOwN
UnKnOwN Old
#9  
Guest
Thanks Meter
Posts: n/a
OK, I thought CECompress/CEDecompress are available but...

so I post some details here now :twisted:

in coredll.dll there are four functions:

StringCompress, StringDecompress, BinaryCompress, BinaryDecompress

You can use them via GetProcAddress( hCoreDLL, TEXT("BinaryDecompress") );

Here are some function headers and defines for you:

#define CECOMPRESS_ALLZEROS 0
#define CECOMPRESS_FAILED 0xffffffffUL
#define CEDECOMPRESS_FAILED 0xffffffffUL

DWORD StringCompress( LPBYTE bufin, DWORD lenin, LPBYTE bufout, DWORD lenout );

DWORD StringDecompress( LPBYTE bufin, DWORD lenin, LPBYTE bufout, DWORD lenout );

DWORD BinaryCompress( LPBYTE bufin, DWORD lenin, LPBYTE bufout, DWORD lenout );

DWORD BinaryDecompress( LPBYTE bufin, DWORD lenin, LPBYTE bufout, DWORD lenout, DWORD skip );

The return value is the number of bytes written to the output buffer or one of the three defines.

UnKnOwN
 
W4XY
Old
#10  
Senior Member
Thanks Meter 0
Posts: 137
Join Date: Jan 2003
Location: Earth... I think
Default compress functions

The compress functions are the ones I was talking about getting out of the emulator code. Another options is to use a pocketpc application to copy the rom images out. The source code of the compression functions is not available, not even in the source code that M$ made available of the private wince parts.
W4XY

 
Post Reply+
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Go to top of page...

XDA PORTAL POSTS

XDA University: Porting ClockworkMod Recovery to New Devices

Having a good recovery makes the process of modifying, tweaking, maintaining, … more

One Stop Guide Shop for the Newbie and Dev

It’s been well established that XDA-Developers isthedestination for resources relating to … more

What Happened at Google I/O 2013 – XDA Developer TV

Unless you just emerged from a deep, dark, dank cavern under the Earth, you know … more

Forums Added for the LG Optimus G Pro and Sony Xperia Tablet Z

Not too long ago, we talked about how Sony was continuing its AOSP efforts on … more