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
0dcf1960
Commit
0dcf1960
authored
Apr 04, 2007
by
Stefan Leichter
Committed by
Alexandre Julliard
Apr 05, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
advapi32: Add some tests for RegDeleteTreeA.
parent
6230222a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
60 additions
and
0 deletions
+60
-0
registry.c
dlls/advapi32/tests/registry.c
+60
-0
No files found.
dlls/advapi32/tests/registry.c
View file @
0dcf1960
...
...
@@ -35,6 +35,7 @@ static const char * sTestpath2 = "%FOO%\\subdir1";
static
HMODULE
hadvapi32
;
static
DWORD
(
WINAPI
*
pRegGetValueA
)(
HKEY
,
LPCSTR
,
LPCSTR
,
DWORD
,
LPDWORD
,
PVOID
,
LPDWORD
);
static
DWORD
(
WINAPI
*
pRegDeleteTreeA
)(
HKEY
,
LPCSTR
);
#define ADVAPI32_GET_PROC(func) \
p ## func = (void*)GetProcAddress(hadvapi32, #func); \
...
...
@@ -47,6 +48,7 @@ static void InitFunctionPtrs(void)
/* This function was introduced with Windows 2003 SP1 */
ADVAPI32_GET_PROC
(
RegGetValueA
)
ADVAPI32_GET_PROC
(
RegDeleteTreeA
)
}
/* delete key and all its subkeys */
...
...
@@ -892,6 +894,62 @@ cleanup:
RegCloseKey
(
subkey
);
}
static
void
test_reg_delete_tree
(
void
)
{
CHAR
buffer
[
MAX_PATH
];
HKEY
subkey
,
subkey2
;
LONG
size
,
ret
;
if
(
!
pRegDeleteTreeA
)
{
skip
(
"Skipping RegDeleteTreeA tests, function not present
\n
"
);
return
;
}
ret
=
RegCreateKeyA
(
hkey_main
,
"subkey"
,
&
subkey
);
ok
(
ret
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
ret
);
ret
=
RegCreateKeyA
(
subkey
,
"subkey2"
,
&
subkey2
);
ok
(
ret
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
ret
);
ret
=
RegSetValueA
(
subkey
,
NULL
,
REG_SZ
,
"data"
,
4
);
ok
(
ret
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
ret
);
ret
=
RegSetValueA
(
subkey2
,
NULL
,
REG_SZ
,
"data2"
,
5
);
ok
(
ret
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
ret
);
ret
=
RegCloseKey
(
subkey2
);
ok
(
ret
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
ret
);
ret
=
pRegDeleteTreeA
(
subkey
,
"subkey2"
);
ok
(
ret
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
ret
);
ok
(
RegOpenKeyA
(
subkey
,
"subkey2"
,
&
subkey2
),
"subkey2 was not deleted
\n
"
);
size
=
MAX_PATH
;
ok
(
!
RegQueryValueA
(
subkey
,
NULL
,
buffer
,
&
size
),
"Default value of subkey not longer present
\n
"
);
ret
=
RegCreateKeyA
(
subkey
,
"subkey2"
,
&
subkey2
);
ok
(
ret
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
ret
);
ret
=
RegCloseKey
(
subkey2
);
ok
(
ret
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
ret
);
ret
=
pRegDeleteTreeA
(
hkey_main
,
"subkey
\\
subkey2"
);
ok
(
ret
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
ret
);
ok
(
RegOpenKeyA
(
subkey
,
"subkey2"
,
&
subkey2
),
"subkey2 was not deleted
\n
"
);
ok
(
!
RegQueryValueA
(
subkey
,
NULL
,
buffer
,
&
size
),
"Default value of subkey not longer present
\n
"
);
ret
=
pRegDeleteTreeA
(
subkey
,
NULL
);
ok
(
ret
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
ret
);
ok
(
!
RegOpenKeyA
(
hkey_main
,
"subkey"
,
&
subkey
),
"subkey was deleted
\n
"
);
ret
=
RegQueryValueA
(
subkey
,
NULL
,
buffer
,
&
size
);
ok
(
ret
==
ERROR_SUCCESS
,
"Default value of subkey is not present
\n
"
);
ok
(
!
lstrlenA
(
buffer
),
"Expected length 0 got length %u(%s)
\n
"
,
lstrlenA
(
buffer
),
buffer
);
ret
=
pRegDeleteTreeA
(
hkey_main
,
"not-here"
);
ok
(
ret
==
ERROR_FILE_NOT_FOUND
,
"Expected ERROR_FILE_NOT_FOUND, got %d
\n
"
,
ret
);
}
START_TEST
(
registry
)
{
/* Load pointers for functions that are not available in all Windows versions */
...
...
@@ -921,6 +979,8 @@ START_TEST(registry)
set_privileges
(
SE_RESTORE_NAME
,
FALSE
);
}
test_reg_delete_tree
();
/* 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