GWin32RegistryKey

GWin32RegistryKey — W32 registry access helper

Functions

GWin32RegistrySubkeyIter * g_win32_registry_subkey_iter_copy ()
void g_win32_registry_subkey_iter_free ()
void g_win32_registry_subkey_iter_assign ()
GWin32RegistryValueIter * g_win32_registry_value_iter_copy ()
void g_win32_registry_value_iter_free ()
void g_win32_registry_value_iter_assign ()
GWin32RegistryKey * g_win32_registry_key_new ()
GWin32RegistryKey * g_win32_registry_key_new_w ()
GWin32RegistryKey * g_win32_registry_key_get_child ()
GWin32RegistryKey * g_win32_registry_key_get_child_w ()
gboolean g_win32_registry_subkey_iter_init ()
void g_win32_registry_subkey_iter_clear ()
gsize g_win32_registry_subkey_iter_n_subkeys ()
gboolean g_win32_registry_subkey_iter_next ()
gboolean g_win32_registry_subkey_iter_get_name ()
gboolean g_win32_registry_subkey_iter_get_name_w ()
gboolean g_win32_registry_value_iter_init ()
void g_win32_registry_value_iter_clear ()
gsize g_win32_registry_value_iter_n_values ()
gboolean g_win32_registry_value_iter_next ()
gboolean g_win32_registry_value_iter_get_value_type ()
gboolean g_win32_registry_value_iter_get_name ()
gboolean g_win32_registry_value_iter_get_name_w ()
gboolean g_win32_registry_value_iter_get_data ()
gboolean g_win32_registry_value_iter_get_data_w ()
gboolean g_win32_registry_key_get_value ()
gboolean g_win32_registry_key_get_value_w ()
const gchar * g_win32_registry_key_get_path ()
const gunichar2 * g_win32_registry_key_get_path_w ()
void (*GWin32RegistryKeyWatchCallbackFunc) ()
gboolean g_win32_registry_key_watch ()
gboolean g_win32_registry_key_has_changed ()
void g_win32_registry_key_erase_change_indicator ()

Types and Values

Includes

#include <gio/win32/gwin32registrykey.h>

Description

GWin32RegistryKey represents a single Windows Registry key.

GWin32RegistryKey is used by a number of helper functions that read Windows Registry. All keys are opened with read-only access, and at the moment there is no API for writing into registry keys or creating new ones.

GWin32RegistryKey implements the GInitable interface, so if it is manually constructed by e.g. g_object_new() you must call g_initable_init() and check the results before using the object. This is done automatically in g_win32_registry_key_new() and g_win32_registry_key_get_child(), so these functions can return NULL.

To increase efficiency, a UTF-16 variant is available for all functions that deal with key or value names in the registry. Use these to perform deep registry queries or other operations that require querying a name of a key or a value and then opening it (or querying its data). The use of UTF-16 functions avoids the overhead of converting names to UTF-8 and back.

All functions operate in current user's context (it is not possible to access registry tree of a different user).

Key paths must use '\' as a separator, '/' is not supported. Key names must not include '\', because it's used as a separator. Value names can include '\'.

Key and value names are not case sensitive.

Full key name (excluding the pre-defined ancestor's name) can't exceed 255 UTF-16 characters, give or take. Value name can't exceed 16383 UTF-16 characters. Tree depth is limited to 512 levels.

Functions

g_win32_registry_subkey_iter_copy ()

GWin32RegistrySubkeyIter *
g_win32_registry_subkey_iter_copy (const GWin32RegistrySubkeyIter *iter);

Creates a dynamically-allocated copy of an iterator. Dynamically-allocated state of the iterator is duplicated too.

Parameters

iter

an iterator

 

Returns

a copy of the iter , free with g_win32_registry_subkey_iter_free().

[transfer full]

Since: 2.46


g_win32_registry_subkey_iter_free ()

void
g_win32_registry_subkey_iter_free (GWin32RegistrySubkeyIter *iter);

Free an iterator allocated on the heap. For iterators that are allocated on the stack use g_win32_registry_subkey_iter_clear() instead.

Parameters

iter

a dynamically-allocated iterator

 

Since: 2.46


g_win32_registry_subkey_iter_assign ()

void
g_win32_registry_subkey_iter_assign (GWin32RegistrySubkeyIter *iter,
                                     const GWin32RegistrySubkeyIter *other);

Assigns the value of other to iter . This function is not useful in applications, because iterators can be assigned with GWin32RegistrySubkeyIter i = j;. The function is used by language bindings.

Parameters

Since: 2.46


g_win32_registry_value_iter_copy ()

GWin32RegistryValueIter *
g_win32_registry_value_iter_copy (const GWin32RegistryValueIter *iter);

Creates a dynamically-allocated copy of an iterator. Dynamically-allocated state of the iterator is duplicated too.

Parameters

iter

an iterator

 

Returns

a copy of the iter , free with g_win32_registry_value_iter_free().

[transfer full]

Since: 2.46


g_win32_registry_value_iter_free ()

void
g_win32_registry_value_iter_free (GWin32RegistryValueIter *iter);

Free an iterator allocated on the heap. For iterators that are allocated on the stack use g_win32_registry_value_iter_clear() instead.

Parameters

iter

a dynamically-allocated iterator

 

Since: 2.46


g_win32_registry_value_iter_assign ()

void
g_win32_registry_value_iter_assign (GWin32RegistryValueIter *iter,
                                    const GWin32RegistryValueIter *other);

Assigns the value of other to iter . This function is not useful in applications, because iterators can be assigned with GWin32RegistryValueIter i = j;. The function is used by language bindings.

Parameters

Since: 2.46


g_win32_registry_key_new ()

GWin32RegistryKey *
g_win32_registry_key_new (const gchar *path,
                          GError **error);

Creates an object that represents a registry key specified by path . path must start with one of the following pre-defined names:

  • HKEY_CLASSES_ROOT

  • HKEY_CURRENT_CONFIG

  • HKEY_CURRENT_USER

  • HKEY_CURRENT_USER_LOCAL_SETTINGS

  • HKEY_LOCAL_MACHINE

  • HKEY_PERFORMANCE_DATA

  • HKEY_PERFORMANCE_NLSTEXT

  • HKEY_PERFORMANCE_TEXT

  • HKEY_USERS path must not end with '\'.

Parameters

path

absolute full name of a key to open (in UTF-8)

 

error

a pointer to a NULL GError, or NULL.

[nullable]

Returns

a GWin32RegistryKey or NULL if can't be opened. Free with g_object_unref().

[nullable][transfer full]


g_win32_registry_key_new_w ()

GWin32RegistryKey *
g_win32_registry_key_new_w (const gunichar2 *path,
                            GError **error);

Creates an object that represents a registry key specified by path . path must start with one of the following pre-defined names:

  • HKEY_CLASSES_ROOT

  • HKEY_CURRENT_CONFIG

  • HKEY_CURRENT_USER

  • HKEY_CURRENT_USER_LOCAL_SETTINGS

  • HKEY_LOCAL_MACHINE

  • HKEY_PERFORMANCE_DATA

  • HKEY_PERFORMANCE_NLSTEXT

  • HKEY_PERFORMANCE_TEXT

  • HKEY_USERS path must not end with L'\'.

Parameters

path

absolute full name of a key to open (in UTF-16).

[in][transfer none]

error

a pointer to a NULL GError, or NULL.

[inout][nullable]

Returns

a GWin32RegistryKey or NULL if can't be opened. Free with g_object_unref().

[nullable][transfer full]


g_win32_registry_key_get_child ()

GWin32RegistryKey *
g_win32_registry_key_get_child (GWin32RegistryKey *key,
                                const gchar *subkey,
                                GError **error);

Opens a subkey of the key .

Parameters

key

a parent GWin32RegistryKey.

[in][transfer none]

subkey

name of a child key to open (in UTF-8), relative to key .

[in][transfer none]

error

a pointer to a NULL GError, or NULL.

[inout][nullable]

Returns

a GWin32RegistryKey or NULL if can't be opened. Free with g_object_unref().

[nullable]


g_win32_registry_key_get_child_w ()

GWin32RegistryKey *
g_win32_registry_key_get_child_w (GWin32RegistryKey *key,
                                  const gunichar2 *subkey,
                                  GError **error);

Opens a subkey of the key .

Parameters

key

a parent GWin32RegistryKey.

[in][transfer none]

subkey

name of a child key to open (in UTF-8), relative to key .

[in][transfer none]

error

a pointer to a NULL GError, or NULL.

[inout][nullable]

Returns

a GWin32RegistryKey or NULL if can't be opened. Free with g_object_unref().

[nullable]


g_win32_registry_subkey_iter_init ()

gboolean
g_win32_registry_subkey_iter_init (GWin32RegistrySubkeyIter *iter,
                                   GWin32RegistryKey *key,
                                   GError **error);

Initialises (without allocating) a GWin32RegistrySubkeyIter. iter may be completely uninitialised prior to this call; its old value is ignored.

The iterator remains valid for as long as key exists. Clean up its internal buffers with a call to g_win32_registry_subkey_iter_clear() when done.

Parameters

iter

a pointer to a GWin32RegistrySubkeyIter.

[in][transfer none]

key

a GWin32RegistryKey to iterate over.

[in][transfer none]

error

a pointer to NULL GError, or NULL.

[inout][nullable]

Returns

TRUE if iterator was initialized successfully, FALSE on error.

Since: 2.46


g_win32_registry_subkey_iter_clear ()

void
g_win32_registry_subkey_iter_clear (GWin32RegistrySubkeyIter *iter);

Frees internal buffers of a GWin32RegistrySubkeyIter.

Parameters

iter

a GWin32RegistrySubkeyIter.

[in][transfer none]

Since: 2.46


g_win32_registry_subkey_iter_n_subkeys ()

gsize
g_win32_registry_subkey_iter_n_subkeys
                               (GWin32RegistrySubkeyIter *iter);

Queries the number of subkeys items in the key that we are iterating over. This is the total number of subkeys -- not the number of items remaining.

This information is accurate at the point of iterator initialization, and may go out of sync with reality even while subkeys are enumerated.

Parameters

iter

a GWin32RegistrySubkeyIter.

[in][transfer none]

Returns

the number of subkeys in the key

Since: 2.46


g_win32_registry_subkey_iter_next ()

gboolean
g_win32_registry_subkey_iter_next (GWin32RegistrySubkeyIter *iter,
                                   gboolean skip_errors,
                                   GError **error);

Moves iterator to the next subkey. Enumeration errors can be ignored if skip_errors is TRUE

Here is an example for iterating with g_win32_registry_subkey_iter_next():

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// recursively iterate a key
void
iterate_key_recursive (GWin32RegistryKey *key)
{
  GWin32RegistrySubkeyIter iter;
  gchar *name;
  GWin32RegistryKey *child;

  if (!g_win32_registry_subkey_iter_init (&iter, key, NULL))
    return;

  while (g_win32_registry_subkey_iter_next (&iter, TRUE, NULL))
    {
      if (!g_win32_registry_subkey_iter_get_name (&iter, &name, NULL, NULL))
        continue;

      g_print ("subkey '%s'\n", name);
      child = g_win32_registry_key_get_child (key, name, NULL);

      if (child)
        iterate_key_recursive (child);
    }

  g_win32_registry_subkey_iter_clear (&iter);
}

Parameters

iter

a GWin32RegistrySubkeyIter.

[in][transfer none]

skip_errors

TRUE if iterator should silently ignore errors (such as the actual number of subkeys being less than expected) and proceed forward.

[in]

error

a pointer to NULL GError, or NULL.

[nullable]

Returns

TRUE if next subkey info was retrieved, FALSE otherwise.

Since: 2.46


g_win32_registry_subkey_iter_get_name ()

gboolean
g_win32_registry_subkey_iter_get_name (GWin32RegistrySubkeyIter *iter,
                                       gchar **subkey_name,
                                       gsize *subkey_name_len,
                                       GError **error);

Gets the name of the subkey at the iter potision.

Parameters

iter

a GWin32RegistrySubkeyIter.

[in][transfer none]

subkey_name

Pointer to a location to store the name of a subkey (in UTF-8). Free with g_free().

[out callee-allocates][transfer none]

subkey_name_len

Pointer to a location to store the length of subkey_name , in gchars, excluding NUL-terminator. NULL if length is not needed.

[out][optional]

error

a pointer to NULL GError, or NULL.

[nullable]

Returns

TRUE if the name was retrieved, FALSE otherwise.

Since: 2.46


g_win32_registry_subkey_iter_get_name_w ()

gboolean
g_win32_registry_subkey_iter_get_name_w
                               (GWin32RegistrySubkeyIter *iter,
                                gunichar2 **subkey_name,
                                gsize *subkey_name_len,
                                GError **error);

Same as g_win32_registry_subkey_iter_get_next(), but outputs UTF-16-encoded data, without converting it to UTF-8 first.

Parameters

iter

a GWin32RegistrySubkeyIter.

[in][transfer none]

subkey_name

Pointer to a location to store the name of a subkey (in UTF-16).

[out callee-allocates][transfer none]

subkey_name_len

Pointer to a location to store the length of subkey_name , in gunichar2s, excluding NUL-terminator. NULL if length is not needed.

[out][optional][transfer none]

error

a pointer to NULL GError, or NULL.

[nullable]

Returns

TRUE if the name was retrieved, FALSE otherwise.

Since: 2.46


g_win32_registry_value_iter_init ()

gboolean
g_win32_registry_value_iter_init (GWin32RegistryValueIter *iter,
                                  GWin32RegistryKey *key,
                                  GError **error);

Initialises (without allocating) a GWin32RegistryValueIter. iter may be completely uninitialised prior to this call; its old value is ignored.

The iterator remains valid for as long as key exists. Clean up its internal buffers with a call to g_win32_registry_value_iter_clear() when done.

Parameters

iter

a pointer to a GWin32RegistryValueIter.

[in][transfer none]

key

a GWin32RegistryKey to iterate over.

[in][transfer none]

error

a pointer to NULL GError, or NULL.

[nullable]

Returns

TRUE if iterator was initialized successfully, FALSE on error.

Since: 2.46


g_win32_registry_value_iter_clear ()

void
g_win32_registry_value_iter_clear (GWin32RegistryValueIter *iter);

Frees internal buffers of a GWin32RegistryValueIter.

Parameters

iter

a GWin32RegistryValueIter.

[in][transfer none]

Since: 2.46


g_win32_registry_value_iter_n_values ()

gsize
g_win32_registry_value_iter_n_values (GWin32RegistryValueIter *iter);

Queries the number of values items in the key that we are iterating over. This is the total number of values -- not the number of items remaining.

This information is accurate at the point of iterator initialization, and may go out of sync with reality even while values are enumerated.

Parameters

iter

a GWin32RegistryValueIter.

[in][transfer none]

Returns

the number of values in the key

Since: 2.46


g_win32_registry_value_iter_next ()

gboolean
g_win32_registry_value_iter_next (GWin32RegistryValueIter *iter,
                                  gboolean skip_errors,
                                  GError **error);

Advances iterator to the next value in the key. If no more values remain then FALSE is returned. Enumeration errors can be ignored if skip_errors is TRUE

Here is an example for iterating with g_win32_registry_value_iter_next():

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// iterate values of a key
void
iterate_values_recursive (GWin32RegistryKey *key)
{
  GWin32RegistryValueIter iter;
  gchar *name;
  GWin32RegistryValueType val_type;
  gchar *val_data;

  if (!g_win32_registry_value_iter_init (&iter, key, NULL))
    return;

  while (g_win32_registry_value_iter_next (&iter, TRUE, NULL))
    {
      if ((!g_win32_registry_value_iter_get_value_type (&iter, &value)) ||
          ((val_type != G_WIN32_REGISTRY_VALUE_STR) &&
           (val_type != G_WIN32_REGISTRY_VALUE_EXPAND_STR)))
        continue;

      if (g_win32_registry_value_iter_get_value (&iter, TRUE, &name, NULL,
                                                 &val_data, NULL, NULL))
        g_print ("value '%s' = '%s'\n", name, val_data);
    }

  g_win32_registry_value_iter_clear (&iter);
}

Parameters

iter

a GWin32RegistryValueIter.

[in][transfer none]

skip_errors

TRUE if iterator should silently ignore errors (such as the actual number of values being less than expected) and proceed forward.

[in]

error

a pointer to NULL GError, or NULL.

[nullable]

Returns

TRUE if next value info was retrieved, FALSE otherwise.

Since: 2.46


g_win32_registry_value_iter_get_value_type ()

gboolean
g_win32_registry_value_iter_get_value_type
                               (GWin32RegistryValueIter *iter,
                                GWin32RegistryValueType *value_type,
                                GError **error);

Stores the type of the value currently being iterated over in value_type .

Parameters

iter

a GWin32RegistryValueIter.

[in][transfer none]

value_type

Pointer to a location to store the type of the value.

[out]

error

a pointer to NULL GError, or NULL.

[nullable]

Returns

TRUE if value type was retrieved, FALSE otherwise.

Since: 2.46


g_win32_registry_value_iter_get_name ()

gboolean
g_win32_registry_value_iter_get_name (GWin32RegistryValueIter *iter,
                                      gchar **value_name,
                                      gsize *value_name_len,
                                      GError **error);

Stores the name of the value currently being iterated over in value_name , and its length - in value_name_len (if not NULL).

Parameters

iter

a GWin32RegistryValueIter.

[in][transfer none]

value_name

Pointer to a location to store the name of a value (in UTF-8).

[out callee-allocates][transfer none]

value_name_len

Pointer to a location to store the length of value_name , in gchars, excluding NUL-terminator. NULL if length is not needed.

[out][optional]

error

a pointer to NULL GError, or NULL.

[nullable]

Returns

TRUE if value name was retrieved, FALSE otherwise.

Since: 2.46


g_win32_registry_value_iter_get_name_w ()

gboolean
g_win32_registry_value_iter_get_name_w
                               (GWin32RegistryValueIter *iter,
                                gunichar2 **value_name,
                                gsize *value_name_len,
                                GError **error);

Stores the name of the value currently being iterated over in value_name , and its length - in value_name (if not NULL).

Parameters

iter

a GWin32RegistryValueIter.

[in][transfer none]

value_name

Pointer to a location to store the name of a value (in UTF-16).

[out callee-allocates][transfer none]

value_name_len

Pointer to a location to store the length of value_name , in gunichar2s, excluding NUL-terminator. NULL if length is not needed.

[out][optional]

error

a pointer to NULL GError, or NULL.

[nullable]

Returns

TRUE if value name was retrieved, FALSE otherwise.

Since: 2.46


g_win32_registry_value_iter_get_data ()

gboolean
g_win32_registry_value_iter_get_data (GWin32RegistryValueIter *iter,
                                      gboolean auto_expand,
                                      gpointer *value_data,
                                      gsize *value_data_size,
                                      GError **error);

Stores the data of the value currently being iterated over in value_data , and its length - in value_data_len (if not NULL).

Parameters

iter

a GWin32RegistryValueIter.

[in][transfer none]

auto_expand

TRUE to automatically expand G_WIN32_REGISTRY_VALUE_EXPAND_STR to G_WIN32_REGISTRY_VALUE_STR.

[in]

value_data

Pointer to a location to store the data of the value (in UTF-8, if it's a string).

[out callee-allocates][optional][transfer none]

value_data_size

Pointer to a location to store the length of value_data , in bytes (including any NUL-terminators, if it's a string). NULL if length is not needed.

[out][optional]

error

a pointer to NULL GError, or NULL.

[nullable]

Returns

TRUE if value data was retrieved, FALSE otherwise.

Since: 2.46


g_win32_registry_value_iter_get_data_w ()

gboolean
g_win32_registry_value_iter_get_data_w
                               (GWin32RegistryValueIter *iter,
                                gboolean auto_expand,
                                gpointer *value_data,
                                gsize *value_data_size,
                                GError **error);

Stores the data of the value currently being iterated over in value_data , and its length - in value_data_len (if not NULL).

Parameters

iter

a GWin32RegistryValueIter.

[in][transfer none]

auto_expand

TRUE to automatically expand G_WIN32_REGISTRY_VALUE_EXPAND_STR to G_WIN32_REGISTRY_VALUE_STR.

[in]

value_data

Pointer to a location to store the data of the value (in UTF-16, if it's a string).

[out callee-allocates][optional][transfer none]

value_data_size

Pointer to a location to store the size of value_data , in bytes (including any NUL-terminators, if it's a string). NULL if length is not needed.

[out][optional]

error

a pointer to NULL GError, or NULL.

[nullable]

Returns

TRUE if value data was retrieved, FALSE otherwise.

Since: 2.46


g_win32_registry_key_get_value ()

gboolean
g_win32_registry_key_get_value (GWin32RegistryKey *key,
                                gboolean auto_expand,
                                const gchar *value_name,
                                GWin32RegistryValueType *value_type,
                                gpointer *value_data,
                                gsize *value_data_size,
                                GError **error);

Get data from a value of a key. String data is guaranteed to be appropriately terminated and will be in UTF-8.

Parameters

key

a GWin32RegistryKey.

[in][transfer none]

auto_expand

(in) TRUE to automatically expand G_WIN32_REGISTRY_VALUE_EXPAND_STR to G_WIN32_REGISTRY_VALUE_STR.

 

value_name

name of the value to get (in UTF-8). Empty string means the '(Default)' value.

[in][transfer none]

value_type

type of the value retrieved.

[out][optional]

value_data

contents of the value.

[out callee-allocates][optional]

value_data_size

size of the buffer pointed by value_data .

[out][optional]

error

a pointer to NULL GError, or NULL.

[nullable]

Returns

TRUE on success, FALSE on failure.

Since: 2.46


g_win32_registry_key_get_value_w ()

gboolean
g_win32_registry_key_get_value_w (GWin32RegistryKey *key,
                                  gboolean auto_expand,
                                  const gunichar2 *value_name,
                                  GWin32RegistryValueType *value_type,
                                  gpointer *value_data,
                                  gsize *value_data_size,
                                  GError **error);

Get data from a value of a key.

Get data from a value of a key. String data is guaranteed to be appropriately terminated and will be in UTF-16.

When calling with value_data == NULL (to get data size without getting the data itself) remember that returned size corresponds to possibly unterminated string data (if value is some kind of string), because termination cannot be checked and fixed unless the data is retreived too.

Parameters

key

a GWin32RegistryKey.

[in][transfer none]

auto_expand

(in) TRUE to automatically expand G_WIN32_REGISTRY_VALUE_EXPAND_STR to G_WIN32_REGISTRY_VALUE_STR.

 

value_name

name of the value to get (in UTF-16). Empty string means the '(Default)' value.

[in][transfer none]

value_type

type of the value retrieved.

[out][optional]

value_data

contents of the value.

[out callee-allocates][optional]

value_data_size

size of the buffer pointed by value_data .

[out][optional]

error

a pointer to NULL GError, or NULL.

[nullable]

Returns

TRUE on success, FALSE on failure.

Since: 2.46


g_win32_registry_key_get_path ()

const gchar *
g_win32_registry_key_get_path (GWin32RegistryKey *key);

Get full path to the key

Parameters

key

a GWin32RegistryKey.

[in][transfer none]

Returns

a full path to the key (in UTF-8), or NULL if it can't be converted to UTF-8.

[transfer none]

Since: 2.46


g_win32_registry_key_get_path_w ()

const gunichar2 *
g_win32_registry_key_get_path_w (GWin32RegistryKey *key);

Get full path to the key

Parameters

key

a GWin32RegistryKey.

[in][transfer none]

Returns

a full path to the key (in UTF-16).

[transfer none]

Since: 2.46


GWin32RegistryKeyWatchCallbackFunc ()

void
(*GWin32RegistryKeyWatchCallbackFunc) (GWin32RegistryKey *key,
                                       gpointer user_data);

The type of the callback passed to g_win32_registry_key_watch().

The callback is invoked after a change matching the watch flags and arguments occurs. If the children of the key were watched also, there is no way to know which one of them triggered the callback.

Parameters

key

A GWin32RegistryKey that was watched.

 

user_data

The user_data gpointer passed to g_win32_registry_key_watch().

 

Since: 2.42


g_win32_registry_key_watch ()

gboolean
g_win32_registry_key_watch (GWin32RegistryKey *key,
                            gboolean watch_children,
                            GWin32RegistryKeyWatcherFlags watch_flags,
                            GWin32RegistryKeyWatchCallbackFunc callback,
                            gpointer user_data,
                            GError **error);

Puts key under a watch.

When the key changes, an APC will be queued in the current thread. The APC will run when the current thread enters alertable state (GLib main loop should do that; if you are not using it, see MSDN documentation for W32API calls that put thread into alertable state). When it runs, it will atomically switch an indicator in the key . If a callback was specified, it is invoked at that point. Subsequent calls to g_win32_registry_key_has_changed() will return TRUE, and the callback (if it was specified) will not be invoked anymore. Calling g_win32_registry_key_erase_change_indicator() will reset the indicator, and g_win32_registry_key_has_changed() will start returning FALSE. To resume the watch, call g_win32_registry_key_watch_for_changes() again.

Calling g_win32_registry_key_watch_for_changes() for a key that is already being watched is allowed and affects nothing.

The fact that the key is being watched will be used internally to update key path (if it changes).

Parameters

key

a GWin32RegistryKey.

[in][transfer none]

watch_children

(in) TRUE also watch the children of the key , FALSE to watch the key only.

 

watch_flags

specifies the types of changes to watch for.

[in]

callback

a function to invoke when a change occurs.

[in][nullable]

user_data

a pointer to pass to callback on invocation.

[in][nullable]

error

a pointer to NULL GError, or NULL.

[nullable]

Returns

TRUE on success, FALSE on failure.

Since: 2.46


g_win32_registry_key_has_changed ()

gboolean
g_win32_registry_key_has_changed (GWin32RegistryKey *key);

Check the key 's status indicator.

Parameters

key

a GWin32RegistryKey.

[in][transfer none]

Returns

TRUE if the key was put under watch at some point and has changed since then, FALSE if it either wasn't changed or wasn't watched at all.

Since: 2.46


g_win32_registry_key_erase_change_indicator ()

void
g_win32_registry_key_erase_change_indicator
                               (GWin32RegistryKey *key);

Erases change indicator of the key .

Subsequent calls to g_win32_registry_key_has_changed() will return FALSE until the key is put on watch again by calling g_win32_registry_key_watch() again.

Parameters

key

a GWin32RegistryKey.

[in][transfer none]

Since: 2.46

Types and Values

struct GWin32RegistrySubkeyIter

struct GWin32RegistrySubkeyIter {
};

struct GWin32RegistryValueIter

struct GWin32RegistryValueIter {
};

struct GWin32RegistryKey

struct GWin32RegistryKey {
  GObject parent_instance;
};

enum GWin32RegistryValueType

Members

G_WIN32_REGISTRY_VALUE_NONE

   

G_WIN32_REGISTRY_VALUE_BINARY

   

G_WIN32_REGISTRY_VALUE_UINT32LE

   

G_WIN32_REGISTRY_VALUE_UINT32BE

   

G_WIN32_REGISTRY_VALUE_UINT32

   

G_WIN32_REGISTRY_VALUE_UINT32

   

G_WIN32_REGISTRY_VALUE_EXPAND_STR

   

G_WIN32_REGISTRY_VALUE_LINK

   

G_WIN32_REGISTRY_VALUE_MULTI_STR

   

G_WIN32_REGISTRY_VALUE_UINT64LE

   

G_WIN32_REGISTRY_VALUE_UINT64

   

G_WIN32_REGISTRY_VALUE_STR

   

enum GWin32RegistryKeyWatcherFlags

Members

G_WIN32_REGISTRY_WATCH_NAME

   

G_WIN32_REGISTRY_WATCH_ATTRIBUTES

   

G_WIN32_REGISTRY_WATCH_VALUES

   

G_WIN32_REGISTRY_WATCH_SECURITY