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) LPWSTR szDiskPrompt, LPDWORD pcchDiskPrompt)
{ {
WCHAR squished_pc[GUID_SIZE]; WCHAR squished_pc[GUID_SIZE];
WCHAR convert[11];
LPWSTR value = NULL; LPWSTR value = NULL;
LPWSTR data = NULL; LPWSTR data = NULL;
LPWSTR ptr; LPWSTR ptr, ptr2;
HKEY source, media; HKEY source, media;
DWORD valuesz, datasz = 0; DWORD valuesz, datasz = 0;
DWORD type; DWORD type;
@ -219,6 +220,8 @@ UINT WINAPI MsiSourceListEnumMediaDisksW(LPCWSTR szProductCodeOrPatchCode,
UINT r; UINT r;
static int index = 0; static int index = 0;
static const WCHAR fmt[] = {'#','%','d',0};
TRACE("(%s, %s, %d, %d, %d, %p, %p, %p, %p)\n", debugstr_w(szProductCodeOrPatchCode), TRACE("(%s, %s, %d, %d, %d, %p, %p, %p, %p)\n", debugstr_w(szProductCodeOrPatchCode),
debugstr_w(szUserSid), dwContext, dwOptions, dwIndex, szVolumeLabel, debugstr_w(szUserSid), dwContext, dwOptions, dwIndex, szVolumeLabel,
pcchVolumeLabel, szDiskPrompt, pcchDiskPrompt); pcchVolumeLabel, szDiskPrompt, pcchDiskPrompt);
@ -285,6 +288,7 @@ UINT WINAPI MsiSourceListEnumMediaDisksW(LPCWSTR szProductCodeOrPatchCode,
if (pdwDiskId) if (pdwDiskId)
*pdwDiskId = atolW(value); *pdwDiskId = atolW(value);
ptr2 = data;
ptr = strchrW(data, ';'); ptr = strchrW(data, ';');
if (!ptr) if (!ptr)
ptr = data; ptr = data;
@ -293,11 +297,19 @@ UINT WINAPI MsiSourceListEnumMediaDisksW(LPCWSTR szProductCodeOrPatchCode,
if (pcchVolumeLabel) 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) if (size >= *pcchVolumeLabel)
r = ERROR_MORE_DATA; r = ERROR_MORE_DATA;
else if (szVolumeLabel) else if (szVolumeLabel)
lstrcpyW(szVolumeLabel, data); lstrcpyW(szVolumeLabel, ptr2);
*pcchVolumeLabel = size; *pcchVolumeLabel = size;
} }
@ -307,6 +319,15 @@ UINT WINAPI MsiSourceListEnumMediaDisksW(LPCWSTR szProductCodeOrPatchCode,
if (!*ptr) if (!*ptr)
ptr++; ptr++;
if (type == REG_DWORD)
{
sprintfW(convert, fmt, *ptr);
size = lstrlenW(convert);
ptr = convert;
}
else
size = lstrlenW(ptr);
size = lstrlenW(ptr); size = lstrlenW(ptr);
if (size >= *pcchDiskPrompt) if (size >= *pcchDiskPrompt)
r = ERROR_MORE_DATA; r = ERROR_MORE_DATA;

View File

@ -2864,13 +2864,10 @@ static void test_MsiSourceListEnumMediaDisks(void)
prompt, &promptsz); prompt, &promptsz);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(id == 1, "Expected 1, got %d\n", id); 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(label, "#42"), "Expected \"#42\", got \"%s\"\n", label); ok(!lstrcmpA(prompt, "#42"), "Expected \"#42\", got \"%s\"\n", prompt);
ok(labelsz == 3, "Expected 3, got %d\n", labelsz); ok(promptsz == 3, "Expected 3, got %d\n", promptsz);
ok(!lstrcmpA(prompt, "#42"), "Expected \"#42\", got \"%s\"\n", prompt);
ok(promptsz == 3, "Expected 3, got %d\n", promptsz);
}
RegDeleteValueA(media, "1"); RegDeleteValueA(media, "1");
RegDeleteValueA(media, "2"); RegDeleteValueA(media, "2");