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

msi: Simplify MsiSourceListAddMediaDisk.

parent d3b37385
...@@ -979,13 +979,12 @@ UINT WINAPI MsiSourceListAddMediaDiskW(LPCWSTR szProduct, LPCWSTR szUserSid, ...@@ -979,13 +979,12 @@ UINT WINAPI MsiSourceListAddMediaDiskW(LPCWSTR szProduct, LPCWSTR szUserSid,
UINT rc; UINT rc;
WCHAR szIndex[10]; WCHAR szIndex[10];
WCHAR squished_pc[GUID_SIZE]; WCHAR squished_pc[GUID_SIZE];
static const WCHAR fmt[] = {'%','i',0};
static const WCHAR disk_fmt[] = {'%','s',';','%','s',0};
static const WCHAR empty[1] = {0};
LPCWSTR pt1,pt2;
LPWSTR buffer; LPWSTR buffer;
DWORD size; DWORD size;
static const WCHAR fmt[] = {'%','i',0};
static const WCHAR semicolon[] = {';',0};
TRACE("%s %s %x %x %i %s %s\n", debugstr_w(szProduct), TRACE("%s %s %x %x %i %s %s\n", debugstr_w(szProduct),
debugstr_w(szUserSid), dwContext, dwOptions, dwDiskId, debugstr_w(szUserSid), dwContext, dwOptions, dwDiskId,
debugstr_w(szVolumeLabel), debugstr_w(szDiskPrompt)); debugstr_w(szVolumeLabel), debugstr_w(szDiskPrompt));
...@@ -1012,33 +1011,24 @@ UINT WINAPI MsiSourceListAddMediaDiskW(LPCWSTR szProduct, LPCWSTR szUserSid, ...@@ -1012,33 +1011,24 @@ UINT WINAPI MsiSourceListAddMediaDiskW(LPCWSTR szProduct, LPCWSTR szUserSid,
if (rc != ERROR_SUCCESS) if (rc != ERROR_SUCCESS)
return rc; return rc;
OpenMediaSubkey(sourcekey,&mediakey,TRUE); OpenMediaSubkey(sourcekey, &mediakey, TRUE);
sprintfW(szIndex,fmt,dwDiskId); sprintfW(szIndex, fmt, dwDiskId);
size = 2; size = 2;
if (szVolumeLabel) if (szVolumeLabel) size += lstrlenW(szVolumeLabel);
{ if (szDiskPrompt) size += lstrlenW(szDiskPrompt);
size +=lstrlenW(szVolumeLabel);
pt1 = szVolumeLabel;
}
else
pt1 = empty;
if (szDiskPrompt)
{
size +=lstrlenW(szDiskPrompt);
pt2 = szDiskPrompt;
}
else
pt2 = empty;
size *=sizeof(WCHAR);
size *= sizeof(WCHAR);
buffer = msi_alloc(size); buffer = msi_alloc(size);
sprintfW(buffer,disk_fmt,pt1,pt2); *buffer = '\0';
if (szVolumeLabel) lstrcpyW(buffer, szVolumeLabel);
lstrcatW(buffer, semicolon);
if (szDiskPrompt) lstrcatW(buffer, szDiskPrompt);
RegSetValueExW(mediakey, szIndex, 0, REG_SZ, (LPBYTE)buffer, size); RegSetValueExW(mediakey, szIndex, 0, REG_SZ, (LPBYTE)buffer, size);
msi_free( buffer ); msi_free(buffer);
RegCloseKey(sourcekey); RegCloseKey(sourcekey);
RegCloseKey(mediakey); RegCloseKey(mediakey);
......
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