25#define REG_VAL_BUF_SIZE 4096
206 while (*
str ==
' ' || *
str ==
'\t')
str++;
218 while (*
p ==
' ' || *
p ==
'\t')
p++;
219 if (*
p && *
p !=
';')
goto error;
256 if (wc > 0xff)
return FALSE;
258 if (
s ==
end && wc == 0)
260 while (*
end ==
' ' || *
end ==
'\t')
end++;
267 else if (*
end ==
';')
277 while (*
end ==
' ' || *
end ==
'\t')
end++;
299 static const struct data_type data_types[] = {
308 const struct data_type *
ptr;
359 for (str_idx = 0; str_idx <
len; str_idx++, val_idx++) {
360 if (
str[str_idx] ==
'\\') {
362 switch (
str[str_idx]) {
373 str[val_idx] =
str[str_idx];
378 str[val_idx] =
str[str_idx];
381 }
else if (
str[str_idx] ==
'"') {
384 str[val_idx] =
str[str_idx];
388 ret = (
str[str_idx] ==
'"');
389 *unparsed =
str + str_idx + 1;
401 if (*key_path) (*key_path)++;
514 static const WCHAR header_31[] =
L"REGEDIT";
516 while (*
s ==
' ' || *
s ==
'\t')
s++;
524 if (!
lstrcmpW(
s,
L"Windows Registry Editor Version 5.00"))
578 static WCHAR hkcr[] =
L"HKEY_CLASSES_ROOT";
579 unsigned int key_end = 0;
650 if (*
p ==
' ' || *
p ==
'\t' || !(key_end =
wcsrchr(
p,
']')))
675 if (*
p ==
'H' || *
p ==
'h')
721 while (*
p ==
' ' || *
p ==
'\t')
p++;
722 if (*
p !=
'=')
goto done;
724 while (*
p ==
' ' || *
p ==
'\t')
p++;
728 while (
len > 0 && (
p[
len - 1] ==
' ' ||
p[
len - 1] ==
'\t'))
len--;
747 while (*
p ==
' ' || *
p ==
'\t')
p++;
748 if (*
p && *
p !=
';')
goto done;
865 while (*
p ==
' ' || *
p ==
'\t')
p++;
973 if (*
p ==
'\r' && *(
p + 1) ==
'\n')
next++;
1027 if (*
p ==
'\r' && *(
p + 1) ==
'\n')
next++;
1047 if (!reg_file || (
fread(
s, 2, 1, reg_file) != 1))
1094 if (!reg_key_name || !reg_key_name[0])
1139 size_t i, escape_count,
pos;
1142 for (
i = 0, escape_count = 0;
i <
str_len;
i++)
1148 if (
c ==
'\r' ||
c ==
'\n' ||
c ==
'\\' ||
c ==
'"')
1190 static const WCHAR default_name[] =
L"@=";
1218 size_t len = 0, line_len;
1269#define MAX_HEX_CHARS 77
1274 size_t num_commas,
i,
pos;
1283 num_commas =
size - 1;
1294 if (
i == num_commas)
break;
1295 (*buf)[
pos++] =
',';
1378#define MAX_SUBKEY_LEN 257
1383 DWORD max_value_len = 256, value_len;
1399 value_len = max_value_len;
1478 static const BYTE bom[] = {0xff,0xfe};
1479 static const WCHAR header[] =
L"Windows Registry Editor Version 5.00\r\n";
1509 if (subkey) *(subkey - 1) = 0;
ACPI_SIZE strlen(const char *String)
char * strpbrk(const char *String, const char *Delimiters)
void WINAPIV output_message(unsigned int id,...)
#define STRING_INVALID_SYSTEM_KEY
#define STRING_ESCAPE_SEQUENCE
const WCHAR * reg_class_namesW[]
void WINAPIV error_exit(unsigned int id,...)
static WCHAR * default_value_name_state(struct parser *parser, WCHAR *pos)
static void export_key_name(FILE *fp, WCHAR *name, BOOL unicode)
BOOL import_registry_file(FILE *reg_file)
static WCHAR * REGPROC_escape_string(WCHAR *str, size_t str_len, size_t *line_len)
static void export_newline(FILE *fp, BOOL unicode)
static WCHAR * hex_data_state(struct parser *parser, WCHAR *pos)
static WCHAR * dword_data_state(struct parser *parser, WCHAR *pos)
static WCHAR * string_data_state(struct parser *parser, WCHAR *pos)
static WCHAR * key_name_state(struct parser *parser, WCHAR *pos)
static void prepare_hex_string_data(struct parser *parser)
static void export_dword_data(WCHAR **buf, DWORD *data)
static WCHAR * delete_value_state(struct parser *parser, WCHAR *pos)
static WCHAR * eol_backslash_state(struct parser *parser, WCHAR *pos)
static WCHAR * build_subkey_path(WCHAR *path, DWORD path_len, WCHAR *subkey_name, DWORD subkey_len)
static WCHAR * data_type_state(struct parser *parser, WCHAR *pos)
static BOOL export_all(WCHAR *file_name, WCHAR *path, BOOL unicode)
static BOOL convert_hex_to_dword(WCHAR *str, DWORD *dw)
static WCHAR * GetWideString(const char *strA)
static HKEY reg_class_keys[]
static enum reg_versions parse_file_header(const WCHAR *s)
static BOOL convert_hex_csv_to_hex(struct parser *parser, WCHAR **str)
static void export_string_data(WCHAR **buf, WCHAR *data, size_t size)
static enum parser_state set_state(struct parser *parser, enum parser_state state)
static void free_parser_data(struct parser *parser)
static void export_registry_data(FILE *fp, HKEY key, WCHAR *path, BOOL unicode)
static WCHAR * set_value_state(struct parser *parser, WCHAR *pos)
static WCHAR * data_start_state(struct parser *parser, WCHAR *pos)
WCHAR *(* parser_state_func)(struct parser *parser, WCHAR *pos)
static WCHAR * GetWideStringN(const char *strA, int chars, DWORD *len)
static WCHAR * get_lineA(FILE *fp)
static BOOL REGPROC_unescape_string(WCHAR *str, WCHAR **unparsed)
static WCHAR * unknown_data_state(struct parser *parser, WCHAR *pos)
static void export_hex_data(FILE *fp, WCHAR **buf, DWORD type, DWORD line_len, void *data, DWORD size, BOOL unicode)
static BOOL parse_data_type(struct parser *parser, WCHAR **line)
static char * GetMultiByteStringN(const WCHAR *strW, int chars, DWORD *len)
static FILE * REGPROC_open_export_file(WCHAR *file_name, BOOL unicode)
static size_t export_value_name(FILE *fp, WCHAR *name, size_t len, BOOL unicode)
static WCHAR * get_lineW(FILE *fp)
static WCHAR * quoted_value_name_state(struct parser *parser, WCHAR *pos)
static HKEY parse_key_name(WCHAR *key_name, WCHAR **key_path)
static WCHAR *(* get_line)(FILE *)
char * GetMultiByteString(const WCHAR *strW)
static void REGPROC_write_line(FILE *fp, const WCHAR *str, BOOL unicode)
static WCHAR * parse_win31_line_state(struct parser *parser, WCHAR *pos)
static WCHAR * delete_key_state(struct parser *parser, WCHAR *pos)
static HKEY open_export_key(HKEY key_class, WCHAR *subkey, WCHAR *path)
static size_t export_hex_data_type(FILE *fp, DWORD type, BOOL unicode)
static BOOL export_key(WCHAR *file_name, WCHAR *path, BOOL unicode)
static WCHAR * hex_multiline_state(struct parser *parser, WCHAR *pos)
BOOL export_registry_key(WCHAR *file_name, WCHAR *path, DWORD format)
void delete_registry_key(WCHAR *reg_key_name)
static void export_data(FILE *fp, WCHAR *value_name, DWORD value_len, DWORD type, void *data, size_t size, BOOL unicode)
static WCHAR * header_state(struct parser *parser, WCHAR *pos)
static WCHAR * line_start_state(struct parser *parser, WCHAR *pos)
static const parser_state_func parser_funcs[NB_PARSER_STATES]
#define STRING_CANNOT_OPEN_FILE
#define STRING_OPEN_KEY_FAILED
#define STRING_UNKNOWN_DATA_FORMAT
#define STRING_DELETE_FAILED
#define RegCloseKey(hKey)
#define _setmode(fd, mode)
while(CdLookupNextInitialFileDirent(IrpContext, Fcb, FileContext))
LSTATUS WINAPI RegDeleteTreeW(_In_ HKEY, _In_opt_ LPCWSTR)
static HRESULT set_value(struct d3dx_parameter *param, const void *data, unsigned int bytes, void *dst_data)
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)
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
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)
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
LONG WINAPI RegDeleteValueW(HKEY hKey, LPCWSTR lpValueName)
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)
#define ERROR_INVALID_PARAMETER
#define WideCharToMultiByte
#define MultiByteToWideChar
static void cleanup(void)
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
GLuint GLuint GLsizei GLenum type
GLuint GLuint GLsizei count
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
GLenum GLuint GLenum GLsizei const GLchar * buf
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
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
_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 fread(_Out_writes_bytes_(_ElementSize *_Count) void *_DstBuf, _In_ size_t _ElementSize, _In_ size_t _Count, _Inout_ FILE *_File)
_Check_return_opt_ _CRTIMP int __cdecl fclose(_Inout_ FILE *_File)
_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)
_Check_return_ unsigned long __cdecl wcstoul(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
REFIID LPVOID DWORD_PTR dw
#define memmove(s1, s2, n)
static const WCHAR invalid[]
#define REG_OPTION_NON_VOLATILE
static unsigned __int64 next
#define open_key(r, p, s, k)
_Check_return_ _CRTIMP _CONST_RETURN wchar_t *__cdecl wcspbrk(_In_z_ const wchar_t *_Str, _In_z_ const wchar_t *_Control)
_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)
_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)
int parse_type(Type t, const vector< string > &tokens, int off, vector< string > &names, vector< string > &dependencies)
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
#define HKEY_LOCAL_MACHINE
#define HKEY_CURRENT_CONFIG
#define HKEY_CURRENT_USER
#define HKEY_CLASSES_ROOT