Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
ffbb1c4e
Commit
ffbb1c4e
authored
Feb 06, 2020
by
Jacek Caban
Committed by
Alexandre Julliard
Feb 06, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
atl: Allow only ASCII digit for registrar binary values.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
d96a0acf
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
8 deletions
+13
-8
registrar.c
dlls/atl/registrar.c
+11
-6
registrar.c
dlls/atl/tests/registrar.c
+2
-2
No files found.
dlls/atl/registrar.c
View file @
ffbb1c4e
...
...
@@ -99,6 +99,14 @@ static void strbuf_write(LPCOLESTR str, strbuf *buf, int len)
buf
->
str
[
buf
->
len
]
=
'\0'
;
}
static
int
xdigit_to_int
(
WCHAR
c
)
{
if
(
'0'
<=
c
&&
c
<=
'9'
)
return
c
-
'0'
;
if
(
'a'
<=
c
&&
c
<=
'f'
)
return
c
-
'a'
+
10
;
if
(
'A'
<=
c
&&
c
<=
'F'
)
return
c
-
'A'
+
10
;
return
-
1
;
}
static
HRESULT
get_word
(
LPCOLESTR
*
str
,
strbuf
*
buf
)
{
LPCOLESTR
iter
,
iter2
=
*
str
;
...
...
@@ -303,15 +311,12 @@ static HRESULT do_process_key(LPCOLESTR *pstr, HKEY parent_key, strbuf *buf, BOO
break
;
}
for
(
i
=
0
;
i
<
count
&&
buf
->
str
[
2
*
i
];
i
++
)
{
WCHAR
digits
[
3
]
;
if
(
!
iswxdigit
(
buf
->
str
[
2
*
i
])
||
!
iswxdigit
(
buf
->
str
[
2
*
i
+
1
])
)
{
int
d1
,
d2
;
if
(
(
d1
=
xdigit_to_int
(
buf
->
str
[
2
*
i
]))
==
-
1
||
(
d2
=
xdigit_to_int
(
buf
->
str
[
2
*
i
+
1
]))
==
-
1
)
{
hres
=
E_FAIL
;
break
;
}
digits
[
0
]
=
buf
->
str
[
2
*
i
];
digits
[
1
]
=
buf
->
str
[
2
*
i
+
1
];
digits
[
2
]
=
0
;
bytes
[
i
]
=
(
BYTE
)
wcstoul
(
digits
,
NULL
,
16
);
bytes
[
i
]
=
(
d1
<<
4
)
|
d2
;
}
if
(
SUCCEEDED
(
hres
))
{
lres
=
RegSetValueExW
(
hkey
,
name
.
len
?
name
.
str
:
NULL
,
0
,
REG_BINARY
,
...
...
dlls/atl/tests/registrar.c
View file @
ffbb1c4e
...
...
@@ -48,7 +48,7 @@ static const char textA[] =
" val 'dword_quoted_hex' = d '0xA'
\n
"
" val 'dword_unquoted_hex' = d 0xA
\n
"
" val 'binary_quoted' = b 'deadbeef'
\n
"
" val 'binary_unquoted' = b dead
beef
\n
"
" val 'binary_unquoted' = b dead
0123
\n
"
" }
\n
"
"}"
;
...
...
@@ -124,7 +124,7 @@ static void test_registrar(void)
size
=
4
;
lret
=
RegQueryValueExA
(
key
,
"binary_unquoted"
,
NULL
,
NULL
,
bytes
,
&
size
);
ok
(
lret
==
ERROR_SUCCESS
,
"RegQueryValueA, failed, error %d
\n
"
,
lret
);
ok
(
bytes
[
0
]
==
0xde
&&
bytes
[
1
]
==
0xad
&&
bytes
[
2
]
==
0x
be
&&
bytes
[
3
]
==
0xef
,
ok
(
bytes
[
0
]
==
0xde
&&
bytes
[
1
]
==
0xad
&&
bytes
[
2
]
==
0x
01
&&
bytes
[
3
]
==
0x23
,
"binary unquoted value was not preserved (it's 0x%02X%02X%02X%02X)
\n
"
,
0xff
&
bytes
[
0
],
0xff
&
bytes
[
1
],
0xff
&
bytes
[
2
],
0xff
&
bytes
[
3
]);
...
...
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