Please Log In or Register - it's FREE!

 
Reply to this topicStart new topic
 Creating CAB files for a MS Smartphone
Richie M
post Oct 20 2003, 21:25
Post #1


Hardcore
Group Icon

Group: Posters
Posts: 2,081
Joined: 29th November 2002
From: Stoke on Trent, England
Member No.: 294



Make a Homescreen installation CAB walk through

Firstly, and the most important, to create a CAB for the Smartphone you need a package called CABWizSP (note the SP the normal CABWiz will not create compatible CAB files!). Unfortunatley you are unable to download this seperately but it comes as part of the Windows Smartphone 2002 SDK. So the first thing to do is to download the SDK from Microsoft and install it on to your PC smile.gif

For the benefit of this tutorial we are only interested in the Tools folder of the SDK as it contains CABWizSP wink.gif
For ease create a folder C:CABWizSP and copy CabwizSP.exe and Cabwiz.ddf from C:Windows CE Toolswce300Smartphone 2002tools

Now we are ready to create our INF file smile.gif which basically tells CABWizSP what files etc we are packaging and where/what to do with them.
(for an example I'll be using a cutdown version of the inf file i used to create the Reload homescreens)
In the CABWizSP folder we created make a new text file and rename it to a .inf (eg Reload.inf). Open the .inf in NotePad and enter the following
CODE
[Version]

Signature = $Windows NT$

Provider = Midnight Richie M

CESignature = "$Windows CE$"



[CEStrings]

AppName = Reloadhome



[CEDevice.ARM720]

ProcessorType  =  0

"Signature" and "CESignature" in the [Version] section must always be as written. "Provider" is used along with "AppName" to create the full application name which is shown on information screens and the Remove Program list.
I will return to the [CEStrings] section later as this is important for when you are creating CABS for program installations etc. Suffice to say tho, that for homescreen installation it only needs to contain the "Appname".
The [CEDevice.ARM720] section should be as written.

Now we'll finish our INF
CODE
[DefaultInstall]

Copyfiles = InstallDir1,InstallDir2,InstallDir3

AddReg = RegSettings.All



[SourceDisksNames]

1 = ,"SourceDir1",,C:SPV Skinsreload1.3

2 = ,"SourceDir2",,C:SPV Skinsreload1.3Reload

3 = ,"SourceDir3",,C:SPV Skinsreload1.3reload_wmp



[SourceDisksFiles]

Reload.home.xml = 1

volume.gif = 2

wmplayer.skn = 3



[DestinationDirs]

InstallDir1 = 0,%CE19%Home

InstallDir2 = 0,%CE1%Reload

InstallDir3 = 0,%CE19%HomeReload



[InstallDir1]

Reload.home.xml,Reload.home.xml



[InstallDir2]

volume.gif,volume.gif



[InstallDir3]

wmplayer.skn,wmplayer.skn



[RegSettings.All]

HKCU,ControlPanelHome,Scheme,0x00000000,IPSMApplication DataHomeReload.home.xml

HKCU,ControlPanelHome,BgImage,0x00000000,""

HKCU,ControlPanelHome,ColorScheme,0x00000000,""

The Copyfiles key, under the [DefaultInstall] section, is required and describes the default files to copy to the target device (which is refernced by a name eg InstallDir1, made up of a destination directory and a copy file list).

The AddReg key, under the [DefaultInstall] section, points to the section name that describes the keys and values that the .cab file adds to the device registry.

The [SourceDisksNames] section is required and describes the name and path of the disk on which your application resides, and follows the syntax disk_id= ,comment,,path

The [SourceDisksFiles] section is required and refers the source file name to the appropriate disk_id given in [SourceDisksNames]

The [DestinationDirs] section is required and describes the names and paths of the destination directories for your application on the target device. The syntax is; file_list_section_name = 0,destination_dir
The 0, must be written as is, in the above example you will notice that in the destion_dir are things like %CE1% these are directory identifier shortcuts (see further down for a full listing). The main one you will use for a Homescreen CAB is %CE19% which points to IPSMApplication Data
Therefore in one example any files listed in the [InstallDir1] will be copied to IPSMApplication DataHome

[InstallDir1] [InstallDir2] and [InstallDir3] sections contain the file lists for the relevant destination directory, folowing the syntax of: local_file_name,destination_file_name (the local_file_name can be enclosed in double quotes ("local_file_name") but this appears to be optional).

The [RegSettings.All] section contains our registry changes (remember the AddReg entery in [DefaultInstall] section!), and follows the syntax of: registry_root_string , subkey,[value_name], flags, value
registry_root_string specifies the registry root location, for example HKCU is the same as saying HKEY_CURRENT_USER
subkey is self-explanitory, in our example ControlPanelHome is the subkey.
value_name is the registry keys value name wink.gif for example Scheme.
flags specify the type of value you are writting (at this stage there is no need to concern our selves with these except the fact that 0x00000000 is for the REG_SZ registry data type).
Finally, value is of course the value you want the registry key to contain smile.gif "" will write nothing to the key!

And that is the basics for creating a homescreens INF file.

Now to create the CAB biggrin.gif

All being well you should have a folder C:CABWizSP with a copy CabwizSP.exe and Cabwiz.ddf in, along with our .inf file which points to the files kept in C:SPV Skins

Having checked your file paths in the inf we are now ready to run CABWizSP, all you have to do is in Windows Explorer drag the .inf onto Cabwizsp.exe smile.gif and this will automatically create .CAB

All you have to do now is copy the CAB to the phone and run it tongue.gif
(Microsoft say that you should run CabwizSP from a command line prompt and rename the CAB to name.hme but there is really no need to do this)

Congratulations, you have created a simplish homescreen CAB file =D>


Now to get a bit more complex

You can make some very complex CAB files, for instance ones that install different files depending on the processor :shock: but i'm not going to go into things like tongue.gif

Instead, the folowing is an example of more things you can do in your INF file so you can install programs etc, and i will explain additional options and/or sections.

The most frequent question has got to be "How do i get the phone to ask if the program should be installed to the phone or storage card?"
To do this is really quite simple, all you have to do add InstallDir in the CEStrings section smile.gif so for example:
CODE
[CEStrings]

AppName="Game Pack"

InstallDir=%CE1%%AppName%

Ah I've sneaked in some new syntax wink.gif this is quite nice as you it shows you, how to refer to CEStrings in other section.
%AppName% will get replaced with Game Pack in this example. Therefore InstallDir actually is Program FilesGame Pack
So following this syntax you can refer to %InstallDir% biggrin.gif
CODE
[DestinationDirs]

CopyToWindows    = 0, %InstallDir%

For example, if the %InstallDir% variable is set to MyApp in the .inf file, and the user selects the Storage Card, the installation location will be Storage CardMyApp. This also applies to %CE% variables, if %InstallDir% is set to %CE1%MyApp, and the user selects the storage card as they did previously. The resulting location will be Storage CardProgram FilesMyApp.

The following table shows each CE directory identifier and the resulting directories on Smartphone 2002
CODE
Directory  Smartphone 2002 Directory

Identifier

%CE1%      Program Files

%CE2%      Windows

%CE4%      WindowsStartUp

%CE5%      My Documents

%CE11%     WindowsStart MenuPrograms

%CE14%     WindowsStart MenuProgramsGames

%CE17%     WindowsStart Menu

%CE18%    <default volume, such as IPSM, dependent on device configuration>

%CE19%     Application Data


Adding Program Shortcuts

You can only add a shortcut on to the phone for a program that is installed within the same CAB file!
The CEShortcuts key, a Windows CE–specific key under the [DefaultInstall] section, is optional and describes the shortcuts that the installation application creates on the device.

The following code example shows a typical [CEShortcuts] section.

CODE
[DefaultInstall]

CEShortcuts = Shortcuts



[DestinationDirs]

Shortcuts = 0,%CE14%             ;WindowsStart MenuProgramsGames



[Shortcuts]

Sample App,0,sample.exe             ; Uses the path in DestinationDirs.

Sample App,0,sample.exe,%InstallDir%; The path is explicitly specified.

The shortcuts are defined as shortcut_filename,shortcut_type_flag,target_file[,standard_destination_path]

shortcut_filename is the name of the shortcut :roll:
shortcut_type_flag is a number where, zero or empty represents a shortcut to a file; any nonzero numeric value represents a shortcut to a folder.
target_file :roll: obvious
[,standard_destination_path] is the optional part where you can define the destination directory for the shortcut (see the above example)


Writting the registry revisted
and an introduction to strings

I have already told you how to add registry keys and values, and explained about CEStrings so before we get any further it will be beneficial to introduce you to Strings.
The [Strings] section is optional and defines one or more string keys. A string key consists of letters, digits, or other printable characters. Enclose value in double quotation marks ““ ””if the corresponding string key is used in an item that requires double quotation marks.
The following code example shows a typical [Strings] section.
CODE
[Strings]

reg_path = SoftwareMicrosoftMy Test App

This can then be used as follows
CODE
[RegSettings]

HKLM,%reg_path%,test,0x00010001,3       ; Test = 3

HKLM,%reg_path%new,another,0x00010001,6  ; Newanother = 6

As previously mentioned; The [RegSettings.All] section contains our registry changes, and follows the syntax of:
registry_root_string , subkey,[value_name], flags, value
registry_root_string specifies the registry root location, for example HKCU is the same as saying HKEY_CURRENT_USER

The following shows the values that are supported
CODE
HKCR The same as HKEY_CLASSES_ROOT

HKCU The same as HKEY_CURRENT_USER

HKLM The same as HKEY_LOCAL_MACHINE


flags specify the type of value you are writting, The following shows the values that are supported
CODE
0x00000002 If the registry key exists, do not overwrite it. This flag can be used in combination with any of the other flags in this table.

0x00000000 The REG_SZ registry data type.

0x00010000 The REG_MULTI_SZ registry data type. The value field that follows can be a list of strings separated by commas.

0x00000001 The REG_BINARY registry data type. The value field that follows must be a list of numeric values separated by commas, one byte per field, and must not use the 0x hexadecimal prefix.

0x00010001 The REG_DWORD data type.  


--------------------
Go to the top of the page
 
+Quote Post
Scath De Solas
post Jul 25 2008, 21:40
Post #2


Newbie
Group Icon

Group: Posters
Posts: 22
Joined: 30th June 2008
Member No.: 403,004

Device(s): SHadow



Error: Section [SourceDisksNames] - path C:SPV Skinsreload1.3 not found


Won't work
Go to the top of the page
 
+Quote Post
angelinalove
post Jul 26 2008, 11:20
Post #3


Newbie
Group Icon

Group: Posters
Posts: 27
Joined: 25th June 2008
Member No.: 401,506



thanks for your help but just let me know actually what is the use of CAB.What will be benefit of it.


--------------------
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

Similar Topics

  Topic Replies Topic Starter Views Last Action
No new Topic has attachmentsBest radio/phone ROM for i900 at the moment?
278 cyberarmy 57,402 Today, 10:00
Last post by: mide74
No New Posts WM 6.5 for Blackjack II
Cooked or legitimate 6.5 ROM for i617
8 pmenadue 9,946 Today, 03:04
Last post by: H.Flores
No new Topic has attachmentsB7300 Omnia Lite applications for i900/i910
Upd.15/10 - OnlineWdgts,DataMngr, SSKeybfix. Apps ported for Omnias :)
794 sector 250,921 Yesterday, 23:44
Last post by: leap_ahead
No New Posts Alarm only goes of for 20 secoonds
10 sharkextreme 326 Today, 06:48
Last post by: mustafa2010
No new Topic has attachmentsHTC Comm Manager for the Sense ROMs
Includes WIFI sharing
20 Dork6243 481 Today, 00:08
Last post by: Dork6243
No New Posts Topic has attachmentsAdapting Menu Bar for WM6.5.x (AMeBa)
Another small App to kill Programs & more ( X/Close-Button )
2 Krazy Radd 190 Yesterday, 23:43
Last post by: leap_ahead

2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 


RSS hit counter Lo-Fi Version Time is now: 1st August 2010 - 10:26

Please visit our 'Plus Partners' - these companies support MoDaCo through 'MoDaCo Plus' - Click Here for more details!

ActiveKitten | Binaryfish | Conduits | DeveloperOne | eSoft Interactive | FTouchSL | Inesoft | LastPass

Lingvosoft | monocube | OmegaOne | Omnisoft | Opera Software | Resco | SBSH | Splashdata

Sprite Software | Syncdata | Teksoft | Titanium Backup | VITO | WalkingHotSpot | WebIS | z4soft

Would your company like to become a 'Plus Partner'? Click Here to contact us!