msi: Handle converting a value of REG_DWORD in MsiSourceListEnumMediaDisks.

This commit is contained in:
James Hawkins 2008-08-28 21:20:46 -05:00 committed by Alexandre Julliard
parent a50fc2cc16
commit d880470dbf
2 changed files with 28 additions and 10 deletions

View File

@ -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;

View File

@ -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");