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
6ebc6279
Commit
6ebc6279
authored
Apr 02, 2010
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
server: Disallow all operations on deleted registry keys.
parent
21da080d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
24 deletions
+28
-24
registry.c
dlls/advapi32/tests/registry.c
+15
-4
registry.c
server/registry.c
+13
-20
No files found.
dlls/advapi32/tests/registry.c
View file @
6ebc6279
...
...
@@ -1924,16 +1924,24 @@ static void test_deleted_key(void)
delete_key
(
hkey_main
);
val_count
=
20
;
val_count
=
sizeof
(
value
)
;
type
=
0
;
res
=
RegEnumValueA
(
hkey
,
0
,
value
,
&
val_count
,
NULL
,
&
type
,
0
,
0
);
todo_wine
ok
(
res
==
ERROR_KEY_DELETED
,
"expect ERROR_KEY_DELETED, got %i
\n
"
,
res
);
ok
(
res
==
ERROR_KEY_DELETED
,
"expect ERROR_KEY_DELETED, got %i
\n
"
,
res
);
res
=
RegEnumKeyA
(
hkey
,
0
,
value
,
sizeof
(
value
)
);
ok
(
res
==
ERROR_KEY_DELETED
,
"expect ERROR_KEY_DELETED, got %i
\n
"
,
res
);
val_count
=
sizeof
(
value
);
type
=
0
;
res
=
RegQueryValueExA
(
hkey
,
"test"
,
NULL
,
&
type
,
(
BYTE
*
)
value
,
&
val_count
);
ok
(
res
==
ERROR_KEY_DELETED
,
"expect ERROR_KEY_DELETED, got %i
\n
"
,
res
);
res
=
RegSetValueExA
(
hkey
,
"test"
,
0
,
REG_SZ
,
(
const
BYTE
*
)
"value"
,
6
);
todo_wine
ok
(
res
==
ERROR_KEY_DELETED
,
"expect ERROR_KEY_DELETED, got %i
\n
"
,
res
);
ok
(
res
==
ERROR_KEY_DELETED
,
"expect ERROR_KEY_DELETED, got %i
\n
"
,
res
);
res
=
RegOpenKeyA
(
hkey
,
"test"
,
&
hkey2
);
todo_wine
ok
(
res
==
ERROR_KEY_DELETED
,
"expect ERROR_KEY_DELETED, got %i
\n
"
,
res
);
ok
(
res
==
ERROR_KEY_DELETED
,
"expect ERROR_KEY_DELETED, got %i
\n
"
,
res
);
if
(
res
==
0
)
RegCloseKey
(
hkey2
);
...
...
@@ -1942,6 +1950,9 @@ static void test_deleted_key(void)
if
(
res
==
0
)
RegCloseKey
(
hkey2
);
res
=
RegFlushKey
(
hkey
);
ok
(
res
==
ERROR_KEY_DELETED
,
"expect ERROR_KEY_DELETED, got %i
\n
"
,
res
);
RegCloseKey
(
hkey
);
setup_main_key
();
...
...
server/registry.c
View file @
6ebc6279
...
...
@@ -712,12 +712,6 @@ static struct key *create_key( struct key *key, const struct unicode_str *name,
int
index
;
struct
unicode_str
token
,
next
;
if
(
key
->
flags
&
KEY_DELETED
)
/* we cannot create a subkey under a deleted key */
{
set_error
(
STATUS_KEY_DELETED
);
return
NULL
;
}
*
created
=
0
;
if
(
!
(
key
=
open_key_prefix
(
key
,
name
,
access
,
&
token
,
&
index
)))
return
NULL
;
...
...
@@ -902,7 +896,7 @@ static void enum_key( const struct key *key, int index, int info_class,
static
int
delete_key
(
struct
key
*
key
,
int
recurse
)
{
int
index
;
struct
key
*
parent
;
struct
key
*
parent
=
key
->
parent
;
/* must find parent and index */
if
(
key
==
root_key
)
...
...
@@ -910,11 +904,7 @@ static int delete_key( struct key *key, int recurse )
set_error
(
STATUS_ACCESS_DENIED
);
return
-
1
;
}
if
(
!
(
parent
=
key
->
parent
)
||
(
key
->
flags
&
KEY_DELETED
))
{
set_error
(
STATUS_KEY_DELETED
);
return
-
1
;
}
assert
(
parent
);
while
(
recurse
&&
(
key
->
last_subkey
>=
0
))
if
(
0
>
delete_key
(
key
->
subkeys
[
key
->
last_subkey
],
1
))
...
...
@@ -1165,16 +1155,24 @@ static void delete_value( struct key *key, const struct unicode_str *name )
}
/* get the registry key corresponding to an hkey handle */
static
inline
struct
key
*
get_hkey_obj
(
obj_handle_t
hkey
,
unsigned
int
access
)
static
struct
key
*
get_hkey_obj
(
obj_handle_t
hkey
,
unsigned
int
access
)
{
return
(
struct
key
*
)
get_handle_obj
(
current
->
process
,
hkey
,
access
,
&
key_ops
);
struct
key
*
key
=
(
struct
key
*
)
get_handle_obj
(
current
->
process
,
hkey
,
access
,
&
key_ops
);
if
(
key
&&
key
->
flags
&
KEY_DELETED
)
{
set_error
(
STATUS_KEY_DELETED
);
release_object
(
key
);
key
=
NULL
;
}
return
key
;
}
/* get the registry key corresponding to a parent key handle */
static
inline
struct
key
*
get_parent_hkey_obj
(
obj_handle_t
hkey
)
{
if
(
!
hkey
)
return
(
struct
key
*
)
grab_object
(
root_key
);
return
(
struct
key
*
)
get_handle_obj
(
current
->
process
,
hkey
,
0
,
&
key_ops
);
return
get_hkey_obj
(
hkey
,
0
);
}
/* read a line from the input file */
...
...
@@ -1698,11 +1696,6 @@ static void save_registry( struct key *key, obj_handle_t handle )
struct
file
*
file
;
int
fd
;
if
(
key
->
flags
&
KEY_DELETED
)
{
set_error
(
STATUS_KEY_DELETED
);
return
;
}
if
(
!
(
file
=
get_file_obj
(
current
->
process
,
handle
,
FILE_WRITE_DATA
)))
return
;
fd
=
dup
(
get_file_unix_fd
(
file
)
);
release_object
(
file
);
...
...
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