[Windows Mobile Development and Hacking General] baniaczek:
XDA - Merge CABs

[Sorry for my english]

Works OK on BlueAngel.

I have 18 CABs in \Extended_ROM. They occupies 11.468.528 bytes. They can be merged into single CAB. It's size is 9.284.964 bytes.

Requirements:

- perl on windows [it will not work on unix nor linux :( sorry]

- cabwiz from Micro$oft

- some basic knowledge if command line, perl and cabwiz

- thinking

- "WinCE CAB Manager" will be very usefull.

- CABs to merge

---------

How to?

---------

Create clean directory.

---------

Create subdirectory ( I'm using .\[SCRIPT] ) and put there files:

CAB_merge.pl

CeSetup.dll

CheckFile.exe

Setup.DLL

Setup.DLL, CeSetup.dll and CheckFile.exe you can extract from any CAB from the \Extended_ROM

---------

Extract your CABs. One CAB == one directory. Be careful with "WinCE CAB Manager" - you will probably get directory named "Customization Tools". Rename them.

The result should look this:

+--[SCRIPT]

+--Album_BlueAngelAKU26_Generic_WWE_RC20

| +--[INSTALLDIR]

| +--[START MENU]

| | \--[PROGRAMS]

| \--[WINDOWS]

+--Album_EnableStreaming

| +--Windows

| \--[INSTALLDIR]

+--BandSel_BAWWE_140921.sa

| +--Windows

| \--[INSTALLDIR]

etc.

Don't worry if you got subdirs like "Windows" and "[WINDOWS]". Doesn't matter.

Look at attached file example_Tree.txt. May be it can help.

---------

Look for directories named "Temp". Read corresponding ..\Windows\_MoveFileList.txt and move files to their original locations. For example: move Temp\_HTCCamera.dll into ..\Windows\_HTCCamera.dll. (!) Don't remove underlines from name.

---------

Try to find duplicates. Decide, which one is too old (look at the time stamps or file-version - rigt_click/properties/version). Don't delete the old one - simply rename and put '~' on the beginning of the name. For example ~Album.exe. Such files will be ignored. If you can't find duplicates - don't worry. CAB_merge.pl will show you.

---------

Find files, which are not needed. For example "WESTTEK Native Office

Viewers.ppt" or "WESTTEK-Product Info.pdf" from ClearVUE. Rename them - put ~'s on the beginning of the name.

---------

Look at *.LNK. They will be imported as shortcuts, not files. If you wish

to have LNK files - edit them. For example Abum.lnk containing string:

20#"\Windows\Album.exe"

put 999 instead of the number:

999#"\Windows\Album.exe"

You will have to modify LNK files, if target file does not exist within the CAB.

---------

Look for files CM_Entries.xml. If you dont have any CM_Entries.xml, skip this step. Probably the best version of CM_Entries.xml can be found in your XDA in the \windows directory. Rename all CM_Entries.xml to ~CM_Entries.xml - they will be ignored. Create directory .\My_CM_Entries\Windows and copy here

CM_Entries.xml from your device. Maybe wiki can help.

---------

Some rules:

Files:

[INSTALLDIR]\CeSetup.DLL

Setup.DLL

[WINDOWS]\CheckFile.exe

[WINDOWS]\Customize.lst

[WINDOWS]\_MoveFileList.txt

will be ignored.

Files:

~*.*

*.BAK

will be ignored.

Files

_*.*

will got destination \Temp and will be listed in [WINDOWS]\_MoveFileList.txt. CeSetup.DLL will move them into appropriate directories, even if they are in use or locked. You will have to reboot your XDA.

File

\Windows\Platformxxx.reg or

[WINDOWS]\Platformxxx.reg

will be imported

File

*.inf

Registry and shortcuts will be imported. Other sections - copyFiles, Version, CeDevice will be ignored

Files

*.lnk

will be imported if possible.

---------

Execute: perl [SCRIPT]\CAB_merge.pl.

If nothing fails - you will get BA.INF in the current directory. In some cases, you will get Customize.lst, Platformxxx.reg _MoveFileList.txt too.

Execute: Cabwiz BA.inf /err CabWizErr.txt /cpu arm

If nothing fails - you will get BA.arm.cab

Read file CabWizErr.txt - check all warnings.

Look at BA.arm.cab. Check everything.

If everything looks ok, copy BA.arm.cab into your device.

Reset the device.

Try to install BA.arm.cab

If you get any message, that fil cann't be copied - skip them, go back to your source files and rename file - add underline's at the beginning. Remake everything:

perl .\[SCRIPT]\CAB_merge.pl

Cabwiz BA.inf /err CabWizErr.txt /cpu arm

copy

restart

install

and so on.

If everything looks ok: modify CAB_merge.pl modify line

$main::cpFileFlag = 0x00000001;

to have

$main::cpFileFlag = 0x00000002;

and remake CAB:

perl .\[SCRIPT]\CAB_merge.pl

Cabwiz BA.inf /err CabWizErr.txt /cpu arm

Your CAB is ready. Replace source CABs from \Extended_ROM with reult of your effort. Remember to modify \Extended_ROM\config.txt.

Need customization? Look at the begining of CAB_merge.pl

Good luck.