Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/msi/install.c | 9 +-------- dlls/msi/package.c | 5 ++--- dlls/msi/tests/custom.c | 8 ++++++-- dlls/msi/winemsi.idl | 2 +- 4 files changed, 10 insertions(+), 14 deletions(-)
diff --git a/dlls/msi/install.c b/dlls/msi/install.c index 63ffbfe..0ec1f24 100644 --- a/dlls/msi/install.c +++ b/dlls/msi/install.c @@ -1379,18 +1379,11 @@ LANGID WINAPI MsiGetLanguage(MSIHANDLE hInstall) if (!package) { MSIHANDLE remote; - HRESULT hr; - LANGID lang;
if (!(remote = msi_get_remote(hInstall))) return ERROR_INVALID_HANDLE;
- hr = remote_GetLanguage(remote, &lang); - - if (SUCCEEDED(hr)) - return lang; - - return 0; + return remote_GetLanguage(remote); }
langid = msi_get_property_int( package->db, szProductLanguage, 0 ); diff --git a/dlls/msi/package.c b/dlls/msi/package.c index b1b2cb4..869da8d 100644 --- a/dlls/msi/package.c +++ b/dlls/msi/package.c @@ -2545,10 +2545,9 @@ UINT __cdecl remote_SetComponentState(MSIHANDLE hinst, LPCWSTR component, INSTAL return MsiSetComponentStateW(hinst, component, state); }
-HRESULT __cdecl remote_GetLanguage(MSIHANDLE hinst, LANGID *language) +LANGID __cdecl remote_GetLanguage(MSIHANDLE hinst) { - *language = MsiGetLanguage(hinst); - return S_OK; + return MsiGetLanguage(hinst); }
HRESULT __cdecl remote_SetInstallLevel(MSIHANDLE hinst, int level) diff --git a/dlls/msi/tests/custom.c b/dlls/msi/tests/custom.c index 2f9ba5d..e9561d6 100644 --- a/dlls/msi/tests/custom.c +++ b/dlls/msi/tests/custom.c @@ -642,12 +642,16 @@ static void test_targetpath(MSIHANDLE hinst) ok(hinst, sz == srcsz, "got size %u\n", sz); }
-static void test_mode(MSIHANDLE hinst) +static void test_misc(MSIHANDLE hinst) { + LANGID lang; UINT r;
r = MsiSetMode(hinst, MSIRUNMODE_REBOOTATEND, FALSE); ok(hinst, !r, "got %u\n", r); + + lang = MsiGetLanguage(hinst); + ok(hinst, lang == 1033, "got %u\n", lang); }
static void test_feature_states(MSIHANDLE hinst) @@ -767,7 +771,7 @@ UINT WINAPI main_test(MSIHANDLE hinst) test_db(hinst); test_doaction(hinst); test_targetpath(hinst); - test_mode(hinst); + test_misc(hinst); test_feature_states(hinst);
return ERROR_SUCCESS; diff --git a/dlls/msi/winemsi.idl b/dlls/msi/winemsi.idl index 132f140..b75f32f 100644 --- a/dlls/msi/winemsi.idl +++ b/dlls/msi/winemsi.idl @@ -85,7 +85,7 @@ interface IWineMsiRemote UINT remote_SetFeatureState( [in] MSIHANDLE hinst, [in, string] LPCWSTR feature, [in] INSTALLSTATE state ); UINT remote_GetComponentState( [in] MSIHANDLE hinst, [in, string] LPCWSTR component, [out] INSTALLSTATE *installed, [out] INSTALLSTATE *action ); UINT remote_SetComponentState( [in] MSIHANDLE hinst, [in, string] LPCWSTR component, [in] INSTALLSTATE state ); - HRESULT remote_GetLanguage( [in] MSIHANDLE hinst, [out] LANGID *language ); + LANGID remote_GetLanguage( [in] MSIHANDLE hinst ); HRESULT remote_SetInstallLevel( [in] MSIHANDLE hinst, [in] int level ); HRESULT remote_FormatRecord( [in] MSIHANDLE hinst, [in] MSIHANDLE record, [out] BSTR *value ); HRESULT remote_EvaluateCondition( [in] MSIHANDLE hinst, [in] BSTR condition );
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/msi/install.c | 13 +------------ dlls/msi/package.c | 5 ++--- dlls/msi/tests/custom.c | 6 ++++++ dlls/msi/winemsi.idl | 2 +- 4 files changed, 10 insertions(+), 16 deletions(-)
diff --git a/dlls/msi/install.c b/dlls/msi/install.c index 0ec1f24..b9290b4 100644 --- a/dlls/msi/install.c +++ b/dlls/msi/install.c @@ -1428,22 +1428,11 @@ UINT WINAPI MsiSetInstallLevel(MSIHANDLE hInstall, int iInstallLevel) if (!package) { MSIHANDLE remote; - HRESULT hr;
if (!(remote = msi_get_remote(hInstall))) return ERROR_INVALID_HANDLE;
- hr = remote_SetInstallLevel(remote, iInstallLevel); - - if (FAILED(hr)) - { - if (HRESULT_FACILITY(hr) == FACILITY_WIN32) - return HRESULT_CODE(hr); - - return ERROR_FUNCTION_FAILED; - } - - return ERROR_SUCCESS; + return remote_SetInstallLevel(remote, iInstallLevel); }
r = MSI_SetInstallLevel( package, iInstallLevel ); diff --git a/dlls/msi/package.c b/dlls/msi/package.c index 869da8d..6a5d689 100644 --- a/dlls/msi/package.c +++ b/dlls/msi/package.c @@ -2550,10 +2550,9 @@ LANGID __cdecl remote_GetLanguage(MSIHANDLE hinst) return MsiGetLanguage(hinst); }
-HRESULT __cdecl remote_SetInstallLevel(MSIHANDLE hinst, int level) +UINT __cdecl remote_SetInstallLevel(MSIHANDLE hinst, int level) { - UINT r = MsiSetInstallLevel(hinst, level); - return HRESULT_FROM_WIN32(r); + return MsiSetInstallLevel(hinst, level); }
HRESULT __cdecl remote_FormatRecord(MSIHANDLE hinst, MSIHANDLE record, diff --git a/dlls/msi/tests/custom.c b/dlls/msi/tests/custom.c index e9561d6..35b1543 100644 --- a/dlls/msi/tests/custom.c +++ b/dlls/msi/tests/custom.c @@ -652,6 +652,12 @@ static void test_misc(MSIHANDLE hinst)
lang = MsiGetLanguage(hinst); ok(hinst, lang == 1033, "got %u\n", lang); + + check_prop(hinst, "INSTALLLEVEL", "3"); + r = MsiSetInstallLevel(hinst, 123); + ok(hinst, !r, "got %u\n", r); + check_prop(hinst, "INSTALLLEVEL", "123"); + MsiSetInstallLevel(hinst, 3); }
static void test_feature_states(MSIHANDLE hinst) diff --git a/dlls/msi/winemsi.idl b/dlls/msi/winemsi.idl index b75f32f..a8e9348 100644 --- a/dlls/msi/winemsi.idl +++ b/dlls/msi/winemsi.idl @@ -86,7 +86,7 @@ interface IWineMsiRemote UINT remote_GetComponentState( [in] MSIHANDLE hinst, [in, string] LPCWSTR component, [out] INSTALLSTATE *installed, [out] INSTALLSTATE *action ); UINT remote_SetComponentState( [in] MSIHANDLE hinst, [in, string] LPCWSTR component, [in] INSTALLSTATE state ); LANGID remote_GetLanguage( [in] MSIHANDLE hinst ); - HRESULT remote_SetInstallLevel( [in] MSIHANDLE hinst, [in] int level ); + UINT remote_SetInstallLevel( [in] MSIHANDLE hinst, [in] int level ); HRESULT remote_FormatRecord( [in] MSIHANDLE hinst, [in] MSIHANDLE record, [out] BSTR *value ); HRESULT remote_EvaluateCondition( [in] MSIHANDLE hinst, [in] BSTR condition ); HRESULT remote_GetFeatureCost( [in] MSIHANDLE hinst, [in] BSTR feature, [in] INT cost_tree, [in] INSTALLSTATE state, [out] INT *cost );
Hi,
While running your changed tests on Windows, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check? Full results can be found at https://testbot.winehq.org/JobDetails.pl?Key=38003
Your paranoid android.
=== w7pro64 (64 bit custom) === The previous 1 run(s) terminated abnormally
Signed-off-by: Hans Leidekker hans@codeweavers.com
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/msi/format.c | 34 +++++++---------- dlls/msi/package.c | 25 ++++++++----- dlls/msi/tests/custom.c | 99 +++++++++++++++++++++++++++++++++++++++++++++++++ dlls/msi/winemsi.idl | 2 +- 4 files changed, 129 insertions(+), 31 deletions(-)
diff --git a/dlls/msi/format.c b/dlls/msi/format.c index f15c4ce..0533cc0 100644 --- a/dlls/msi/format.c +++ b/dlls/msi/format.c @@ -907,43 +907,35 @@ UINT WINAPI MsiFormatRecordW( MSIHANDLE hInstall, MSIHANDLE hRecord,
TRACE("%d %d %p %p\n", hInstall, hRecord, szResult, sz);
+ record = msihandle2msiinfo(hRecord, MSIHANDLETYPE_RECORD); + if (!record) + return ERROR_INVALID_HANDLE; + package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE ); if (!package) { - HRESULT hr; + LPWSTR value = NULL; MSIHANDLE remote; - BSTR value = NULL; awstring wstr;
if ((remote = msi_get_remote(hInstall))) { - hr = remote_FormatRecord(remote, hRecord, &value); - if (FAILED(hr)) - goto done; + r = remote_FormatRecord(remote, (struct wire_record *)&record->count, &value); + if (r) + { + midl_user_free(value); + return r; + }
wstr.unicode = TRUE; wstr.str.w = szResult; - r = msi_strcpy_to_awstring( value, SysStringLen(value), &wstr, sz ); - -done: - SysFreeString( value ); - - if (FAILED(hr)) - { - if (HRESULT_FACILITY(hr) == FACILITY_WIN32) - return HRESULT_CODE(hr); - - return ERROR_FUNCTION_FAILED; - } + r = msi_strcpy_to_awstring(value, -1, &wstr, sz);
+ midl_user_free(value); return r; } }
- record = msihandle2msiinfo( hRecord, MSIHANDLETYPE_RECORD ); - - if (!record) - return ERROR_INVALID_HANDLE; if (!sz) { msiobj_release( &record->hdr ); diff --git a/dlls/msi/package.c b/dlls/msi/package.c index 6a5d689..4a46df1 100644 --- a/dlls/msi/package.c +++ b/dlls/msi/package.c @@ -2555,20 +2555,27 @@ UINT __cdecl remote_SetInstallLevel(MSIHANDLE hinst, int level) return MsiSetInstallLevel(hinst, level); }
-HRESULT __cdecl remote_FormatRecord(MSIHANDLE hinst, MSIHANDLE record, - BSTR *value) +UINT __cdecl remote_FormatRecord(MSIHANDLE hinst, struct wire_record *remote_rec, LPWSTR *value) { + WCHAR empty[1]; DWORD size = 0; - UINT r = MsiFormatRecordW(hinst, record, NULL, &size); - if (r == ERROR_SUCCESS) + MSIHANDLE rec; + UINT r; + + if ((r = unmarshal_record(remote_rec, &rec))) + return r; + + r = MsiFormatRecordW(hinst, rec, empty, &size); + if (r == ERROR_MORE_DATA) { - *value = SysAllocStringLen(NULL, size); + *value = midl_user_allocate(++size * sizeof(WCHAR)); if (!*value) - return E_OUTOFMEMORY; - size++; - r = MsiFormatRecordW(hinst, record, *value, &size); + return ERROR_OUTOFMEMORY; + r = MsiFormatRecordW(hinst, rec, *value, &size); } - return HRESULT_FROM_WIN32(r); + + MsiCloseHandle(rec); + return r; }
HRESULT __cdecl remote_EvaluateCondition(MSIHANDLE hinst, BSTR condition) diff --git a/dlls/msi/tests/custom.c b/dlls/msi/tests/custom.c index 35b1543..76a70ad 100644 --- a/dlls/msi/tests/custom.c +++ b/dlls/msi/tests/custom.c @@ -750,6 +750,104 @@ static void test_feature_states(MSIHANDLE hinst) ok(hinst, action == INSTALLSTATE_LOCAL, "got action %d\n", action); }
+static void test_format_record(MSIHANDLE hinst) +{ + static const WCHAR xyzW[] = {'f','o','o',' ','1','2','3',0}; + static const WCHAR xyW[] = {'f','o','o',' ','1','2',0}; + WCHAR bufferW[10]; + char buffer[10]; + MSIHANDLE rec; + DWORD sz; + UINT r; + + r = MsiFormatRecordA(hinst, 0, NULL, NULL); + ok(hinst, r == ERROR_INVALID_HANDLE, "got %u\n", r); + + rec = MsiCreateRecord(1); + MsiRecordSetStringA(rec, 0, "foo [1]"); + MsiRecordSetInteger(rec, 1, 123); + + r = MsiFormatRecordA(hinst, rec, NULL, NULL); + ok(hinst, !r, "got %u\n", r); + + r = MsiFormatRecordA(hinst, rec, buffer, NULL); + ok(hinst, r == ERROR_INVALID_PARAMETER, "got %u\n", r); + + /* Returned size is in bytes, not chars, but only for custom actions. */ + + sz = 0; + r = MsiFormatRecordA(hinst, rec, NULL, &sz); + ok(hinst, !r, "got %u\n", r); + todo_wine_ok(hinst, sz == 14, "got size %u\n", sz); + + sz = 0; + strcpy(buffer,"q"); + r = MsiFormatRecordA(hinst, rec, buffer, &sz); + ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r); + ok(hinst, !strcmp(buffer, "q"), "got "%s"\n", buffer); + todo_wine_ok(hinst, sz == 14, "got size %u\n", sz); + + sz = 1; + strcpy(buffer,"x"); + r = MsiFormatRecordA(hinst, rec, buffer, &sz); + ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r); + ok(hinst, !buffer[0], "got "%s"\n", buffer); + todo_wine_ok(hinst, sz == 14, "got size %u\n", sz); + + sz = 7; + strcpy(buffer,"x"); + r = MsiFormatRecordA(hinst, rec, buffer, &sz); + ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r); + ok(hinst, !strcmp(buffer, "foo 12"), "got "%s"\n", buffer); + todo_wine_ok(hinst, sz == 14, "got size %u\n", sz); + + sz = 8; + strcpy(buffer,"x"); + r = MsiFormatRecordA(hinst, rec, buffer, &sz); + ok(hinst, !r, "got %u\n", r); + ok(hinst, !strcmp(buffer, "foo 123"), "got "%s"\n", buffer); + ok(hinst, sz == 7, "got size %u\n", sz); + + sz = 0; + bufferW[0] = 'q'; + r = MsiFormatRecordW(hinst, rec, bufferW, &sz); + ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r); + ok(hinst, bufferW[0] == 'q', "got %s\n", dbgstr_w(bufferW)); + ok(hinst, sz == 7, "got size %u\n", sz); + + sz = 1; + bufferW[0] = 'q'; + r = MsiFormatRecordW(hinst, rec, bufferW, &sz); + ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r); + ok(hinst, !bufferW[0], "got %s\n", dbgstr_w(bufferW)); + ok(hinst, sz == 7, "got size %u\n", sz); + + sz = 7; + bufferW[0] = 'q'; + r = MsiFormatRecordW(hinst, rec, bufferW, &sz); + ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r); + ok(hinst, !lstrcmpW(bufferW, xyW), "got %s\n", dbgstr_w(bufferW)); + ok(hinst, sz == 7, "got size %u\n", sz); + + sz = 8; + bufferW[0] = 'q'; + r = MsiFormatRecordW(hinst, rec, bufferW, &sz); + ok(hinst, !r, "got %u\n", r); + ok(hinst, !lstrcmpW(bufferW, xyzW), "got %s\n", dbgstr_w(bufferW)); + ok(hinst, sz == 7, "got size %u\n", sz); + + /* check that properties work */ + MsiSetPropertyA(hinst, "fmtprop", "foobar"); + MsiRecordSetStringA(rec, 0, "[fmtprop]"); + sz = sizeof(buffer); + r = MsiFormatRecordA(hinst, rec, buffer, &sz); + ok(hinst, !r, "got %u\n", r); + ok(hinst, !strcmp(buffer, "foobar"), "got "%s"\n", buffer); + ok(hinst, sz == 6, "got size %u\n", sz); + + MsiCloseHandle(rec); +} + /* Main test. Anything that doesn't depend on a specific install configuration * or have undesired side effects should go here. */ UINT WINAPI main_test(MSIHANDLE hinst) @@ -779,6 +877,7 @@ UINT WINAPI main_test(MSIHANDLE hinst) test_targetpath(hinst); test_misc(hinst); test_feature_states(hinst); + test_format_record(hinst);
return ERROR_SUCCESS; } diff --git a/dlls/msi/winemsi.idl b/dlls/msi/winemsi.idl index a8e9348..7d7054a 100644 --- a/dlls/msi/winemsi.idl +++ b/dlls/msi/winemsi.idl @@ -87,7 +87,7 @@ interface IWineMsiRemote UINT remote_SetComponentState( [in] MSIHANDLE hinst, [in, string] LPCWSTR component, [in] INSTALLSTATE state ); LANGID remote_GetLanguage( [in] MSIHANDLE hinst ); UINT remote_SetInstallLevel( [in] MSIHANDLE hinst, [in] int level ); - HRESULT remote_FormatRecord( [in] MSIHANDLE hinst, [in] MSIHANDLE record, [out] BSTR *value ); + UINT remote_FormatRecord( [in] MSIHANDLE hinst, [in] struct wire_record *record, [out, string] LPWSTR *value); HRESULT remote_EvaluateCondition( [in] MSIHANDLE hinst, [in] BSTR condition ); HRESULT remote_GetFeatureCost( [in] MSIHANDLE hinst, [in] BSTR feature, [in] INT cost_tree, [in] INSTALLSTATE state, [out] INT *cost ); HRESULT remote_EnumComponentCosts( [in] MSIHANDLE hinst, [in] BSTR component, [in] DWORD index, [in] INSTALLSTATE state,
Hi,
While running your changed tests on Windows, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check? Full results can be found at https://testbot.winehq.org/JobDetails.pl?Key=38004
Your paranoid android.
=== w7pro64 (64 bit custom) === The previous 1 run(s) terminated abnormally
Signed-off-by: Hans Leidekker hans@codeweavers.com
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/msi/cond.y | 21 +++------------------ dlls/msi/package.c | 5 ++--- dlls/msi/tests/custom.c | 7 +++++++ dlls/msi/winemsi.idl | 2 +- 4 files changed, 13 insertions(+), 22 deletions(-)
diff --git a/dlls/msi/cond.y b/dlls/msi/cond.y index 8a3373f..ce06199 100644 --- a/dlls/msi/cond.y +++ b/dlls/msi/cond.y @@ -851,29 +851,14 @@ MSICONDITION WINAPI MsiEvaluateConditionW( MSIHANDLE hInstall, LPCWSTR szConditi if( !package ) { MSIHANDLE remote; - HRESULT hr; - BSTR condition;
if (!(remote = msi_get_remote(hInstall))) return MSICONDITION_ERROR;
- condition = SysAllocString( szCondition ); - if (!condition) - return ERROR_OUTOFMEMORY; + if (!szCondition) + return MSICONDITION_NONE;
- hr = remote_EvaluateCondition(remote, condition); - - SysFreeString( condition ); - - if (FAILED(hr)) - { - if (HRESULT_FACILITY(hr) == FACILITY_WIN32) - return HRESULT_CODE(hr); - - return ERROR_FUNCTION_FAILED; - } - - return ERROR_SUCCESS; + return remote_EvaluateCondition(remote, szCondition); }
ret = MSI_EvaluateConditionW( package, szCondition ); diff --git a/dlls/msi/package.c b/dlls/msi/package.c index 4a46df1..c93a0c8 100644 --- a/dlls/msi/package.c +++ b/dlls/msi/package.c @@ -2578,10 +2578,9 @@ UINT __cdecl remote_FormatRecord(MSIHANDLE hinst, struct wire_record *remote_rec return r; }
-HRESULT __cdecl remote_EvaluateCondition(MSIHANDLE hinst, BSTR condition) +MSICONDITION __cdecl remote_EvaluateCondition(MSIHANDLE hinst, LPCWSTR condition) { - UINT r = MsiEvaluateConditionW(hinst, condition); - return HRESULT_FROM_WIN32(r); + return MsiEvaluateConditionW(hinst, condition); }
HRESULT __cdecl remote_GetFeatureCost(MSIHANDLE hinst, BSTR feature, diff --git a/dlls/msi/tests/custom.c b/dlls/msi/tests/custom.c index 76a70ad..2035a8f 100644 --- a/dlls/msi/tests/custom.c +++ b/dlls/msi/tests/custom.c @@ -644,6 +644,7 @@ static void test_targetpath(MSIHANDLE hinst)
static void test_misc(MSIHANDLE hinst) { + MSICONDITION cond; LANGID lang; UINT r;
@@ -658,6 +659,12 @@ static void test_misc(MSIHANDLE hinst) ok(hinst, !r, "got %u\n", r); check_prop(hinst, "INSTALLLEVEL", "123"); MsiSetInstallLevel(hinst, 3); + + cond = MsiEvaluateConditionA(hinst, NULL); + ok(hinst, cond == MSICONDITION_NONE, "got %u\n", cond); + MsiSetPropertyA(hinst, "condprop", "1"); + cond = MsiEvaluateConditionA(hinst, "condprop = 1"); + ok(hinst, cond == MSICONDITION_TRUE, "got %u\n", cond); }
static void test_feature_states(MSIHANDLE hinst) diff --git a/dlls/msi/winemsi.idl b/dlls/msi/winemsi.idl index 7d7054a..6bdd117 100644 --- a/dlls/msi/winemsi.idl +++ b/dlls/msi/winemsi.idl @@ -88,7 +88,7 @@ interface IWineMsiRemote LANGID remote_GetLanguage( [in] MSIHANDLE hinst ); UINT remote_SetInstallLevel( [in] MSIHANDLE hinst, [in] int level ); UINT remote_FormatRecord( [in] MSIHANDLE hinst, [in] struct wire_record *record, [out, string] LPWSTR *value); - HRESULT remote_EvaluateCondition( [in] MSIHANDLE hinst, [in] BSTR condition ); + MSICONDITION remote_EvaluateCondition( [in] MSIHANDLE hinst, [in, string] LPCWSTR condition ); HRESULT remote_GetFeatureCost( [in] MSIHANDLE hinst, [in] BSTR feature, [in] INT cost_tree, [in] INSTALLSTATE state, [out] INT *cost ); HRESULT remote_EnumComponentCosts( [in] MSIHANDLE hinst, [in] BSTR component, [in] DWORD index, [in] INSTALLSTATE state, [out, size_is(*buflen)] BSTR drive, [in, out] DWORD *buflen, [out] INT *cost, [out] INT *temp );
Hi,
While running your changed tests on Windows, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check? Full results can be found at https://testbot.winehq.org/JobDetails.pl?Key=38007
Your paranoid android.
=== w7pro64 (64 bit custom) === The previous 1 run(s) terminated abnormally
Signed-off-by: Hans Leidekker hans@codeweavers.com
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/msi/install.c | 9 +++++++++ dlls/msi/tests/package.c | 18 ++++++++++++++++-- 2 files changed, 25 insertions(+), 2 deletions(-)
diff --git a/dlls/msi/install.c b/dlls/msi/install.c index b9290b4..63aed1e 100644 --- a/dlls/msi/install.c +++ b/dlls/msi/install.c @@ -1061,6 +1061,9 @@ UINT WINAPI MsiGetFeatureCostW(MSIHANDLE hInstall, LPCWSTR szFeature, TRACE("(%d %s %i %i %p)\n", hInstall, debugstr_w(szFeature), iCostTree, iState, piCost);
+ if (!szFeature) + return ERROR_INVALID_PARAMETER; + package = msihandle2msiinfo(hInstall, MSIHANDLETYPE_PACKAGE); if (!package) { @@ -1090,6 +1093,12 @@ UINT WINAPI MsiGetFeatureCostW(MSIHANDLE hInstall, LPCWSTR szFeature, return ERROR_SUCCESS; }
+ if (!piCost) + { + msiobj_release( &package->hdr ); + return ERROR_INVALID_PARAMETER; + } + feature = msi_get_loaded_feature(package, szFeature);
if (feature) diff --git a/dlls/msi/tests/package.c b/dlls/msi/tests/package.c index c2e2106..d26e2fd 100644 --- a/dlls/msi/tests/package.c +++ b/dlls/msi/tests/package.c @@ -8479,7 +8479,7 @@ static void test_MsiApplyPatch(void) ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %u\n", r); }
-static void test_MsiEnumComponentCosts(void) +static void test_costs(void) { MSIHANDLE hdb, hpkg; char package[12], drive[3]; @@ -8662,6 +8662,20 @@ static void test_MsiEnumComponentCosts(void) r = MsiEnumComponentCostsA( hpkg, "", 1, INSTALLSTATE_UNKNOWN, drive, &len, &cost, &temp ); ok( r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %u\n", r );
+ /* test MsiGetFeatureCost */ + cost = 0xdead; + r = MsiGetFeatureCostA( hpkg, NULL, MSICOSTTREE_SELFONLY, INSTALLSTATE_LOCAL, &cost ); + ok( r == ERROR_INVALID_PARAMETER, "got %u\n", r); + ok( cost == 0xdead, "got %d\n", cost ); + + r = MsiGetFeatureCostA( hpkg, "one", MSICOSTTREE_SELFONLY, INSTALLSTATE_LOCAL, NULL ); + ok( r == ERROR_INVALID_PARAMETER, "got %u\n", r); + + cost = 0xdead; + r = MsiGetFeatureCostA( hpkg, "one", MSICOSTTREE_SELFONLY, INSTALLSTATE_LOCAL, &cost ); + ok( !r, "got %u\n", r); + ok( cost == 8, "got %d\n", cost ); + MsiCloseHandle( hpkg ); error: MsiCloseHandle( hdb ); @@ -9702,7 +9716,7 @@ START_TEST(package) test_MsiSetProperty(); test_MsiApplyMultiplePatches(); test_MsiApplyPatch(); - test_MsiEnumComponentCosts(); + test_costs(); test_MsiDatabaseCommit(); test_externalui(); test_externalui_message();
Signed-off-by: Hans Leidekker hans@codeweavers.com
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/msi/install.c | 22 ++++------------------ dlls/msi/package.c | 7 +++---- dlls/msi/tests/custom.c | 20 ++++++++++++++++++++ dlls/msi/tests/install.c | 1 + dlls/msi/winemsi.idl | 3 ++- 5 files changed, 30 insertions(+), 23 deletions(-)
diff --git a/dlls/msi/install.c b/dlls/msi/install.c index 63aed1e..45c5537 100644 --- a/dlls/msi/install.c +++ b/dlls/msi/install.c @@ -1068,29 +1068,15 @@ UINT WINAPI MsiGetFeatureCostW(MSIHANDLE hInstall, LPCWSTR szFeature, if (!package) { MSIHANDLE remote; - HRESULT hr; - BSTR feature;
if (!(remote = msi_get_remote(hInstall))) return ERROR_INVALID_HANDLE;
- feature = SysAllocString(szFeature); - if (!feature) - return ERROR_OUTOFMEMORY; + /* FIXME: should use SEH */ + if (!piCost) + return RPC_X_NULL_REF_POINTER;
- hr = remote_GetFeatureCost(remote, feature, iCostTree, iState, piCost); - - SysFreeString(feature); - - if (FAILED(hr)) - { - if (HRESULT_FACILITY(hr) == FACILITY_WIN32) - return HRESULT_CODE(hr); - - return ERROR_FUNCTION_FAILED; - } - - return ERROR_SUCCESS; + return remote_GetFeatureCost(remote, szFeature, iCostTree, iState, piCost); }
if (!piCost) diff --git a/dlls/msi/package.c b/dlls/msi/package.c index c93a0c8..b633250 100644 --- a/dlls/msi/package.c +++ b/dlls/msi/package.c @@ -2583,11 +2583,10 @@ MSICONDITION __cdecl remote_EvaluateCondition(MSIHANDLE hinst, LPCWSTR condition return MsiEvaluateConditionW(hinst, condition); }
-HRESULT __cdecl remote_GetFeatureCost(MSIHANDLE hinst, BSTR feature, - INT cost_tree, INSTALLSTATE state, INT *cost) +UINT __cdecl remote_GetFeatureCost(MSIHANDLE hinst, LPCWSTR feature, + MSICOSTTREE cost_tree, INSTALLSTATE state, INT *cost) { - UINT r = MsiGetFeatureCostW(hinst, feature, cost_tree, state, cost); - return HRESULT_FROM_WIN32(r); + return MsiGetFeatureCostW(hinst, feature, cost_tree, state, cost); }
HRESULT __cdecl remote_EnumComponentCosts(MSIHANDLE hinst, BSTR component, diff --git a/dlls/msi/tests/custom.c b/dlls/msi/tests/custom.c index 2035a8f..ecd172a 100644 --- a/dlls/msi/tests/custom.c +++ b/dlls/msi/tests/custom.c @@ -855,6 +855,25 @@ static void test_format_record(MSIHANDLE hinst) MsiCloseHandle(rec); }
+static void test_costs(MSIHANDLE hinst) +{ + INT cost; + UINT r; + + cost = 0xdead; + r = MsiGetFeatureCostA(hinst, NULL, MSICOSTTREE_CHILDREN, INSTALLSTATE_LOCAL, &cost); + ok(hinst, r == ERROR_INVALID_PARAMETER, "got %u\n", r); + todo_wine_ok(hinst, !cost, "got %d\n", cost); + + r = MsiGetFeatureCostA(hinst, "One", MSICOSTTREE_CHILDREN, INSTALLSTATE_LOCAL, NULL); + ok(hinst, r == RPC_X_NULL_REF_POINTER, "got %u\n", r); + + cost = 0xdead; + r = MsiGetFeatureCostA(hinst, "One", MSICOSTTREE_CHILDREN, INSTALLSTATE_LOCAL, &cost); + ok(hinst, !r, "got %u\n", r); + todo_wine_ok(hinst, cost == 8, "got %d\n", cost); +} + /* Main test. Anything that doesn't depend on a specific install configuration * or have undesired side effects should go here. */ UINT WINAPI main_test(MSIHANDLE hinst) @@ -885,6 +904,7 @@ UINT WINAPI main_test(MSIHANDLE hinst) test_misc(hinst); test_feature_states(hinst); test_format_record(hinst); + test_costs(hinst);
return ERROR_SUCCESS; } diff --git a/dlls/msi/tests/install.c b/dlls/msi/tests/install.c index 6a7383b..5c83d30 100644 --- a/dlls/msi/tests/install.c +++ b/dlls/msi/tests/install.c @@ -698,6 +698,7 @@ static const CHAR ca1_install_exec_seq_dat[] = "Action\tCondition\tSequence\n" "CostInitialize\t\t100\n" "FileCost\t\t200\n" "CostFinalize\t\t300\n" + "InstallValidate\t\t400\n" "embednull\t\t600\n" "maintest\tMAIN_TEST\t700\n" "testretval\tTEST_RETVAL\t710\n"; diff --git a/dlls/msi/winemsi.idl b/dlls/msi/winemsi.idl index 6bdd117..fa98ac0 100644 --- a/dlls/msi/winemsi.idl +++ b/dlls/msi/winemsi.idl @@ -29,6 +29,7 @@ typedef int MSIRUNMODE; typedef int INSTALLSTATE; typedef int MSICOLINFO; typedef int MSIMODIFY; +typedef int MSICOSTTREE;
#define MSIFIELD_NULL 0 #define MSIFIELD_INT 1 @@ -89,7 +90,7 @@ interface IWineMsiRemote UINT remote_SetInstallLevel( [in] MSIHANDLE hinst, [in] int level ); UINT remote_FormatRecord( [in] MSIHANDLE hinst, [in] struct wire_record *record, [out, string] LPWSTR *value); MSICONDITION remote_EvaluateCondition( [in] MSIHANDLE hinst, [in, string] LPCWSTR condition ); - HRESULT remote_GetFeatureCost( [in] MSIHANDLE hinst, [in] BSTR feature, [in] INT cost_tree, [in] INSTALLSTATE state, [out] INT *cost ); + UINT remote_GetFeatureCost( [in] MSIHANDLE hinst, [in, string] LPCWSTR feature, [in] MSICOSTTREE cost_tree, [in] INSTALLSTATE state, [out] INT *cost ); HRESULT remote_EnumComponentCosts( [in] MSIHANDLE hinst, [in] BSTR component, [in] DWORD index, [in] INSTALLSTATE state, [out, size_is(*buflen)] BSTR drive, [in, out] DWORD *buflen, [out] INT *cost, [out] INT *temp );
Hi,
While running your changed tests on Windows, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check? Full results can be found at https://testbot.winehq.org/JobDetails.pl?Key=38013
Your paranoid android.
=== wxppro (32 bit install) === msi:install contains a misplaced failure message for custom
=== w7u (32 bit custom) === The previous 1 run(s) terminated abnormally
=== w7pro64 (32 bit custom) === The previous 1 run(s) terminated abnormally
=== w7pro64 (64 bit custom) === The previous 1 run(s) terminated abnormally
Signed-off-by: Hans Leidekker hans@codeweavers.com
Hi,
While running your changed tests on Windows, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check? Full results can be found at https://testbot.winehq.org/JobDetails.pl?Key=38002
Your paranoid android.
=== w7pro64 (64 bit custom) === The previous 1 run(s) terminated abnormally