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
99748496
Commit
99748496
authored
Aug 31, 2015
by
Vincent Povirk
Committed by
Alexandre Julliard
Sep 01, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
advapi32: RegOpenKeyEx can return special roots when asked for empty subkey.
parent
d8f79a03
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
1 deletion
+55
-1
registry.c
dlls/advapi32/registry.c
+16
-0
registry.c
dlls/advapi32/tests/registry.c
+39
-1
No files found.
dlls/advapi32/registry.c
View file @
99748496
...
@@ -476,6 +476,14 @@ LSTATUS WINAPI RegOpenKeyExW( HKEY hkey, LPCWSTR name, DWORD options, REGSAM acc
...
@@ -476,6 +476,14 @@ LSTATUS WINAPI RegOpenKeyExW( HKEY hkey, LPCWSTR name, DWORD options, REGSAM acc
OBJECT_ATTRIBUTES
attr
;
OBJECT_ATTRIBUTES
attr
;
UNICODE_STRING
nameW
;
UNICODE_STRING
nameW
;
if
(
retkey
&&
(
!
name
||
!
name
[
0
])
&&
(
HandleToUlong
(
hkey
)
>=
HandleToUlong
(
HKEY_SPECIAL_ROOT_FIRST
))
&&
(
HandleToUlong
(
hkey
)
<=
HandleToUlong
(
HKEY_SPECIAL_ROOT_LAST
)))
{
*
retkey
=
hkey
;
return
ERROR_SUCCESS
;
}
/* NT+ allows beginning backslash for HKEY_CLASSES_ROOT */
/* NT+ allows beginning backslash for HKEY_CLASSES_ROOT */
if
(
HandleToUlong
(
hkey
)
==
HandleToUlong
(
HKEY_CLASSES_ROOT
)
&&
name
&&
*
name
==
'\\'
)
name
++
;
if
(
HandleToUlong
(
hkey
)
==
HandleToUlong
(
HKEY_CLASSES_ROOT
)
&&
name
&&
*
name
==
'\\'
)
name
++
;
...
@@ -520,6 +528,14 @@ LSTATUS WINAPI RegOpenKeyExA( HKEY hkey, LPCSTR name, DWORD options, REGSAM acce
...
@@ -520,6 +528,14 @@ LSTATUS WINAPI RegOpenKeyExA( HKEY hkey, LPCSTR name, DWORD options, REGSAM acce
STRING
nameA
;
STRING
nameA
;
NTSTATUS
status
;
NTSTATUS
status
;
if
(
retkey
&&
(
!
name
||
!
name
[
0
])
&&
(
HandleToUlong
(
hkey
)
>=
HandleToUlong
(
HKEY_SPECIAL_ROOT_FIRST
))
&&
(
HandleToUlong
(
hkey
)
<=
HandleToUlong
(
HKEY_SPECIAL_ROOT_LAST
)))
{
*
retkey
=
hkey
;
return
ERROR_SUCCESS
;
}
if
(
!
is_version_nt
())
access
=
MAXIMUM_ALLOWED
;
/* Win95 ignores the access mask */
if
(
!
is_version_nt
())
access
=
MAXIMUM_ALLOWED
;
/* Win95 ignores the access mask */
else
else
{
{
...
...
dlls/advapi32/tests/registry.c
View file @
99748496
...
@@ -1075,7 +1075,6 @@ static void test_reg_open_key(void)
...
@@ -1075,7 +1075,6 @@ static void test_reg_open_key(void)
ok
(
ret
==
ERROR_INVALID_HANDLE
||
ret
==
ERROR_BADKEY
,
/* Windows 95 returns BADKEY */
ok
(
ret
==
ERROR_INVALID_HANDLE
||
ret
==
ERROR_BADKEY
,
/* Windows 95 returns BADKEY */
"expected ERROR_INVALID_HANDLE or ERROR_BADKEY, got %d
\n
"
,
ret
);
"expected ERROR_INVALID_HANDLE or ERROR_BADKEY, got %d
\n
"
,
ret
);
ok
(
hkResult
==
hkPreserve
,
"expected hkResult == hkPreserve
\n
"
);
ok
(
hkResult
==
hkPreserve
,
"expected hkResult == hkPreserve
\n
"
);
RegCloseKey
(
hkResult
);
/* send in NULL hkResult */
/* send in NULL hkResult */
ret
=
RegOpenKeyA
(
HKEY_CURRENT_USER
,
"Software
\\
Wine
\\
Test"
,
NULL
);
ret
=
RegOpenKeyA
(
HKEY_CURRENT_USER
,
"Software
\\
Wine
\\
Test"
,
NULL
);
...
@@ -1101,6 +1100,45 @@ static void test_reg_open_key(void)
...
@@ -1101,6 +1100,45 @@ static void test_reg_open_key(void)
"expected ERROR_SUCCESS, ERROR_BAD_PATHNAME or ERROR_FILE_NOT_FOUND, got %d
\n
"
,
ret
);
"expected ERROR_SUCCESS, ERROR_BAD_PATHNAME or ERROR_FILE_NOT_FOUND, got %d
\n
"
,
ret
);
RegCloseKey
(
hkResult
);
RegCloseKey
(
hkResult
);
/* NULL or empty subkey of special root */
hkResult
=
NULL
;
ret
=
RegOpenKeyExA
(
HKEY_CLASSES_ROOT
,
NULL
,
0
,
KEY_QUERY_VALUE
,
&
hkResult
);
ok
(
ret
==
ERROR_SUCCESS
,
"expected ERROR_SUCCESS, got %d
\n
"
,
ret
);
ok
(
hkResult
==
HKEY_CLASSES_ROOT
,
"expected hkResult == HKEY_CLASSES_ROOT
\n
"
);
hkResult
=
NULL
;
ret
=
RegOpenKeyExA
(
HKEY_CLASSES_ROOT
,
""
,
0
,
KEY_QUERY_VALUE
,
&
hkResult
);
ok
(
ret
==
ERROR_SUCCESS
,
"expected ERROR_SUCCESS, got %d
\n
"
,
ret
);
ok
(
hkResult
==
HKEY_CLASSES_ROOT
,
"expected hkResult == HKEY_CLASSES_ROOT
\n
"
);
hkResult
=
NULL
;
ret
=
RegOpenKeyExA
(
HKEY_CLASSES_ROOT
,
"
\\
"
,
0
,
KEY_QUERY_VALUE
,
&
hkResult
);
ok
(
ret
==
ERROR_SUCCESS
,
"expected ERROR_SUCCESS, got %d
\n
"
,
ret
);
ok
(
hkResult
!=
HKEY_CLASSES_ROOT
,
"expected hkResult to be a new key
\n
"
);
ok
(
!
RegCloseKey
(
hkResult
),
"got invalid hkey
\n
"
);
/* empty subkey of existing handle */
hkResult
=
hkPreserve
;
ret
=
RegOpenKeyExA
(
hkPreserve
,
""
,
0
,
KEY_QUERY_VALUE
,
&
hkResult
);
ok
(
ret
==
ERROR_SUCCESS
,
"expected ERROR_SUCCESS, got %d
\n
"
,
ret
);
ok
(
hkResult
!=
hkPreserve
,
"expected hkResult != hkPreserve
\n
"
);
ok
(
!
RegCloseKey
(
hkResult
),
"got invalid hkey
\n
"
);
/* NULL subkey of existing handle */
hkResult
=
hkPreserve
;
ret
=
RegOpenKeyExA
(
hkPreserve
,
NULL
,
0
,
KEY_QUERY_VALUE
,
&
hkResult
);
ok
(
ret
==
ERROR_SUCCESS
,
"expected ERROR_SUCCESS, got %d
\n
"
,
ret
);
ok
(
hkResult
!=
hkPreserve
,
"expected hkResult != hkPreserve
\n
"
);
ok
(
!
RegCloseKey
(
hkResult
),
"got invalid hkey
\n
"
);
/* empty subkey of NULL */
hkResult
=
hkPreserve
;
ret
=
RegOpenKeyExA
(
NULL
,
""
,
0
,
KEY_QUERY_VALUE
,
&
hkResult
);
ok
(
ret
==
ERROR_INVALID_HANDLE
,
"expected ERROR_INVALID_HANDLE, got %d
\n
"
,
ret
);
ok
(
hkResult
==
hkPreserve
,
"expected hkResult == hkPreserve
\n
"
);
RegCloseKey
(
hkPreserve
);
/* WOW64 flags */
/* WOW64 flags */
hkResult
=
NULL
;
hkResult
=
NULL
;
ret
=
RegOpenKeyExA
(
HKEY_LOCAL_MACHINE
,
"Software"
,
0
,
KEY_READ
|
KEY_WOW64_32KEY
,
&
hkResult
);
ret
=
RegOpenKeyExA
(
HKEY_LOCAL_MACHINE
,
"Software"
,
0
,
KEY_READ
|
KEY_WOW64_32KEY
,
&
hkResult
);
...
...
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