Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Change Binary Restry value


3 replies to this topic

Stefan Pauwels

Stefan Pauwels
  • Members
  • 4 posts

Posted 10 October 2002 - 09:41

How can I change a binary value in the registry?
Using Installshield function is very difficut to me.

Can someone please help me?

Thanks

EberhardH

EberhardH
  • Members
  • 137 posts

Posted 11 October 2002 - 10:32

Hi Stefan,

it is most important to put the hexadecimal values (bytes) in ascending order into a string array (don't forget: the very first index is 0)! This is a bit annoying if your binary values to set are of a rather long size. The registry entry has to exist prior to writing the bytes into the registry.

As an example with writing 3 bytes, try this:

Code Sample
STRING szKey, szName, szStrArray;
NUMBER nType, nSize, nRet;

RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE); //or wherever
szKey = "SOFTWARE\\MyTestKey";
szName = "MyEntry";
nType = REGDB_BINARY;
nSize = 3;
szStrArray[0] = 0xAF;
szStrArray[1] = 0xC3;
szStrArray[2] = 0x00;
//entry must exist, otherwise create it before with
//RegDBCreateKeyEx(szKey, szName);
nRet = RegDBSetKeyValueEx(szKey, szName, nType, szStrArray, nSize);
//... etc


Eberhard

EberhardH

EberhardH
  • Members
  • 137 posts

Posted 11 October 2002 - 10:35

Hi Stefan,

it is most important to put the hexadecimal values (bytes) in ascending order into a string array (don't forget: the very first index is 0)! This is a bit annoying if your binary values to set are of a rather long size. The registry entry has to exist prior to writing the bytes into the registry.

As an example with writing 3 bytes, try this:

Code Sample
STRING szKey, szName, szStrArray;
NUMBER nType, nSize, nRet;

RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE); //or wherever
szKey = "SOFTWARE\\MyTestKey";
szName = "MyEntry";
nType = REGDB_BINARY;
nSize = 3;
szStrArray[0] = 0xAF;
szStrArray[1] = 0xC3;
szStrArray[2] = 0x00;
//entry must exist, otherwise create it before with
//RegDBCreateKeyEx(szKey, szName);
nRet = RegDBSetKeyValueEx(szKey, szName, nType, szStrArray, nSize);
//... etc


Eberhard

Stefan Pauwels

Stefan Pauwels
  • Members
  • 4 posts

Posted 11 October 2002 - 10:41

Hi,

Thanks for your help. :)