1 /* GIO - GLib Input, Output and Streaming Library
3 * Copyright (C) 2014 Руслан Ижбулатов <lrn1986@gmail.com>
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General
16 * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
19 #ifndef __G_WIN32_REGISTRY_KEY_H__
20 #define __G_WIN32_REGISTRY_KEY_H__
24 #ifdef G_PLATFORM_WIN32
28 #define G_TYPE_WIN32_REGISTRY_KEY (g_win32_registry_key_get_type ())
29 #define G_WIN32_REGISTRY_KEY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_WIN32_REGISTRY_KEY, GWin32RegistryKey))
30 #define G_WIN32_REGISTRY_KEY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), G_TYPE_WIN32_REGISTRY_KEY, GWin32RegistryKeyClass))
31 #define G_IS_WIN32_REGISTRY_KEY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_WIN32_REGISTRY_KEY))
32 #define G_IS_WIN32_REGISTRY_KEY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), G_TYPE_WIN32_REGISTRY_KEY))
33 #define G_WIN32_REGISTRY_KEY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_WIN32_REGISTRY_KEY, GWin32RegistryKeyClass))
36 G_WIN32_REGISTRY_VALUE_NONE = 0,
37 G_WIN32_REGISTRY_VALUE_BINARY = 1,
38 G_WIN32_REGISTRY_VALUE_UINT32LE = 2,
39 G_WIN32_REGISTRY_VALUE_UINT32BE = 3,
40 #if G_BYTE_ORDER == G_BIG_ENDIAN
41 G_WIN32_REGISTRY_VALUE_UINT32 = G_WIN32_REGISTRY_VALUE_UINT32BE,
43 G_WIN32_REGISTRY_VALUE_UINT32 = G_WIN32_REGISTRY_VALUE_UINT32LE,
45 G_WIN32_REGISTRY_VALUE_EXPAND_STR = 4,
46 G_WIN32_REGISTRY_VALUE_LINK = 5,
47 G_WIN32_REGISTRY_VALUE_MULTI_STR = 6,
48 G_WIN32_REGISTRY_VALUE_UINT64LE = 7,
49 #if G_BYTE_ORDER == G_LITTLE_ENDIAN
50 G_WIN32_REGISTRY_VALUE_UINT64 = G_WIN32_REGISTRY_VALUE_UINT64LE,
52 G_WIN32_REGISTRY_VALUE_STR = 8
53 } GWin32RegistryValueType;
56 G_WIN32_REGISTRY_WATCH_NAME = 1 << 0,
57 G_WIN32_REGISTRY_WATCH_ATTRIBUTES = 1 << 1,
58 G_WIN32_REGISTRY_WATCH_VALUES = 1 << 2,
59 G_WIN32_REGISTRY_WATCH_SECURITY = 1 << 3,
60 } GWin32RegistryKeyWatcherFlags;
62 typedef struct _GWin32RegistryKey GWin32RegistryKey;
63 typedef struct _GWin32RegistryKeyClass GWin32RegistryKeyClass;
64 typedef struct _GWin32RegistryKeyPrivate GWin32RegistryKeyPrivate;
65 typedef struct _GWin32RegistrySubkeyIter GWin32RegistrySubkeyIter;
66 typedef struct _GWin32RegistryValueIter GWin32RegistryValueIter;
68 struct _GWin32RegistryKey {
69 GObject parent_instance;
72 GWin32RegistryKeyPrivate *priv;
75 struct _GWin32RegistryKeyClass {
76 GObjectClass parent_class;
80 * GWin32RegistryKeyWatchCallbackFunc:
81 * @key: A #GWin32RegistryKey that was watched.
82 * @user_data: The @user_data #gpointer passed to g_win32_registry_key_watch().
84 * The type of the callback passed to g_win32_registry_key_watch().
86 * The callback is invoked after a change matching the watch flags and arguments
87 * occurs. If the children of the key were watched also, there is no way to know
88 * which one of them triggered the callback.
92 typedef void (*GWin32RegistryKeyWatchCallbackFunc) (GWin32RegistryKey *key,
95 #define G_TYPE_WIN32_REGISTRY_SUBKEY_ITER (g_win32_registry_subkey_iter_get_type ())
97 struct _GWin32RegistrySubkeyIter {
99 GWin32RegistryKey *key;
103 gunichar2 *subkey_name;
104 gsize subkey_name_size;
105 gsize subkey_name_len;
107 gchar *subkey_name_u8;
110 #define G_TYPE_WIN32_REGISTRY_VALUE_ITER (g_win32_registry_value_iter_get_type ())
112 struct _GWin32RegistryValueIter {
114 GWin32RegistryKey *key;
118 gunichar2 *value_name;
119 gsize value_name_size;
120 gsize value_name_len;
121 GWin32RegistryValueType value_type;
123 gsize value_data_size;
124 gsize value_actual_data_size;
125 GWin32RegistryValueType value_expanded_type;
126 gunichar2 *value_data_expanded;
127 gsize value_data_expanded_charsize;
129 gchar *value_name_u8;
130 gsize value_name_u8_len;
131 gchar *value_data_u8;
132 gsize value_data_u8_size;
133 gchar *value_data_expanded_u8;
134 gsize value_data_expanded_u8_size;
137 GLIB_AVAILABLE_IN_2_46
138 GWin32RegistrySubkeyIter *g_win32_registry_subkey_iter_copy (const GWin32RegistrySubkeyIter *iter);
139 GLIB_AVAILABLE_IN_2_46
140 void g_win32_registry_subkey_iter_free (GWin32RegistrySubkeyIter *iter);
141 GLIB_AVAILABLE_IN_2_46
142 void g_win32_registry_subkey_iter_assign (GWin32RegistrySubkeyIter *iter,
143 const GWin32RegistrySubkeyIter *other);
144 GLIB_AVAILABLE_IN_2_46
145 GType g_win32_registry_subkey_iter_get_type (void) G_GNUC_CONST;
148 GLIB_AVAILABLE_IN_2_46
149 GWin32RegistryValueIter *g_win32_registry_value_iter_copy (const GWin32RegistryValueIter *iter);
150 GLIB_AVAILABLE_IN_2_46
151 void g_win32_registry_value_iter_free (GWin32RegistryValueIter *iter);
152 GLIB_AVAILABLE_IN_2_46
153 void g_win32_registry_value_iter_assign (GWin32RegistryValueIter *iter,
154 const GWin32RegistryValueIter *other);
155 GLIB_AVAILABLE_IN_2_46
156 GType g_win32_registry_value_iter_get_type (void) G_GNUC_CONST;
159 GLIB_AVAILABLE_IN_2_46
160 GType g_win32_registry_key_get_type (void);
162 GLIB_AVAILABLE_IN_2_46
163 GWin32RegistryKey *g_win32_registry_key_new (const gchar *path,
166 GLIB_AVAILABLE_IN_2_46
167 GWin32RegistryKey *g_win32_registry_key_new_w (const gunichar2 *path,
170 GLIB_AVAILABLE_IN_2_46
171 GWin32RegistryKey *g_win32_registry_key_get_child (GWin32RegistryKey *key,
175 GLIB_AVAILABLE_IN_2_46
176 GWin32RegistryKey *g_win32_registry_key_get_child_w (GWin32RegistryKey *key,
177 const gunichar2 *subkey,
180 GLIB_AVAILABLE_IN_2_46
181 gboolean g_win32_registry_subkey_iter_init (GWin32RegistrySubkeyIter *iter,
182 GWin32RegistryKey *key,
184 GLIB_AVAILABLE_IN_2_46
185 void g_win32_registry_subkey_iter_clear (GWin32RegistrySubkeyIter *iter);
186 GLIB_AVAILABLE_IN_2_46
187 gsize g_win32_registry_subkey_iter_n_subkeys (GWin32RegistrySubkeyIter *iter);
188 GLIB_AVAILABLE_IN_2_46
189 gboolean g_win32_registry_subkey_iter_next (GWin32RegistrySubkeyIter *iter,
190 gboolean skip_errors,
192 GLIB_AVAILABLE_IN_2_46
193 gboolean g_win32_registry_subkey_iter_get_name (GWin32RegistrySubkeyIter *iter,
195 gsize *subkey_name_len,
197 GLIB_AVAILABLE_IN_2_46
198 gboolean g_win32_registry_subkey_iter_get_name_w (GWin32RegistrySubkeyIter *iter,
199 gunichar2 **subkey_name,
200 gsize *subkey_name_len,
203 GLIB_AVAILABLE_IN_2_46
204 gboolean g_win32_registry_value_iter_init (GWin32RegistryValueIter *iter,
205 GWin32RegistryKey *key,
207 GLIB_AVAILABLE_IN_2_46
208 void g_win32_registry_value_iter_clear (GWin32RegistryValueIter *iter);
209 GLIB_AVAILABLE_IN_2_46
210 gsize g_win32_registry_value_iter_n_values (GWin32RegistryValueIter *iter);
211 GLIB_AVAILABLE_IN_2_46
212 gboolean g_win32_registry_value_iter_next (GWin32RegistryValueIter *iter,
213 gboolean skip_errors,
215 GLIB_AVAILABLE_IN_2_46
216 gboolean g_win32_registry_value_iter_get_value_type (GWin32RegistryValueIter *iter,
217 GWin32RegistryValueType *value_type,
219 GLIB_AVAILABLE_IN_2_46
220 gboolean g_win32_registry_value_iter_get_name (GWin32RegistryValueIter *iter,
222 gsize *value_name_len,
224 GLIB_AVAILABLE_IN_2_46
225 gboolean g_win32_registry_value_iter_get_name_w (GWin32RegistryValueIter *iter,
226 gunichar2 **value_name,
227 gsize *value_name_len,
229 GLIB_AVAILABLE_IN_2_46
230 gboolean g_win32_registry_value_iter_get_data (GWin32RegistryValueIter *iter,
231 gboolean auto_expand,
232 gpointer *value_data,
233 gsize *value_data_size,
235 GLIB_AVAILABLE_IN_2_46
236 gboolean g_win32_registry_value_iter_get_data_w (GWin32RegistryValueIter *iter,
237 gboolean auto_expand,
238 gpointer *value_data,
239 gsize *value_data_size,
242 GLIB_AVAILABLE_IN_2_66
243 gboolean g_win32_registry_key_get_value (GWin32RegistryKey *key,
244 const gchar * const *mui_dll_dirs,
245 gboolean auto_expand,
246 const gchar *value_name,
247 GWin32RegistryValueType *value_type,
248 gpointer *value_data,
249 gsize *value_data_size,
252 GLIB_AVAILABLE_IN_2_66
253 gboolean g_win32_registry_key_get_value_w (GWin32RegistryKey *key,
254 const gunichar2 * const *mui_dll_dirs,
255 gboolean auto_expand,
256 const gunichar2 *value_name,
257 GWin32RegistryValueType *value_type,
258 gpointer *value_data,
259 gsize *value_data_size,
262 GLIB_AVAILABLE_IN_2_46
263 const gchar *g_win32_registry_key_get_path (GWin32RegistryKey *key);
265 GLIB_AVAILABLE_IN_2_46
266 const gunichar2 *g_win32_registry_key_get_path_w (GWin32RegistryKey *key);
268 GLIB_AVAILABLE_IN_2_46
269 gboolean g_win32_registry_key_watch (GWin32RegistryKey *key,
270 gboolean watch_children,
271 GWin32RegistryKeyWatcherFlags watch_flags,
272 GWin32RegistryKeyWatchCallbackFunc callback,
275 GLIB_AVAILABLE_IN_2_46
276 gboolean g_win32_registry_key_has_changed (GWin32RegistryKey *key);
278 GLIB_AVAILABLE_IN_2_46
279 void g_win32_registry_key_erase_change_indicator (GWin32RegistryKey *key);
281 GLIB_AVAILABLE_IN_2_66
282 const gunichar2 * const *g_win32_registry_get_os_dirs_w (void);
284 GLIB_AVAILABLE_IN_2_66
285 const gchar * const *g_win32_registry_get_os_dirs (void);
289 #endif /* G_PLATFORM_WIN32 */
291 #endif /* __G_WIN32_REGISTRY_KEY_H__ */