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
9ce39bd2
Commit
9ce39bd2
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: Compare registry export data with expected data.
Signed-off-by:
Hugh McMaster
<
hugh.mcmaster@outlook.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
f886f9f3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
0 deletions
+46
-0
reg.c
programs/reg/tests/reg.c
+46
-0
No files found.
programs/reg/tests/reg.c
View file @
9ce39bd2
...
...
@@ -4210,11 +4210,55 @@ static void test_import_31(void)
ok
(
err
==
ERROR_SUCCESS
,
"RegDeleteKeyA failed: %d
\n
"
,
err
);
}
#define compare_export(f,e) compare_export_(__LINE__,f,e)
static
BOOL
compare_export_
(
unsigned
line
,
const
char
*
filename
,
const
char
*
expected
)
{
FILE
*
fp
;
long
file_size
;
WCHAR
*
fbuf
=
NULL
,
*
wstr
=
NULL
;
size_t
len
;
BOOL
ret
=
FALSE
;
fp
=
fopen
(
filename
,
"rb"
);
if
(
!
fp
)
return
FALSE
;
if
(
fseek
(
fp
,
0
,
SEEK_END
))
goto
error
;
file_size
=
ftell
(
fp
);
if
(
file_size
==
-
1
)
goto
error
;
rewind
(
fp
);
fbuf
=
HeapAlloc
(
GetProcessHeap
(),
0
,
file_size
+
sizeof
(
WCHAR
));
if
(
!
fbuf
)
goto
error
;
fread
(
fbuf
,
file_size
,
1
,
fp
);
fbuf
[
file_size
/
sizeof
(
WCHAR
)]
=
0
;
fclose
(
fp
);
len
=
MultiByteToWideChar
(
CP_UTF8
,
0
,
expected
,
-
1
,
NULL
,
0
);
wstr
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
));
if
(
!
wstr
)
goto
exit
;
MultiByteToWideChar
(
CP_UTF8
,
0
,
expected
,
-
1
,
wstr
,
len
);
lok
(
!
lstrcmpW
(
fbuf
,
wstr
),
"export data does not match expected data
\n
"
);
ret
=
TRUE
;
exit:
HeapFree
(
GetProcessHeap
(),
0
,
fbuf
);
HeapFree
(
GetProcessHeap
(),
0
,
wstr
);
return
ret
;
error:
fclose
(
fp
);
return
FALSE
;
}
static
void
test_export
(
void
)
{
LONG
err
;
DWORD
r
,
os_version
,
major_version
,
minor_version
;
HKEY
hkey
;
const
char
*
empty_key_test
=
"
\xef\xbb\xbf
Windows Registry Editor Version 5.00
\r\n\r\n
"
"[HKEY_CURRENT_USER
\\
"
KEY_BASE
"]
\r\n\r\n
"
;
err
=
RegDeleteKeyA
(
HKEY_CURRENT_USER
,
KEY_BASE
);
ok
(
err
==
ERROR_SUCCESS
||
err
==
ERROR_FILE_NOT_FOUND
,
"got %d
\n
"
,
err
);
...
...
@@ -4276,6 +4320,8 @@ static void test_export(void)
else
/* Windows XP (32-bit) and older */
win_skip
(
"File overwrite flag [/y] not supported; skipping position tests
\n
"
);
todo_wine
ok
(
compare_export
(
"file.reg"
,
empty_key_test
),
"compare_export() failed
\n
"
);
err
=
DeleteFileA
(
"file.reg"
);
todo_wine
ok
(
err
,
"DeleteFile failed: %u
\n
"
,
GetLastError
());
...
...
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