msi: Move version string conversions to registry.c.
This commit is contained in:
parent
9917250863
commit
230af9d21f
|
@ -3088,7 +3088,7 @@ static UINT ACTION_PublishProduct(MSIPACKAGE *package)
|
||||||
buffer = msi_dup_property( package, szProductVersion );
|
buffer = msi_dup_property( package, szProductVersion );
|
||||||
if (buffer)
|
if (buffer)
|
||||||
{
|
{
|
||||||
DWORD verdword = build_version_dword(buffer);
|
DWORD verdword = msi_version_str_to_dword(buffer);
|
||||||
msi_reg_set_val_dword( hkey, INSTALLPROPERTY_VERSIONW, verdword );
|
msi_reg_set_val_dword( hkey, INSTALLPROPERTY_VERSIONW, verdword );
|
||||||
}
|
}
|
||||||
msi_free(buffer);
|
msi_free(buffer);
|
||||||
|
@ -3588,7 +3588,7 @@ static UINT ACTION_RegisterProduct(MSIPACKAGE *package)
|
||||||
buffer = msi_dup_property( package, szProductVersion );
|
buffer = msi_dup_property( package, szProductVersion );
|
||||||
if (buffer)
|
if (buffer)
|
||||||
{
|
{
|
||||||
DWORD verdword = build_version_dword(buffer);
|
DWORD verdword = msi_version_str_to_dword(buffer);
|
||||||
|
|
||||||
msi_reg_set_val_dword( hkey, INSTALLPROPERTY_VERSIONW, verdword );
|
msi_reg_set_val_dword( hkey, INSTALLPROPERTY_VERSIONW, verdword );
|
||||||
msi_reg_set_val_dword( hkey, INSTALLPROPERTY_VERSIONMAJORW, verdword>>24 );
|
msi_reg_set_val_dword( hkey, INSTALLPROPERTY_VERSIONMAJORW, verdword>>24 );
|
||||||
|
|
|
@ -266,7 +266,6 @@ extern MSIFOLDER *get_loaded_folder( MSIPACKAGE *package, LPCWSTR dir );
|
||||||
extern int track_tempfile(MSIPACKAGE *package, LPCWSTR name, LPCWSTR path);
|
extern int track_tempfile(MSIPACKAGE *package, LPCWSTR name, LPCWSTR path);
|
||||||
extern UINT schedule_action(MSIPACKAGE *package, UINT script, LPCWSTR action);
|
extern UINT schedule_action(MSIPACKAGE *package, UINT script, LPCWSTR action);
|
||||||
extern LPWSTR build_icon_path(MSIPACKAGE *, LPCWSTR);
|
extern LPWSTR build_icon_path(MSIPACKAGE *, LPCWSTR);
|
||||||
extern DWORD build_version_dword(LPCWSTR);
|
|
||||||
extern LPWSTR build_directory_name(DWORD , ...);
|
extern LPWSTR build_directory_name(DWORD , ...);
|
||||||
extern BOOL create_full_pathW(const WCHAR *path);
|
extern BOOL create_full_pathW(const WCHAR *path);
|
||||||
extern BOOL ACTION_VerifyComponentForAction(MSICOMPONENT*, INSTALLSTATE);
|
extern BOOL ACTION_VerifyComponentForAction(MSICOMPONENT*, INSTALLSTATE);
|
||||||
|
|
|
@ -43,47 +43,6 @@ const WCHAR cszSourceDir[] = {'S','o','u','r','c','e','D','i','r',0};
|
||||||
const WCHAR cszRootDrive[] = {'R','O','O','T','D','R','I','V','E',0};
|
const WCHAR cszRootDrive[] = {'R','O','O','T','D','R','I','V','E',0};
|
||||||
const WCHAR cszbs[]={'\\',0};
|
const WCHAR cszbs[]={'\\',0};
|
||||||
|
|
||||||
DWORD build_version_dword(LPCWSTR version_string)
|
|
||||||
{
|
|
||||||
SHORT major,minor;
|
|
||||||
WORD build;
|
|
||||||
DWORD rc = 0x00000000;
|
|
||||||
LPCWSTR ptr1;
|
|
||||||
|
|
||||||
ptr1 = version_string;
|
|
||||||
|
|
||||||
if (!ptr1)
|
|
||||||
return rc;
|
|
||||||
else
|
|
||||||
major = atoiW(ptr1);
|
|
||||||
|
|
||||||
|
|
||||||
if(ptr1)
|
|
||||||
ptr1 = strchrW(ptr1,'.');
|
|
||||||
if (ptr1)
|
|
||||||
{
|
|
||||||
ptr1++;
|
|
||||||
minor = atoiW(ptr1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
minor = 0;
|
|
||||||
|
|
||||||
if (ptr1)
|
|
||||||
ptr1 = strchrW(ptr1,'.');
|
|
||||||
|
|
||||||
if (ptr1)
|
|
||||||
{
|
|
||||||
ptr1++;
|
|
||||||
build = atoiW(ptr1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
build = 0;
|
|
||||||
|
|
||||||
rc = MAKELONG(build,MAKEWORD(minor,major));
|
|
||||||
TRACE("%s -> 0x%lx\n",debugstr_w(version_string),rc);
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
|
|
||||||
LPWSTR build_icon_path(MSIPACKAGE *package, LPCWSTR icon_name )
|
LPWSTR build_icon_path(MSIPACKAGE *package, LPCWSTR icon_name )
|
||||||
{
|
{
|
||||||
LPWSTR SystemFolder, dest, FilePath;
|
LPWSTR SystemFolder, dest, FilePath;
|
||||||
|
|
|
@ -415,6 +415,9 @@ extern UINT MSIREG_OpenUserComponentsKey(LPCWSTR szComponent, HKEY* key, BOOL cr
|
||||||
extern UINT MSIREG_OpenUpgradeCodesKey(LPCWSTR szProduct, HKEY* key, BOOL create);
|
extern UINT MSIREG_OpenUpgradeCodesKey(LPCWSTR szProduct, HKEY* key, BOOL create);
|
||||||
extern UINT MSIREG_OpenUserUpgradeCodesKey(LPCWSTR szProduct, HKEY* key, BOOL create);
|
extern UINT MSIREG_OpenUserUpgradeCodesKey(LPCWSTR szProduct, HKEY* key, BOOL create);
|
||||||
|
|
||||||
|
extern DWORD msi_version_str_to_dword(LPCWSTR p);
|
||||||
|
extern LPWSTR msi_version_dword_to_str(DWORD version);
|
||||||
|
|
||||||
extern LONG msi_reg_set_val_str( HKEY hkey, LPCWSTR name, LPCWSTR value );
|
extern LONG msi_reg_set_val_str( HKEY hkey, LPCWSTR name, LPCWSTR value );
|
||||||
extern LONG msi_reg_set_val_multi_str( HKEY hkey, LPCWSTR name, LPCWSTR value );
|
extern LONG msi_reg_set_val_multi_str( HKEY hkey, LPCWSTR name, LPCWSTR value );
|
||||||
extern LONG msi_reg_set_val_dword( HKEY hkey, LPCWSTR name, DWORD val );
|
extern LONG msi_reg_set_val_dword( HKEY hkey, LPCWSTR name, DWORD val );
|
||||||
|
|
|
@ -305,6 +305,38 @@ BOOL encode_base85_guid( GUID *guid, LPWSTR str )
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DWORD msi_version_str_to_dword(LPCWSTR p)
|
||||||
|
{
|
||||||
|
DWORD major, minor = 0, build = 0, version = 0;
|
||||||
|
|
||||||
|
if (!p)
|
||||||
|
return version;
|
||||||
|
|
||||||
|
major = atoiW(p);
|
||||||
|
|
||||||
|
p = strchrW(p, '.');
|
||||||
|
if (p)
|
||||||
|
{
|
||||||
|
minor = atoiW(p+1);
|
||||||
|
p = strchrW(p+1, '.');
|
||||||
|
if (p)
|
||||||
|
build = atoiW(p+1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return MAKELONG(build, MAKEWORD(minor, major));
|
||||||
|
}
|
||||||
|
|
||||||
|
LPWSTR msi_version_dword_to_str(DWORD version)
|
||||||
|
{
|
||||||
|
const WCHAR fmt[] = { '%','u','.','%','u','.','%','u',0 };
|
||||||
|
LPWSTR str = msi_alloc(20);
|
||||||
|
sprintfW(str, fmt,
|
||||||
|
(version&0xff000000)>>24,
|
||||||
|
(version&0x00ff0000)>>16,
|
||||||
|
version&0x0000ffff);
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
LONG msi_reg_set_val_str( HKEY hkey, LPCWSTR name, LPCWSTR value )
|
LONG msi_reg_set_val_str( HKEY hkey, LPCWSTR name, LPCWSTR value )
|
||||||
{
|
{
|
||||||
DWORD len = value ? (lstrlenW(value) + 1) * sizeof (WCHAR) : 0;
|
DWORD len = value ? (lstrlenW(value) + 1) * sizeof (WCHAR) : 0;
|
||||||
|
|
|
@ -151,7 +151,7 @@ static UINT ITERATE_FindRelatedProducts(MSIRECORD *rec, LPVOID param)
|
||||||
(LPBYTE)&check, &sz);
|
(LPBYTE)&check, &sz);
|
||||||
/* check min */
|
/* check min */
|
||||||
ver = MSI_RecordGetString(rec,2);
|
ver = MSI_RecordGetString(rec,2);
|
||||||
comp_ver = build_version_dword(ver);
|
comp_ver = msi_version_str_to_dword(ver);
|
||||||
r = check - comp_ver;
|
r = check - comp_ver;
|
||||||
if (r < 0 || (r == 0 && !(attributes &
|
if (r < 0 || (r == 0 && !(attributes &
|
||||||
msidbUpgradeAttributesVersionMinInclusive)))
|
msidbUpgradeAttributesVersionMinInclusive)))
|
||||||
|
@ -163,7 +163,7 @@ static UINT ITERATE_FindRelatedProducts(MSIRECORD *rec, LPVOID param)
|
||||||
|
|
||||||
/* check max */
|
/* check max */
|
||||||
ver = MSI_RecordGetString(rec,3);
|
ver = MSI_RecordGetString(rec,3);
|
||||||
comp_ver = build_version_dword(ver);
|
comp_ver = msi_version_str_to_dword(ver);
|
||||||
r = check - comp_ver;
|
r = check - comp_ver;
|
||||||
if (r > 0 || (r == 0 && !(attributes &
|
if (r > 0 || (r == 0 && !(attributes &
|
||||||
msidbUpgradeAttributesVersionMaxInclusive)))
|
msidbUpgradeAttributesVersionMaxInclusive)))
|
||||||
|
|
Loading…
Reference in New Issue