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
ee11f6ff
Commit
ee11f6ff
authored
Sep 18, 2017
by
Hugh McMaster
Committed by
Alexandre Julliard
Sep 18, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
regedit/tests: Combine and rename the r_exec_import_*str functions.
Signed-off-by:
Hugh McMaster
<
hugh.mcmaster@outlook.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
77442049
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
33 deletions
+23
-33
regedit.c
programs/regedit/tests/regedit.c
+23
-33
No files found.
programs/regedit/tests/regedit.c
View file @
ee11f6ff
...
...
@@ -67,48 +67,38 @@ static BOOL write_file(const void *str, DWORD size)
return
ret
;
}
#define exec_import_str(c) r_exec_import_str(__LINE__, c)
static
BOOL
r_exec_import_str
(
unsigned
line
,
const
char
*
file_contents
)
{
BOOL
br
;
if
(
!
write_file
(
file_contents
,
strlen
(
file_contents
)))
return
FALSE
;
run_regedit_exe
(
"regedit.exe /s test.reg"
);
br
=
DeleteFileA
(
"test.reg"
);
lok
(
br
,
"DeleteFile failed: %u
\n
"
,
GetLastError
());
#define exec_import_str(c) import_reg(__LINE__,c,FALSE)
#define exec_import_wstr(c) import_reg(__LINE__,c,TRUE)
return
br
;
}
#define exec_import_wstr(c) r_exec_import_wstr(__LINE__, c)
static
BOOL
r_exec_import_wstr
(
unsigned
line
,
const
char
*
file_contents
)
static
BOOL
import_reg
(
unsigned
line
,
const
char
*
contents
,
BOOL
unicode
)
{
int
lenA
,
len
,
memsize
;
WCHAR
*
wstr
;
BOOL
br
=
FALSE
;
int
lenA
;
BOOL
ret
;
lenA
=
strlen
(
file_
contents
);
lenA
=
strlen
(
contents
);
len
=
MultiByteToWideChar
(
CP_UTF8
,
0
,
file_contents
,
lenA
,
NULL
,
0
);
memsize
=
len
*
sizeof
(
WCHAR
);
wstr
=
HeapAlloc
(
GetProcessHeap
(),
0
,
memsize
);
if
(
!
wstr
)
return
FALSE
;
MultiByteToWideChar
(
CP_UTF8
,
0
,
file_contents
,
lenA
,
wstr
,
len
);
if
(
unicode
)
{
int
len
=
MultiByteToWideChar
(
CP_UTF8
,
0
,
contents
,
lenA
,
NULL
,
0
);
int
size
=
len
*
sizeof
(
WCHAR
);
WCHAR
*
wstr
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
if
(
!
wstr
)
return
FALSE
;
MultiByteToWideChar
(
CP_UTF8
,
0
,
contents
,
lenA
,
wstr
,
len
);
ret
=
write_file
(
wstr
,
size
);
HeapFree
(
GetProcessHeap
(),
0
,
wstr
);
}
else
ret
=
write_file
(
contents
,
lenA
);
if
(
!
write_file
(
wstr
,
memsize
))
goto
exit
;
if
(
!
ret
)
return
FALSE
;
run_regedit_exe
(
"regedit.exe /s test.reg"
);
br
=
DeleteFileA
(
"test.reg"
);
lok
(
br
,
"DeleteFile failed: %u
\n
"
,
GetLastError
());
ret
=
DeleteFileA
(
"test.reg"
);
lok
(
ret
,
"DeleteFile failed: %u
\n
"
,
GetLastError
());
exit:
HeapFree
(
GetProcessHeap
(),
0
,
wstr
);
return
br
;
return
ret
;
}
#define TODO_REG_TYPE (0x0001u)
...
...
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