Latest available version: IDA and decompilers v8.4.240320sp1 see all releases
Hex-Rays logo State-of-the-art binary code analysis tools
email icon
registry.hpp File Reference

Registry related functions. More...

Macros

#define ROOT_KEY_NAME   "Software\\Hex-Rays\\IDA"
 Default key used to store IDA settings in registry (Windows version). More...
 

Enumerations

enum  regval_type_t { reg_unknown = 0 , reg_sz = 1 , reg_binary = 3 , reg_dword = 4 }
 Types of values stored in the registry. More...
 

Functions

idaman THREAD_SAFE bool ida_export reg_delete_subkey (const char *name)
 Delete a key from the registry.
 
idaman THREAD_SAFE bool ida_export reg_delete_tree (const char *name)
 Delete a subtree from the registry.
 
idaman THREAD_SAFE bool ida_export reg_delete (const char *name, const char *subkey=nullptr)
 Delete a value from the registry. More...
 
idaman THREAD_SAFE bool ida_export reg_subkey_exists (const char *name)
 Is there already a key with the given name?
 
idaman THREAD_SAFE bool ida_export reg_exists (const char *name, const char *subkey=nullptr)
 Is there already a value with the given name? More...
 
idaman THREAD_SAFE bool ida_export reg_subkey_children (qstrvec_t *out, const char *name, bool subkeys)
 Retrieve the child names of the given key. More...
 
idaman THREAD_SAFE bool ida_export reg_data_type (regval_type_t *out, const char *name, const char *subkey=nullptr)
 Get data type of a given value. More...
 
idaman THREAD_SAFE void ida_export reg_read_strlist (qstrvec_t *list, const char *subkey)
 Retrieve all string values associated with the given key. More...
 
idaman THREAD_SAFE void ida_export reg_update_strlist (const char *subkey, const char *add, size_t maxrecs, const char *rem=nullptr, bool ignorecase=false)
 Update list of strings associated with given key. More...
 
THREAD_SAFE void reg_write_binary (const char *name, const void *data, size_t datalen, const char *subkey=nullptr)
 Write binary data to the registry. More...
 
THREAD_SAFE void reg_write_binary (const char *name, const bytevec_t &data, const char *subkey=nullptr)
 Write binary data to the registry. More...
 
THREAD_SAFE bool reg_read_binary (const char *name, void *data, size_t datalen, const char *subkey=nullptr)
 Read binary data from the registry. More...
 
THREAD_SAFE bool reg_read_binary_part (const char *name, void *data, size_t datalen, const char *subkey=nullptr)
 Read a chunk of binary data from the registry. More...
 
THREAD_SAFE bool reg_read_binary (const char *name, bytevec_t *data, const char *subkey=nullptr)
 Read binary data from the registry. More...
 
THREAD_SAFE void reg_write_string (const char *name, const char *utf8, const char *subkey=nullptr)
 Write a string to the registry. More...
 
THREAD_SAFE bool reg_read_string (qstring *utf8, const char *name, const char *subkey=nullptr)
 Read a string from the registry. More...
 
THREAD_SAFE int reg_read_int (const char *name, int defval, const char *subkey=nullptr)
 Read integer value from the registry. More...
 
THREAD_SAFE void reg_write_int (const char *name, int value, const char *subkey=nullptr)
 Write integer value to the registry. More...
 
THREAD_SAFE bool reg_read_bool (const char *name, bool defval, const char *subkey=nullptr)
 Read boolean value from the registry. More...
 
THREAD_SAFE void reg_write_bool (const char *name, int value, const char *subkey=nullptr)
 Write boolean value to the registry. More...
 
THREAD_SAFE bool reg_subkey_subkeys (qstrvec_t *out, const char *name)
 Get all subkey names of given key.
 
THREAD_SAFE bool reg_subkey_values (qstrvec_t *out, const char *name)
 Get all value names under given key.
 
THREAD_SAFE void reg_update_filestrlist (const char *subkey, const char *add, size_t maxrecs, const char *rem=nullptr)
 Update registry with a file list. More...
 

Detailed Description

Registry related functions.

IDA uses the registry to store global configuration options that must persist after IDA has been closed.

On Windows, IDA uses the Windows registry directly. On Unix systems, the registry is stored in a file (typically ~/.idapro/ida.reg).

The root key for accessing IDA settings in the registry is defined by ROOT_KEY_NAME.

Macro Definition Documentation

◆ ROOT_KEY_NAME

#define ROOT_KEY_NAME   "Software\\Hex-Rays\\IDA"

Default key used to store IDA settings in registry (Windows version).

Note
this name is automatically prepended to all key names passed to functions in this file.

Enumeration Type Documentation

◆ regval_type_t

Types of values stored in the registry.

Enumerator
reg_unknown 

unknown

reg_sz 

utf8 string

reg_binary 

binary data

reg_dword 

32-bit number

Function Documentation

◆ reg_delete()

idaman THREAD_SAFE bool ida_export reg_delete ( const char *  name,
const char *  subkey = nullptr 
)

Delete a value from the registry.

Parameters
namevalue name
subkeyparent key
Returns
success

◆ reg_exists()

idaman THREAD_SAFE bool ida_export reg_exists ( const char *  name,
const char *  subkey = nullptr 
)

