如何使用Inno Setup将HEX-Data添加到注册表中?

时间:2015-05-04 15:24:42

标签: inno-setup

当我想将HEX-Data添加到注册表中时,我想知道我要写什么?!?!

我有

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\FOOBAR]
"Type"=dword:00000110
"ImagePath"=hex(2):43,00,3a,00,5c,00,73,00,64,00,69,00,62,00,61,00,73,00,65,00,\
 5c,00,64,00,62,00,6e,00,74,00,35,00,73,00,76,00,2e,00,65,00,78,00,65,00,00,\
 00

我希望通过我的Inno-Script将其添加到注册表中。

第一个值很容易......

Root: "HKLM"; Subkey: "SYSTEM\CurrentControlSet\Services\FOOBAR"; ValueType: dword; ValueName: "Type"; ValueData: "00000110"

但是六角部分是什么?我无法找到像HEX而不是DWORD的内容,这是否意味着如果我有这样的数据,我必须做一些转换?

我有第二个相似的值,但实际上它的接缝是不同的,因为有hex:...而不是hex(2):...

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Centura SQLBase\Security]
"Security"=hex:01,00,14,80,b8,00,00,00,c4,00,00,00,14,00,00,00,30,00,00,00,02,\
 00,1c,00,01,00,00,00,02,80,14,00,ff,01,0f,00,01,01,00,00,00,00,00,01,00,00,\
 00,00,02,00,88,00,06,00,00,00,00,00,14,00,fd,01,02,00,01,01,00,00,00,00,00,\
 05,12,00,00,00,00,00,18,00,ff,01,0f,00,01,02,00,00,00,00,00,05,20,00,00,00,\
 20,02,00,00,00,00,14,00,8d,01,02,00,01,01,00,00,00,00,00,05,04,00,00,00,00,\
 00,14,00,8d,01,02,00,01,01,00,00,00,00,00,05,06,00,00,00,00,00,14,00,00,01,\
 00,00,01,01,00,00,00,00,00,05,0b,00,00,00,00,00,18,00,ff,01,0f,00,01,02,00,\
 00,00,00,00,05,20,00,00,00,25,02,00,00,01,01,00,00,00,00,00,05,12,00,00,00,\
 01,01,00,00,00,00,00,05,12,00,00,00

1 个答案:

答案 0 :(得分:2)

hex条目映射到{。1}}值类型,REG_BINARY映射到* .reg文件中的hex(2)类型。以下是显示注册表数据类型映射(source)的* .reg文件条目的表:

REG_EXPAND_SZ

因此,您的问题中的导出表示以十六进制字节表示法的逗号分隔的┌─────────────┬────────────────┐ │ File entry │ Registry type │ ├─────────────┼────────────────┤ │ hex │ REG_BINARY │ ├─────────────┼────────────────┤ │ dword │ REG_DWORD │ ├─────────────┼────────────────┤ │ hex(2) │ REG_EXPAND_SZ │ ├─────────────┼────────────────┤ │ hex(7) │ REG_MULTI_SZ │ ├─────────────┼────────────────┤ │ none │ REG_SZ │ └─────────────┴────────────────┘ 类型数据系列,您可以将其写为REG_BINARY值类型条目,其中以十六进制表示的空格分隔字节序列符号。换句话说,您只需用该系列中的空格替换逗号(当然,删除binary换行符。)

我会稍微缩短你的例子,让我们把它作为输入:

\

这就是Inno Setup条目的编写方式:

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Centura SQLBase\Security]
"Security"=hex:01,00,14,80,b8,00,00