IDA SDK

- Main Page
- Header Files
- Classes
- Modules

- File List
- File Members

Functions | Macros | Enumerations
registry.hpp File Reference

## 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.

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

## Macros
#define | ROOT_KEY_NAME "Software\\Hex-Rays\\IDA"
| 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...

## Macro Definition Documentation

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

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

enum 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

idaman bool ida_export reg_delete | ( | const char * | name,
|  | const char * | subkey = `NULL`
| ) |  |

Delete a value from the registry.

Parameters

  name | value name
  subkey | parent key

Returns
  success

idaman bool ida_export reg_exists | ( | const char * | name,
|  | const char * | subkey = `NULL`
| ) |  |

Is there already a value with the given name?

Parameters

  name | value name
  subkey | parent key

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

Retrieve the child names of the given key.

Parameters

  out | result
  name | key name
  subkeys | if true, collect subkey names. if false, collect value names.

Returns
  false if the given key does not exist

idaman bool ida_export reg_data_type | ( | regval_type_t * | out,
|  | const char * | name,
|  | const char * | subkey = `NULL`
| ) |  |

Get data type of a given value.

Parameters

  out | result
  name | value name
  subkey | key name

Returns
  false if the [key+]value doesn't exist

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

Retrieve all string values associated with the given key.

Also see reg_update_strlist().

idaman void ida_export reg_update_strlist | ( | const char * | subkey,
|  | const char * | add,
|  | size_t | maxrecs,
|  | const char * | rem = `NULL`,
|  | bool | ignorecase = `false`
| ) |  |

Update list of strings associated with given key.

Parameters

  subkey | key name
  add | string to be added to list, can be NULL
  maxrecs | limit list to this size
  rem | string to be removed from list, can be NULL
  ignorecase | ignore case for 'add' and 'rem'

void reg_write_binary | ( | const char * | name,
|  | const void * | data,
|  | size_t | datalen,
|  | const char * | subkey = `NULL`
| ) |  |
| inline

Write binary data to the registry.

Parameters

  name | value name
  data | input, must not be NULL
  datalen | length of input in bytes
  subkey | key name

bool reg_read_binary | ( | const char * | name,
|  | void * | data,
|  | size_t | datalen,
|  | const char * | subkey = `NULL`
| ) |  |
| inline

Read binary data from the registry.

Parameters

  | name | value name
  [out] | data | result, must not be NULL
  | datalen | length of out buffer in bytes
  | subkey | key name

Returns
  false if 'data' is not large enough to hold all data present. in this case 'data' is left untouched.

bool reg_read_binary_part | ( | const char * | name,
|  | void * | data,
|  | size_t | datalen,
|  | const char * | subkey = `NULL`
| ) |  |
| inline

Read a chunk of binary data from the registry.

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

Parameters

  | name | value name
  [out] | data | result, must not be NULL
  | datalen | length of output buffer in bytes
  | subkey | key name

Returns
  success

bool reg_read_binary | ( | const char * | name,
|  | bytevec_t * | data,
|  | const char * | subkey = `NULL`
| ) |  |
| inline

Read binary data from the registry.

Parameters

  | name | value name
  [out] | data | output buffer, must not be NULL
  | subkey | key name

Returns
  success

void reg_write_string | ( | const char * | name,
|  | const char * | utf8,
|  | const char * | subkey = `NULL`
| ) |  |
| inline

Write a string to the registry.

Parameters

  name | value name
  utf8 | utf8-encoded string
  subkey | key name

bool reg_read_string | ( | const char * | name,
|  | char * | utf8,
|  | size_t | utf8len,
|  | const char * | subkey = `NULL`
| ) |  |
| inline

Read a string from the registry.

Parameters

  | name | value name
  [out] | utf8 | output buffer
  | utf8len | length of output buffer
  | subkey | key name

Returns
  success

void reg_read_string | ( | const char * | name,
|  | size_t | utf8len,
|  | char * | utf8,
|  | const char * | def,
|  | const char * | subkey = `NULL`
| ) |  |
| inline

Read a string from the registry.

Parameters

  | name | value name
  | utf8len | length of output buffer
  [out] | utf8 | output buffer
  | def | default value, copied to 'utf8' if initial reg read fails.
  | subkey | key name

int reg_read_int | ( | const char * | name,
|  | int | defval,
|  | const char * | subkey = `NULL`
| ) |  |
| inline

Read integer value from the registry.

Parameters

  name | value name
  defval | default value
  subkey | key name

Returns
  the value read from the registry, or 'defval' if the read failed

void reg_write_int | ( | const char * | name,
|  | int | value,
|  | const char * | subkey = `NULL`
| ) |  |
| inline

Write integer value to the registry.

Parameters

  name | value name
  value | value to write
  subkey | key name

bool reg_read_bool | ( | const char * | name,
|  | bool | defval,
|  | const char * | subkey = `NULL`
| ) |  |
| inline

Read boolean value from the registry.

Parameters

  name | value name
  defval | default value
  subkey | key name

Returns
  boolean read from registry, or 'defval' if the read failed

void reg_write_bool | ( | const char * | name,
|  | int | value,
|  | const char * | subkey = `NULL`
| ) |  |
| inline

Write boolean value to the registry.

Parameters

  name | value name
  value | boolean to write (nonzero = true)
  subkey | key name

void reg_update_filestrlist | ( | const char * | subkey,
|  | const char * | add,
|  | size_t | maxrecs,
|  | const char * | rem = `NULL`
| ) |  |
| 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.