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
da6d5e6a
Commit
da6d5e6a
authored
Jun 28, 2014
by
Nikolay Sivov
Committed by
Alexandre Julliard
Jun 30, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
advapi32: Implement RegDeleteKeyValue().
parent
f9a19f57
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
100 additions
and
13 deletions
+100
-13
advapi32.spec
dlls/advapi32/advapi32.spec
+2
-2
registry.c
dlls/advapi32/registry.c
+45
-11
registry.c
dlls/advapi32/tests/registry.c
+53
-0
No files found.
dlls/advapi32/advapi32.spec
View file @
da6d5e6a
...
...
@@ -588,8 +588,8 @@
# @ stub RegDeleteKeyTransactedA
# @ stub RegDeleteKeyTransactedW
@ stdcall RegDeleteKeyW(long wstr)
# @ stub RegDeleteKeyValueA
# @ stub RegDeleteKeyValueW
@ stdcall RegDeleteKeyValueA(long str str)
@ stdcall RegDeleteKeyValueW(long wstr wstr)
@ stdcall RegDeleteTreeA(long str)
@ stdcall RegDeleteTreeW(long wstr)
@ stdcall RegDeleteValueA(long str)
...
...
dlls/advapi32/registry.c
View file @
da6d5e6a
...
...
@@ -2050,8 +2050,6 @@ LSTATUS WINAPI RegEnumValueA( HKEY hkey, DWORD index, LPSTR value, LPDWORD val_c
return
RtlNtStatusToDosError
(
status
);
}
/******************************************************************************
* RegDeleteValueW [ADVAPI32.@]
*
...
...
@@ -2059,15 +2057,9 @@ LSTATUS WINAPI RegEnumValueA( HKEY hkey, DWORD index, LPSTR value, LPDWORD val_c
*/
LSTATUS
WINAPI
RegDeleteValueW
(
HKEY
hkey
,
LPCWSTR
name
)
{
UNICODE_STRING
nameW
;
if
(
!
(
hkey
=
get_special_root_hkey
(
hkey
,
0
)))
return
ERROR_INVALID_HANDLE
;
RtlInitUnicodeString
(
&
nameW
,
name
);
return
RtlNtStatusToDosError
(
NtDeleteValueKey
(
hkey
,
&
nameW
)
);
return
RegDeleteKeyValueW
(
hkey
,
NULL
,
name
);
}
/******************************************************************************
* RegDeleteValueA [ADVAPI32.@]
*
...
...
@@ -2083,22 +2075,64 @@ LSTATUS WINAPI RegDeleteValueW( HKEY hkey, LPCWSTR name )
*/
LSTATUS
WINAPI
RegDeleteValueA
(
HKEY
hkey
,
LPCSTR
name
)
{
ANSI_STRING
nameA
;
return
RegDeleteKeyValueA
(
hkey
,
NULL
,
name
);
}
/******************************************************************************
* RegDeleteKeyValueW [ADVAPI32.@]
*/
LONG
WINAPI
RegDeleteKeyValueW
(
HKEY
hkey
,
LPCWSTR
subkey
,
LPCWSTR
name
)
{
UNICODE_STRING
nameW
;
HKEY
hsubkey
=
0
;
LONG
ret
;
if
(
!
(
hkey
=
get_special_root_hkey
(
hkey
,
0
)))
return
ERROR_INVALID_HANDLE
;
if
(
subkey
)
{
if
((
ret
=
RegOpenKeyExW
(
hkey
,
subkey
,
0
,
KEY_SET_VALUE
,
&
hsubkey
)))
return
ret
;
hkey
=
hsubkey
;
}
RtlInitUnicodeString
(
&
nameW
,
name
);
ret
=
RtlNtStatusToDosError
(
NtDeleteValueKey
(
hkey
,
&
nameW
)
);
if
(
hsubkey
)
RegCloseKey
(
hsubkey
);
return
ret
;
}
/******************************************************************************
* RegDeleteKeyValueA [ADVAPI32.@]
*/
LONG
WINAPI
RegDeleteKeyValueA
(
HKEY
hkey
,
LPCSTR
subkey
,
LPCSTR
name
)
{
UNICODE_STRING
nameW
;
HKEY
hsubkey
=
0
;
ANSI_STRING
nameA
;
NTSTATUS
status
;
if
(
!
(
hkey
=
get_special_root_hkey
(
hkey
,
0
)))
return
ERROR_INVALID_HANDLE
;
if
(
subkey
)
{
LONG
ret
=
RegOpenKeyExA
(
hkey
,
subkey
,
0
,
KEY_SET_VALUE
,
&
hsubkey
);
if
(
ret
)
return
ret
;
hkey
=
hsubkey
;
}
RtlInitAnsiString
(
&
nameA
,
name
);
if
(
!
(
status
=
RtlAnsiStringToUnicodeString
(
&
nameW
,
&
nameA
,
TRUE
)))
{
status
=
NtDeleteValueKey
(
hkey
,
&
nameW
);
RtlFreeUnicodeString
(
&
nameW
);
}
if
(
hsubkey
)
RegCloseKey
(
hsubkey
);
return
RtlNtStatusToDosError
(
status
);
}
/******************************************************************************
* RegLoadKeyW [ADVAPI32.@]
*
...
...
dlls/advapi32/tests/registry.c
View file @
da6d5e6a
...
...
@@ -47,6 +47,7 @@ static BOOL (WINAPI *pIsWow64Process)(HANDLE,PBOOL);
static
NTSTATUS
(
WINAPI
*
pNtDeleteKey
)(
HANDLE
);
static
NTSTATUS
(
WINAPI
*
pRtlFormatCurrentUserKeyPath
)(
UNICODE_STRING
*
);
static
NTSTATUS
(
WINAPI
*
pRtlFreeUnicodeString
)(
PUNICODE_STRING
);
static
LONG
(
WINAPI
*
pRegDeleteKeyValueA
)(
HKEY
,
LPCSTR
,
LPCSTR
);
static
BOOL
limited_user
;
...
...
@@ -135,6 +136,7 @@ static void InitFunctionPtrs(void)
ADVAPI32_GET_PROC
(
RegGetValueA
);
ADVAPI32_GET_PROC
(
RegDeleteTreeA
);
ADVAPI32_GET_PROC
(
RegDeleteKeyExA
);
ADVAPI32_GET_PROC
(
RegDeleteKeyValueA
);
pIsWow64Process
=
(
void
*
)
GetProcAddress
(
hkernel32
,
"IsWow64Process"
);
pRtlFormatCurrentUserKeyPath
=
(
void
*
)
GetProcAddress
(
hntdll
,
"RtlFormatCurrentUserKeyPath"
);
...
...
@@ -2768,6 +2770,56 @@ static void test_delete_value(void)
"expect ERROR_FILE_NOT_FOUND, got %i
\n
"
,
res
);
}
static
void
test_delete_key_value
(
void
)
{
HKEY
subkey
;
LONG
ret
;
if
(
!
pRegDeleteKeyValueA
)
{
win_skip
(
"RegDeleteKeyValue is not available.
\n
"
);
return
;
}
ret
=
pRegDeleteKeyValueA
(
NULL
,
NULL
,
NULL
);
ok
(
ret
==
ERROR_INVALID_HANDLE
,
"got %d
\n
"
,
ret
);
ret
=
pRegDeleteKeyValueA
(
hkey_main
,
NULL
,
NULL
);
ok
(
ret
==
ERROR_FILE_NOT_FOUND
,
"got %d
\n
"
,
ret
);
ret
=
RegSetValueExA
(
hkey_main
,
"test"
,
0
,
REG_SZ
,
(
const
BYTE
*
)
"value"
,
6
);
ok
(
ret
==
ERROR_SUCCESS
,
"got %d
\n
"
,
ret
);
ret
=
RegQueryValueExA
(
hkey_main
,
"test"
,
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
ret
==
ERROR_SUCCESS
,
"got %d
\n
"
,
ret
);
/* NULL subkey name means delete from open key */
ret
=
pRegDeleteKeyValueA
(
hkey_main
,
NULL
,
"test"
);
ok
(
ret
==
ERROR_SUCCESS
,
"got %d
\n
"
,
ret
);
ret
=
RegQueryValueExA
(
hkey_main
,
"test"
,
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
ret
==
ERROR_FILE_NOT_FOUND
,
"got %d
\n
"
,
ret
);
/* now with real subkey */
ret
=
RegCreateKeyExA
(
hkey_main
,
"Subkey1"
,
0
,
NULL
,
0
,
KEY_WRITE
|
KEY_READ
,
NULL
,
&
subkey
,
NULL
);
ok
(
!
ret
,
"failed with error %d
\n
"
,
ret
);
ret
=
RegSetValueExA
(
subkey
,
"test"
,
0
,
REG_SZ
,
(
const
BYTE
*
)
"value"
,
6
);
ok
(
ret
==
ERROR_SUCCESS
,
"got %d
\n
"
,
ret
);
ret
=
RegQueryValueExA
(
subkey
,
"test"
,
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
ret
==
ERROR_SUCCESS
,
"got %d
\n
"
,
ret
);
ret
=
pRegDeleteKeyValueA
(
hkey_main
,
"Subkey1"
,
"test"
);
ok
(
ret
==
ERROR_SUCCESS
,
"got %d
\n
"
,
ret
);
ret
=
RegQueryValueExA
(
subkey
,
"test"
,
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
ret
==
ERROR_FILE_NOT_FOUND
,
"got %d
\n
"
,
ret
);
RegDeleteKeyA
(
subkey
,
""
);
RegCloseKey
(
subkey
);
}
START_TEST
(
registry
)
{
/* Load pointers for functions that are not available in all Windows versions */
...
...
@@ -2808,6 +2860,7 @@ START_TEST(registry)
test_rw_order
();
test_deleted_key
();
test_delete_value
();
test_delete_key_value
();
/* cleanup */
delete_key
(
hkey_main
);
...
...
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