InstallSheild技术-->Accessing or Setting Windows Installer Properties

在Basic MSI 和InstallScript MSI工程中,推迟,提交,回滚的自定义操作(Custom Actions)只能访问有限的几个windows安装属性:CustomActionData, ProductCode, 和UserSID。
如果你想在推迟/提交/回滚的自定义操作中,访问一些其他的windows属性,可以将需要访问的属性传递给CustomActionData,然后获取CustomActionData的值。

下面是一个在推迟自定义操作中,访问windows安装属性SUPPORTDIR的例子:

1. 在Custom Actions and Sequences中创建一个set-a-property的自定义操作叫GetSUPPORTDIR。如下设置这个自定义操作,
? Property Name: DisplaySupportDir
? Property Value: [SUPPORTDIR]

? Install Exec Sequence: After InstallInitialize


2. 在InstallScript中,创建一个新的函数叫DisplaySupportDir


3. 添加下面代码可以显示SUPPORTDIR的值。
function DisplaySupportDir(hMSI)
STRING supportDirPath;
NUMBER supportDirPathBuffer;
begin
supportDirPathBuffer = MAX_PATH;
if(MsiGetProperty(hMSI, "CustomActionData", supportDirPath, supportDirPathBuffer) == ERROR_SUCCESS) then
SprintfBox(INFORMATION,"Deferred Execution","The value of SUPPORTDIR is %s",supportDirPath);
SprintfBox(INFORMATION,"Deferred Execution","The value of InstallScript‘s SUPPORTDIR is %s",SUPPORTDIR);
endif;

end;


4. 在Custom Actions and Sequences中创建一个InstallScript的自定义操作叫DisplaySupportDir。如下设置这个自定义操作,

? Function Name: DisplaySupportDir
? In-Script Execution: Deferred Execution in System Context

? Install Exec Sequence: After GetSUPPORTDIR


P.S翻译来自InstallSheild2008的help资料

InstallSheild技术-->Accessing or Setting Windows Installer Properties,布布扣,bubuko.com

InstallSheild技术-->Accessing or Setting Windows Installer Properties

上一篇:H3C VLAN-access+路由


下一篇:进程的概念,系统资源分配的单元