Is there already a value with the given name?

Parameters
namevalue name
subkeyparent key

◆ reg_subkey_children()

idaman THREAD_SAFE bool ida_export reg_subkey_children ( qstrvec_t out,
const char *  name,
bool  subkeys 
)

Retrieve the child names of the given key.

Parameters
outresult
namekey name
subkeysif true, collect subkey names. if false, collect value names.
Returns
false if the given key does not exist

◆ reg_data_type()

idaman THREAD_SAFE bool ida_export reg_data_type ( regval_type_t out,
const char *  name,
const char *  subkey = nullptr 
)

Get data type of a given value.

Parameters
outresult
namevalue name
subkeykey name
Returns
false if the [key+]value doesn't exist

◆ reg_read_strlist()

idaman THREAD_SAFE void ida_export reg_read_strlist ( qstrvec_t list,
const char *  subkey 
)

Retrieve all string values associated with the given key.

Also see reg_update_strlist().

◆ reg_update_strlist()

idaman THREAD_SAFE void ida_export reg_update_strlist ( const char *  subkey,
const char *  add,
size_t  maxrecs,
const char *  rem = nullptr,
bool  ignorecase = false 
)

Update list of strings associated with given key.

Parameters
subkeykey name
addstring to be added to list, can be nullptr
maxrecslimit list to this size
remstring to be removed from list, can be nullptr
ignorecaseignore case for 'add' and 'rem'

◆ reg_write_binary() [1/2]

THREAD_SAFE void reg_write_binary ( const char *  name,
const void *  data,
size_t  datalen,
const char *  subkey = nullptr 
)
inline

Write binary data to the registry.

Parameters
namevalue name
datainput, must not be nullptr
datalenlength of input in bytes
subkeykey name

◆ reg_write_binary() [2/2]

THREAD_SAFE void reg_write_binary ( const char *  name,
const bytevec_t data,
const char *  subkey = nullptr 
)
inline

Write binary data to the registry.

Parameters
namevalue name
datainput data (as byte vector)
subkeykey name

◆ reg_read_binary() [1/2]

THREAD_SAFE bool reg_read_binary ( const char *  name,
void *  data,
size_t  datalen,
const char *  subkey = nullptr 
)
inline

Read binary data from the registry.

Parameters
namevalue name
[out]dataresult, must not be nullptr
datalenlength of out buffer in bytes
subkeykey name
Returns
false if 'data' is not large enough to hold all data present. in this case 'data' is left untouched.

◆ reg_read_binary_part()

THREAD_SAFE bool reg_read_binary_part ( const char *  name,
void *  data,
size_t  datalen,
const char *  subkey = nullptr 
)
inline

Read a chunk of binary data from the registry.

This function succeeds even in the case of a partial read.

Parameters
namevalue name
[out]dataresult, must not be nullptr
datalenlength of output buffer in bytes
subkeykey name
Returns
success

◆ reg_read_binary() [2/2]

THREAD_SAFE bool reg_read_binary ( const char *  name,
bytevec_t data,
const char *  subkey = nullptr 
)
inline

Read binary data from the registry.

Parameters
namevalue name
[out]dataoutput buffer, must not be nullptr
subkeykey name
Returns
success

◆ reg_write_string()

THREAD_SAFE void reg_write_string ( const char *  name,
const char *  utf8,
const char *  subkey = nullptr 
)
inline

Write a string to the registry.

Parameters
namevalue name
utf8utf8-encoded string
subkeykey name

◆ reg_read_string()

THREAD_SAFE bool reg_read_string ( qstring utf8,
const char *  name,
const char *  subkey = nullptr 
)
inline

Read a string from the registry.

Parameters
[out]utf8output buffer
namevalue name
subkeykey name
Returns
success

◆ reg_read_int()

THREAD_SAFE int reg_read_int ( const char *  name,
int  defval,
const char *  subkey = nullptr 
)
inline

Read integer value from the registry.

Parameters
namevalue name
defvaldefault value
subkeykey name
Returns
the value read from the registry, or 'defval' if the read failed

◆ reg_write_int()

THREAD_SAFE void reg_write_int ( const char *  name,
int  value,
const char *  subkey = nullptr 
)
inline

Write integer value to the registry.

Parameters
namevalue name
valuevalue to write
subkeykey name

◆ reg_read_bool()

THREAD_SAFE bool reg_read_bool ( const char *  name,
bool  defval,
const char *  subkey = nullptr 
)
inline

Read boolean value from the registry.

Parameters
namevalue name
defvaldefault value
subkeykey name
Returns
boolean read from registry, or 'defval' if the read failed

◆ reg_write_bool()

THREAD_SAFE void reg_write_bool ( const char *  name,
int  value,
const char *  subkey = nullptr 
)
inline

Write boolean value to the registry.

Parameters
namevalue name
valueboolean to write (nonzero = true)
subkeykey name

◆ reg_update_filestrlist()

THREAD_SAFE void reg_update_filestrlist ( const char *  subkey,
const char *  add,
size_t  maxrecs,
const char *  rem = nullptr 
)
inline

Update registry with a file list.

Case sensitivity will vary depending on the target OS.

Note
'add' and 'rem' must be UTF-8, just like for regular string operations.