2
* Copyright (c) 2005 Massachusetts Institute of Technology
4
* Permission is hereby granted, free of charge, to any person
5
* obtaining a copy of this software and associated documentation
6
* files (the "Software"), to deal in the Software without
7
* restriction, including without limitation the rights to use, copy,
8
* modify, merge, publish, distribute, sublicense, and/or sell copies
9
* of the Software, and to permit persons to whom the Software is
10
* furnished to do so, subject to the following conditions:
12
* The above copyright notice and this permission notice shall be
13
* included in all copies or substantial portions of the Software.
15
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
19
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
20
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27
#ifndef __KHIMAIRA_KCONFIGINTERNAL_H
28
#define __KHIMAIRA_KCONFIGINTERNAL_H
39
/* TODO: Implement configuration provider interfaces
41
typedef struct kconf_provider_t {
46
typedef struct kconf_conf_space_t {
49
/* kconf_provider * provider; */
51
/* the regpath is the cumulative path starting from a hive root */
54
khm_int32 regkey_user_flags;
56
khm_int32 regkey_machine_flags;
61
const kconf_schema * schema;
64
TDCL(struct kconf_conf_space_t);
67
#define KCONF_SPACE_FLAG_DELETE_U 0x00000040
68
#define KCONF_SPACE_FLAG_DELETE_M 0x00000080
69
#define KCONF_SPACE_FLAG_DELETED 0x00000100
71
typedef struct kconf_conf_handle_t {
74
kconf_conf_space * space;
76
struct kconf_conf_handle_t * lower;
78
LDCL(struct kconf_conf_handle_t);
81
#define KCONF_HANDLE_MAGIC 0x38eb49d2
82
#define khc_is_handle(h) ((h) && ((kconf_handle *)h)->magic == KCONF_HANDLE_MAGIC)
83
#define khc_shadow(h) (((kconf_handle *)h)->lower)
84
#define khc_is_shadowed(h) (khc_is_handle(h) && khc_shadow(h) != NULL)
86
extern kconf_conf_space * conf_root;
87
extern kconf_handle * conf_handles;
88
extern kconf_handle * conf_free_handles;
89
extern CRITICAL_SECTION cs_conf_global;
90
extern LONG conf_init;
91
extern LONG conf_status;
93
#define khc_is_config_running() (conf_init && conf_status)
95
#define CONFIG_REGPATHW L"Software\\MIT\\NetIDMgr"
97
void init_kconf(void);
98
void exit_kconf(void);
100
/* handle operations */
101
#define khc_space_from_handle(h) (((kconf_handle *) h)->space)
102
#define khc_is_schema_handle(h) (((kconf_handle *) h)->flags & KCONF_FLAG_SCHEMA)
103
#define khc_is_user_handle(h) (((kconf_handle *) h)->flags & KCONF_FLAG_USER)
104
#define khc_is_machine_handle(h) (((kconf_handle *) h)->flags & KCONF_FLAG_MACHINE)
105
#define khc_handle_flags(h) (((kconf_handle *) h)->flags)
108
khcint_handle_from_space(kconf_conf_space * s, khm_int32 flags);
111
khcint_handle_free(kconf_handle * h);
114
khcint_create_empty_space(void);
117
khcint_free_space(kconf_conf_space * r);
120
khcint_space_hold(kconf_conf_space * s);
123
khcint_space_release(kconf_conf_space * s);
126
khcint_space_open_key(kconf_conf_space * s, khm_int32 flags);
129
khcint_remove_space(kconf_conf_space * c, khm_int32 flags);