ReactOS 0.4.16-dev-297-gc569aee
regproc.c File Reference
#include <errno.h>
#include <fcntl.h>
#include <io.h>
#include <windows.h>
#include <commctrl.h>
#include "main.h"
Include dependency graph for regproc.c:

Go to the source code of this file.

Classes

struct  parser
 

Macros

#define REG_VAL_BUF_SIZE   4096
 
#define MAX_HEX_CHARS   77
 
#define MAX_SUBKEY_LEN   257
 

Typedefs

typedef WCHAR *(* parser_state_func) (struct parser *parser, WCHAR *pos)
 

Enumerations

enum  parser_state {
  HEADER , PARSE_WIN31_LINE , LINE_START , KEY_NAME ,
  DELETE_KEY , DEFAULT_VALUE_NAME , QUOTED_VALUE_NAME , DATA_START ,
  DELETE_VALUE , DATA_TYPE , STRING_DATA , DWORD_DATA ,
  HEX_DATA , EOL_BACKSLASH , HEX_MULTILINE , UNKNOWN_DATA ,
  SET_VALUE , NB_PARSER_STATES , HEADER , PARSE_WIN31_LINE ,
  LINE_START , KEY_NAME , DELETE_KEY , DEFAULT_VALUE_NAME ,
  QUOTED_VALUE_NAME , DATA_START , DELETE_VALUE , DATA_TYPE ,
  STRING_DATA , DWORD_DATA , HEX_DATA , EOL_BACKSLASH ,
  HEX_MULTILINE , UNKNOWN_DATA , SET_VALUE , NB_PARSER_STATES ,
  LINE_START , SECTION_NAME , KEY_NAME , VALUE_NAME ,
  EOL_BACKSLASH , QUOTES , LEADING_SPACES , TRAILING_SPACES ,
  COMMENT , NB_PARSER_STATES , LINE_START , SECTION_NAME ,
  KEY_NAME , VALUE_NAME , EOL_BACKSLASH , QUOTES ,
  LEADING_SPACES , TRAILING_SPACES , COMMENT , NB_PARSER_STATES ,
  LINE_START , SECTION_NAME , KEY_NAME , VALUE_NAME ,
  EOL_BACKSLASH , QUOTES , LEADING_SPACES , TRAILING_SPACES ,
  COMMENT , NB_PARSER_STATES
}
 
enum  reg_versions {
  REG_VERSION_31 , REG_VERSION_40 , REG_VERSION_50 , REG_VERSION_FUZZY ,
  REG_VERSION_INVALID , REG_VERSION_31 , REG_VERSION_40 , REG_VERSION_50 ,
  REG_VERSION_FUZZY , REG_VERSION_INVALID
}
 

Functions

static WCHARGetWideString (const char *strA)
 
static WCHARGetWideStringN (const char *strA, int chars, DWORD *len)
 
charGetMultiByteString (const WCHAR *strW)
 
static charGetMultiByteStringN (const WCHAR *strW, int chars, DWORD *len)
 
static WCHARheader_state (struct parser *parser, WCHAR *pos)
 
static WCHARparse_win31_line_state (struct parser *parser, WCHAR *pos)
 
static WCHARline_start_state (struct parser *parser, WCHAR *pos)
 
static WCHARkey_name_state (struct parser *parser, WCHAR *pos)
 
static WCHARdelete_key_state (struct parser *parser, WCHAR *pos)
 
static WCHARdefault_value_name_state (struct parser *parser, WCHAR *pos)
 
static WCHARquoted_value_name_state (struct parser *parser, WCHAR *pos)
 
static WCHARdata_start_state (struct parser *parser, WCHAR *pos)
 
static WCHARdelete_value_state (struct parser *parser, WCHAR *pos)
 
static WCHARdata_type_state (struct parser *parser, WCHAR *pos)
 
static WCHARstring_data_state (struct parser *parser, WCHAR *pos)
 
static WCHARdword_data_state (struct parser *parser, WCHAR *pos)
 
static WCHARhex_data_state (struct parser *parser, WCHAR *pos)
 
static WCHAReol_backslash_state (struct parser *parser, WCHAR *pos)
 
static WCHARhex_multiline_state (struct parser *parser, WCHAR *pos)
 
static WCHARunknown_data_state (struct parser *parser, WCHAR *pos)
 
static WCHARset_value_state (struct parser *parser, WCHAR *pos)
 
static enum parser_state set_state (struct parser *parser, enum parser_state state)
 
static BOOL convert_hex_to_dword (WCHAR *str, DWORD *dw)
 
static BOOL convert_hex_csv_to_hex (struct parser *parser, WCHAR **str)
 
static BOOL parse_data_type (struct parser *parser, WCHAR **line)
 
static BOOL REGPROC_unescape_string (WCHAR *str, WCHAR **unparsed)
 
static HKEY parse_key_name (WCHAR *key_name, WCHAR **key_path)
 
static void close_key (struct parser *parser)
 
static LONG open_key (struct parser *parser, WCHAR *path)
 
static void free_parser_data (struct parser *parser)
 
static void prepare_hex_string_data (struct parser *parser)
 
static enum reg_versions parse_file_header (const WCHAR *s)
 
static WCHARget_lineA (FILE *fp)
 
static WCHARget_lineW (FILE *fp)
 
BOOL import_registry_file (FILE *reg_file)
 
void delete_registry_key (WCHAR *reg_key_name)
 
static void REGPROC_write_line (FILE *fp, const WCHAR *str, BOOL unicode)
 
static WCHARREGPROC_escape_string (WCHAR *str, size_t str_len, size_t *line_len)
 
static size_t export_value_name (FILE *fp, WCHAR *name, size_t len, BOOL unicode)
 
static void export_string_data (WCHAR **buf, WCHAR *data, size_t size)
 
static void export_dword_data (WCHAR **buf, DWORD *data)
 
static size_t export_hex_data_type (FILE *fp, DWORD type, BOOL unicode)
 
static void export_hex_data (FILE *fp, WCHAR **buf, DWORD type, DWORD line_len, void *data, DWORD size, BOOL unicode)
 
static void export_newline (FILE *fp, BOOL unicode)
 
static void export_data (FILE *fp, WCHAR *value_name, DWORD value_len, DWORD type, void *data, size_t size, BOOL unicode)
 
static WCHARbuild_subkey_path (WCHAR *path, DWORD path_len, WCHAR *subkey_name, DWORD subkey_len)
 
static void export_key_name (FILE *fp, WCHAR *name, BOOL unicode)
 
static void export_registry_data (FILE *fp, HKEY key, WCHAR *path, BOOL unicode)
 
static FILEREGPROC_open_export_file (WCHAR *file_name, BOOL unicode)
 
static HKEY open_export_key (HKEY key_class, WCHAR *subkey, WCHAR *path)
 
static BOOL export_key (WCHAR *file_name, WCHAR *path, BOOL unicode)
 
static BOOL export_all (WCHAR *file_name, WCHAR *path, BOOL unicode)
 
BOOL export_registry_key (WCHAR *file_name, WCHAR *path, DWORD format)
 

Variables

static HKEY reg_class_keys []
 
static WCHAR *(* get_line )(FILE *)
 
static const parser_state_func parser_funcs [NB_PARSER_STATES]
 

Macro Definition Documentation

◆ MAX_HEX_CHARS

#define MAX_HEX_CHARS   77

Definition at line 1269 of file regproc.c.

◆ MAX_SUBKEY_LEN

#define MAX_SUBKEY_LEN   257

Definition at line 1378 of file regproc.c.

◆ REG_VAL_BUF_SIZE

#define REG_VAL_BUF_SIZE   4096

Definition at line 25 of file regproc.c.

Typedef Documentation

◆ parser_state_func

typedef WCHAR *(* parser_state_func) (struct parser *parser, WCHAR *pos)

Definition at line 148 of file regproc.c.

Enumeration Type Documentation

◆ parser_state

Enumerator
HEADER 
PARSE_WIN31_LINE 
LINE_START 
KEY_NAME 
DELETE_KEY 
DEFAULT_VALUE_NAME 
QUOTED_VALUE_NAME 
DATA_START 
DELETE_VALUE 
DATA_TYPE 
STRING_DATA 
DWORD_DATA 
HEX_DATA 
EOL_BACKSLASH 
HEX_MULTILINE 
UNKNOWN_DATA 
SET_VALUE 
NB_PARSER_STATES 
HEADER 
PARSE_WIN31_LINE 
LINE_START 
KEY_NAME 
DELETE_KEY 
DEFAULT_VALUE_NAME 
QUOTED_VALUE_NAME 
DATA_START 
DELETE_VALUE 
DATA_TYPE 
STRING_DATA 
DWORD_DATA 
HEX_DATA 
EOL_BACKSLASH 
HEX_MULTILINE 
UNKNOWN_DATA 
SET_VALUE 
NB_PARSER_STATES 
LINE_START 
SECTION_NAME 
KEY_NAME 
VALUE_NAME 
EOL_BACKSLASH 
QUOTES 
LEADING_SPACES 
TRAILING_SPACES 
COMMENT 
NB_PARSER_STATES 
LINE_START 
SECTION_NAME 
KEY_NAME 
VALUE_NAME 
EOL_BACKSLASH 
QUOTES 
LEADING_SPACES 
TRAILING_SPACES 
COMMENT 
NB_PARSER_STATES 
LINE_START 
SECTION_NAME 
KEY_NAME 
VALUE_NAME 
EOL_BACKSLASH 
QUOTES 
LEADING_SPACES 
TRAILING_SPACES 
COMMENT 
NB_PARSER_STATES 

Definition at line 109 of file regproc.c.

110{
111 HEADER, /* parsing the registry file version header */
112 PARSE_WIN31_LINE, /* parsing a Windows 3.1 registry line */
113 LINE_START, /* at the beginning of a registry line */
114 KEY_NAME, /* parsing a key name */
115 DELETE_KEY, /* deleting a registry key */
116 DEFAULT_VALUE_NAME, /* parsing a default value name */
117 QUOTED_VALUE_NAME, /* parsing a double-quoted value name */
118 DATA_START, /* preparing for data parsing operations */
119 DELETE_VALUE, /* deleting a registry value */
120 DATA_TYPE, /* parsing the registry data type */
121 STRING_DATA, /* parsing REG_SZ data */
122 DWORD_DATA, /* parsing DWORD data */
123 HEX_DATA, /* parsing REG_BINARY, REG_NONE, REG_EXPAND_SZ or REG_MULTI_SZ data */
124 EOL_BACKSLASH, /* preparing to parse multiple lines of hex data */
125 HEX_MULTILINE, /* parsing multiple lines of hex data */
126 UNKNOWN_DATA, /* parsing an unhandled or invalid data type */
127 SET_VALUE, /* adding a value to the registry */
129};
@ PARSE_WIN31_LINE
Definition: regproc.c:112
@ HEX_DATA
Definition: regproc.c:123
@ DEFAULT_VALUE_NAME
Definition: regproc.c:116
@ HEADER
Definition: regproc.c:111
@ NB_PARSER_STATES
Definition: regproc.c:128
@ STRING_DATA
Definition: regproc.c:121
@ QUOTED_VALUE_NAME
Definition: regproc.c:117
@ DATA_TYPE
Definition: regproc.c:120
@ HEX_MULTILINE
Definition: regproc.c:125
@ UNKNOWN_DATA
Definition: regproc.c:126
@ LINE_START
Definition: regproc.c:113
@ EOL_BACKSLASH
Definition: regproc.c:124
@ SET_VALUE
Definition: regproc.c:127
@ DELETE_VALUE
Definition: regproc.c:119
@ DWORD_DATA
Definition: regproc.c:122
@ KEY_NAME
Definition: regproc.c:114
@ DATA_START
Definition: regproc.c:118
@ DELETE_KEY
Definition: regproc.c:115

◆ reg_versions

Enumerator
REG_VERSION_31 
REG_VERSION_40 
REG_VERSION_50 
REG_VERSION_FUZZY 
REG_VERSION_INVALID 
REG_VERSION_31 
REG_VERSION_40 
REG_VERSION_50 
REG_VERSION_FUZZY 
REG_VERSION_INVALID 

Definition at line 504 of file regproc.c.

504 {
510};
@ REG_VERSION_50
Definition: regproc.c:507
@ REG_VERSION_INVALID
Definition: regproc.c:509
@ REG_VERSION_40
Definition: regproc.c:506
@ REG_VERSION_FUZZY
Definition: regproc.c:508
@ REG_VERSION_31
Definition: regproc.c:505

Function Documentation

◆ build_subkey_path()

static WCHAR * build_subkey_path ( WCHAR path,
DWORD  path_len,
WCHAR subkey_name,
DWORD  subkey_len 
)
static

Definition at line 1350 of file regproc.c.

1351{
1352 WCHAR *subkey_path;
1353
1354 subkey_path = malloc((path_len + subkey_len + 2) * sizeof(WCHAR));
1355#ifdef __REACTOS__
1356 StringCchPrintfW(subkey_path, path_len + subkey_len + 2, L"%s\\%s", path, subkey_name);
1357#else
1358 swprintf(subkey_path, path_len + subkey_len + 2, L"%s\\%s", path, subkey_name);
1359#endif
1360
1361 return subkey_path;
1362}
#define malloc
Definition: debug_ros.c:4
#define swprintf
Definition: precomp.h:40
static DWORD path_len
Definition: batch.c:31
#define L(x)
Definition: ntvdm.h:50
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:530
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by export_registry_data().

◆ close_key()

static void close_key ( struct parser parser)
static

Definition at line 420 of file regproc.c.

421{
422 if (parser->hkey)
423 {
426
428 parser->hkey = NULL;
429 }
430}
#define RegCloseKey(hKey)
Definition: registry.h:49
#define free
Definition: debug_ros.c:5
#define NULL
Definition: types.h:112
Definition: import.c:81
HKEY hkey
Definition: import.c:87
WCHAR * key_name
Definition: import.c:88

◆ convert_hex_csv_to_hex()

static BOOL convert_hex_csv_to_hex ( struct parser parser,
WCHAR **  str 
)
static

Definition at line 235 of file regproc.c.

236{
237 size_t size;
238 BYTE *d;
239 WCHAR *s;
240
242
243 /* The worst case is 1 digit + 1 comma per byte */
244 size = ((lstrlenW(*str) + 1) / 2) + parser->data_size;
246
247 s = *str;
248 d = (BYTE *)parser->data + parser->data_size;
249
250 while (*s)
251 {
252 WCHAR *end;
253 unsigned long wc;
254
255 wc = wcstoul(s, &end, 16);
256 if (wc > 0xff) return FALSE;
257
258 if (s == end && wc == 0)
259 {
260 while (*end == ' ' || *end == '\t') end++;
261 if (*end == '\\')
262 {
264 *str = end + 1;
265 return TRUE;
266 }
267 else if (*end == ';')
268 return TRUE;
269 return FALSE;
270 }
271
272 *d++ = wc;
273 parser->data_size++;
274
275 if (*end && *end != ',')
276 {
277 while (*end == ' ' || *end == '\t') end++;
278 if (*end && *end != ';') return FALSE;
279 return TRUE;
280 }
281
282 if (*end) end++;
283 s = end;
284 }
285
286 return TRUE;
287}
while(CdLookupNextInitialFileDirent(IrpContext, Fcb, FileContext))
#define realloc
Definition: debug_ros.c:6
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define lstrlenW
Definition: compat.h:750
GLdouble s
Definition: gl.h:2039
GLuint GLuint end
Definition: gl.h:1545
GLsizeiptr size
Definition: glext.h:5919
_Check_return_ unsigned long __cdecl wcstoul(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
#define d
Definition: ke_i.h:81
const WCHAR * str
BOOL backslash
Definition: import.c:94
DWORD data_size
Definition: import.c:93
void * data
Definition: import.c:92
unsigned char BYTE
Definition: xxhash.c:193

Referenced by hex_data_state().

◆ convert_hex_to_dword()

static BOOL convert_hex_to_dword ( WCHAR str,
DWORD dw 
)
static

Definition at line 201 of file regproc.c.

202{
203 WCHAR *p, *end;
204 int count = 0;
205
206 while (*str == ' ' || *str == '\t') str++;
207 if (!*str) goto error;
208
209 p = str;
210 while (iswxdigit(*p))
211 {
212 count++;
213 p++;
214 }
215 if (count > 8) goto error;
216
217 end = p;
218 while (*p == ' ' || *p == '\t') p++;
219 if (*p && *p != ';') goto error;
220
221 *end = 0;
222 *dw = wcstoul(str, &end, 16);
223 return TRUE;
224
225error:
226 return FALSE;
227}
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLfloat GLfloat p
Definition: glext.h:8902
#define iswxdigit(_c)
Definition: ctype.h:668
REFIID LPVOID DWORD_PTR dw
Definition: atlbase.h:40
#define error(str)
Definition: mkdosfs.c:1605

Referenced by dword_data_state().

◆ data_start_state()

static WCHAR * data_start_state ( struct parser parser,
WCHAR pos 
)
static

Definition at line 716 of file regproc.c.

717{
718 WCHAR *p = pos;
719 unsigned int len;
720
721 while (*p == ' ' || *p == '\t') p++;
722 if (*p != '=') goto done;
723 p++;
724 while (*p == ' ' || *p == '\t') p++;
725
726 /* trim trailing whitespace */
727 len = lstrlenW(p);
728 while (len > 0 && (p[len - 1] == ' ' || p[len - 1] == '\t')) len--;
729 p[len] = 0;
730
731 if (*p == '-')
733 else
735 return p;
736
737done:
739 return p;
740}
static enum parser_state set_state(struct parser *parser, enum parser_state state)
Definition: regproc.c:191
GLenum GLsizei len
Definition: glext.h:6722

◆ data_type_state()

static WCHAR * data_type_state ( struct parser parser,
WCHAR pos 
)
static

Definition at line 758 of file regproc.c.

759{
760 WCHAR *line = pos;
761
763 {
765 return line;
766 }
767
768 switch (parser->parse_type)
769 {
770 case REG_SZ:
772 break;
773 case REG_DWORD:
775 break;
776 case REG_BINARY: /* all hex data types, including undefined */
778 break;
779 default:
781 }
782
783 return line;
784}
static BOOL parse_data_type(struct parser *parser, WCHAR **line)
Definition: regproc.c:295
#define REG_SZ
Definition: layer.c:22
#define REG_BINARY
Definition: nt_native.h:1496
#define REG_DWORD
Definition: sdbapi.c:596
Definition: parser.c:49
DWORD parse_type
Definition: import.c:90

◆ default_value_name_state()

static WCHAR * default_value_name_state ( struct parser parser,
WCHAR pos 
)
static

Definition at line 683 of file regproc.c.

684{
687
689 return pos + 1;
690}
WCHAR * value_name
Definition: import.c:89

◆ delete_key_state()

static WCHAR * delete_key_state ( struct parser parser,
WCHAR pos 
)
static

Definition at line 669 of file regproc.c.

670{
671 WCHAR *p = pos;
672
674
675 if (*p == 'H' || *p == 'h')
677
679 return p;
680}
void delete_registry_key(WCHAR *reg_key_name)
Definition: regproc.c:1089
#define close_key(k)
Definition: reg_test.h:52

◆ delete_registry_key()

void delete_registry_key ( WCHAR reg_key_name)

Definition at line 1089 of file regproc.c.

1090{
1091 WCHAR *key_name = NULL;
1092 HKEY key_class;
1093
1094 if (!reg_key_name || !reg_key_name[0])
1095 return;
1096
1097 if (!(key_class = parse_key_name(reg_key_name, &key_name)))
1098 {
1099 if (key_name) *(key_name - 1) = 0;
1100#ifdef __REACTOS__
1102 return;
1103#else
1105#endif
1106 }
1107
1108 if (!key_name || !*key_name)
1109#ifdef __REACTOS__
1110 {
1111 output_message(STRING_DELETE_FAILED, reg_key_name);
1112 return;
1113 }
1114#else
1115 error_exit(STRING_DELETE_FAILED, reg_key_name);
1116#endif
1117
1118#ifdef __REACTOS__
1119 SHDeleteKey(key_class, key_name);
1120#else
1121 RegDeleteTreeW(key_class, key_name);
1122#endif
1123}
void WINAPIV output_message(unsigned int id,...)
Definition: reg.c:92
#define STRING_INVALID_SYSTEM_KEY
Definition: resource.h:54
void WINAPIV error_exit(unsigned int id,...)
Definition: regedit.c:88
static HKEY parse_key_name(WCHAR *key_name, WCHAR **key_path)
Definition: regproc.c:394
#define STRING_DELETE_FAILED
Definition: resource.h:345
LSTATUS WINAPI RegDeleteTreeW(_In_ HKEY, _In_opt_ LPCWSTR)
#define SHDeleteKey
Definition: shlwapi.h:44

Referenced by delete_key_state(), and PerformRegAction().

◆ delete_value_state()

static WCHAR * delete_value_state ( struct parser parser,
WCHAR pos 
)
static

Definition at line 743 of file regproc.c.

744{
745 WCHAR *p = pos + 1;
746
747 while (*p == ' ' || *p == '\t') p++;
748 if (*p && *p != ';') goto done;
749
751
752done:
754 return p;
755}
LONG WINAPI RegDeleteValueW(HKEY hKey, LPCWSTR lpValueName)
Definition: reg.c:2330

◆ dword_data_state()

static WCHAR * dword_data_state ( struct parser parser,
WCHAR pos 
)
static

Definition at line 811 of file regproc.c.

812{
813 WCHAR *line = pos;
814
815 parser->data = malloc(sizeof(DWORD));
816
818 goto invalid;
819
820 parser->data_size = sizeof(DWORD);
821
823 return line;
824
825invalid:
828 return line;
829}
static BOOL convert_hex_to_dword(WCHAR *str, DWORD *dw)
Definition: regproc.c:201
static void free_parser_data(struct parser *parser)
Definition: regproc.c:462
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR invalid[]
Definition: assoc.c:39
#define DWORD
Definition: nt_native.h:44

◆ eol_backslash_state()

static WCHAR * eol_backslash_state ( struct parser parser,
WCHAR pos 
)
static

Definition at line 861 of file regproc.c.

862{
863 WCHAR *p = pos;
864
865 while (*p == ' ' || *p == '\t') p++;
866 if (*p && *p != ';') goto invalid;
867
869 return pos;
870
871invalid:
874 return p;
875}

◆ export_all()

static BOOL export_all ( WCHAR file_name,
WCHAR path,
BOOL  unicode 
)
static

Definition at line 1530 of file regproc.c.

1531{
1532 FILE *fp;
1533 int i;
1534 HKEY classes[] = {HKEY_LOCAL_MACHINE, HKEY_USERS}, key;
1535 WCHAR *class_name;
1536
1537 fp = REGPROC_open_export_file(file_name, unicode);
1538#ifdef __REACTOS__
1539 if (!fp)
1540 return TRUE; /* Error message is already displayed */
1541#endif
1542
1543 for (i = 0; i < ARRAY_SIZE(classes); i++)
1544 {
1545 if (!(key = open_export_key(classes[i], NULL, path)))
1546 {
1547 fclose(fp);
1548 return FALSE;
1549 }
1550
1551 class_name = malloc((lstrlenW(reg_class_namesW[i]) + 1) * sizeof(WCHAR));
1552 lstrcpyW(class_name, reg_class_namesW[i]);
1553
1554 export_registry_data(fp, classes[i], class_name, unicode);
1555
1556 free(class_name);
1558 }
1559
1560 export_newline(fp, unicode);
1561 fclose(fp);
1562
1563 return TRUE;
1564}
const WCHAR * reg_class_namesW[]
Definition: main.c:12
#define ARRAY_SIZE(A)
Definition: main.h:20
static void export_newline(FILE *fp, BOOL unicode)
Definition: regproc.c:1309
static void export_registry_data(FILE *fp, HKEY key, WCHAR *path, BOOL unicode)
Definition: regproc.c:1380
static FILE * REGPROC_open_export_file(WCHAR *file_name, BOOL unicode)
Definition: regproc.c:1452
static HKEY open_export_key(HKEY key_class, WCHAR *subkey, WCHAR *path)
Definition: regproc.c:1490
#define lstrcpyW
Definition: compat.h:749
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
_Check_return_opt_ _CRTIMP int __cdecl fclose(_Inout_ FILE *_File)
static LPCWSTR file_name
Definition: protocol.c:147
Definition: copy.c:22
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define HKEY_USERS
Definition: winreg.h:13

Referenced by export_registry_key().

◆ export_data()

static void export_data ( FILE fp,
WCHAR value_name,
DWORD  value_len,
DWORD  type,
void data,
size_t  size,
BOOL  unicode 
)
static

Definition at line 1314 of file regproc.c.

1316{
1317 WCHAR *buf = NULL;
1318 size_t line_len = export_value_name(fp, value_name, value_len, unicode);
1319
1320 switch (type)
1321 {
1322 case REG_SZ:
1324 break;
1325 case REG_DWORD:
1326 if (size)
1327 {
1329 break;
1330 }
1331 /* fall through */
1332 case REG_NONE:
1333 case REG_EXPAND_SZ:
1334 case REG_BINARY:
1335 case REG_MULTI_SZ:
1336 default:
1337 export_hex_data(fp, &buf, type, line_len, data, size, unicode);
1338 break;
1339 }
1340
1341 if (size || type == REG_SZ)
1342 {
1343 REGPROC_write_line(fp, buf, unicode);
1344 free(buf);
1345 }
1346
1347 export_newline(fp, unicode);
1348}
static void export_dword_data(WCHAR **buf, DWORD *data)
Definition: regproc.c:1233
static void export_string_data(WCHAR **buf, WCHAR *data, size_t size)
Definition: regproc.c:1216
static void export_hex_data(FILE *fp, WCHAR **buf, DWORD type, DWORD line_len, void *data, DWORD size, BOOL unicode)
Definition: regproc.c:1271
static size_t export_value_name(FILE *fp, WCHAR *name, size_t len, BOOL unicode)
Definition: regproc.c:1188
static void REGPROC_write_line(FILE *fp, const WCHAR *str, BOOL unicode)
Definition: regproc.c:1125
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define REG_MULTI_SZ
Definition: nt_native.h:1501
#define REG_NONE
Definition: nt_native.h:1492
#define REG_EXPAND_SZ
Definition: nt_native.h:1494

Referenced by export_registry_data().

◆ export_dword_data()

static void export_dword_data ( WCHAR **  buf,
DWORD data 
)
static

Definition at line 1233 of file regproc.c.

1234{
1235 *buf = malloc(15 * sizeof(WCHAR));
1236#ifdef __REACTOS__
1237 StringCchPrintfW(*buf, 15, L"dword:%08x", *data);
1238#else
1239 swprintf(*buf, 15, L"dword:%08x", *data);
1240#endif
1241}

Referenced by export_data().

◆ export_hex_data()

static void export_hex_data ( FILE fp,
WCHAR **  buf,
DWORD  type,
DWORD  line_len,
void data,
DWORD  size,
BOOL  unicode 
)
static

Definition at line 1271 of file regproc.c.

1273{
1274 size_t num_commas, i, pos;
1275
1276 line_len += export_hex_data_type(fp, type, unicode);
1277
1278 if (!size) return;
1279
1280 if (!unicode && (type == REG_EXPAND_SZ || type == REG_MULTI_SZ))
1281 data = GetMultiByteStringN(data, size / sizeof(WCHAR), &size);
1282
1283 num_commas = size - 1;
1284 *buf = malloc(size * 3 * sizeof(WCHAR));
1285
1286 for (i = 0, pos = 0; i < size; i++)
1287 {
1288#ifdef __REACTOS__
1289 StringCchPrintfW(*buf + pos, 3, L"%02x", ((BYTE *)data)[i]);
1290 pos += wcslen(*buf + pos);
1291#else
1292 pos += swprintf(*buf + pos, 3, L"%02x", ((BYTE *)data)[i]);
1293#endif
1294 if (i == num_commas) break;
1295 (*buf)[pos++] = ',';
1296 (*buf)[pos] = 0;
1297 line_len += 3;
1298
1299 if (line_len >= MAX_HEX_CHARS)
1300 {
1301 REGPROC_write_line(fp, *buf, unicode);
1302 REGPROC_write_line(fp, L"\\\r\n ", unicode);
1303 line_len = 2;
1304 pos = 0;
1305 }
1306 }
1307}
#define MAX_HEX_CHARS
Definition: regproc.c:1269
static char * GetMultiByteStringN(const WCHAR *strW, int chars, DWORD *len)
Definition: regproc.c:91
static size_t export_hex_data_type(FILE *fp, DWORD type, BOOL unicode)
Definition: regproc.c:1243
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)

