msi: Implement the Version property of the Installer object.

This commit is contained in:
James Hawkins 2007-12-02 01:35:33 -06:00 committed by Alexandre Julliard
parent 6a30e1b0b4
commit b57a2f93a9
4 changed files with 28 additions and 6 deletions

View file

@ -30,6 +30,7 @@
#include "msipriv.h"
#include "activscp.h"
#include "oleauto.h"
#include "shlwapi.h"
#include "wine/debug.h"
#include "wine/unicode.h"
@ -1648,6 +1649,26 @@ static HRESULT WINAPI InstallerImpl_Invoke(
else return DISP_E_MEMBERNOTFOUND;
break;
case DISPID_INSTALLER_VERSION:
if (wFlags & DISPATCH_PROPERTYGET) {
DLLVERSIONINFO verinfo;
WCHAR version[MAX_PATH];
static const WCHAR format[] = {'%','d','.','%','d','.','%','d','.','%','d',0};
verinfo.cbSize = sizeof(DLLVERSIONINFO);
hr = DllGetVersion(&verinfo);
if (FAILED(hr)) return hr;
sprintfW(version, format, verinfo.dwMajorVersion, verinfo.dwMinorVersion,
verinfo.dwBuildNumber, verinfo.dwPlatformID);
V_VT(pVarResult) = VT_BSTR;
V_BSTR(pVarResult) = SysAllocString(version);
}
else return DISP_E_MEMBERNOTFOUND;
break;
case DISPID_INSTALLER_REGISTRYVALUE:
if (wFlags & DISPATCH_METHOD) {
HKEY hkey;

View file

@ -145,6 +145,8 @@ library WindowsInstaller
void InstallProduct(
[in] BSTR PackagePath,
[in, optional, defaultvalue("0")] BSTR PropertyValues);
[id(DISPID_INSTALLER_VERSION)]
BSTR Version();
[id(DISPID_INSTALLER_REGISTRYVALUE), propget]
BSTR RegistryValue(
[in] VARIANT Root,

View file

@ -20,6 +20,7 @@
#define DISPID_INSTALLER_OPENPACKAGE 2
#define DISPID_INSTALLER_OPENDATABASE 4
#define DISPID_INSTALLER_INSTALLPRODUCT 8
#define DISPID_INSTALLER_VERSION 9
#define DISPID_INSTALLER_REGISTRYVALUE 11
#define DISPID_INSTALLER_PRODUCTSTATE 17
#define DISPID_INSTALLER_PRODUCTINFO 18

View file

@ -475,8 +475,8 @@ static void test_dispid(void)
ok( get_dispid( pInstaller, "EnableLog" ) == 7, "dispid wrong\n");
}
ok( get_dispid( pInstaller, "InstallProduct" ) == 8, "dispid wrong\n");
todo_wine {
ok( get_dispid( pInstaller, "Version" ) == 9, "dispid wrong\n");
todo_wine {
ok( get_dispid( pInstaller, "LastErrorRecord" ) == 10, "dispid wrong\n");
}
ok( get_dispid( pInstaller, "RegistryValue" ) == 11, "dispid wrong\n");
@ -2379,11 +2379,9 @@ static void test_Installer(void)
}
/* Installer::Version */
todo_wine {
memset(szPath, 0, sizeof(szPath));
hr = Installer_VersionGet(szPath);
ok(hr == S_OK, "Installer_VersionGet failed, hresult 0x%08x\n", hr);
}
memset(szPath, 0, sizeof(szPath));
hr = Installer_VersionGet(szPath);
ok(hr == S_OK, "Installer_VersionGet failed, hresult 0x%08x\n", hr);
/* Installer::InstallProduct and other tests that depend on our product being installed */
test_Installer_InstallProduct();