您的位置:首页 > 其它

如何制作WinCE程序安装包(cab压缩包)

2012-01-17 13:25 831 查看
转自:http://blog.sina.com.cn/s/blog_49aef14b0100ef89.html~type=v5_one&label=rela_nextarticle
如何制作WinCE安装包
一、工具软件
要在Wince安装程序,则需要制作*.cab安装包。制作*.cab安装包,需要专门的制作工具软件,该软件需在同级目录下包含如下文件:
Cabwiz.exe 、cabwiz.ddf、ezsetup.exe 、makecab.exe

二、制作安装过程
第一步:先制作.inf文件
要制作.cab安装包,你只要写一个.inf文件,cabwiz.exe会根据你的这个INF文件来生成*.CAB文件。

第二步:使用cabwiz.exe制作应用程序CAB包
在Dos命令行下输入下列命令:
cabwiz 你的Inf文件名 /err log.txt /cpu ARM
生成*.ARM.CAB表示成功,如果失败请查看Log.txt文件。

第三步:将*.ARM.CAB拷贝到Setup目录当中去,修改目录中的Setup.ini文件
CabFiles = example.ARM.CAB 将example.ARM.CAB替换成*.ARM.CAB

第四步:连接手机通过USB连接PC,运行*.ARM.CAB文件

二、制作INF文件说明
第一个字段[Version]
中Provider大家可以随便改,其他两个参数就不要去碰了。
第二个字段[CEStings]
CompanyName="宇龙通信科技有限公司"
AppName=移动办公
InstallDir=\UserData\myoa
说明:
CompanyName是公司名字,可以任意修改。
AppName是应用程序名字,可以任意修改。
InstallDir是应用程序安装的Wince终端的路径,可以任意修改。
第三个字段[CEDevice]
CEDevice字段是程序所对应的设备平台,这个大家就不用去管它了。
第四个字段[SourceDisksNames]
是指定源文件程序所在的磁盘路径。
1=,"cab",,"D:\oasourcedir\programe\"
可以修改"D:\oasourcedir\programe\"来指定源文件所在路径,也就是要制作安装盘的*.exe等文件路径,其它的都不要修改了。
第五个字段[SourceDisksFiles]
就是大家要打包的源文件清单,后面的=1就表示文件的路径,也就是[SourceDisksNames]中的1。
oa.exe=1
readme.txt=1
my.jpg=1
有多少个要打包的源文件都可以把名字加上即可,格式为:文件名.文件类型 = 1
第六个字段[DefaultInstall]
CEShortcuts=CEShortcuts1,CEShortcuts2,CEShortcuts3,CEShortcuts4
CopyFiles=Files.Common
AddReg=RegData

就是安装程序到手机中时:
CopyFiles参数表示安装时如何解压拷贝文件,AddReg参数表示安装时如何修改注册表。CEShortcuts参数表示如何在Wince桌面创建快捷方式。

CopyFiles=后面跟着是字段名字,即你所要做的拷贝工作到底有哪些。AddReg=作用一样。
例如在范本中,CopyFiles=Files.Common就是告诉cabwiz.exe要做一个拷贝文件工作,
需把一些文件拷贝到安装指定目录文件夹下,要拷贝的文件在[Files.Common]字段中。

而AddReg=RegData表示安装程序还要修改注册表,修改的东西在[RegData]字段中。

第七个字段[Files.Common]
就是安装拷贝文件到手机中,目标安装时需要拷贝哪些文件,应该与[SourceDisksFiles]中的文件名字一致。
oa.exe,oa.exe,,0
readme.txt,readme.txt,,0
my.jpg,my.jpg,,0

下一个字段[Shortcuts]
关于应用程序桌面快捷方式设置:

Sample App,0,sample.exe

Sample App,0,sample.exe,%InstallDir%

字段语法说明一下,四个域,域之间用逗号隔开,前三个域的内容必须填写。
第一个域是快捷键名称,也就是在Wince桌面快捷方式名称。
第二个域中0表示是文件,其他任何非零数表示为目录,
第三个域就是快捷键的目标程序(目录),
第四个域是可选域,是安放快捷键的目录,默认目录就是[DestinationDirs]中Shortcuts = "",你可以指定其他目录,如你想在开始菜单中加入自己的快捷键的话就在这里写上storage\windows\startmenu\。
下面是范例:
移动OA,0,oa.exe,UserData\myoa
最后一个字段[RegData]
就是安装程序到手机步骤中时,修改注册表。
第一个“,”之前表示注册表中的四大块的名字,直接用缩写就可以了,如范本中HKLM就代表HKEY_LOCAL_MACHINE,其他三个分别为HKCR,HKCU和HKU。

第二个“,”之前表示你要修改的键的具体路径(如果没有会自动建立),即完整的项(key)名称,

第三个“,”之前就表示你要具体修改的键(就是我们经常在修改注册表的文章中看到的Value Name),如果没有的话程序就会自动建立,

第四个“,”之前表示值类型,目前我只懂得整数是0x00010001(见补充2),字符型数据这里你就不要填了,留着个“,”就可以了。最后就是你要填入的Value。

