Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
e1e79d12
Commit
e1e79d12
authored
Mar 22, 2017
by
Hugh McMaster
Committed by
Alexandre Julliard
Mar 22, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
regedit: Parse UTF-16 file header for validation.
Signed-off-by:
Hugh McMaster
<
hugh.mcmaster@outlook.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
9af3dffa
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
4 deletions
+43
-4
regproc.c
programs/regedit/regproc.c
+43
-4
No files found.
programs/regedit/regproc.c
View file @
e1e79d12
...
...
@@ -646,11 +646,34 @@ static void processRegEntry31(WCHAR *line)
closeKey
();
}
/* version constants */
enum
reg_versions
{
REG_VERSION_31
,
REG_VERSION_40
,
REG_VERSION_50
,
REG_VERSION_INVALID
};
static
enum
reg_versions
parse_file_header
(
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
};
while
(
*
s
&&
(
*
s
==
' '
||
*
s
==
'\t'
))
s
++
;
#define REG_VERSION_31 3
#define REG_VERSION_40 4
#define REG_VERSION_50 5
if
(
!
strcmpW
(
s
,
header_31
))
return
REG_VERSION_31
;
if
(
!
strcmpW
(
s
,
header_40
))
return
REG_VERSION_40
;
if
(
!
strcmpW
(
s
,
header_50
))
return
REG_VERSION_50
;
return
REG_VERSION_INVALID
;
}
/******************************************************************************
* Processes a registry file.
...
...
@@ -799,6 +822,13 @@ static WCHAR *get_lineW(FILE *fp)
static
WCHAR
*
buf
,
*
next
;
WCHAR
*
line
;
if
(
!
fp
)
{
if
(
size
)
HeapFree
(
GetProcessHeap
(),
0
,
buf
);
size
=
0
;
return
NULL
;
}
if
(
!
size
)
{
size
=
REG_VAL_BUF_SIZE
;
...
...
@@ -861,6 +891,15 @@ static WCHAR *get_lineW(FILE *fp)
static
void
processRegLinesW
(
FILE
*
fp
)
{
WCHAR
*
line
;
int
reg_version
;
line
=
get_lineW
(
fp
);
reg_version
=
parse_file_header
(
line
);
if
(
reg_version
==
REG_VERSION_INVALID
)
{
get_lineW
(
NULL
);
/* Reset static variables */
return
;
}
while
((
line
=
get_lineW
(
fp
)))
processRegEntry
(
line
,
TRUE
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment