msi: Allow setting a media disk as the last used source in the internal msi_set_last_used_source.
This commit is contained in:
parent
7d10d1d2d0
commit
cf84e2df5b
|
@ -3508,9 +3508,13 @@ static UINT ACTION_PublishProduct(MSIPACKAGE *package)
|
||||||
/* publish the SourceList info */
|
/* publish the SourceList info */
|
||||||
LIST_FOR_EACH_ENTRY(info, &package->sourcelist_info, MSISOURCELISTINFO, entry)
|
LIST_FOR_EACH_ENTRY(info, &package->sourcelist_info, MSISOURCELISTINFO, entry)
|
||||||
{
|
{
|
||||||
MsiSourceListSetInfoW(package->ProductCode, NULL,
|
if (!lstrcmpW(info->property, INSTALLPROPERTY_LASTUSEDSOURCEW))
|
||||||
info->context, info->options,
|
msi_set_last_used_source(package->ProductCode, NULL, info->context,
|
||||||
info->property, info->value);
|
info->options, info->value);
|
||||||
|
else
|
||||||
|
MsiSourceListSetInfoW(package->ProductCode, NULL,
|
||||||
|
info->context, info->options,
|
||||||
|
info->property, info->value);
|
||||||
}
|
}
|
||||||
|
|
||||||
LIST_FOR_EACH_ENTRY(disk, &package->sourcelist_media, MSIMEDIADISK, entry)
|
LIST_FOR_EACH_ENTRY(disk, &package->sourcelist_media, MSIMEDIADISK, entry)
|
||||||
|
|
|
@ -885,6 +885,8 @@ extern BOOL check_unique_action(const MSIPACKAGE *, LPCWSTR);
|
||||||
extern WCHAR* generate_error_string(MSIPACKAGE *, UINT, DWORD, ... );
|
extern WCHAR* generate_error_string(MSIPACKAGE *, UINT, DWORD, ... );
|
||||||
extern UINT msi_create_component_directories( MSIPACKAGE *package );
|
extern UINT msi_create_component_directories( MSIPACKAGE *package );
|
||||||
extern void msi_ui_error( DWORD msg_id, DWORD type );
|
extern void msi_ui_error( DWORD msg_id, DWORD type );
|
||||||
|
extern UINT msi_set_last_used_source(LPCWSTR product, LPCWSTR usersid,
|
||||||
|
MSIINSTALLCONTEXT context, DWORD options, LPCWSTR value);
|
||||||
|
|
||||||
/* control event stuff */
|
/* control event stuff */
|
||||||
extern VOID ControlEvent_FireSubscribedEvent(MSIPACKAGE *package, LPCWSTR event,
|
extern VOID ControlEvent_FireSubscribedEvent(MSIPACKAGE *package, LPCWSTR event,
|
||||||
|
|
|
@ -701,15 +701,16 @@ UINT WINAPI MsiSourceListSetInfoA(LPCSTR szProduct, LPCSTR szUserSid,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static UINT set_last_used_source(HKEY source, LPCWSTR product, LPCWSTR usersid,
|
UINT msi_set_last_used_source(LPCWSTR product, LPCWSTR usersid,
|
||||||
MSIINSTALLCONTEXT context, DWORD options,
|
MSIINSTALLCONTEXT context, DWORD options,
|
||||||
LPCWSTR value)
|
LPCWSTR value)
|
||||||
{
|
{
|
||||||
|
HKEY source;
|
||||||
LPWSTR buffer;
|
LPWSTR buffer;
|
||||||
WCHAR typechar;
|
WCHAR typechar;
|
||||||
DWORD size;
|
DWORD size;
|
||||||
UINT r;
|
UINT r;
|
||||||
int index = 0;
|
int index = 1;
|
||||||
|
|
||||||
static const WCHAR format[] = {'%','c',';','%','i',';','%','s',0};
|
static const WCHAR format[] = {'%','c',';','%','i',';','%','s',0};
|
||||||
|
|
||||||
|
@ -717,27 +718,36 @@ static UINT set_last_used_source(HKEY source, LPCWSTR product, LPCWSTR usersid,
|
||||||
typechar = 'n';
|
typechar = 'n';
|
||||||
else if (options & MSISOURCETYPE_URL)
|
else if (options & MSISOURCETYPE_URL)
|
||||||
typechar = 'u';
|
typechar = 'u';
|
||||||
|
else if (options & MSISOURCETYPE_MEDIA)
|
||||||
|
typechar = 'm';
|
||||||
else
|
else
|
||||||
return ERROR_INVALID_PARAMETER;
|
return ERROR_INVALID_PARAMETER;
|
||||||
|
|
||||||
/* make sure the source is registered */
|
if (!(options & MSISOURCETYPE_MEDIA))
|
||||||
r = MsiSourceListAddSourceExW(product, usersid, context,
|
{
|
||||||
options, value, 0);
|
r = MsiSourceListAddSourceExW(product, usersid, context,
|
||||||
if (r != ERROR_SUCCESS)
|
options, value, 0);
|
||||||
return r;
|
if (r != ERROR_SUCCESS)
|
||||||
|
return r;
|
||||||
|
|
||||||
while ((r = MsiSourceListEnumSourcesW(product, usersid, context, options,
|
index = 0;
|
||||||
index, NULL, NULL)) == ERROR_SUCCESS)
|
while ((r = MsiSourceListEnumSourcesW(product, usersid, context, options,
|
||||||
index++;
|
index, NULL, NULL)) == ERROR_SUCCESS)
|
||||||
|
index++;
|
||||||
|
|
||||||
if (r != ERROR_NO_MORE_ITEMS)
|
if (r != ERROR_NO_MORE_ITEMS)
|
||||||
return r;
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
size = (lstrlenW(format) + lstrlenW(value) + 7) * sizeof(WCHAR);
|
size = (lstrlenW(format) + lstrlenW(value) + 7) * sizeof(WCHAR);
|
||||||
buffer = msi_alloc(size);
|
buffer = msi_alloc(size);
|
||||||
if (!buffer)
|
if (!buffer)
|
||||||
return ERROR_OUTOFMEMORY;
|
return ERROR_OUTOFMEMORY;
|
||||||
|
|
||||||
|
r = OpenSourceKey(product, &source, MSICODE_PRODUCT, context, FALSE);
|
||||||
|
if (r != ERROR_SUCCESS)
|
||||||
|
return r;
|
||||||
|
|
||||||
sprintfW(buffer, format, typechar, index, value);
|
sprintfW(buffer, format, typechar, index, value);
|
||||||
|
|
||||||
size = (lstrlenW(buffer) + 1) * sizeof(WCHAR);
|
size = (lstrlenW(buffer) + 1) * sizeof(WCHAR);
|
||||||
|
@ -745,6 +755,7 @@ static UINT set_last_used_source(HKEY source, LPCWSTR product, LPCWSTR usersid,
|
||||||
REG_SZ, (LPBYTE)buffer, size);
|
REG_SZ, (LPBYTE)buffer, size);
|
||||||
msi_free(buffer);
|
msi_free(buffer);
|
||||||
|
|
||||||
|
RegCloseKey(source);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -818,15 +829,19 @@ UINT WINAPI MsiSourceListSetInfoW( LPCWSTR szProduct, LPCWSTR szUserSid,
|
||||||
if (rc != ERROR_SUCCESS)
|
if (rc != ERROR_SUCCESS)
|
||||||
rc = ERROR_UNKNOWN_PROPERTY;
|
rc = ERROR_UNKNOWN_PROPERTY;
|
||||||
}
|
}
|
||||||
else if (strcmpW(szProperty, INSTALLPROPERTY_LASTUSEDSOURCEW)==0)
|
else if (!lstrcmpW(szProperty, INSTALLPROPERTY_LASTUSEDSOURCEW))
|
||||||
rc = set_last_used_source(sourcekey, szProduct, szUserSid, dwContext,
|
{
|
||||||
dwOptions, szValue);
|
if (!(dwOptions & (MSISOURCETYPE_NETWORK | MSISOURCETYPE_URL)))
|
||||||
|
rc = ERROR_INVALID_PARAMETER;
|
||||||
|
else
|
||||||
|
rc = msi_set_last_used_source(szProduct, szUserSid, dwContext,
|
||||||
|
dwOptions, szValue);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
rc = ERROR_UNKNOWN_PROPERTY;
|
rc = ERROR_UNKNOWN_PROPERTY;
|
||||||
|
|
||||||
RegCloseKey(sourcekey);
|
RegCloseKey(sourcekey);
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************
|
/******************************************************************
|
||||||
|
|
Loading…
Reference in New Issue