Commit d880470d authored by James Hawkins's avatar James Hawkins Committed by Alexandre Julliard

msi: Handle converting a value of REG_DWORD in MsiSourceListEnumMediaDisks.

parent a50fc2cc
......@@ -208,9 +208,10 @@ UINT WINAPI MsiSourceListEnumMediaDisksW(LPCWSTR szProductCodeOrPatchCode,
LPWSTR szDiskPrompt, LPDWORD pcchDiskPrompt)
{
WCHAR squished_pc[GUID_SIZE];
WCHAR convert[11];
LPWSTR value = NULL;
LPWSTR data = NULL;
LPWSTR ptr;
LPWSTR ptr, ptr2;
HKEY source, media;
DWORD valuesz, datasz = 0;
DWORD type;
......@@ -219,6 +220,8 @@ UINT WINAPI MsiSourceListEnumMediaDisksW(LPCWSTR szProductCodeOrPatchCode,
UINT r;
static int index = 0;
static const WCHAR fmt[] = {'#','%','d',0};
TRACE("(%s, %s, %d, %d, %d, %p, %p, %p, %p)\n", debugstr_w(szProductCodeOrPatchCode),
debugstr_w(szUserSid), dwContext, dwOptions, dwIndex, szVolumeLabel,
pcchVolumeLabel, szDiskPrompt, pcchDiskPrompt);
......@@ -285,6 +288,7 @@ UINT WINAPI MsiSourceListEnumMediaDisksW(LPCWSTR szProductCodeOrPatchCode,
if (pdwDiskId)
*pdwDiskId = atolW(value);
ptr2 = data;
ptr = strchrW(data, ';');
if (!ptr)
ptr = data;
......@@ -293,11 +297,19 @@ UINT WINAPI MsiSourceListEnumMediaDisksW(LPCWSTR szProductCodeOrPatchCode,
if (pcchVolumeLabel)
{
size = lstrlenW(data);
if (type == REG_DWORD)
{
sprintfW(convert, fmt, *data);
size = lstrlenW(convert);
ptr2 = convert;
}
else
size = lstrlenW(data);
if (size >= *pcchVolumeLabel)
r = ERROR_MORE_DATA;
else if (szVolumeLabel)
lstrcpyW(szVolumeLabel, data);
lstrcpyW(szVolumeLabel, ptr2);
*pcchVolumeLabel = size;
}
......@@ -307,6 +319,15 @@ UINT WINAPI MsiSourceListEnumMediaDisksW(LPCWSTR szProductCodeOrPatchCode,
if (!*ptr)
ptr++;
if (type == REG_DWORD)
{
sprintfW(convert, fmt, *ptr);
size = lstrlenW(convert);
ptr = convert;
}
else
size = lstrlenW(ptr);
size = lstrlenW(ptr);
if (size >= *pcchDiskPrompt)
r = ERROR_MORE_DATA;
......
......@@ -2864,13 +2864,10 @@ static void test_MsiSourceListEnumMediaDisks(void)
prompt, &promptsz);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(id == 1, "Expected 1, got %d\n", id);
todo_wine
{
ok(!lstrcmpA(label, "#42"), "Expected \"#42\", got \"%s\"\n", label);
ok(labelsz == 3, "Expected 3, got %d\n", labelsz);
ok(!lstrcmpA(prompt, "#42"), "Expected \"#42\", got \"%s\"\n", prompt);
ok(promptsz == 3, "Expected 3, got %d\n", promptsz);
}
ok(!lstrcmpA(label, "#42"), "Expected \"#42\", got \"%s\"\n", label);
ok(labelsz == 3, "Expected 3, got %d\n", labelsz);
ok(!lstrcmpA(prompt, "#42"), "Expected \"#42\", got \"%s\"\n", prompt);
ok(promptsz == 3, "Expected 3, got %d\n", promptsz);
RegDeleteValueA(media, "1");
RegDeleteValueA(media, "2");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment