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
5d7bbb56
Commit
5d7bbb56
authored
Nov 30, 2022
by
Sven Baars
Committed by
Alexandre Julliard
Mar 15, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernelbase: Move create_key() below open_key().
parent
0badf072
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
81 additions
and
81 deletions
+81
-81
registry.c
dlls/kernelbase/registry.c
+81
-81
No files found.
dlls/kernelbase/registry.c
View file @
5d7bbb56
...
...
@@ -140,87 +140,6 @@ static HKEY get_perflib_key( HANDLE key )
return
key
;
}
/* wrapper for NtCreateKey that creates the key recursively if necessary */
static
NTSTATUS
create_key
(
HKEY
*
retkey
,
HKEY
root
,
UNICODE_STRING
name
,
ULONG
options
,
ACCESS_MASK
access
,
const
UNICODE_STRING
*
class
,
PULONG
dispos
)
{
BOOL
force_wow32
=
is_win64
&&
(
access
&
KEY_WOW64_32KEY
);
NTSTATUS
status
=
STATUS_OBJECT_NAME_NOT_FOUND
;
OBJECT_ATTRIBUTES
attr
;
HANDLE
subkey
;
attr
.
Length
=
sizeof
(
attr
);
attr
.
RootDirectory
=
root
;
attr
.
ObjectName
=
&
name
;
attr
.
Attributes
=
0
;
attr
.
SecurityDescriptor
=
NULL
;
attr
.
SecurityQualityOfService
=
NULL
;
if
(
options
&
REG_OPTION_OPEN_LINK
)
attr
.
Attributes
|=
OBJ_OPENLINK
;
if
(
!
force_wow32
)
status
=
NtCreateKey
(
&
subkey
,
access
,
&
attr
,
0
,
class
,
options
,
dispos
);
if
(
status
==
STATUS_OBJECT_NAME_NOT_FOUND
)
{
WCHAR
*
buffer
=
name
.
Buffer
;
DWORD
attrs
,
pos
=
0
,
i
=
0
,
len
=
name
.
Length
/
sizeof
(
WCHAR
);
/* don't try to create registry root */
if
(
!
attr
.
RootDirectory
&&
len
>
10
&&
!
wcsnicmp
(
buffer
,
L"
\\
Registry
\\
"
,
10
))
i
+=
10
;
while
(
i
<
len
&&
buffer
[
i
]
!=
'\\'
)
i
++
;
if
(
i
==
len
&&
!
force_wow32
)
return
status
;
attrs
=
attr
.
Attributes
;
for
(;;)
{
name
.
Buffer
=
buffer
+
pos
;
name
.
Length
=
(
i
-
pos
)
*
sizeof
(
WCHAR
);
if
(
force_wow32
&&
pos
)
{
if
(
is_wow6432node
(
&
name
))
force_wow32
=
FALSE
;
else
if
((
subkey
=
open_wow6432node
(
attr
.
RootDirectory
)))
{
if
(
attr
.
RootDirectory
!=
root
)
NtClose
(
attr
.
RootDirectory
);
attr
.
RootDirectory
=
subkey
;
force_wow32
=
FALSE
;
}
}
if
(
i
==
len
)
{
attr
.
Attributes
=
attrs
;
status
=
NtCreateKey
(
&
subkey
,
access
,
&
attr
,
0
,
class
,
options
,
dispos
);
}
else
{
attr
.
Attributes
=
attrs
&
~
OBJ_OPENLINK
;
status
=
NtCreateKey
(
&
subkey
,
access
,
&
attr
,
0
,
class
,
options
&
~
REG_OPTION_CREATE_LINK
,
dispos
);
}
if
(
attr
.
RootDirectory
!=
root
)
NtClose
(
attr
.
RootDirectory
);
if
(
!
NT_SUCCESS
(
status
))
return
status
;
if
(
i
==
len
)
break
;
attr
.
RootDirectory
=
subkey
;
while
(
i
<
len
&&
buffer
[
i
]
==
'\\'
)
i
++
;
pos
=
i
;
while
(
i
<
len
&&
buffer
[
i
]
!=
'\\'
)
i
++
;
}
}
attr
.
RootDirectory
=
subkey
;
if
(
force_wow32
&&
(
subkey
=
open_wow6432node
(
attr
.
RootDirectory
)))
{
if
(
attr
.
RootDirectory
!=
root
)
NtClose
(
attr
.
RootDirectory
);
attr
.
RootDirectory
=
subkey
;
}
if
(
status
==
STATUS_PREDEFINED_HANDLE
)
{
attr
.
RootDirectory
=
get_perflib_key
(
attr
.
RootDirectory
);
status
=
STATUS_SUCCESS
;
}
*
retkey
=
attr
.
RootDirectory
;
return
status
;
}
static
NTSTATUS
open_subkey
(
HKEY
*
subkey
,
HKEY
root
,
UNICODE_STRING
*
name
,
DWORD
options
,
ACCESS_MASK
access
)
{
DWORD
i
=
0
,
len
=
name
->
Length
/
sizeof
(
WCHAR
);
...
...
@@ -322,6 +241,87 @@ static NTSTATUS open_key( HKEY *retkey, HKEY root, UNICODE_STRING name, DWORD op
return
status
;
}
/* wrapper for NtCreateKey that creates the key recursively if necessary */
static
NTSTATUS
create_key
(
HKEY
*
retkey
,
HKEY
root
,
UNICODE_STRING
name
,
ULONG
options
,
ACCESS_MASK
access
,
const
UNICODE_STRING
*
class
,
PULONG
dispos
)
{
BOOL
force_wow32
=
is_win64
&&
(
access
&
KEY_WOW64_32KEY
);
NTSTATUS
status
=
STATUS_OBJECT_NAME_NOT_FOUND
;
OBJECT_ATTRIBUTES
attr
;
HANDLE
subkey
;
attr
.
Length
=
sizeof
(
attr
);
attr
.
RootDirectory
=
root
;
attr
.
ObjectName
=
&
name
;
attr
.
Attributes
=
0
;
attr
.
SecurityDescriptor
=
NULL
;
attr
.
SecurityQualityOfService
=
NULL
;
if
(
options
&
REG_OPTION_OPEN_LINK
)
attr
.
Attributes
|=
OBJ_OPENLINK
;
if
(
!
force_wow32
)
status
=
NtCreateKey
(
&
subkey
,
access
,
&
attr
,
0
,
class
,
options
,
dispos
);
if
(
status
==
STATUS_OBJECT_NAME_NOT_FOUND
)
{
WCHAR
*
buffer
=
name
.
Buffer
;
DWORD
attrs
,
pos
=
0
,
i
=
0
,
len
=
name
.
Length
/
sizeof
(
WCHAR
);
/* don't try to create registry root */
if
(
!
attr
.
RootDirectory
&&
len
>
10
&&
!
wcsnicmp
(
buffer
,
L"
\\
Registry
\\
"
,
10
))
i
+=
10
;
while
(
i
<
len
&&
buffer
[
i
]
!=
'\\'
)
i
++
;
if
(
i
==
len
&&
!
force_wow32
)
return
status
;
attrs
=
attr
.
Attributes
;
for
(;;)
{
name
.
Buffer
=
buffer
+
pos
;
name
.
Length
=
(
i
-
pos
)
*
sizeof
(
WCHAR
);
if
(
force_wow32
&&
pos
)
{
if
(
is_wow6432node
(
&
name
))
force_wow32
=
FALSE
;
else
if
((
subkey
=
open_wow6432node
(
attr
.
RootDirectory
)))
{
if
(
attr
.
RootDirectory
!=
root
)
NtClose
(
attr
.
RootDirectory
);
attr
.
RootDirectory
=
subkey
;
force_wow32
=
FALSE
;
}
}
if
(
i
==
len
)
{
attr
.
Attributes
=
attrs
;
status
=
NtCreateKey
(
&
subkey
,
access
,
&
attr
,
0
,
class
,
options
,
dispos
);
}
else
{
attr
.
Attributes
=
attrs
&
~
OBJ_OPENLINK
;
status
=
NtCreateKey
(
&
subkey
,
access
,
&
attr
,
0
,
class
,
options
&
~
REG_OPTION_CREATE_LINK
,
dispos
);
}
if
(
attr
.
RootDirectory
!=
root
)
NtClose
(
attr
.
RootDirectory
);
if
(
!
NT_SUCCESS
(
status
))
return
status
;
if
(
i
==
len
)
break
;
attr
.
RootDirectory
=
subkey
;
while
(
i
<
len
&&
buffer
[
i
]
==
'\\'
)
i
++
;
pos
=
i
;
while
(
i
<
len
&&
buffer
[
i
]
!=
'\\'
)
i
++
;
}
}
attr
.
RootDirectory
=
subkey
;
if
(
force_wow32
&&
(
subkey
=
open_wow6432node
(
attr
.
RootDirectory
)))
{
if
(
attr
.
RootDirectory
!=
root
)
NtClose
(
attr
.
RootDirectory
);
attr
.
RootDirectory
=
subkey
;
}
if
(
status
==
STATUS_PREDEFINED_HANDLE
)
{
attr
.
RootDirectory
=
get_perflib_key
(
attr
.
RootDirectory
);
status
=
STATUS_SUCCESS
;
}
*
retkey
=
attr
.
RootDirectory
;
return
status
;
}
/* create one of the HKEY_* special root keys */
static
HKEY
create_special_root_hkey
(
HKEY
hkey
,
DWORD
access
)
{
...
...
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