Detailed Descriptions > MIAMEX > MIAMEX 138: Registry operations
Open

This call is needed to open up a branch of the Registry and returns a handle which can be used in subsequent opcodes.

xcall MIAMEX, MX_REGISTRY, REGOP_OPEN, hkey, subkey, rights, hkeynew, status

Parameters

hkey  (B,4)  [in]

can be a key returned in the hkeynew parameter from a previous open, or more likely, one of the following symbols (from ashell.def) for the main hives in the Registry:

Symbol

HKEY_CLASSES_ROOT

HKEY_CURRENT_USER

HKEY_LOCAL_MACHINE

HKEY_USERS

 

subkey  [in]

is a string combining one or more levels beneath the level referenced by the key hkey, for example:

SUBKEY = "SOFTWARE\MicroSabio\JBCT\ATE"

Note that subkey is not case sensitive on lookup, but when creating keys, the case specified will be retained. (Same idea as with Windows filenames.)

rights  [in]

is a numeric variable combining one or more of the following bits relating to the kind of rights you want to request for this key:

Symbol

Value

Description

RGKEY_QUERY_VALUE

&h0001

Ability to query a value

RGKEY_SET_VALUE

&h0002

Ability to change or set a value

RGKEY_CREATE_SUB_KEY

&h0004

Ability to create a new sub key

RGKEY_ENUM_SUB_KEYS

&h0008

Ability to enumerate sub keys

Hex-Decimal Values

 

hkeynew  (B,4)  [out]

will return the handle to the opened key, and will be needed for subsequent operations.

status  (F,6)  [out]

returns 0 for success, or else an error code. You can convert the error code to a message using:

xcall MIAMEX, MX_ERRNOMSG, status, msg