Hugh McMaster : reg/tests: Exclude the null terminating character from MultiByteToWideChar conversion.
Alexandre Julliard
julliard at winehq.org
Fri Sep 2 11:41:44 CDT 2016
Module: wine
Branch: master
Commit: 6d72a0cca355444070f3b5eae96f865a9efcf9f5
URL: http://source.winehq.org/git/wine.git/?a=commit;h=6d72a0cca355444070f3b5eae96f865a9efcf9f5
Author: Hugh McMaster <hugh.mcmaster at outlook.com>
Date: Thu Sep 1 13:37:06 2016 +0000
reg/tests: Exclude the null terminating character from MultiByteToWideChar conversion.
Signed-off-by: Hugh McMaster <hugh.mcmaster at outlook.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
programs/reg/tests/reg.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/programs/reg/tests/reg.c b/programs/reg/tests/reg.c
index 715cdbd..1e3d1d2 100644
--- a/programs/reg/tests/reg.c
+++ b/programs/reg/tests/reg.c
@@ -727,17 +727,19 @@ static BOOL test_import_str_(unsigned line, const char *file_contents, DWORD *rc
#define test_import_wstr(c,r) test_import_wstr_(__LINE__,c,r)
static BOOL test_import_wstr_(unsigned line, const char *file_contents, DWORD *rc)
{
- int len, memsize;
+ int lenA, len, memsize;
WCHAR *wstr;
HANDLE regfile;
DWORD written;
BOOL ret;
- len = MultiByteToWideChar(CP_UTF8, 0, file_contents, -1, NULL, 0);
+ lenA = strlen(file_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, -1, wstr, memsize);
+ MultiByteToWideChar(CP_UTF8, 0, file_contents, lenA, wstr, memsize);
regfile = CreateFileA("test.reg", GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL, NULL);
More information about the wine-cvs
mailing list