#include <stdarg.h>
#define COBJMACROS
-#define NONAMELESSUNION
#include "windef.h"
#include "winbase.h"
if (rc != ERROR_SUCCESS)
rc = ERROR_BAD_CONFIGURATION;
}
+ RegCloseKey(rootkey);
return rc;
}
LPWSTR szVolumeLabel, LPDWORD pcchVolumeLabel,
LPWSTR szDiskPrompt, LPDWORD pcchDiskPrompt)
{
- WCHAR squished_pc[GUID_SIZE];
- WCHAR convert[11];
- LPWSTR value = NULL;
- LPWSTR data = NULL;
- LPWSTR ptr, ptr2;
+ static const WCHAR fmt[] = {'#','%','d',0};
+ WCHAR squashed_pc[SQUASHED_GUID_SIZE], convert[11];
+ WCHAR *value = NULL, *data = NULL, *ptr, *ptr2;
HKEY source, media;
- DWORD valuesz, datasz = 0;
- DWORD type;
- DWORD numvals, size;
+ DWORD valuesz, datasz = 0, type, numvals, size;
LONG res;
UINT r;
static DWORD 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);
- if (!szProductCodeOrPatchCode ||
- !squash_guid(szProductCodeOrPatchCode, squished_pc))
+ if (!szProductCodeOrPatchCode || !squash_guid( szProductCodeOrPatchCode, squashed_pc ))
return ERROR_INVALID_PARAMETER;
if (dwContext == MSIINSTALLCONTEXT_MACHINE && szUserSid)
if (dwIndex != index)
return ERROR_INVALID_PARAMETER;
- r = OpenSourceKey(szProductCodeOrPatchCode, &source,
- dwOptions, dwContext, FALSE);
+ r = OpenSourceKey(szProductCodeOrPatchCode, &source, dwOptions, dwContext, FALSE);
if (r != ERROR_SUCCESS)
return r;
return ERROR_NO_MORE_ITEMS;
}
- if (!pcchVolumeLabel && !pcchDiskPrompt)
- {
- r = RegEnumValueW(media, dwIndex, NULL, NULL, NULL,
- &type, NULL, NULL);
- goto done;
- }
-
res = RegQueryInfoKeyW(media, NULL, NULL, NULL, NULL, NULL,
NULL, &numvals, &valuesz, &datasz, NULL, NULL);
if (res != ERROR_SUCCESS)
DWORD dwOptions, DWORD dwIndex,
LPWSTR szSource, LPDWORD pcchSource)
{
- WCHAR squished_pc[GUID_SIZE];
- WCHAR name[32];
- HKEY source = NULL;
- HKEY subkey = NULL;
+ static const WCHAR format[] = {'%','d',0};
+ WCHAR squashed_pc[SQUASHED_GUID_SIZE], name[32];
+ HKEY source = NULL, subkey = NULL;
LONG res;
UINT r = ERROR_INVALID_PARAMETER;
static DWORD index = 0;
- static const WCHAR format[] = {'%','d',0};
-
TRACE("(%s, %s, %d, %d, %d, %p, %p)\n", debugstr_w(szProductCodeOrPatch),
debugstr_w(szUserSid), dwContext, dwOptions, dwIndex, szSource, pcchSource);
if (dwIndex == 0)
index = 0;
- if (!szProductCodeOrPatch || !squash_guid(szProductCodeOrPatch, squished_pc))
+ if (!szProductCodeOrPatch || !squash_guid( szProductCodeOrPatch, squashed_pc ))
goto done;
if (szSource && !pcchSource)
if (dwIndex != index)
goto done;
- r = OpenSourceKey(szProductCodeOrPatch, &source,
- dwOptions, dwContext, FALSE);
+ r = OpenSourceKey( szProductCodeOrPatch, &source, dwOptions, dwContext, FALSE );
if (r != ERROR_SUCCESS)
goto done;
LPCWSTR szProperty, LPWSTR szValue,
LPDWORD pcchValue)
{
- WCHAR squished_pc[GUID_SIZE];
+ static const WCHAR mediapack[] = {'M','e','d','i','a','P','a','c','k','a','g','e',0};
+ WCHAR *source, *ptr, squashed_pc[SQUASHED_GUID_SIZE];
HKEY sourcekey, media;
- LPWSTR source, ptr;
DWORD size;
UINT rc;
- static const WCHAR mediapack[] = {
- 'M','e','d','i','a','P','a','c','k','a','g','e',0};
-
TRACE("%s %s\n", debugstr_w(szProduct), debugstr_w(szProperty));
- if (!szProduct || !squash_guid(szProduct, squished_pc))
+ if (!szProduct || !squash_guid( szProduct, squashed_pc ))
return ERROR_INVALID_PARAMETER;
if (szValue && !pcchValue)
0, 0, NULL, &size);
if (rc != ERROR_SUCCESS)
{
- RegCloseKey(sourcekey);
- return ERROR_SUCCESS;
+ static WCHAR szEmpty[1] = { '\0' };
+ rc = ERROR_SUCCESS;
+ source = NULL;
+ ptr = szEmpty;
+ goto output_out;
}
source = msi_alloc(size);
else
ptr++;
}
-
+output_out:
if (szValue)
{
if (strlenW(ptr) < *pcchValue)
r = OpenSourceKey(product, &source, MSICODE_PRODUCT, context, FALSE);
if (r != ERROR_SUCCESS)
+ {
+ msi_free(buffer);
return r;
+ }
sprintfW(buffer, format, typechar, index, value);
MSIINSTALLCONTEXT dwContext, DWORD dwOptions,
LPCWSTR szProperty, LPCWSTR szValue)
{
- WCHAR squished_pc[GUID_SIZE];
+ static const WCHAR media_package[] = {'M','e','d','i','a','P','a','c','k','a','g','e',0};
+ WCHAR squashed_pc[SQUASHED_GUID_SIZE];
HKEY sourcekey, media;
LPCWSTR property;
UINT rc;
- static const WCHAR media_package[] = {
- 'M','e','d','i','a','P','a','c','k','a','g','e',0
- };
-
TRACE("%s %s %x %x %s %s\n", debugstr_w(szProduct), debugstr_w(szUserSid),
dwContext, dwOptions, debugstr_w(szProperty), debugstr_w(szValue));
- if (!szProduct || !squash_guid(szProduct, squished_pc))
+ if (!szProduct || !squash_guid( szProduct, squashed_pc ))
return ERROR_INVALID_PARAMETER;
if (!szProperty)
UINT WINAPI MsiSourceListAddSourceW( LPCWSTR szProduct, LPCWSTR szUserName,
DWORD dwReserved, LPCWSTR szSource)
{
- WCHAR squished_pc[GUID_SIZE];
+ WCHAR *sidstr = NULL, squashed_pc[SQUASHED_GUID_SIZE];
INT ret;
- LPWSTR sidstr = NULL;
- DWORD sidsize = 0;
- DWORD domsize = 0;
- DWORD context;
+ DWORD sidsize = 0, domsize = 0, context;
HKEY hkey = 0;
UINT r;
if (dwReserved != 0)
return ERROR_INVALID_PARAMETER;
- if (!szProduct || !squash_guid(szProduct, squished_pc))
+ if (!szProduct || !squash_guid( szProduct, squashed_pc ))
return ERROR_INVALID_PARAMETER;
if (!szUserName || !*szUserName)
MSIINSTALLCONTEXT dwContext, DWORD dwOptions, LPCWSTR szSource,
DWORD dwIndex)
{
- HKEY sourcekey;
- HKEY typekey;
+ static const WCHAR fmt[] = {'%','i',0};
+ HKEY sourcekey, typekey;
UINT rc;
struct list sourcelist;
media_info *info;
- WCHAR squished_pc[GUID_SIZE];
- WCHAR name[10];
- LPWSTR source;
+ WCHAR *source, squashed_pc[SQUASHED_GUID_SIZE], name[10];
LPCWSTR postfix;
- DWORD size, count;
- DWORD index;
-
- static const WCHAR fmt[] = {'%','i',0};
+ DWORD size, count, index;
TRACE("%s %s %x %x %s %i\n", debugstr_w(szProduct), debugstr_w(szUserSid),
dwContext, dwOptions, debugstr_w(szSource), dwIndex);
- if (!szProduct || !squash_guid(szProduct, squished_pc))
+ if (!szProduct || !squash_guid( szProduct, squashed_pc ))
return ERROR_INVALID_PARAMETER;
if (!szSource || !*szSource)
list_init(&sourcelist);
rc = fill_source_list(&sourcelist, typekey, &count);
if (rc != ERROR_NO_MORE_ITEMS)
- return rc;
+ goto done;
size = (lstrlenW(source) + 1) * sizeof(WCHAR);
MSIINSTALLCONTEXT dwContext, DWORD dwOptions, DWORD dwDiskId,
LPCWSTR szVolumeLabel, LPCWSTR szDiskPrompt)
{
- HKEY sourcekey;
- HKEY mediakey;
+ static const WCHAR fmt[] = {'%','i',0};
+ HKEY sourcekey, mediakey;
UINT rc;
- WCHAR szIndex[10];
- WCHAR squished_pc[GUID_SIZE];
- LPWSTR buffer;
+ WCHAR *buffer, squashed_pc[SQUASHED_GUID_SIZE], szIndex[10];
DWORD size;
- static const WCHAR fmt[] = {'%','i',0};
-
TRACE("%s %s %x %x %i %s %s\n", debugstr_w(szProduct),
debugstr_w(szUserSid), dwContext, dwOptions, dwDiskId,
debugstr_w(szVolumeLabel), debugstr_w(szDiskPrompt));
- if (!szProduct || !squash_guid(szProduct, squished_pc))
+ if (!szProduct || !squash_guid( szProduct, squashed_pc ))
return ERROR_INVALID_PARAMETER;
if (dwOptions != MSICODE_PRODUCT && dwOptions != MSICODE_PATCH)