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
f40ef077
Commit
f40ef077
authored
Sep 18, 2017
by
Hugh McMaster
Committed by
Alexandre Julliard
Sep 18, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reg/tests: Use a helper function to create registry keys.
Signed-off-by:
Hugh McMaster
<
hugh.mcmaster@outlook.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
e6c18792
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
8 deletions
+14
-8
reg.c
programs/reg/tests/reg.c
+14
-8
No files found.
programs/reg/tests/reg.c
View file @
f40ef077
...
...
@@ -118,6 +118,16 @@ static void verify_key_nonexist_(unsigned line, HKEY key_base, const char *subke
RegCloseKey
(
hkey
);
}
#define add_key(k,p,s) add_key_(__LINE__,k,p,s)
static
void
add_key_
(
unsigned
line
,
const
HKEY
hkey
,
const
char
*
path
,
HKEY
*
subkey
)
{
LONG
err
;
err
=
RegCreateKeyExA
(
hkey
,
path
,
0
,
NULL
,
REG_OPTION_NON_VOLATILE
,
KEY_READ
|
KEY_WRITE
,
NULL
,
subkey
,
NULL
);
lok
(
err
==
ERROR_SUCCESS
,
"RegCreateKeyExA failed: %d
\n
"
,
err
);
}
static
void
test_add
(
void
)
{
HKEY
hkey
;
...
...
@@ -516,8 +526,7 @@ static void test_delete(void)
run_reg_exe
(
"reg delete /?"
,
&
r
);
ok
(
r
==
REG_EXIT_SUCCESS
,
"got exit code %d, expected 0
\n
"
,
r
);
err
=
RegCreateKeyExA
(
HKEY_CURRENT_USER
,
KEY_BASE
,
0
,
NULL
,
0
,
KEY_ALL_ACCESS
,
NULL
,
&
hkey
,
NULL
);
ok
(
err
==
ERROR_SUCCESS
,
"got %d
\n
"
,
err
);
add_key
(
HKEY_CURRENT_USER
,
KEY_BASE
,
&
hkey
);
err
=
RegSetValueExA
(
hkey
,
"foo"
,
0
,
REG_DWORD
,
(
LPBYTE
)
&
deadbeef
,
sizeof
(
deadbeef
));
ok
(
err
==
ERROR_SUCCESS
,
"got %d
\n
"
,
err
);
...
...
@@ -528,8 +537,7 @@ static void test_delete(void)
err
=
RegSetValueExA
(
hkey
,
""
,
0
,
REG_DWORD
,
(
LPBYTE
)
&
deadbeef
,
sizeof
(
deadbeef
));
ok
(
err
==
ERROR_SUCCESS
,
"got %d
\n
"
,
err
);
err
=
RegCreateKeyExA
(
hkey
,
"subkey"
,
0
,
NULL
,
0
,
KEY_ALL_ACCESS
,
NULL
,
&
hsubkey
,
NULL
);
ok
(
err
==
ERROR_SUCCESS
,
"got %d
\n
"
,
err
);
add_key
(
hkey
,
"subkey"
,
&
hsubkey
);
RegCloseKey
(
hsubkey
);
run_reg_exe
(
"reg delete HKCU
\\
"
KEY_BASE
" /v bar /f"
,
&
r
);
...
...
@@ -577,8 +585,7 @@ static void test_query(void)
ok
(
r
==
REG_EXIT_SUCCESS
,
"got exit code %d, expected 0
\n
"
,
r
);
/* Create a test key */
err
=
RegCreateKeyExA
(
HKEY_CURRENT_USER
,
KEY_BASE
,
0
,
NULL
,
0
,
KEY_ALL_ACCESS
,
NULL
,
&
key
,
NULL
);
ok
(
err
==
ERROR_SUCCESS
,
"got %d, expected 0
\n
"
,
err
);
add_key
(
HKEY_CURRENT_USER
,
KEY_BASE
,
&
key
);
run_reg_exe
(
"reg query HKCU
\\
"
KEY_BASE
" /ve"
,
&
r
);
ok
(
r
==
REG_EXIT_SUCCESS
||
broken
(
r
==
REG_EXIT_FAILURE
/* WinXP */
),
...
...
@@ -612,8 +619,7 @@ static void test_query(void)
ok
(
r
==
REG_EXIT_SUCCESS
,
"got exit code %d, expected 0
\n
"
,
r
);
/* Create a test subkey */
err
=
RegCreateKeyExA
(
key
,
"Subkey"
,
0
,
NULL
,
0
,
KEY_ALL_ACCESS
,
NULL
,
&
subkey
,
NULL
);
ok
(
err
==
ERROR_SUCCESS
,
"got %d
\n
"
,
err
);
add_key
(
key
,
"Subkey"
,
&
subkey
);
err
=
RegSetValueExA
(
subkey
,
"Test"
,
0
,
REG_SZ
,
(
BYTE
*
)
world
,
sizeof
(
world
));
ok
(
err
==
ERROR_SUCCESS
,
"got %d, expected 0
\n
"
,
err
);
...
...
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