1
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
3
* The contents of this file are subject to the Netscape Public
4
* License Version 1.1 (the "License"); you may not use this file
5
* except in compliance with the License. You may obtain a copy of
6
* the License at http://www.mozilla.org/NPL/
8
* Software distributed under the License is distributed on an "AS
9
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
10
* implied. See the License for the specific language governing
11
* rights and limitations under the License.
13
* The Original Code is Mozilla Communicator client code,
14
* released March 31, 1998.
16
* The Initial Developer of the Original Code is Netscape Communications
17
* Corporation. Portions created by Netscape are
18
* Copyright (C) 1998 Netscape Communications Corporation. All
22
* Daniel Veditz <dveditz@netscape.com>
25
* XP Registry functions (prototype)
33
#ifndef STANDALONE_REGISTRY
37
/* --------------------------------------------------------------------
38
* Miscellaneous Definitions
39
* --------------------------------------------------------------------
41
#define MAGIC_NUMBER 0x76644441L
42
#define MAJOR_VERSION 1 /* major version for incompatible changes */
43
#define MINOR_VERSION 2 /* minor ver for new (compatible) features */
45
#define HDRRESERVE 128 /* number of bytes reserved for hdr */
49
#define PACKBUFFERSIZE 2048
53
#define REGTYPE_KEY (1)
54
#define REGTYPE_DELETED (0x0080)
56
/* Private standard keys */
57
#define ROOTKEY (0x20)
58
#define ROOTKEY_VERSIONS (0x21)
60
/* strings for standard keys */
61
#define ROOTKEY_STR "/"
62
#define ROOTKEY_VERSIONS_STR "Version Registry"
63
#define ROOTKEY_USERS_STR "Users"
64
#define ROOTKEY_COMMON_STR "Common"
65
#define ROOTKEY_PRIVATE_STR "Private Arenas"
67
#define OLD_VERSIONS_STR "ROOTKEY_VERSIONS"
68
#define OLD_USERS_STR "ROOTKEY_USERS"
69
#define OLD_COMMON_STR "ROOTKEY_COMMON"
71
/* needs to be kept in sync with PE. see ns/cmd/winfe/profile.h */
72
/* and ns/cmd/macfe/central/profile.cp */
73
#define ASW_MAGIC_PROFILE_NAME "User1"
76
#define COPYDESC(dest,src) memcpy((dest),(src),sizeof(REGDESC))
78
#define VALID_FILEHANDLE(fh) ((fh) != NULL)
80
#define INVALID_NAME_CHAR(p) ( ((unsigned char)(p) < 0x20) )
82
#define TYPE_IS_ENTRY(type) ( (type) & REGTYPE_ENTRY )
83
#define TYPE_IS_KEY(type) ( !((type) & REGTYPE_ENTRY) )
85
#define VERIFY_HREG(h)\
86
( ((h) == NULL) ? REGERR_PARAM : \
87
( (((REGHANDLE*)(h))->magic == MAGIC_NUMBER) ? REGERR_OK : REGERR_BADMAGIC ) )
91
/* --------------------------------------------------------------------
93
* --------------------------------------------------------------------
96
typedef int32 REGOFF; /* offset into registry file */
100
REGOFF location; /* this object's offset (for verification) */
101
REGOFF name; /* name string */
102
uint16 namelen; /* length of name string (including terminator) */
103
uint16 type; /* node type (key, or entry style) */
104
REGOFF left; /* next object at this level (0 if none) */
105
REGOFF down; /* KEY: first subkey VALUE: 0 */
106
REGOFF value; /* KEY: first entry object VALUE: value string */
107
uint32 valuelen; /* KEY: 0 VALUE: length of value data */
108
uint32 valuebuf; /* KEY: 0 VALUE: length available */
109
REGOFF parent; /* the node on the immediate level above */
112
/* offsets into structure on disk */
113
#define DESC_LOCATION 0
115
#define DESC_NAMELEN 8
119
#define DESC_VALUE 20
120
#define DESC_VALUELEN 24
121
#define DESC_VALUEBUF 16 /* stored in place of "down" for entries */
122
#define DESC_PARENT 28
124
#define DESC_SIZE 32 /* size of desc on disk */
128
uint32 magic; /* must equal MAGIC_NUMBER */
129
uint16 verMajor; /* major version number */
130
uint16 verMinor; /* minor version number */
131
REGOFF avail; /* next available offset */
132
REGOFF root; /* root object */
135
/* offsets into structure on disk*/
137
#define HDR_VERMAJOR 4
138
#define HDR_VERMINOR 6
142
typedef XP_File FILEHANDLE; /* platform-specific file reference */
144
typedef struct _stdnodes {
152
typedef struct _regfile
162
struct _regfile *next;
163
struct _regfile *prev;
164
#ifndef STANDALONE_REGISTRY
170
typedef struct _reghandle
172
uint32 magic; /* for validating reg handles */
173
REGFILE *pReg; /* the real registry file object */