9.172 PUT_REGISTRY_VALUE

Note: Built-In Function Rules     Usage Options

Processing

Adds/updates the value for the specified Registry Key.

When the length of an Argument is stated as being greater than 50, this is only true for Fields. Literal values are restricted to a maximum length of 50. This is especially true for the first four arguments in this BIF. All these arguments are limited to a length of 50 unless a field is used.

Arguments

No.

Type

Req/ Opt

Description

Min Len

Max Len

Min Dec

Max Dec

1

A

R

Registry Root

For example: HKEY_CLASSES_ROOT,
HKEY_LOCAL_MACHINE

1

256

 

 

2

u

R

Registry Path

For example:
WinZip\shell\open\command

1

256

 

 

3

u

R

Registry Key Name

1

256

 

 

4

X

R

Registry Key Value:
Refer to Registry Key Value Note for details.

1

Unlimited

 

Unlimited

5

A

O

Value Type:
S – String
B – Binary
D – DWORD
X – Expanded String which can contain environment variables.
Refer to Supported & Default Key Types for further information.

Default Value – S

1

1

0

 

6

A

O

Create key:
Y – If registry does not exist, create one.
N – No key to be created.
Default – N.

1

1

 

 

7

N

O

Registry Hive to use: 32 or 64
Any other value will use the default for the application. That is, a 32 bit application will write to wow6432 while a 64 bit application will write to wow6464.

This argument is ignored on a 32 bit operating system.

1

4

0

0

 

Return Values

No.

Type

Req/ Opt

Description

Min Len

Max Len

Min Dec

Max Dec

1

A

R

Return Code

OK – Key added / updated
ER – Key could not be added / updated

2

2

 

 

 

Registry Key Value Note

If the S type is used to save a field value (except Binary or VarBinary ), the string representation of the field will be saved in the Registry.

If the B type is used to save an Alpha, Char or String field, it is presumed that the field value is a hexadecimal string and it will be converted into its actual value. Any byte in the Alpha, Char or String field must be a 1,2,3,4,5,6,7,8,9,A,B,C,D,E or F character. If a non Hexadecimal character is encountered, it will be replaced with '0' (zero).

If the D type is used to save an Alpha, Char or String field value, it is presumed that the field value is a decimal string representation of a value and it will be converted into that actual value.

The Supported & Default Key Types table shows how the key type is defined by default and also the supported key types for each field type. The default is applied when the 5th argument is not specified. It is strongly recommended that you use the default.

If a non-supported key type is used, a fatal error with the message: "Using non-supported key type" will occur.

Supported & Default Key Types

Field Type

Key Type by Default

Supported Key Type

Alpha, Char and String

S

S, B, D, X

CLOB, BLOB, Time,
Date, DateTime,
Packed, Signed, Float
Boolean and Integer

S

S, X

Less than 8 bytes Integer

S

S, D, X

Binary
VarBinary.

B

B