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
78fecb03
Commit
78fecb03
authored
Jul 25, 2016
by
Hugh McMaster
Committed by
Alexandre Julliard
Jul 27, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reg/tests: Add some tests for 'reg import'.
Signed-off-by:
Hugh McMaster
<
hugh.mcmaster@outlook.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
cf69c12c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
61 additions
and
1 deletion
+61
-1
reg.c
programs/reg/tests/reg.c
+61
-1
No files found.
programs/reg/tests/reg.c
View file @
78fecb03
...
...
@@ -16,6 +16,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <stdio.h>
#include <windows.h>
#include "wine/test.h"
...
...
@@ -675,9 +676,37 @@ static void test_v_flags(void)
ok
(
r
==
REG_EXIT_FAILURE
,
"got exit code %d, expected 1
\n
"
,
r
);
}
static
BOOL
write_reg_file
(
const
char
*
value
,
char
*
tmp_name
)
{
static
const
char
regedit4
[]
=
"REGEDIT4"
;
static
const
char
key
[]
=
"[HKEY_CURRENT_USER
\\
"
KEY_BASE
"]"
;
char
file_data
[
MAX_PATH
],
tmp_path
[
MAX_PATH
];
HANDLE
hfile
;
DWORD
written
;
BOOL
ret
;
sprintf
(
file_data
,
"%s
\n\n
%s
\n
%s
\n
"
,
regedit4
,
key
,
value
);
GetTempPathA
(
MAX_PATH
,
tmp_path
);
GetTempFileNameA
(
tmp_path
,
"reg"
,
0
,
tmp_name
);
hfile
=
CreateFileA
(
tmp_name
,
GENERIC_WRITE
,
0
,
NULL
,
CREATE_ALWAYS
,
FILE_ATTRIBUTE_NORMAL
,
0
);
if
(
hfile
==
INVALID_HANDLE_VALUE
)
return
FALSE
;
ret
=
WriteFile
(
hfile
,
file_data
,
strlen
(
file_data
),
&
written
,
NULL
);
CloseHandle
(
hfile
);
return
ret
;
}
static
void
test_import
(
void
)
{
DWORD
r
;
DWORD
r
,
dword
=
0x123
;
char
test1_reg
[
MAX_PATH
],
test2_reg
[
MAX_PATH
];
char
cmdline
[
MAX_PATH
];
char
test_string
[]
=
"Test string"
;
HKEY
hkey
;
LONG
err
;
run_reg_exe
(
"reg import"
,
&
r
);
ok
(
r
==
REG_EXIT_FAILURE
,
"got exit code %d, expected 1
\n
"
,
r
);
...
...
@@ -687,6 +716,37 @@ static void test_import(void)
run_reg_exe
(
"reg import missing.reg"
,
&
r
);
ok
(
r
==
REG_EXIT_FAILURE
,
"got exit code %d, expected 1
\n
"
,
r
);
/* Create test files */
ok
(
write_reg_file
(
"
\"
Wine
\"
=dword:00000123"
,
test1_reg
),
"Failed to write registry file
\n
"
);
ok
(
write_reg_file
(
"@=
\"
Test string
\"
"
,
test2_reg
),
"Failed to write registry file
\n
"
);
sprintf
(
cmdline
,
"reg import %s"
,
test1_reg
);
run_reg_exe
(
cmdline
,
&
r
);
todo_wine
ok
(
r
==
REG_EXIT_SUCCESS
,
"got exit code %d, expected 0
\n
"
,
r
);
sprintf
(
cmdline
,
"reg import %s"
,
test2_reg
);
run_reg_exe
(
cmdline
,
&
r
);
todo_wine
ok
(
r
==
REG_EXIT_SUCCESS
,
"got exit code %d, expected 0
\n
"
,
r
);
err
=
RegOpenKeyExA
(
HKEY_CURRENT_USER
,
KEY_BASE
,
0
,
KEY_READ
,
&
hkey
);
todo_wine
ok
(
err
==
ERROR_SUCCESS
,
"got %d, expected 0
\n
"
,
err
);
todo_wine
verify_reg
(
hkey
,
"Wine"
,
REG_DWORD
,
&
dword
,
sizeof
(
dword
),
0
);
todo_wine
verify_reg
(
hkey
,
""
,
REG_SZ
,
test_string
,
sizeof
(
test_string
),
0
);
err
=
RegCloseKey
(
hkey
);
todo_wine
ok
(
err
==
ERROR_SUCCESS
,
"got %d, expected 0
\n
"
,
err
);
err
=
RegDeleteKeyA
(
HKEY_CURRENT_USER
,
KEY_BASE
);
todo_wine
ok
(
err
==
ERROR_SUCCESS
,
"got %d, expected 0
\n
"
,
err
);
sprintf
(
cmdline
,
"reg import %s %s"
,
test1_reg
,
test2_reg
);
run_reg_exe
(
cmdline
,
&
r
);
ok
(
r
==
REG_EXIT_FAILURE
,
"got exit code %d, expected 1
\n
"
,
r
);
DeleteFileA
(
test1_reg
);
DeleteFileA
(
test2_reg
);
}
START_TEST
(
reg
)
...
...
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