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
cd4b9c11
Commit
cd4b9c11
authored
Nov 24, 2010
by
Damjan Jovanovic
Committed by
Alexandre Julliard
Nov 24, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
atl: Add support for binary values in IRegistrar.
parent
d2a221d2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
0 deletions
+52
-0
registrar.c
dlls/atl/registrar.c
+35
-0
registrar.c
dlls/atl/tests/registrar.c
+17
-0
No files found.
dlls/atl/registrar.c
View file @
cd4b9c11
...
@@ -299,6 +299,41 @@ static HRESULT do_process_key(LPCOLESTR *pstr, HKEY parent_key, strbuf *buf, BOO
...
@@ -299,6 +299,41 @@ static HRESULT do_process_key(LPCOLESTR *pstr, HKEY parent_key, strbuf *buf, BOO
}
}
break
;
break
;
}
}
case
'b'
:
{
BYTE
*
bytes
;
DWORD
count
;
DWORD
i
;
hres
=
get_word
(
&
iter
,
buf
);
if
(
FAILED
(
hres
))
break
;
count
=
(
lstrlenW
(
buf
->
str
)
+
1
)
/
2
;
bytes
=
HeapAlloc
(
GetProcessHeap
(),
0
,
count
);
if
(
bytes
==
NULL
)
{
hres
=
E_OUTOFMEMORY
;
break
;
}
for
(
i
=
0
;
i
<
count
&&
buf
->
str
[
2
*
i
];
i
++
)
{
WCHAR
digits
[
3
];
if
(
!
isxdigitW
(
buf
->
str
[
2
*
i
])
||
!
isxdigitW
(
buf
->
str
[
2
*
i
+
1
]))
{
hres
=
E_FAIL
;
break
;
}
digits
[
0
]
=
buf
->
str
[
2
*
i
];
digits
[
1
]
=
buf
->
str
[
2
*
i
+
1
];
digits
[
2
]
=
0
;
bytes
[
i
]
=
(
BYTE
)
strtoulW
(
digits
,
NULL
,
16
);
}
if
(
SUCCEEDED
(
hres
))
{
lres
=
RegSetValueExW
(
hkey
,
name
.
len
?
name
.
str
:
NULL
,
0
,
REG_BINARY
,
bytes
,
count
);
if
(
lres
!=
ERROR_SUCCESS
)
{
WARN
(
"Could not set value of key: 0x%08x
\n
"
,
lres
);
hres
=
HRESULT_FROM_WIN32
(
lres
);
}
}
HeapFree
(
GetProcessHeap
(),
0
,
bytes
);
break
;
}
default:
default:
WARN
(
"Wrong resource type: %s
\n
"
,
debugstr_w
(
buf
->
str
));
WARN
(
"Wrong resource type: %s
\n
"
,
debugstr_w
(
buf
->
str
));
hres
=
DISP_E_EXCEPTION
;
hres
=
DISP_E_EXCEPTION
;
...
...
dlls/atl/tests/registrar.c
View file @
cd4b9c11
...
@@ -47,6 +47,8 @@ static const char textA[] =
...
@@ -47,6 +47,8 @@ static const char textA[] =
" val 'dword_unquoted_dec' = d 1
\n
"
" val 'dword_unquoted_dec' = d 1
\n
"
" val 'dword_quoted_hex' = d '0xA'
\n
"
" val 'dword_quoted_hex' = d '0xA'
\n
"
" val 'dword_unquoted_hex' = d 0xA
\n
"
" val 'dword_unquoted_hex' = d 0xA
\n
"
" val 'binary_quoted' = b 'deadbeef'
\n
"
" val 'binary_unquoted' = b deadbeef
\n
"
" }
\n
"
" }
\n
"
"}"
;
"}"
;
...
@@ -72,6 +74,7 @@ static void test_registrar(void)
...
@@ -72,6 +74,7 @@ static void test_registrar(void)
DWORD
size
;
DWORD
size
;
LONG
lret
;
LONG
lret
;
HKEY
key
;
HKEY
key
;
BYTE
bytes
[
4
];
MultiByteToWideChar
(
CP_ACP
,
0
,
textA
,
-
1
,
textW
,
count
);
MultiByteToWideChar
(
CP_ACP
,
0
,
textA
,
-
1
,
textW
,
count
);
hr
=
IRegistrar_StringRegister
(
registrar
,
textW
);
hr
=
IRegistrar_StringRegister
(
registrar
,
textW
);
...
@@ -100,6 +103,20 @@ static void test_registrar(void)
...
@@ -100,6 +103,20 @@ static void test_registrar(void)
ok
(
lret
==
ERROR_SUCCESS
,
"RegQueryValueExA failed, error %d
\n
"
,
lret
);
ok
(
lret
==
ERROR_SUCCESS
,
"RegQueryValueExA failed, error %d
\n
"
,
lret
);
ok
(
dword
==
1
,
"quoted dec is not supposed to be %d
\n
"
,
dword
);
ok
(
dword
==
1
,
"quoted dec is not supposed to be %d
\n
"
,
dword
);
size
=
4
;
lret
=
RegQueryValueExA
(
key
,
"binary_quoted"
,
NULL
,
NULL
,
bytes
,
&
size
);
ok
(
lret
==
ERROR_SUCCESS
,
"RegQueryValueA, failed, error %d
\n
"
,
lret
);
ok
(
bytes
[
0
]
=
0xde
&&
bytes
[
1
]
==
0xad
&&
bytes
[
2
]
==
0xbe
&&
bytes
[
3
]
==
0xef
,
"binary quoted value was not preserved (it's 0x%02X%02X%02X%02X)
\n
"
,
0xff
&
bytes
[
0
],
0xff
&
bytes
[
1
],
0xff
&
bytes
[
2
],
0xff
&
bytes
[
3
]);
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
]
==
0xbe
&&
bytes
[
3
]
==
0xef
,
"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
]);
hr
=
IRegistrar_StringUnregister
(
registrar
,
textW
);
hr
=
IRegistrar_StringUnregister
(
registrar
,
textW
);
ok
(
SUCCEEDED
(
hr
),
"IRegistar_StringUnregister failed, hr = 0x%08X
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"IRegistar_StringUnregister failed, hr = 0x%08X
\n
"
,
hr
);
RegCloseKey
(
key
);
RegCloseKey
(
key
);
...
...
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