HOWTO:InstallShield如何往注册表中写二进制数据(REGDB_BINARY)

版权声明: 可以任意转载,转载时请务必以超链接形式标明文章原始出处和作者信息。

下面是一个简单的示例代码,实现将二进制数据写入注册表: 

function OnBegin()
NUMBER
nRootKey, nType, nSize;
STRING szKey,szNumName, svHex[8];
begin
nRootKey = HKEY_LOCAL_MACHINE;
RegDBSetDefaultRoot
( nRootKey );


// Set up parameters for call to RegDBSetKeyValueEx.
szKey = "SOFTWARE\\Kevin Wan";
szNumName = "BinaryValue";

svHex[0] = 0x47;
svHex[1] = 0x65;
svHex[2] = 0x6D;
svHex[3] = 0x53;
svHex[4] = 0x41;
svHex[5] = 0x46;
svHex[6] = 0x45;
svHex[7] = 0x20;

nType = REGDB_BINARY;
nSize = 8;

// Set a key name and a value associated with it.
if (RegDBSetKeyValueEx (szKey, szNumName, nType, svHex,
nSize) < 0) then
MessageBox
("RegDBSetKeyValueEx failed.", SEVERE);
abort
;
endif
;
end;
原文地址:https://www.cnblogs.com/wanbinghong/p/1822506.html