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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef _REGISTRY_REGISTRY_H_
#define _REGISTRY_REGISTRY_H_
#include <stddef.h>
#include <rtl/ustring.h>
#include <registry/regtype.h>
#include <registry/regdllapi.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/** This function creates the specified key.
If the key already exists in the registry, the function opens the key only.
@param hKey identifies a currently open key. The key which will be opened or created by this
function is a subkey of the key identified by hKey.
@param keyName points to a null terminated string specifying the name of a key.
@param phNewKey points to a variable that receives the handle of the opened or created key.
The memory to store this variable will be allocated and will be freed by the function
reg_closeKey. If the function fails, phNewKey is NULL.
@return REG_NO_ERROR if succeeds else an error code.
*/
REG_DLLPUBLIC RegError REGISTRY_CALLTYPE reg_createKey(RegKeyHandle hKey,
rtl_uString* keyName,
RegKeyHandle* phNewKey);
/** This function opens the specified key.
@param hKey identifies a currently open key. The key which will be opened by this function
is a subkey of the key identified by hKey
@param keyName points to a null terminated string specifying the name of a key.
@param phOpenKey points to a variable that receives the handle of the opened key.
The memory to store this variable will be allocated and will be freed by the function
reg_closeKey. If the function fails, phNewKey is NULL.
@return REG_NO_ERROR if succeeds else an error code.
*/
REG_DLLPUBLIC RegError REGISTRY_CALLTYPE reg_openKey(RegKeyHandle hKey,
rtl_uString* keyName,
RegKeyHandle* phOpenKey);
/** This function opens all subkeys of the specified key.
@param hKey identifies a currently open key. The key that subkeys will be opened by this
function is a subkey of the key identified by hKey
@param keyName points to a null terminated string specifying the name of a key whose subkeys
will be opened.
@param pphSubKeys points to a variable that receives an array of all opened subkeys.
The memory to store this variable will be allocated and will be freed by the function
reg_closeSubKeys. If the function fails, pphSubKeys is NULL.
@param pnSubKeys specifies the length of the array (the number of open subkeys).
@return REG_NO_ERROR if succeeds else an error code.
*/
REG_DLLPUBLIC RegError REGISTRY_CALLTYPE reg_openSubKeys(RegKeyHandle hKey,
rtl_uString* keyName,
RegKeyHandle** pphSubKeys,
sal_uInt32* pnSubKeys);
/** This function closes all subkeys specified in the array.
@param phSubKeys points to a variable that containss an array of all opened subkeys.
The allocated memory of pphSubKeys and all open subkeys will be freed.
@param nSubKeys specifies the length of the array (the number of subkeys to closed).
@return REG_NO_ERROR if succeeds else an error code.
*/
REG_DLLPUBLIC RegError REGISTRY_CALLTYPE reg_closeSubKeys(RegKeyHandle* phSubKeys,
sal_uInt32 nSubKeys);
/** This function deletes the specified key.
@param hKey identifies a currently open key. The key deleted by this function
is a subkey of the key identified by hKey
@param keyName points to a null terminated string specifying the name of a key which will
be deleted.
@return REG_NO_ERROR if succeeds else an error code.
*/
REG_DLLPUBLIC RegError REGISTRY_CALLTYPE reg_deleteKey(RegKeyHandle hKey,
rtl_uString* keyName);
/** This function closes the specified key.
@param hKey identifies a currently open key which will be closed by this function.
The memory of the variable specifying the key will be freed.
@return REG_NO_ERROR if succeeds else an error code.
*/
REG_DLLPUBLIC RegError REGISTRY_CALLTYPE reg_closeKey(RegKeyHandle hKey);
/** This function returns the name of a key.
@param hKey identifies a currently open key which name will be returned.
@param pKeyName contains the keyname if succeeds else an empty string.
*/
REG_DLLPUBLIC RegError REGISTRY_CALLTYPE reg_getKeyName(RegKeyHandle hKey, rtl_uString** pKeyName);
/** This function sets a value of a key.
@param hKey identifies a currently open key. The key which value will be set by this
function is a subkey of the key identified by hKey.
@param keyName points to a null terminated string specifying the name of a key which value
will be set. If keyName is NULL, then the value of the key specified by
hKey will be set.
@param valueType specifies the type of the value.
@param pData points to a memory block containing the data of the value.
@param valueSize specifies the size of pData in bytes
@return REG_NO_ERROR if succeeds else an error code.
*/
REG_DLLPUBLIC RegError REGISTRY_CALLTYPE reg_setValue(RegKeyHandle hKey,
rtl_uString* keyName,
RegValueType valueType,
RegValue pData,
sal_uInt32 valueSize);
/** This function sets an long list value of a key.
@param[in] hKey identifies a currently open key. The key which value will be set by this
function is a subkey of the key identified by hKey.
@param[in] keyName points to a null terminated string specifying the name of a key which value
will be set. If keyName is NULL, then the value of the key specified by
hKey will be set.
@param[out] pValueList points to an array of longs containing the data of the value.
@param[out] len specifies the len of pValueList.
@return REG_NO_ERROR if succeeds else an error code.
*/
REG_DLLPUBLIC RegError REGISTRY_CALLTYPE reg_setLongListValue(RegKeyHandle hKey,
rtl_uString* keyName,
sal_Int32* pValueList,
sal_uInt32 len);
/** This function sets an ascii list value of a key.
@param[in] hKey identifies a currently open key. The key which value will be set by this
function is a subkey of the key identified by hKey.
@param[in] keyName points to a null terminated string specifying the name of a key which value
will be set. If keyName is NULL, then the value of the key specified by
hKey will be set.
@param[in] pValueList points to an array of sal_Char* containing the data of the value.
@param[in] len specifies the len of pValueList.
@return REG_NO_ERROR if succeeds else an error code.
*/
REG_DLLPUBLIC RegError REGISTRY_CALLTYPE reg_setStringListValue(RegKeyHandle hKey,
rtl_uString* keyName,
sal_Char** pValueList,
sal_uInt32 len);
/** This function sets an unicode string list value of a key.
@param[in] hKey identifies a currently open key. The key which value will be set by this
function is a subkey of the key identified by hKey.
@param[in] keyName points to a null terminated string specifying the name of a key which value
will be set. If keyName is NULL, then the value of the key specified by
hKey will be set.
@param[in] pValueList points to an array of sal_Unicode* containing the data of the value.
@param[in] len specifies the len of pValueList.
@return REG_NO_ERROR if succeeds else an error code.
*/
REG_DLLPUBLIC RegError REGISTRY_CALLTYPE reg_setUnicodeListValue(RegKeyHandle hKey,
rtl_uString* keyName,
sal_Unicode** pValueList,
sal_uInt32 len);
/** This function gets info about type and size of a key value.
@param hKey identifies a currently open key. The key which value info will be got by this
function is a subkey of the key identified by hKey.
@param keyName points to a null terminated string specifying the name of a key which value
will be got. If keyName is NULL, then the value info of the key specified by
hKey will be got.
@param pValueType returns the type of the value.
@param pValueSize returns the size of the value in bytes
@return REG_NO_ERROR if succeeds else an error code.
*/
REG_DLLPUBLIC RegError REGISTRY_CALLTYPE reg_getValueInfo(RegKeyHandle hKey,
rtl_uString* keyName,
RegValueType* pValueType,
sal_uInt32* pValueSize);
/** This function gets the value of a key.
@param hKey identifies a currently open key. The key which value will be got by this
function is a subkey of the key identified by hKey.
@param keyName points to a null terminated string specifying the name of a key which value
will be got. If keyName is NULL, then the value of the key specified by
hKey will be got.
@param pData points to an allocated memory block receiving the data of the value.
@return REG_NO_ERROR if succeeds else an error code.
*/
REG_DLLPUBLIC RegError REGISTRY_CALLTYPE reg_getValue(RegKeyHandle hKey,
rtl_uString* keyName,
RegValue pData);
/** This function gets the long list value of a key.
@param[in] hKey identifies a currently open key. The key which value will be got by this
function is a subkey of the key identified by hKey.
@param[in] keyName points to a null terminated string specifying the name of a key which value
will be got. If keyName is NULL, then the value of the key specified by
hKey will be got.
@param[out] pValueList a Pointer to a long value list which returns the data of the value.
@param[out] pLen returns the length of the value list.
@return REG_NO_ERROR if succeeds else an error code.
*/
REG_DLLPUBLIC RegError REGISTRY_CALLTYPE reg_getLongListValue(RegKeyHandle hKey,
rtl_uString* keyName,
sal_Int32** pValueList,
sal_uInt32* pLen);
/** This function gets the string list value of a key.
@param[in] hKey identifies a currently open key. The key whose value will be retrived by this
function is a subkey of the key identified by hKey.
@param[in] keyName points to a null terminated string specifying the name of a key whose value
will be retrived. If keyName is NULL, then the value of the key specified by
hKey will be retrived.
@param[out] pValueList a Pointer to an ascii value list which returns the data of the value.
@param[out] pLen returns the length of the value list.
@return REG_NO_ERROR if succeeds else an error code.
*/
REG_DLLPUBLIC RegError REGISTRY_CALLTYPE reg_getStringListValue(RegKeyHandle hKey,
rtl_uString* keyName,
sal_Char*** pValueList,
sal_uInt32* pLen);
/** This function gets the unicode list value of a key.
@param[in] hKey identifies a currently open key. The key whose value will be retrived by this
function is a subkey of the key identified by hKey.
@param[in] keyName points to a null terminated string specifying the name of a key whose value
will be retrived. If keyName is NULL, then the value of the key specified by
hKey will be retrived.
@param[out] pValueList a Pointer to an unicode value list which returns the data of the value.
@param[out] pLen returns the length of the value list.
@return REG_NO_ERROR if succeeds else an error code.
*/
REG_DLLPUBLIC RegError REGISTRY_CALLTYPE reg_getUnicodeListValue(RegKeyHandle hKey,
rtl_uString* keyName,
sal_Unicode*** pValueList,
sal_uInt32* pLen);
/** This function frees the memory of a value list.
@param valueType specifies the type of the list values.
@param pValueList a Pointer to the value list.
@param len specifies the length of the value list.
@return REG_NO_ERROR if succeeds else an error code.
*/
REG_DLLPUBLIC RegError REGISTRY_CALLTYPE reg_freeValueList(RegValueType valueType,
RegValue pValueList,
sal_uInt32 len);
/** This function returns the type of a key.
The registry differentiates two possible types:
- RG_KEYTYPE represents a real key
- RG_LINKTYPE used to represent a link (no longer used)
@param[in] hKey identifies a currently open key. The key specified by keyName is a subkey
of the key identified by hKey.
@param[in] keyName points to a null terminated string specifying the name of the key which keytype
will be returned.
@param[out] pKeyType returns the type of the key.
@return REG_NO_ERROR if succeeds else an error code.
*/
REG_DLLPUBLIC RegError REGISTRY_CALLTYPE reg_getKeyType(RegKeyHandle hKey,
rtl_uString* keyName,
RegKeyType* pKeyType);
/** This function resolves a keyname.
@param[in] hKey identifies a currently open key. The key specified by keyName is a subkey
of the key identified by hKey.
@param[in] keyName points to a null terminated string specifying the relativ name of a key.
The name of hKey together with keyName will be generated.
@param[in] firstLinkOnly ignored
@param[out] pResolvedName returns the resolved keyName.
@return REG_NO_ERROR if succeeds else an error code.
*/
REG_DLLPUBLIC RegError REGISTRY_CALLTYPE reg_getResolvedKeyName(RegKeyHandle hKey,
rtl_uString* keyName,
sal_Bool firstLinkOnly,
rtl_uString** pResolvedName);
/** This function loads registry information from a file and save it under the
specified keyName.
@param hKey identifies a currently open key. The key which should store the registry information
is a subkey of this key.
@param keyName points to a null terminated string specifying the name of the key which stores the
registry information. If keyName is NULL the registry information will be saved under
the key specified by hKey.
@param regFileName points to a null terminated string specifying the file which conains the
registry information.
@return REG_NO_ERROR if succeeds else an error code.
*/
REG_DLLPUBLIC RegError REGISTRY_CALLTYPE reg_loadKey(RegKeyHandle hKey,
rtl_uString* keyName,
rtl_uString* regFileName);
/** This function saves the registry information under a specified key and all of its subkeys and save
it in a registry file.
@param hKey identifies a currently open key. The key which information is saved by this
function is a subkey of the key identified by hKey.
@param keyName points to a null terminated string specifying the name of the subkey.
If keyName is NULL the registry information under the key specified by hKey
will be saved in the specified file.
@param regFileName points to a null terminated string specifying the file which will contain the
registry information.
@return REG_NO_ERROR if succeeds else an error code.
*/
REG_DLLPUBLIC RegError REGISTRY_CALLTYPE reg_saveKey(RegKeyHandle hKey,
rtl_uString* keyName,
rtl_uString* regFileName);
/** This function merges the registry information from a specified source with the information of the
currently open registry.
All existing keys will be extended and existing key values will be overwritten.
@param hKey identifies a currently open key. The key which information is merged by this
function is a subkey of the key identified by hKey.
@param keyName points to a null terminated string specifying the name of the key which will be merged.
If keyName is NULL the registry information under the key specified by hKey
is merged with the complete information from the specified file.
@param regFileName points to a null terminated string specifying the file containing the
registry information.
@param bWarnings if TRUE the function returns an error if a key already exists.
@param bReport if TRUE the function reports warnings on stdout if a key already exists.
@return REG_NO_ERROR if succeeds else an error code.
*/
REG_DLLPUBLIC RegError REGISTRY_CALLTYPE reg_mergeKey(RegKeyHandle hKey,
rtl_uString* keyName,
rtl_uString* regFileName,
sal_Bool bWarnings,
sal_Bool bReport);
/** This function creates a new registry with the specified name and creates a root key.
@param registryName points to a null terminated string specifying the name of the new registry.
@param phRegistry points to a handle of the new registry if the function succeeds otherwise NULL.
@return REG_NO_ERROR if succeeds else an error code.
*/
REG_DLLPUBLIC RegError REGISTRY_CALLTYPE reg_createRegistry(rtl_uString* registryName,
RegHandle* phRegistry);
/** This function opens the root key of a registry.
@param hRegistry identifies a currently open registry whose rootKey will be returned.
@param phRootKey points to a handle of the open root key if the function succeeds otherwise NULL.
@return REG_NO_ERROR if succeeds else an error code.
*/
REG_DLLPUBLIC RegError REGISTRY_CALLTYPE reg_openRootKey(RegHandle hRegistry,
RegKeyHandle* phRootKey);
/** This function returns the name of a registry.
@param hRegistry identifies a currently open registry whose name will be returned.
@param pName returns the name of the registry if the function succeeds otherwise an empty string.
@return REG_NO_ERROR if succeeds else an error code.
*/
REG_DLLPUBLIC RegError REGISTRY_CALLTYPE reg_getName(RegHandle hRegistry, rtl_uString** pName);
/** This function returns the access mode of the registry.
@param hReg identifies a currently open registry.
@return TRUE if accessmode is read only else FALSE.
*/
REG_DLLPUBLIC sal_Bool REGISTRY_CALLTYPE reg_isReadOnly(RegHandle hReg);
/** This function opens a registry with the specified name.
@param registryName points to a null terminated string specifying the name of the registry.
@param phRegistry points to a hanle of the opened registry if the function succeeds otherwise NULL.
@param accessMode specifies the accessmode of the registry, REG_READONLY or REG_READWRITE.
@return REG_NO_ERROR if succeeds else an error code.
*/
REG_DLLPUBLIC RegError REGISTRY_CALLTYPE reg_openRegistry(rtl_uString* registryName,
RegHandle* phRegistry,
RegAccessMode accessMode);
/** This function closes a registry.
@param hRegistry identifies a currently open registry which should be closed.
@return REG_NO_ERROR if succeeds else an error code.
*/
REG_DLLPUBLIC RegError REGISTRY_CALLTYPE reg_closeRegistry(RegHandle hRegistry);
/** This function destroys a registry.
@param hRegistry identifies a currently open registry.
@param registryName specifies a registry name of a registry which should be destroyed. If the
name is NULL the registry itselfs will be destroyed.
@return REG_NO_ERROR if succeeds else an error code.
*/
REG_DLLPUBLIC RegError REGISTRY_CALLTYPE reg_destroyRegistry(RegHandle hRegistry,
rtl_uString* registryName);
/** This function reports the complete registry information of a key and all of its subkeys.
All information which are available (keynames, value types, values, ...)
will be printed to stdout for report issues only.
@param hKey identifies a currently open key which content will be reported.
@return REG_NO_ERROR if succeeds else an error code.
*/
REG_DLLPUBLIC RegError REGISTRY_CALLTYPE reg_dumpRegistry(RegKeyHandle hKey);
#ifdef __cplusplus
}
#endif
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|