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
75aa00a5
Commit
75aa00a5
authored
Mar 09, 2023
by
Sven Baars
Committed by
Alexandre Julliard
Mar 15, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernelbase: Pass the key name to open_key().
parent
a31d0e6c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
41 deletions
+32
-41
registry.c
dlls/kernelbase/registry.c
+32
-41
No files found.
dlls/kernelbase/registry.c
View file @
75aa00a5
...
...
@@ -214,21 +214,28 @@ static NTSTATUS create_key( HKEY *retkey, ACCESS_MASK access, OBJECT_ATTRIBUTES
}
/* wrapper for NtOpenKeyEx to handle Wow6432 nodes */
static
NTSTATUS
open_key
(
HKEY
*
retkey
,
HKEY
root
,
DWORD
options
,
ACCESS_MASK
access
,
OBJECT_ATTRIBUTES
*
attr
)
static
NTSTATUS
open_key
(
HKEY
*
retkey
,
HKEY
root
,
UNICODE_STRING
name
,
DWORD
options
,
ACCESS_MASK
access
)
{
OBJECT_ATTRIBUTES
attr
;
NTSTATUS
status
;
BOOL
force_wow32
=
is_win64
&&
(
access
&
KEY_WOW64_32KEY
);
HANDLE
subkey
;
WCHAR
*
buffer
=
attr
->
ObjectName
->
Buffer
;
DWORD
pos
=
0
,
i
=
0
,
len
=
attr
->
ObjectName
->
Length
/
sizeof
(
WCHAR
);
UNICODE_STRING
str
;
WCHAR
*
buffer
=
name
.
Buffer
;
DWORD
pos
=
0
,
i
=
0
,
len
=
name
.
Length
/
sizeof
(
WCHAR
);
*
retkey
=
NULL
;
attr
.
Length
=
sizeof
(
attr
);
attr
.
RootDirectory
=
root
;
attr
.
ObjectName
=
&
name
;
attr
.
Attributes
=
0
;
attr
.
SecurityDescriptor
=
NULL
;
attr
.
SecurityQualityOfService
=
NULL
;
if
(
!
force_wow32
)
{
if
(
options
&
REG_OPTION_OPEN_LINK
)
attr
->
Attributes
|=
OBJ_OPENLINK
;
status
=
NtOpenKeyEx
(
(
HANDLE
*
)
retkey
,
access
,
attr
,
options
);
if
(
options
&
REG_OPTION_OPEN_LINK
)
attr
.
Attributes
|=
OBJ_OPENLINK
;
status
=
NtOpenKeyEx
(
(
HANDLE
*
)
retkey
,
access
,
&
attr
,
options
);
if
(
status
==
STATUS_PREDEFINED_HANDLE
)
{
*
retkey
=
get_perflib_key
(
*
retkey
);
...
...
@@ -239,51 +246,50 @@ static NTSTATUS open_key( HKEY *retkey, HKEY root, DWORD options, ACCESS_MASK ac
if
(
len
&&
buffer
[
0
]
==
'\\'
)
return
STATUS_OBJECT_PATH_INVALID
;
while
(
i
<
len
&&
buffer
[
i
]
!=
'\\'
)
i
++
;
attr
->
ObjectName
=
&
str
;
for
(;;)
{
str
.
Buffer
=
buffer
+
pos
;
str
.
Length
=
(
i
-
pos
)
*
sizeof
(
WCHAR
);
name
.
Buffer
=
buffer
+
pos
;
name
.
Length
=
(
i
-
pos
)
*
sizeof
(
WCHAR
);
if
(
force_wow32
&&
pos
)
{
if
(
is_wow6432node
(
&
str
))
force_wow32
=
FALSE
;
else
if
((
subkey
=
open_wow6432node
(
attr
->
RootDirectory
)))
if
(
is_wow6432node
(
&
name
))
force_wow32
=
FALSE
;
else
if
((
subkey
=
open_wow6432node
(
attr
.
RootDirectory
)))
{
if
(
attr
->
RootDirectory
!=
root
)
NtClose
(
attr
->
RootDirectory
);
attr
->
RootDirectory
=
subkey
;
if
(
attr
.
RootDirectory
!=
root
)
NtClose
(
attr
.
RootDirectory
);
attr
.
RootDirectory
=
subkey
;
force_wow32
=
FALSE
;
}
}
if
(
i
==
len
)
{
if
(
options
&
REG_OPTION_OPEN_LINK
)
attr
->
Attributes
|=
OBJ_OPENLINK
;
status
=
NtOpenKeyEx
(
&
subkey
,
access
,
attr
,
options
);
if
(
options
&
REG_OPTION_OPEN_LINK
)
attr
.
Attributes
|=
OBJ_OPENLINK
;
status
=
NtOpenKeyEx
(
&
subkey
,
access
,
&
attr
,
options
);
}
else
{
if
(
!
(
options
&
REG_OPTION_OPEN_LINK
))
attr
->
Attributes
&=
~
OBJ_OPENLINK
;
status
=
NtOpenKeyEx
(
&
subkey
,
access
,
attr
,
options
&
~
REG_OPTION_OPEN_LINK
);
if
(
!
(
options
&
REG_OPTION_OPEN_LINK
))
attr
.
Attributes
&=
~
OBJ_OPENLINK
;
status
=
NtOpenKeyEx
(
&
subkey
,
access
,
&
attr
,
options
&
~
REG_OPTION_OPEN_LINK
);
}
if
(
attr
->
RootDirectory
!=
root
)
NtClose
(
attr
->
RootDirectory
);
if
(
attr
.
RootDirectory
!=
root
)
NtClose
(
attr
.
RootDirectory
);
if
(
status
)
return
status
;
attr
->
RootDirectory
=
subkey
;
attr
.
RootDirectory
=
subkey
;
if
(
i
==
len
)
break
;
while
(
i
<
len
&&
buffer
[
i
]
==
'\\'
)
i
++
;
pos
=
i
;
while
(
i
<
len
&&
buffer
[
i
]
!=
'\\'
)
i
++
;
}
if
(
force_wow32
&&
(
subkey
=
open_wow6432node
(
attr
->
RootDirectory
)))
if
(
force_wow32
&&
(
subkey
=
open_wow6432node
(
attr
.
RootDirectory
)))
{
if
(
attr
->
RootDirectory
!=
root
)
NtClose
(
attr
->
RootDirectory
);
attr
->
RootDirectory
=
subkey
;
if
(
attr
.
RootDirectory
!=
root
)
NtClose
(
attr
.
RootDirectory
);
attr
.
RootDirectory
=
subkey
;
}
if
(
status
==
STATUS_PREDEFINED_HANDLE
)
{
attr
->
RootDirectory
=
get_perflib_key
(
attr
->
RootDirectory
);
attr
.
RootDirectory
=
get_perflib_key
(
attr
.
RootDirectory
);
status
=
STATUS_SUCCESS
;
}
*
retkey
=
attr
->
RootDirectory
;
*
retkey
=
attr
.
RootDirectory
;
return
status
;
}
...
...
@@ -512,7 +518,6 @@ LSTATUS WINAPI DECLSPEC_HOTPATCH RegCreateKeyExA( HKEY hkey, LPCSTR name, DWORD
*/
LSTATUS
WINAPI
DECLSPEC_HOTPATCH
RegOpenKeyExW
(
HKEY
hkey
,
LPCWSTR
name
,
DWORD
options
,
REGSAM
access
,
PHKEY
retkey
)
{
OBJECT_ATTRIBUTES
attr
;
UNICODE_STRING
nameW
;
if
(
retkey
&&
(
!
name
||
!
name
[
0
])
&&
...
...
@@ -530,14 +535,8 @@ LSTATUS WINAPI DECLSPEC_HOTPATCH RegOpenKeyExW( HKEY hkey, LPCWSTR name, DWORD o
*
retkey
=
NULL
;
if
(
!
(
hkey
=
get_special_root_hkey
(
hkey
,
access
)))
return
ERROR_INVALID_HANDLE
;
attr
.
Length
=
sizeof
(
attr
);
attr
.
RootDirectory
=
hkey
;
attr
.
ObjectName
=
&
nameW
;
attr
.
Attributes
=
0
;
attr
.
SecurityDescriptor
=
NULL
;
attr
.
SecurityQualityOfService
=
NULL
;
RtlInitUnicodeString
(
&
nameW
,
name
);
return
RtlNtStatusToDosError
(
open_key
(
retkey
,
hkey
,
options
,
access
,
&
attr
)
);
return
RtlNtStatusToDosError
(
open_key
(
retkey
,
hkey
,
nameW
,
options
,
access
)
);
}
...
...
@@ -563,7 +562,6 @@ LSTATUS WINAPI DECLSPEC_HOTPATCH RegOpenKeyExW( HKEY hkey, LPCWSTR name, DWORD o
*/
LSTATUS
WINAPI
DECLSPEC_HOTPATCH
RegOpenKeyExA
(
HKEY
hkey
,
LPCSTR
name
,
DWORD
options
,
REGSAM
access
,
PHKEY
retkey
)
{
OBJECT_ATTRIBUTES
attr
;
STRING
nameA
;
NTSTATUS
status
;
...
...
@@ -584,18 +582,11 @@ LSTATUS WINAPI DECLSPEC_HOTPATCH RegOpenKeyExA( HKEY hkey, LPCSTR name, DWORD op
if
(
!
(
hkey
=
get_special_root_hkey
(
hkey
,
access
)))
return
ERROR_INVALID_HANDLE
;
attr
.
Length
=
sizeof
(
attr
);
attr
.
RootDirectory
=
hkey
;
attr
.
ObjectName
=
&
NtCurrentTeb
()
->
StaticUnicodeString
;
attr
.
Attributes
=
0
;
attr
.
SecurityDescriptor
=
NULL
;
attr
.
SecurityQualityOfService
=
NULL
;
RtlInitAnsiString
(
&
nameA
,
name
);
if
(
!
(
status
=
RtlAnsiStringToUnicodeString
(
&
NtCurrentTeb
()
->
StaticUnicodeString
,
&
nameA
,
FALSE
)))
{
status
=
open_key
(
retkey
,
hkey
,
options
,
access
,
&
attr
);
status
=
open_key
(
retkey
,
hkey
,
NtCurrentTeb
()
->
StaticUnicodeString
,
options
,
access
);
}
return
RtlNtStatusToDosError
(
status
);
}
...
...
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