Jump to content

Creating CAB files for a MS Smartphone


Guest Richie M

Recommended Posts

Guest Richie M

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 :)

For the benefit of this tutorial we are only interested in the Tools folder of the SDK as it contains CABWizSP :lol:

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 :( 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

[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
[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 :D 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 :D "" will write nothing to the key! And that is the basics for creating a homescreens INF file. Now to create the CAB :D 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 :lol: and this will automatically create .CAB All you have to do now is copy the CAB to the phone and run it :D (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 :D 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 :lol: so for example:
[CEStrings]


AppName="Game Pack"


InstallDir=%CE1%%AppName%
Ah I've sneaked in some new syntax :D 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% :D
[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
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.
[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.
[Strings]


reg_path = SoftwareMicrosoftMy Test App
This can then be used as follows
[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
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
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.  

Link to comment
Share on other sites

  • 4 years later...

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.