在范例中
HKLM,SOFTWARE\Microsoft\Shell\Rai\:CallAlert,BKBitmapFile,,"\Storage\Application Data\Home\iMac\call1.jpg"
表示修改(建立)名为BKBitmapFile的键的值,它在HKLM\SOFTWARE\Microsoft\Shell\Rai\:CallAlert下,值内容为\Storage\Application Data\Home\iMac\call1.jpg,很明显,这是一个值为String类型的键。

一个INF范例文件:

[Version]

Signature="$ Windows NT$ "

Provider=yulong

CESignature="$ Windows CE$ "
[CEStrings]

CompanyName="huwei通信科技有限公司"

AppName=移动办公

InstallDir=\UserData\myoa
[CEDevice]

VersionMin=5.00

VersionMax=5.00
[SourceDisksNames]

1=,"cab",,"D:\oasourcedir\programe\"
[SourceDisksFiles]

oa.exe=1

readme.txt=1

my.jpg=1
[DefaultInstall]

CEShortcuts=CEShortcuts1,CEShortcuts2,CEShortcuts3,CEShortcuts4

CopyFiles=Files.Common

AddReg=RegData
[DestinationDirs]

Files.Common=0,%InstallDir%

CEShortcuts1=0,windows\propertypage\others

CEShortcuts2=0,dbdata\sysconfig\propertypage\others

CEShortcuts3=0,windows\propertypage\links

CEShortcuts4=0,dbdata\sysconfig\propertypage\links
[Files.Common]

oa.exe,oa.exe,,0

readme.txt,readme.txt,,0

my.jpg,my.jpg,,0
[CEShortcuts1]

移动OA,0,oa.exe,UserData\myoa
[CEShortcuts2]

移动OA,0,oa.exe,UserData\myoa
[CEShortcuts3]

移动OA,0,oa.exe,UserData\myoa
[CEShortcuts4]

移动OA,0,oa.exe,UserData\myoa
[RegData]

HKLM,SOFTWARE\Microsoft\Shell\Rai\:CallAlert,BKBitmapFile,,"\Storage\Application Data\Home\iMac\call1.jpg"
------------------------------------------------------------------------------------------------------------------------
最后补充一点,就是dll文件的添加(在DefaultInstall节中加入)
DefaultInstall

The [DefaultInstall] section is required and describes the default installation of your application.

[DefaultInstall]

Copyfiles=copyfile_list_section[,copyfile_list_section]

AddReg=add_registry_section[,add_registry_section]

[CEShortcuts=shortcut_list_section[,shortcut_list_section]] ; new key

[CESetupDLL=setup_DLL] ; new key

[CESelfRegister=self_reg_DLL_filename[,self_reg_DLL_filename] ; new key

shortcut_list_section

String that identifies one more section that defines shortcuts to a file, as defined in the [CEShortcuts] section.

setup_DLL

Optimal string that specifies a Setup.dll. It is written by the independent software vendor (ISV) and contains customized functions for operations during installation and removal of the application. The file
must be specified in the [SourceDisksFiles] section.

self_reg_DLL_filename

String that identifies files that self-register by exporting the
DllRegisterServer and DllUnregisterServer Component Object Model (COM) functions. You must specify the files in the [SourceDiskFiles] section.

During installation, if installation on the device fails to call the file's exported
DllRegisterServer function, the file's exported DllUnregisterServer function will not be called during removal.

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

[DefaultInstall]

AddReg = RegSettings.All

CEShortcuts = Shortcuts.All

————————————————————————————————————————————————

我做的例子(其中有dll文件的添加):

[Version]

Signature = "$Windows NT$"

Provider = "FengShuJun"

CESignature = "$Windows CE$"

[CEStrings]

CompanyName="MZSH"

AppName = "MyListFile"

InstallDir=%CE2%\MyFileList

[CEDevice]

[DefaultInstall]

CopyFiles = Application

AddReg=RegData

CEShortcuts = Shortcuts

CESetupDLL = SETUPDLL.dll

[SourceDisksNames]

1= ,"exe",,.

2= ,"png",,.

3= ,"dll",,.

[SourceDisksFiles]

MyListFile.exe =1

ico.png =2

SETUPDLL.dll =3

[DestinationDirs]

Application = 0,%InstallDir%

Shortcuts = 0,%CE5%

[Application]

"MyListFile.exe" ,,,0x00000001

"ico.png" ,,,0x00000001

[RegData]

HKLM,SOFTWARE\Meizu\MiniOneShell\Main\MyListFile,DisplayName,,"MyListFile"

HKLM,SOFTWARE\Meizu\MiniOneShell\Main\MyListFile,ExecFileName,,"%CE2%\\MyFileList\\MyListFile.exe"

HKLM,SOFTWARE\Meizu\MiniOneShell\Main\MyListFile,ProgramID,,"{9DADA145-E5DC-4edd-9998-1A4C5B414800}"

HKLM,SOFTWARE\Meizu\MiniOneShell\Main\MyListFile,DefaultIcon,,"%CE2%\\MyFileList\\ico.png"

HKLM,SOFTWARE\Meizu\MiniOneShell\Main\MyListFile,Order,,"dword:3"

HKLM,SOFTWARE\Meizu\MiniOneShell\Main\MyListFile,Page,,"dword:3"

[Shortcuts]

%AppName%,0,MyListFile.exe ,%CE17%
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: