{
struct data_type { const WCHAR *tag; int len; int type; int parse_type; };
- static const WCHAR quote[] = {'"'};
- static const WCHAR hex[] = {'h','e','x',':'};
- static const WCHAR dword[] = {'d','w','o','r','d',':'};
- static const WCHAR hexp[] = {'h','e','x','('};
-
static const struct data_type data_types[] = {
- /* tag len type parse type */
- { quote, 1, REG_SZ, REG_SZ },
- { hex, 4, REG_BINARY, REG_BINARY },
- { dword, 6, REG_DWORD, REG_DWORD },
- { hexp, 4, -1, REG_BINARY }, /* REG_NONE, REG_EXPAND_SZ, REG_MULTI_SZ */
- { NULL, 0, 0, 0 }
+ /* tag len type parse type */
+ { L"\"", 1, REG_SZ, REG_SZ },
+ { L"hex:", 4, REG_BINARY, REG_BINARY },
+ { L"dword:", 6, REG_DWORD, REG_DWORD },
+ { L"hex(", 4, -1, REG_BINARY }, /* REG_NONE, REG_EXPAND_SZ, REG_MULTI_SZ */
+ { NULL, 0, 0, 0 }
};
const struct data_type *ptr;
static enum reg_versions parse_file_header(const WCHAR *s)
{
- static const WCHAR header_31[] = {'R','E','G','E','D','I','T',0};
- static const WCHAR header_40[] = {'R','E','G','E','D','I','T','4',0};
- static const WCHAR header_50[] = {'W','i','n','d','o','w','s',' ',
- 'R','e','g','i','s','t','r','y',' ','E','d','i','t','o','r',' ',
- 'V','e','r','s','i','o','n',' ','5','.','0','0',0};
+ static const WCHAR *header_31 = L"REGEDIT";
while (*s == ' ' || *s == '\t') s++;
if (!lstrcmpW(s, header_31))
return REG_VERSION_31;
- if (!lstrcmpW(s, header_40))
+ if (!lstrcmpW(s, L"REGEDIT4"))
return REG_VERSION_40;
- if (!lstrcmpW(s, header_50))
+ if (!lstrcmpW(s, L"Windows Registry Editor Version 5.00"))
return REG_VERSION_50;
/* The Windows version accepts registry file headers beginning with "REGEDIT" and ending
static WCHAR *parse_win31_line_state(struct parser *parser, WCHAR *pos)
{
WCHAR *line, *value;
- static WCHAR hkcr[] = {'H','K','E','Y','_','C','L','A','S','S','E','S','_','R','O','O','T'};
unsigned int key_end = 0;
if (!(line = get_line(parser->file)))
return NULL;
- if (wcsncmp(line, hkcr, ARRAY_SIZE(hkcr)))
+ if (wcsncmp(line, L"HKEY_CLASSES_ROOT", 17)) /* "HKEY_CLASSES_ROOT" without NUL */
return line;
/* get key name */
while (next)
{
- static const WCHAR line_endings[] = {'\r','\n',0};
- WCHAR *p = wcspbrk(line, line_endings);
+ WCHAR *p = wcspbrk(line, L"\r\n");
if (!p)
{
size_t len, count;
{
WCHAR *filename, *pos;
FILE *fp;
- static const WCHAR rb_mode[] = {'r','b',0};
BYTE s[2];
struct parser parser;
filename = argvW[2];
- fp = _wfopen(filename, rb_mode);
+ fp = _wfopen(filename, L"rb");
if (!fp)
{
output_message(STRING_FILE_NOT_FOUND, filename);