From 47ac325f82756eabf2e558e6c9e944f02abe4b38 Mon Sep 17 00:00:00 2001 From: James Hawkins Date: Mon, 13 Oct 2008 03:57:43 -0500 Subject: [PATCH] msi: Fix the returned format of REG_BINARY data. --- dlls/msi/appsearch.c | 14 +++++++++----- dlls/msi/tests/package.c | 5 +---- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/dlls/msi/appsearch.c b/dlls/msi/appsearch.c index ed02f83758..70bf13aafd 100644 --- a/dlls/msi/appsearch.c +++ b/dlls/msi/appsearch.c @@ -245,7 +245,9 @@ static void ACTION_ConvertRegValue(DWORD regType, const BYTE *value, DWORD sz, LPWSTR *appValue) { static const WCHAR dwordFmt[] = { '#','%','d','\0' }; - static const WCHAR binFmt[] = { '#','x','%','x','\0' }; + static const WCHAR binPre[] = { '#','x','\0' }; + static const WCHAR binFmt[] = { '%','0','2','X','\0' }; + LPWSTR ptr; DWORD i; switch (regType) @@ -277,10 +279,12 @@ static void ACTION_ConvertRegValue(DWORD regType, const BYTE *value, DWORD sz, ExpandEnvironmentStringsW((LPCWSTR)value, *appValue, sz); break; case REG_BINARY: - /* 3 == length of "#x" */ - *appValue = msi_alloc((sz * 3 + 1) * sizeof(WCHAR)); - for (i = 0; i < sz; i++) - sprintfW(*appValue + i * 3, binFmt, value[i]); + /* #x\0 */ + *appValue = msi_alloc((sz * 2 + 3) * sizeof(WCHAR)); + lstrcpyW(*appValue, binPre); + ptr = *appValue + lstrlenW(binPre); + for (i = 0; i < sz; i++, ptr += 2) + sprintfW(ptr, binFmt, value[i]); break; default: WARN("unimplemented for values of type %d\n", regType); diff --git a/dlls/msi/tests/package.c b/dlls/msi/tests/package.c index 31f5ad612b..581ffd5ddd 100644 --- a/dlls/msi/tests/package.c +++ b/dlls/msi/tests/package.c @@ -6339,10 +6339,7 @@ static void test_appsearch_reglocator(void) lstrcpyA(path, "#xCDAB3412EF907856"); r = MsiGetPropertyA(hpkg, "SIGPROP7", prop, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - todo_wine - { - ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop); - } + ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop); size = MAX_PATH; r = MsiGetPropertyA(hpkg, "SIGPROP8", prop, &size);