Referenced by export_data().

◆ export_hex_data_type()

static size_t export_hex_data_type ( FILE fp,
DWORD  type,
BOOL  unicode 
)
static

Definition at line 1243 of file regproc.c.

1244{
1245 static const WCHAR hex[] = L"hex:";
1246 size_t line_len;
1247
1248 if (type == REG_BINARY)
1249 {
1250 line_len = lstrlenW(hex);
1251 REGPROC_write_line(fp, hex, unicode);
1252 }
1253 else
1254 {
1255 WCHAR *buf = malloc(15 * sizeof(WCHAR));
1256#ifdef __REACTOS__
1257 StringCchPrintfW(buf, 15, L"hex(%x):", type);
1258 line_len = wcslen(buf);
1259#else
1260 line_len = swprintf(buf, 15, L"hex(%x):", type);
1261#endif
1262 REGPROC_write_line(fp, buf, unicode);
1263 free(buf);
1264 }
1265
1266 return line_len;
1267}
int hex(char ch)

Referenced by export_hex_data().

◆ export_key()

static BOOL export_key ( WCHAR file_name,
WCHAR path,
BOOL  unicode 
)
static

Definition at line 1501 of file regproc.c.

1502{
1503 HKEY key_class, key;
1504 WCHAR *subkey;
1505 FILE *fp;
1506
1507 if (!(key_class = parse_key_name(path, &subkey)))
1508 {
1509 if (subkey) *(subkey - 1) = 0;
1511 return FALSE;
1512 }
1513
1514 if (!(key = open_export_key(key_class, subkey, path)))
1515 return FALSE;
1516
1517 fp = REGPROC_open_export_file(file_name, unicode);
1518#ifdef __REACTOS__
1519 if (!fp)
1520 return TRUE; /* Error message is already displayed */
1521#endif
1522 export_registry_data(fp, key, path, unicode);
1523 export_newline(fp, unicode);
1524 fclose(fp);
1525
1527 return TRUE;
1528}

Referenced by export_registry_key().

◆ export_key_name()

static void export_key_name ( FILE fp,
WCHAR name,
BOOL  unicode 
)
static

Definition at line 1364 of file regproc.c.

1365{
1366 WCHAR *buf;
1367
1368 buf = malloc((lstrlenW(name) + 7) * sizeof(WCHAR));
1369#ifdef __REACTOS__
1370 StringCchPrintfW(buf, lstrlenW(name) + 7, L"\r\n[%s]\r\n", name);
1371#else
1372 swprintf(buf, lstrlenW(name) + 7, L"\r\n[%s]\r\n", name);
1373#endif
1374 REGPROC_write_line(fp, buf, unicode);
1375 free(buf);
1376}
Definition: name.c:39

Referenced by export_registry_data().

◆ export_newline()

static void export_newline ( FILE fp,
BOOL  unicode 
)
static

Definition at line 1309 of file regproc.c.

1310{
1311 REGPROC_write_line(fp, L"\r\n", unicode);
1312}

Referenced by export_all(), export_data(), and export_key().

◆ export_registry_data()

static void export_registry_data ( FILE fp,
HKEY  key,
WCHAR path,
BOOL  unicode 
)
static

Definition at line 1380 of file regproc.c.

1381{
1382 LONG rc;
1383 DWORD max_value_len = 256, value_len;
1384 DWORD max_data_bytes = 2048, data_size;
1385 DWORD subkey_len;
1386 DWORD i, type, path_len;
1387 WCHAR *value_name, *subkey_name, *subkey_path;
1388 BYTE *data;
1389 HKEY subkey;
1390
1391 export_key_name(fp, path, unicode);
1392
1393 value_name = malloc(max_value_len * sizeof(WCHAR));
1394 data = malloc(max_data_bytes);
1395
1396 i = 0;
1397 for (;;)
1398 {
1399 value_len = max_value_len;
1400 data_size = max_data_bytes;
1401 rc = RegEnumValueW(key, i, value_name, &value_len, NULL, &type, data, &data_size);
1402 if (rc == ERROR_SUCCESS)
1403 {
1404 export_data(fp, value_name, value_len, type, data, data_size, unicode);
1405 i++;
1406 }
1407 else if (rc == ERROR_MORE_DATA)
1408 {
1409 if (data_size > max_data_bytes)
1410 {
1411 max_data_bytes = data_size;
1412 data = realloc(data, max_data_bytes);
1413 }
1414 else
1415 {
1416 max_value_len *= 2;
1417 value_name = realloc(value_name, max_value_len * sizeof(WCHAR));
1418 }
1419 }
1420 else break;
1421 }
1422
1423 free(data);
1424 free(value_name);
1425
1426 subkey_name = malloc(MAX_SUBKEY_LEN * sizeof(WCHAR));
1427
1429
1430 i = 0;
1431 for (;;)
1432 {
1433 subkey_len = MAX_SUBKEY_LEN;
1434 rc = RegEnumKeyExW(key, i, subkey_name, &subkey_len, NULL, NULL, NULL, NULL);
1435 if (rc == ERROR_SUCCESS)
1436 {
1437 subkey_path = build_subkey_path(path, path_len, subkey_name, subkey_len);
1438 if (!RegOpenKeyExW(key, subkey_name, 0, KEY_READ, &subkey))
1439 {
1440 export_registry_data(fp, subkey, subkey_path, unicode);
1441 RegCloseKey(subkey);
1442 }
1443 free(subkey_path);
1444 i++;
1445 }
1446 else break;
1447 }
1448
1449 free(subkey_name);
1450}
static void export_key_name(FILE *fp, WCHAR *name, BOOL unicode)
Definition: regproc.c:1364
static WCHAR * build_subkey_path(WCHAR *path, DWORD path_len, WCHAR *subkey_name, DWORD subkey_len)
Definition: regproc.c:1350
#define MAX_SUBKEY_LEN
Definition: regproc.c:1378
static void export_data(FILE *fp, WCHAR *value_name, DWORD value_len, DWORD type, void *data, size_t size, BOOL unicode)
Definition: regproc.c:1314
#define ERROR_MORE_DATA
Definition: dderror.h:13
#define ERROR_SUCCESS
Definition: deptool.c:10
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3333
LONG WINAPI RegEnumKeyExW(_In_ HKEY hKey, _In_ DWORD dwIndex, _Out_ LPWSTR lpName, _Inout_ LPDWORD lpcbName, _Reserved_ LPDWORD lpReserved, _Out_opt_ LPWSTR lpClass, _Inout_opt_ LPDWORD lpcbClass, _Out_opt_ PFILETIME lpftLastWriteTime)
Definition: reg.c:2504
LONG WINAPI RegEnumValueW(_In_ HKEY hKey, _In_ DWORD index, _Out_ LPWSTR value, _Inout_ PDWORD val_count, _Reserved_ PDWORD reserved, _Out_opt_ PDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ PDWORD count)
Definition: reg.c:2830
#define KEY_READ
Definition: nt_native.h:1023
long LONG
Definition: pedump.c:60

Referenced by export_all(), export_key(), and export_registry_data().

◆ export_registry_key()

BOOL export_registry_key ( WCHAR file_name,
WCHAR path,
DWORD  format 
)

Definition at line 1566 of file regproc.c.

1567{
1568 BOOL unicode = (format == REG_FORMAT_5);
1569
1570 if (path && *path)
1571 return export_key(file_name, path, unicode);
1572 else
1573 return export_all(file_name, path, unicode);
1574}
#define REG_FORMAT_5
Definition: main.h:31
static BOOL export_all(WCHAR *file_name, WCHAR *path, BOOL unicode)
Definition: regproc.c:1530
static BOOL export_key(WCHAR *file_name, WCHAR *path, BOOL unicode)
Definition: regproc.c:1501
unsigned int BOOL
Definition: ntddk_ex.h:94
Definition: format.c:58

Referenced by ExportRegistryFile(), and PerformRegAction().

◆ export_string_data()

static void export_string_data ( WCHAR **  buf,
WCHAR data,
size_t  size 
)
static

Definition at line 1216 of file regproc.c.

1217{
1218 size_t len = 0, line_len;
1219 WCHAR *str;
1220
1221 if (size)
1222 len = size / sizeof(WCHAR) - 1;
1223 str = REGPROC_escape_string(data, len, &line_len);
1224 *buf = malloc((line_len + 3) * sizeof(WCHAR));
1225#ifdef __REACTOS__
1226 StringCchPrintfW(*buf, line_len + 3, L"\"%s\"", str);
1227#else
1228 swprintf(*buf, line_len + 3, L"\"%s\"", str);
1229#endif
1230 free(str);
1231}
static WCHAR * REGPROC_escape_string(WCHAR *str, size_t str_len, size_t *line_len)
Definition: regproc.c:1137

Referenced by export_data().

◆ export_value_name()

static size_t export_value_name ( FILE fp,
WCHAR name,
size_t  len,
BOOL  unicode 
)
static

Definition at line 1188 of file regproc.c.

1189{
1190 static const WCHAR default_name[] = L"@=";
1191 size_t line_len;
1192
1193 if (name && *name)
1194 {
1195 WCHAR *str = REGPROC_escape_string(name, len, &line_len);
1196 WCHAR *buf = malloc((line_len + 4) * sizeof(WCHAR));
1197#ifdef __REACTOS__
1198 StringCchPrintfW(buf, line_len + 4, L"\"%s\"=", str);
1199 line_len = wcslen(buf);
1200#else
1201 line_len = swprintf(buf, line_len + 4, L"\"%s\"=", str);
1202#endif
1203 REGPROC_write_line(fp, buf, unicode);
1204 free(buf);
1205 free(str);
1206 }
1207 else
1208 {
1209 line_len = lstrlenW(default_name);
1210 REGPROC_write_line(fp, default_name, unicode);
1211 }
1212
1213 return line_len;
1214}

Referenced by export_data().

◆ free_parser_data()

static void free_parser_data ( struct parser parser)
static

◆ get_lineA()

static WCHAR * get_lineA ( FILE fp)
static

Definition at line 928 of file regproc.c.

929{
930 static WCHAR *lineW;
931 static size_t size;
932 static char *buf, *next;
933 char *line;
934
935 free(lineW);
936
937 if (!fp) goto cleanup;
938
939 if (!size)
940 {
942 buf = malloc(size);
943 *buf = 0;
944 next = buf;
945 }
946 line = next;
947
948 while (next)
949 {
950 char *p = strpbrk(line, "\r\n");
951 if (!p)
952 {
953 size_t len, count;
954 len = strlen(next);
955 memmove(buf, next, len + 1);
956 if (size - len < 3)
957 {
958 size *= 2;
959 buf = realloc(buf, size);
960 }
961 if (!(count = fread(buf + len, 1, size - len - 1, fp)))
962 {
963 next = NULL;
964 lineW = GetWideString(buf);
965 return lineW;
966 }
967 buf[len + count] = 0;
968 next = buf;
969 line = buf;
970 continue;
971 }
972 next = p + 1;
973 if (*p == '\r' && *(p + 1) == '\n') next++;
974 *p = 0;
975 lineW = GetWideString(line);
976 return lineW;
977 }
978
979cleanup:
980 lineW = NULL;
981 if (size) free(buf);
982 size = 0;
983 return NULL;
984}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
char * strpbrk(const char *String, const char *Delimiters)
Definition: utclib.c:302
#define REG_VAL_BUF_SIZE
Definition: regproc.c:25
static WCHAR * GetWideString(const char *strA)
Definition: regproc.c:36
static void cleanup(void)
Definition: main.c:1335
_Check_return_opt_ _CRTIMP size_t __cdecl fread(_Out_writes_bytes_(_ElementSize *_Count) void *_DstBuf, _In_ size_t _ElementSize, _In_ size_t _Count, _Inout_ FILE *_File)
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
static unsigned __int64 next
Definition: rand_nt.c:6

Referenced by import_registry_file().

◆ get_lineW()

static WCHAR * get_lineW ( FILE fp)
static

Definition at line 986 of file regproc.c.

987{
988 static size_t size;
989 static WCHAR *buf, *next;
990 WCHAR *line;
991
992 if (!fp) goto cleanup;
993
994 if (!size)
995 {
997 buf = malloc(size * sizeof(WCHAR));
998 *buf = 0;
999 next = buf;
1000 }
1001 line = next;
1002
1003 while (next)
1004 {
1005 WCHAR *p = wcspbrk(line, L"\r\n");
1006 if (!p)
1007 {
1008 size_t len, count;
1009 len = lstrlenW(next);
1010 memmove(buf, next, (len + 1) * sizeof(WCHAR));
1011 if (size - len < 3)
1012 {
1013 size *= 2;
1014 buf = realloc(buf, size * sizeof(WCHAR));
1015 }
1016 if (!(count = fread(buf + len, sizeof(WCHAR), size - len - 1, fp)))
1017 {
1018 next = NULL;
1019 return buf;
1020 }
1021 buf[len + count] = 0;
1022 next = buf;
1023 line = buf;
1024 continue;
1025 }
1026 next = p + 1;
1027 if (*p == '\r' && *(p + 1) == '\n') next++;
1028 *p = 0;
1029 return line;
1030 }
1031
1032cleanup:
1033 if (size) free(buf);
1034 size = 0;
1035 return NULL;
1036}
_Check_return_ _CRTIMP _CONST_RETURN wchar_t *__cdecl wcspbrk(_In_z_ const wchar_t *_Str, _In_z_ const wchar_t *_Control)

Referenced by import_registry_file().

◆ GetMultiByteString()

char * GetMultiByteString ( const WCHAR strW)

Definition at line 73 of file regproc.c.

74{
75 if(strW)
76 {
77 char* strA;
78 int len = WideCharToMultiByte(CP_ACP, 0, strW, -1, NULL, 0, NULL, NULL);
79
80 strA = malloc(len);
82 return strA;
83 }
84 return NULL;
85}
#define CP_ACP
Definition: compat.h:109
#define WideCharToMultiByte
Definition: compat.h:111
WCHAR strW[12]
Definition: clipboard.c:2029
char strA[12]
Definition: clipboard.c:2028

Referenced by REGPROC_write_line().

◆ GetMultiByteStringN()

static char * GetMultiByteStringN ( const WCHAR strW,
int  chars,
DWORD len 
)
static

Definition at line 91 of file regproc.c.

92{
93 if(strW)
94 {
95 char* strA;
96 *len = WideCharToMultiByte(CP_ACP, 0, strW, chars, NULL, 0, NULL, NULL);
97
98 strA = malloc(*len);
100 return strA;
101 }
102 *len = 0;
103 return NULL;
104}

Referenced by export_hex_data().

◆ GetWideString()

static WCHAR * GetWideString ( const char strA)
static

Definition at line 36 of file regproc.c.

37{
38 if(strA)
39 {
40 WCHAR* strW;
41 int len = MultiByteToWideChar(CP_ACP, 0, strA, -1, NULL, 0);
42
43 strW = malloc(len * sizeof(WCHAR));
45 return strW;
46 }
47 return NULL;
48}
#define MultiByteToWideChar
Definition: compat.h:110

Referenced by get_lineA().

◆ GetWideStringN()

static WCHAR * GetWideStringN ( const char strA,
int  chars,
DWORD len 
)
static

Definition at line 54 of file regproc.c.

55{
56 if(strA)
57 {
58 WCHAR* strW;
59 *len = MultiByteToWideChar(CP_ACP, 0, strA, chars, NULL, 0);
60
61 strW = malloc(*len * sizeof(WCHAR));
62 MultiByteToWideChar(CP_ACP, 0, strA, chars, strW, *len);
63 return strW;
64 }
65 *len = 0;
66 return NULL;
67}

Referenced by prepare_hex_string_data().

◆ header_state()

static WCHAR * header_state ( struct parser parser,
WCHAR pos 
)
static

Definition at line 539 of file regproc.c.

540{
541 WCHAR *line, *header;
542
543 if (!(line = get_line(parser->file)))
544 return NULL;
545
546 if (!parser->is_unicode)
547 {
548 header = malloc((lstrlenW(line) + 3) * sizeof(WCHAR));
549 header[0] = parser->two_wchars[0];
550 header[1] = parser->two_wchars[1];
551 lstrcpyW(header + 2, line);
553 free(header);
554 }
556
557 switch (parser->reg_version)
558 {
559 case REG_VERSION_31:
561 break;
562 case REG_VERSION_40:
563 case REG_VERSION_50:
565 break;
566 default:
567 get_line(NULL); /* Reset static variables */
568 return NULL;
569 }
570
571 return line;
572}
static enum reg_versions parse_file_header(const WCHAR *s)
Definition: regproc.c:512
static WCHAR *(* get_line)(FILE *)
Definition: regproc.c:106
BOOL is_unicode
Definition: import.c:84
WCHAR two_wchars[2]
Definition: import.c:83
short int reg_version
Definition: import.c:85
FILE * file
Definition: import.c:82

◆ hex_data_state()

static WCHAR * hex_data_state ( struct parser parser,
WCHAR pos 
)
static

Definition at line 832 of file regproc.c.

833{
834 WCHAR *line = pos;
835
836 if (!*line)
837 goto set_value;
838
840 goto invalid;
841
842 if (parser->backslash)
843 {
845 return line;
846 }
847
849
852 return line;
853
854invalid:
857 return line;
858}
static void prepare_hex_string_data(struct parser *parser)
Definition: regproc.c:471
static BOOL convert_hex_csv_to_hex(struct parser *parser, WCHAR **str)
Definition: regproc.c:235
static HRESULT set_value(struct d3dx_parameter *param, const void *data, unsigned int bytes, void *dst_data)
Definition: effect.c:889

◆ hex_multiline_state()

static WCHAR * hex_multiline_state ( struct parser parser,
WCHAR pos 
)
static

Definition at line 878 of file regproc.c.

879{
880 WCHAR *line;
881
882 if (!(line = get_line(parser->file)))
883 {
886 return pos;
887 }
888
889 while (*line == ' ' || *line == '\t') line++;
890 if (!*line || *line == ';') return line;
891
892 if (!iswxdigit(*line)) goto invalid;
893
895 return line;
896
897invalid:
900 return line;
901}

◆ import_registry_file()

BOOL import_registry_file ( FILE reg_file)

Definition at line 1041 of file regproc.c.

1042{
1043 BYTE s[2];
1044 struct parser parser;
1045 WCHAR *pos;
1046
1047 if (!reg_file || (fread(s, 2, 1, reg_file) != 1))
1048 return FALSE;
1049
1050 parser.is_unicode = (s[0] == 0xff && s[1] == 0xfe);
1052
1053 parser.file = reg_file;
1054 parser.two_wchars[0] = s[0];
1055 parser.two_wchars[1] = s[1];
1056 parser.reg_version = -1;
1057 parser.hkey = NULL;
1060 parser.parse_type = 0;
1061 parser.data_type = 0;
1062 parser.data = NULL;
1063 parser.data_size = 0;
1066
1068
1069 /* parser main loop */
1070 while (pos)
1072
1075
1077 close_key(&parser);
1078
1079 return TRUE;
1080}
static WCHAR * get_lineA(FILE *fp)
Definition: regproc.c:928
static WCHAR * get_lineW(FILE *fp)
Definition: regproc.c:986
static const parser_state_func parser_funcs[NB_PARSER_STATES]
Definition: regproc.c:169
enum parser_state state
Definition: import.c:95
DWORD data_type
Definition: import.c:91

Referenced by ImportRegistryFile(), and PerformRegAction().

◆ key_name_state()

static WCHAR * key_name_state ( struct parser parser,
WCHAR pos 
)
static

Definition at line 646 of file regproc.c.

647{
648 WCHAR *p = pos, *key_end;
649
650 if (*p == ' ' || *p == '\t' || !(key_end = wcsrchr(p, ']')))
651 goto done;
652
653 *key_end = 0;
654
655 if (*p == '-')
656 {
658 return p + 1;
659 }
660 else if (open_key(parser, p) != ERROR_SUCCESS)
662
663done:
665 return p;
666}
#define STRING_OPEN_KEY_FAILED
Definition: resource.h:340
#define wcsrchr
Definition: compat.h:16
#define open_key(r, p, s, k)
Definition: reg_test.h:49

◆ line_start_state()

static WCHAR * line_start_state ( struct parser parser,
WCHAR pos 
)
static

Definition at line 614 of file regproc.c.

615{
616 WCHAR *line, *p;
617
618 if (!(line = get_line(parser->file)))
619 return NULL;
620
621 for (p = line; *p; p++)
622 {
623 switch (*p)
624 {
625 case '[':
627 return p + 1;
628 case '@':
630 return p;
631 case '"':
633 return p + 1;
634 case ' ':
635 case '\t':
636 break;
637 default:
638 return p;
639 }
640 }
641
642 return p;
643}

◆ open_export_key()

static HKEY open_export_key ( HKEY  key_class,
WCHAR subkey,
WCHAR path 
)
static

Definition at line 1490 of file regproc.c.

1491{
1492 HKEY key;
1493
1494 if (!RegOpenKeyExW(key_class, subkey, 0, KEY_READ, &key))
1495 return key;
1496
1498 return NULL;
1499}

Referenced by export_all(), and export_key().

◆ open_key()

static LONG open_key ( struct parser parser,
WCHAR path 
)
static

Definition at line 436 of file regproc.c.

437{
438 HKEY key_class;
439 WCHAR *key_path;
440 LONG res;
441
443
444 /* Get the registry class */
445 if (!path || !(key_class = parse_key_name(path, &key_path)))
447
448 res = RegCreateKeyExW(key_class, key_path, 0, NULL, REG_OPTION_NON_VOLATILE,
450
451 if (res == ERROR_SUCCESS)
452 {
453 parser->key_name = malloc((lstrlenW(path) + 1) * sizeof(WCHAR));
455 }
456 else
457 parser->hkey = NULL;
458
459 return res;
460}
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
Definition: reg.c:1096
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
GLuint res
Definition: glext.h:9613
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
#define REG_OPTION_NON_VOLATILE
Definition: nt_native.h:1057

◆ parse_data_type()

static BOOL parse_data_type ( struct parser parser,
WCHAR **  line 
)
static

Definition at line 295 of file regproc.c.

296{
297 struct data_type { const WCHAR *tag; int len; int type; int parse_type; };
298
299 static const struct data_type data_types[] = {
300 /* tag len type parse type */
301 { L"\"", 1, REG_SZ, REG_SZ },
302 { L"hex:", 4, REG_BINARY, REG_BINARY },
303 { L"dword:", 6, REG_DWORD, REG_DWORD },
304 { L"hex(", 4, -1, REG_BINARY }, /* REG_NONE, REG_EXPAND_SZ, REG_MULTI_SZ */
305 { NULL, 0, 0, 0 }
306 };
307
308 const struct data_type *ptr;
309
310 for (ptr = data_types; ptr->tag; ptr++)
311 {
312 if (wcsncmp(ptr->tag, *line, ptr->len))
313 continue;
314
315 parser->parse_type = ptr->parse_type;
316 parser->data_type = ptr->parse_type;
317 *line += ptr->len;
318
319 if (ptr->type == -1)
320 {
321 WCHAR *end;
322 DWORD val;
323
324 if (!**line || towlower((*line)[1]) == 'x')
325 return FALSE;
326
327 /* "hex(xx):" is special */
328 val = wcstoul(*line, &end, 16);
329#ifdef __REACTOS__
330 /* Up to 8 hex digits, "hex(000000002)" is invalid */
331 if (*end != ')' || *(end + 1) != ':' || (val == ~0u && errno == ERANGE) || end - *line > 8)
332#else
333 if (*end != ')' || *(end + 1) != ':' || (val == ~0u && errno == ERANGE))
334#endif
335 return FALSE;
336
338 *line = end + 2;
339 }
340 return TRUE;
341 }
342 return FALSE;
343}
#define ERANGE
Definition: acclib.h:92
GLuint GLfloat * val
Definition: glext.h:7180
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
static PVOID ptr
Definition: dispmode.c:27
#define errno
Definition: errno.h:18
_Check_return_ _CRTIMP int __cdecl wcsncmp(_In_reads_or_z_(_MaxCount) const wchar_t *_Str1, _In_reads_or_z_(_MaxCount) const wchar_t *_Str2, _In_ size_t _MaxCount)
int parse_type(Type t, const vector< string > &tokens, int off, vector< string > &names, vector< string > &dependencies)
Definition: sdkparse.cpp:653
Definition: ecma_167.h:138
#define towlower(c)
Definition: wctype.h:97

Referenced by data_type_state().

◆ parse_file_header()

static enum reg_versions parse_file_header ( const WCHAR s)
static

Definition at line 512 of file regproc.c.

513{
514 static const WCHAR header_31[] = L"REGEDIT";
515
516 while (*s == ' ' || *s == '\t') s++;
517
518 if (!lstrcmpW(s, header_31))
519 return REG_VERSION_31;
520
521 if (!lstrcmpW(s, L"REGEDIT4"))
522 return REG_VERSION_40;
523
524 if (!lstrcmpW(s, L"Windows Registry Editor Version 5.00"))
525 return REG_VERSION_50;
526
527 /* The Windows version accepts registry file headers beginning with "REGEDIT" and ending
528 * with other characters, as long as "REGEDIT" appears at the start of the line. For example,
529 * "REGEDIT 4", "REGEDIT9" and "REGEDIT4FOO" are all treated as valid file headers.
530 * In all such cases, however, the contents of the registry file are not imported.
531 */
532 if (!wcsncmp(s, header_31, 7)) /* "REGEDIT" without NUL */
533 return REG_VERSION_FUZZY;
534
535 return REG_VERSION_INVALID;
536}
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4243

Referenced by header_state().

◆ parse_key_name()

static HKEY parse_key_name ( WCHAR key_name,
WCHAR **  key_path 
)
static

Definition at line 394 of file regproc.c.

395{
396 unsigned int i;
397
398 if (!key_name) return 0;
399
400 *key_path = wcschr(key_name, '\\');
401 if (*key_path) (*key_path)++;
402
403 for (i = 0; i < ARRAY_SIZE(reg_class_keys); i++)
404 {
406#ifdef __REACTOS__
408#else
410#endif
411 (key_name[len] == 0 || key_name[len] == '\\'))
412 {
413 return reg_class_keys[i];
414 }
415 }
416
417 return 0;
418}
static HKEY reg_class_keys[]
Definition: regproc.c:27
#define wcschr
Definition: compat.h:17
#define wcsnicmp
Definition: compat.h:14
_Check_return_ _CRTIMP int __cdecl _wcsnicmp(_In_reads_or_z_(_MaxCount) const wchar_t *_Str1, _In_reads_or_z_(_MaxCount) const wchar_t *_Str2, _In_ size_t _MaxCount)

Referenced by delete_registry_key(), export_key(), and open_key().

◆ parse_win31_line_state()

static WCHAR * parse_win31_line_state ( struct parser parser,
WCHAR pos 
)
static

Definition at line 575 of file regproc.c.

576{
577 WCHAR *line, *value;
578 static WCHAR hkcr[] = L"HKEY_CLASSES_ROOT";
579 unsigned int key_end = 0;
580
581 if (!(line = get_line(parser->file)))
582 return NULL;
583
584 if (wcsncmp(line, hkcr, lstrlenW(hkcr)))
585 return line;
586
587 /* get key name */
588 while (line[key_end] && !iswspace(line[key_end])) key_end++;
589
590 value = line + key_end;
591 while (*value == ' ' || *value == '\t') value++;
592
593 if (*value == '=') value++;
594 if (*value == ' ') value++; /* at most one space is skipped */
595
596 line[key_end] = 0;
597
599 {
601 return line;
602 }
603
606 parser->data = value;
607 parser->data_size = (lstrlenW(value) + 1) * sizeof(WCHAR);
608
610 return value;
611}
#define iswspace(_c)
Definition: ctype.h:669
Definition: pdh_main.c:94

◆ prepare_hex_string_data()

static void prepare_hex_string_data ( struct parser parser)
static

Definition at line 471 of file regproc.c.

472{
475 {
476 if (parser->is_unicode)
477 {
478 WCHAR *data = parser->data;
479 DWORD len = parser->data_size / sizeof(WCHAR);
480
481 if (data[len - 1] != 0)
482 {
483 data[len] = 0;
484 parser->data_size += sizeof(WCHAR);
485 }
486 }
487 else
488 {
489 BYTE *data = parser->data;
490
491 if (data[parser->data_size - 1] != 0)
492 {
493 data[parser->data_size] = 0;
494 parser->data_size++;
495 }
496
498 parser->data_size *= sizeof(WCHAR);
499 free(data);
500 }
501 }
502}
static WCHAR * GetWideStringN(const char *strA, int chars, DWORD *len)
Definition: regproc.c:54

Referenced by hex_data_state(), and hex_multiline_state().

◆ quoted_value_name_state()

static WCHAR * quoted_value_name_state ( struct parser parser,
WCHAR pos 
)
static

Definition at line 693 of file regproc.c.

694{
695 WCHAR *val_name = pos, *p;
696
699
700 if (!REGPROC_unescape_string(val_name, &p))
701 goto invalid;
702
703 /* copy the value name in case we need to parse multiple lines and the buffer is overwritten */
704 parser->value_name = malloc((lstrlenW(val_name) + 1) * sizeof(WCHAR));
705 lstrcpyW(parser->value_name, val_name);
706
708 return p;
709
710invalid:
712 return val_name;
713}
static BOOL REGPROC_unescape_string(WCHAR *str, WCHAR **unparsed)
Definition: regproc.c:352

◆ REGPROC_escape_string()

static WCHAR * REGPROC_escape_string ( WCHAR str,
size_t  str_len,
size_t line_len 
)
static

Definition at line 1137 of file regproc.c.

1138{
1139 size_t i, escape_count, pos;
1140 WCHAR *buf;
1141
1142 for (i = 0, escape_count = 0; i < str_len; i++)
1143 {
1144 WCHAR c = str[i];
1145
1146 if (!c) break;
1147
1148 if (c == '\r' || c == '\n' || c == '\\' || c == '"')
1149 escape_count++;
1150 }
1151
1152 buf = malloc((str_len + escape_count + 1) * sizeof(WCHAR));
1153
1154 for (i = 0, pos = 0; i < str_len; i++, pos++)
1155 {
1156 WCHAR c = str[i];
1157
1158 if (!c) break;
1159
1160 switch (c)
1161 {
1162 case '\r':
1163 buf[pos++] = '\\';
1164 buf[pos] = 'r';
1165 break;
1166 case '\n':
1167 buf[pos++] = '\\';
1168 buf[pos] = 'n';
1169 break;
1170 case '\\':
1171 buf[pos++] = '\\';
1172 buf[pos] = '\\';
1173 break;
1174 case '"':
1175 buf[pos++] = '\\';
1176 buf[pos] = '"';
1177 break;
1178 default:
1179 buf[pos] = c;
1180 }
1181 }
1182
1183 buf[pos] = 0;
1184 *line_len = pos;
1185 return buf;
1186}
const GLubyte * c
Definition: glext.h:8905
#define c
Definition: ke_i.h:80
#define str_len
Definition: treelist.c:89

Referenced by export_string_data(), and export_value_name().

◆ REGPROC_open_export_file()

static FILE * REGPROC_open_export_file ( WCHAR file_name,
BOOL  unicode 
)
static

Definition at line 1452 of file regproc.c.

1453{
1454 FILE *file;
1455
1456 if (!lstrcmpW(file_name, L"-"))
1457 {
1458 file = stdout;
1460 }
1461 else
1462 {
1463 file = _wfopen(file_name, L"wb");
1464 if (!file)
1465 {
1466 _wperror(L"regedit");
1467#ifdef __REACTOS__
1469 return NULL;
1470#else
1472#endif
1473 }
1474 }
1475
1476 if (unicode)
1477 {
1478 static const BYTE bom[] = {0xff,0xfe};
1479 static const WCHAR header[] = L"Windows Registry Editor Version 5.00\r\n";
1480
1481 fwrite(bom, sizeof(BYTE), ARRAY_SIZE(bom), file);
1482 fwrite(header, sizeof(WCHAR), lstrlenW(header), file);
1483 }
1484 else
1485 fputs("REGEDIT4\r\n", file);
1486
1487 return file;
1488}
#define STRING_CANNOT_OPEN_FILE
Definition: resource.h:330
#define _setmode(fd, mode)
Definition: cat.c:21
#define _O_BINARY
Definition: cabinet.h:51
#define stdout
Definition: stdio.h:99
_Check_return_ _CRTIMP int __cdecl _fileno(_In_ FILE *_File)
_Check_return_opt_ _CRTIMP int __cdecl fputs(_In_z_ const char *_Str, _Inout_ FILE *_File)
_Check_return_ _CRTIMP FILE *__cdecl _wfopen(_In_z_ const wchar_t *_Filename, _In_z_ const wchar_t *_Mode)
_CRTIMP void __cdecl _wperror(_In_opt_z_ const wchar_t *_ErrMsg)
_Check_return_opt_ _CRTIMP size_t __cdecl fwrite(_In_reads_bytes_(_Size *_Count) const void *_Str, _In_ size_t _Size, _In_ size_t _Count, _Inout_ FILE *_File)
Definition: fci.c:127

Referenced by export_all(), export_key(), and export_registry_key().

◆ REGPROC_unescape_string()

static BOOL REGPROC_unescape_string ( WCHAR str,
WCHAR **  unparsed 
)
static

Definition at line 352 of file regproc.c.

353{
354 int str_idx = 0; /* current character under analysis */
355 int val_idx = 0; /* the last character of the unescaped string */
356 int len = lstrlenW(str);
357 BOOL ret;
358
359 for (str_idx = 0; str_idx < len; str_idx++, val_idx++) {
360 if (str[str_idx] == '\\') {
361 str_idx++;
362 switch (str[str_idx]) {
363 case 'n':
364 str[val_idx] = '\n';
365 break;
366 case 'r':
367 str[val_idx] = '\r';
368 break;
369 case '0':
370 return FALSE;
371 case '\\':
372 case '"':
373 str[val_idx] = str[str_idx];
374 break;
375 default:
376 if (!str[str_idx]) return FALSE;
378 str[val_idx] = str[str_idx];
379 break;
380 }
381 } else if (str[str_idx] == '"') {
382 break;
383 } else {
384 str[val_idx] = str[str_idx];
385 }
386 }
387
388 ret = (str[str_idx] == '"');
389 *unparsed = str + str_idx + 1;
390 str[val_idx] = '\0';
391 return ret;
392}
#define STRING_ESCAPE_SEQUENCE
Definition: resource.h:80
int ret

Referenced by processSetValue(), quoted_value_name_state(), setValue(), and string_data_state().

◆ REGPROC_write_line()

static void REGPROC_write_line ( FILE fp,
const WCHAR str,
BOOL  unicode 
)
static

Definition at line 1125 of file regproc.c.

1126{
1127 if (unicode)
1128 fwrite(str, sizeof(WCHAR), lstrlenW(str), fp);
1129 else
1130 {
1131 char *strA = GetMultiByteString(str);
1132 fputs(strA, fp);
1133 free(strA);
1134 }
1135}
char * GetMultiByteString(const WCHAR *strW)
Definition: regproc.c:73

Referenced by export_data(), export_hex_data(), export_hex_data_type(), export_key_name(), export_newline(), and export_value_name().

◆ set_state()

◆ set_value_state()

static WCHAR * set_value_state ( struct parser parser,
WCHAR pos 
)
static

Definition at line 913 of file regproc.c.

914{
917
919
922 else
924
925 return pos;
926}
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4882

◆ string_data_state()

static WCHAR * string_data_state ( struct parser parser,
WCHAR pos 
)
static

Definition at line 787 of file regproc.c.

788{
789 WCHAR *line;
790
791 parser->data = pos;
792
794 goto invalid;
795
796 while (*line == ' ' || *line == '\t') line++;
797 if (*line && *line != ';') goto invalid;
798
799 parser->data_size = (lstrlenW(parser->data) + 1) * sizeof(WCHAR);
800
802 return line;
803
804invalid:
807 return line;
808}

◆ unknown_data_state()

static WCHAR * unknown_data_state ( struct parser parser,
WCHAR pos 
)
static

Definition at line 904 of file regproc.c.

905{
907
909 return pos;
910}
#define STRING_UNKNOWN_DATA_FORMAT
Definition: resource.h:336

Variable Documentation

◆ get_line

WCHAR *(* get_line) (FILE *) ( FILE )
static

◆ parser_funcs

Initial value:
=
{
}
static WCHAR * default_value_name_state(struct parser *parser, WCHAR *pos)
Definition: regproc.c:683
static WCHAR * hex_data_state(struct parser *parser, WCHAR *pos)
Definition: regproc.c:832
static WCHAR * dword_data_state(struct parser *parser, WCHAR *pos)
Definition: regproc.c:811
static WCHAR * string_data_state(struct parser *parser, WCHAR *pos)
Definition: regproc.c:787
static WCHAR * key_name_state(struct parser *parser, WCHAR *pos)
Definition: regproc.c:646
static WCHAR * delete_value_state(struct parser *parser, WCHAR *pos)
Definition: regproc.c:743
static WCHAR * eol_backslash_state(struct parser *parser, WCHAR *pos)
Definition: regproc.c:861
static WCHAR * data_type_state(struct parser *parser, WCHAR *pos)
Definition: regproc.c:758
static WCHAR * set_value_state(struct parser *parser, WCHAR *pos)
Definition: regproc.c:913
static WCHAR * data_start_state(struct parser *parser, WCHAR *pos)
Definition: regproc.c:716
static WCHAR * unknown_data_state(struct parser *parser, WCHAR *pos)
Definition: regproc.c:904
static WCHAR * quoted_value_name_state(struct parser *parser, WCHAR *pos)
Definition: regproc.c:693
static WCHAR * parse_win31_line_state(struct parser *parser, WCHAR *pos)
Definition: regproc.c:575
static WCHAR * delete_key_state(struct parser *parser, WCHAR *pos)
Definition: regproc.c:669
static WCHAR * hex_multiline_state(struct parser *parser, WCHAR *pos)
Definition: regproc.c:878
static WCHAR * header_state(struct parser *parser, WCHAR *pos)
Definition: regproc.c:539
static WCHAR * line_start_state(struct parser *parser, WCHAR *pos)
Definition: regproc.c:614

Definition at line 169 of file regproc.c.

Referenced by import_registry_file().

◆ reg_class_keys

HKEY reg_class_keys[]
static
Initial value:
= {
}
#define HKEY_CURRENT_CONFIG
Definition: winreg.h:15
#define HKEY_DYN_DATA
Definition: winreg.h:16
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10

Definition at line 27 of file regproc.c.

Referenced by export_registry_key(), getRegClass(), and parse_key_name().