winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
April 2018
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
2 participants
542 discussions
Start a n
N
ew thread
Zebediah Figura : msi: Handle some invalid parameters in MsiGetFeatureCost ().
by Alexandre Julliard
25 Apr '18
25 Apr '18
Module: wine Branch: master Commit: 1b6adcb7216a6b4a0706ac7255f3ddb832656127 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=1b6adcb7216a6b4a0706ac72…
Author: Zebediah Figura <z.figura12(a)gmail.com> Date: Tue Apr 24 22:27:41 2018 -0500 msi: Handle some invalid parameters in MsiGetFeatureCost(). Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com> Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- 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();
1
0
0
0
Zebediah Figura : msi: Make MsiEvaluateCondition() RPC-compatible.
by Alexandre Julliard
25 Apr '18
25 Apr '18
Module: wine Branch: master Commit: 0fc1b6f2f31952f9dab4a22805fe0f098548cb25 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=0fc1b6f2f31952f9dab4a228…
Author: Zebediah Figura <z.figura12(a)gmail.com> Date: Tue Apr 24 22:27:40 2018 -0500 msi: Make MsiEvaluateCondition() RPC-compatible. Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com> Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- 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 );
1
0
0
0
Zebediah Figura : msi: Make MsiFormatRecord() RPC-compatible.
by Alexandre Julliard
25 Apr '18
25 Apr '18
Module: wine Branch: master Commit: ef7ed29348584fc0385d42b707fd6fcc03dfddc5 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=ef7ed29348584fc0385d42b7…
Author: Zebediah Figura <z.figura12(a)gmail.com> Date: Tue Apr 24 22:27:39 2018 -0500 msi: Make MsiFormatRecord() RPC-compatible. Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com> Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- 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,
1
0
0
0
Zebediah Figura : msi: Make MsiSetInstallLevel() RPC-compatible.
by Alexandre Julliard
25 Apr '18
25 Apr '18
Module: wine Branch: master Commit: 5ab576b8a09f715401a1de2bb384ccc9ffb37750 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=5ab576b8a09f715401a1de2b…
Author: Zebediah Figura <z.figura12(a)gmail.com> Date: Tue Apr 24 22:27:38 2018 -0500 msi: Make MsiSetInstallLevel() RPC-compatible. Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com> Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- 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 );
1
0
0
0
Zebediah Figura : msi: Make MsiGetLanguage() RPC-compatible.
by Alexandre Julliard
25 Apr '18
25 Apr '18
Module: wine Branch: master Commit: 5f45959adc55961a9787b54cd7814f18c056ebef URL:
https://source.winehq.org/git/wine.git/?a=commit;h=5f45959adc55961a9787b54c…
Author: Zebediah Figura <z.figura12(a)gmail.com> Date: Tue Apr 24 22:27:37 2018 -0500 msi: Make MsiGetLanguage() RPC-compatible. Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com> Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- 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 );
1
0
0
0
Dmitry Timoshkov : mstask/tests: Add more tests for ITaskScheduler:: AddWorkItem().
by Alexandre Julliard
25 Apr '18
25 Apr '18
Module: wine Branch: master Commit: c65df521a45be40550b297fc46acbfabb14ec42d URL:
https://source.winehq.org/git/wine.git/?a=commit;h=c65df521a45be40550b297fc…
Author: Dmitry Timoshkov <dmitry(a)baikal.ru> Date: Wed Apr 25 11:34:57 2018 +0800 mstask/tests: Add more tests for ITaskScheduler::AddWorkItem(). Signed-off-by: Dmitry Timoshkov <dmitry(a)baikal.ru> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/mstask/tests/task_scheduler.c | 98 ++++++++++++++++++++++++++++---------- 1 file changed, 74 insertions(+), 24 deletions(-) diff --git a/dlls/mstask/tests/task_scheduler.c b/dlls/mstask/tests/task_scheduler.c index 8482972..8b93b56 100644 --- a/dlls/mstask/tests/task_scheduler.c +++ b/dlls/mstask/tests/task_scheduler.c @@ -273,7 +273,7 @@ static void test_save_task_curfile(ITask *task) IPersistFile_Release(pfile); } -static WCHAR *get_task_curfile(ITask *task) +static WCHAR *get_task_curfile(ITask *task, BOOL should_exist, BOOL is_dirty, int line) { HRESULT hr; IPersistFile *pfile; @@ -281,18 +281,28 @@ static WCHAR *get_task_curfile(ITask *task) CLSID clsid; hr = ITask_QueryInterface(task, &IID_IPersistFile, (void **)&pfile); - ok(hr == S_OK, "QueryInterface error %#x\n", hr); + ok_(__FILE__, line)(hr == S_OK, "QueryInterface error %#x\n", hr); + + hr = IPersistFile_IsDirty(pfile); + ok_(__FILE__, line)(hr == is_dirty ? S_OK : S_FALSE, "got %#x\n", hr); + curfile = NULL; hr = IPersistFile_GetCurFile(pfile, &curfile); - ok(hr == S_OK, "GetCurFile error %#x\n", hr); - ok(curfile && curfile[0] , "curfile should not be NULL\n"); + ok_(__FILE__, line)(hr == S_OK, "GetCurFile error %#x\n", hr); + ok_(__FILE__, line)(curfile && curfile[0] , "curfile should not be NULL\n"); + + hr = IPersistFile_Load(pfile, curfile, STGM_READ); + if (should_exist) + ok_(__FILE__, line)(hr == S_OK, "Load error %#x\n", hr); + else + ok_(__FILE__, line)(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "wrong error %#x\n", hr); if (0) /* crashes under Windows */ hr = IPersistFile_GetClassID(pfile, NULL); hr = IPersistFile_GetClassID(pfile, &clsid); - ok(hr == S_OK, "GetClassID error %#x\n", hr); - ok(IsEqualCLSID(&clsid, &CLSID_CTask), "got %s\n", wine_dbgstr_guid(&clsid)); + ok_(__FILE__, line)(hr == S_OK, "GetClassID error %#x\n", hr); + ok_(__FILE__, line)(IsEqualCLSID(&clsid, &CLSID_CTask), "got %s\n", wine_dbgstr_guid(&clsid)); IPersistFile_Release(pfile); @@ -301,16 +311,30 @@ static WCHAR *get_task_curfile(ITask *task) static void test_task_storage(void) { - static const WCHAR Task1[] = { 'w','i','n','e','t','a','s','k',0 }; - static const WCHAR Task1_job[] = { '\\','T','a','s','k','s','\\','w','i','n','e','t','a','s','k','.','j','o','b',0 }; - WCHAR task_full_name[MAX_PATH]; + static const WCHAR Task1[] = { 'w','i','n','e','t','a','s','k','1',0 }; + static const WCHAR Task2[] = { 'w','i','n','e','t','a','s','k','2',0 }; + static const WCHAR Task3[] = { 'w','i','n','e','t','a','s','k','3',0 }; + static const WCHAR Task1_ext[] = { 'w','i','n','e','t','a','s','k','.','e','x','t',0 }; + static const WCHAR Task1_job[] = { '\\','T','a','s','k','s','\\','w','i','n','e','t','a','s','k','1','.','j','o','b',0 }; + static const WCHAR Task2_job[] = { '\\','T','a','s','k','s','\\','w','i','n','e','t','a','s','k','2','.','j','o','b',0 }; + static const WCHAR Task3_job[] = { '\\','T','a','s','k','s','\\','w','i','n','e','t','a','s','k','3','.','j','o','b',0 }; + WCHAR task1_full_name[MAX_PATH], task2_full_name[MAX_PATH], task3_full_name[MAX_PATH]; HRESULT hr; ITaskScheduler *scheduler; ITask *task, *task2; WCHAR *curfile, *curfile2; - GetWindowsDirectoryW(task_full_name, MAX_PATH); - lstrcatW(task_full_name, Task1_job); + GetWindowsDirectoryW(task1_full_name, MAX_PATH); + lstrcatW(task1_full_name, Task1_job); + GetWindowsDirectoryW(task2_full_name, MAX_PATH); + lstrcatW(task2_full_name, Task2_job); + GetWindowsDirectoryW(task3_full_name, MAX_PATH); + lstrcatW(task3_full_name, Task3_job); + + /* cleanup after previous runs */ + DeleteFileW(task1_full_name); + DeleteFileW(task2_full_name); + DeleteFileW(task3_full_name); hr = CoCreateInstance(&CLSID_CTaskScheduler, NULL, CLSCTX_INPROC_SERVER, &IID_ITaskScheduler, (void **)&scheduler); if (hr != S_OK) @@ -319,41 +343,66 @@ static void test_task_storage(void) return; } + hr = ITaskScheduler_NewWorkItem(scheduler, Task1_ext, &CLSID_CTask, &IID_ITask, (IUnknown **)&task); + ok(hr == E_INVALIDARG, "wrong error %#x\n", hr); + hr = ITaskScheduler_NewWorkItem(scheduler, Task1, &CLSID_CTask, &IID_ITask, (IUnknown **)&task); ok(hr == S_OK, "NewWorkItem error %#x\n", hr); - curfile = get_task_curfile(task); + curfile = get_task_curfile(task, FALSE, FALSE, __LINE__); ok(!file_exists(curfile), "curfile should not exist\n"); - ok(!lstrcmpW(curfile, task_full_name), "name is wrong %s\n", wine_dbgstr_w(curfile)); + ok(!lstrcmpW(curfile, task1_full_name), "name is wrong %s\n", wine_dbgstr_w(curfile)); + + hr = ITask_SetComment(task, Task1); + ok(hr == S_OK, "got %#x\n", hr); + + curfile2 = get_task_curfile(task, FALSE, TRUE, __LINE__); + ok(!file_exists(curfile2), "curfile should not exist\n"); + ok(!lstrcmpW(curfile2, task1_full_name), "name is wrong %s\n", wine_dbgstr_w(curfile2)); + CoTaskMemFree(curfile2); hr = ITaskScheduler_NewWorkItem(scheduler, Task1, &CLSID_CTask, &IID_ITask, (IUnknown **)&task2); ok(hr == S_OK, "NewWorkItem error %#x\n", hr); ok(task2 != task, "tasks should not be equal\n"); - curfile2 = get_task_curfile(task); + curfile2 = get_task_curfile(task2, FALSE, FALSE, __LINE__); ok(!file_exists(curfile2), "curfile2 should not exist\n"); - ok(!lstrcmpW(curfile2, task_full_name), "name is wrong %s\n", wine_dbgstr_w(curfile2)); + ok(!lstrcmpW(curfile2, task1_full_name), "name is wrong %s\n", wine_dbgstr_w(curfile2)); CoTaskMemFree(curfile); CoTaskMemFree(curfile2); + ITask_Release(task2); task2 = (ITask *)0xdeadbeef; hr = ITaskScheduler_Activate(scheduler, Task1, &IID_ITask, (IUnknown **)&task2); ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "wrong error %#x\n", hr); ok(task2 == (ITask *)0xdeadbeef, "task should not be set to NULL\n"); - hr = ITaskScheduler_AddWorkItem(scheduler, Task1, (IScheduledWorkItem *)task); + hr = ITaskScheduler_AddWorkItem(scheduler, Task2, (IScheduledWorkItem *)task); ok(hr == S_OK, "AddWorkItem error %#x\n", hr); + curfile = get_task_curfile(task, TRUE, FALSE, __LINE__); + ok(file_exists(curfile), "curfile should exist\n"); + ok(!lstrcmpW(curfile, task2_full_name), "name is wrong %s\n", wine_dbgstr_w(curfile)); - curfile = get_task_curfile(task); + hr = ITaskScheduler_AddWorkItem(scheduler, Task3, (IScheduledWorkItem *)task); + ok(hr == S_OK, "AddWorkItem error %#x\n", hr); + curfile = get_task_curfile(task, TRUE, FALSE, __LINE__); ok(file_exists(curfile), "curfile should exist\n"); + ok(!lstrcmpW(curfile, task3_full_name), "name is wrong %s\n", wine_dbgstr_w(curfile)); + + hr = ITaskScheduler_AddWorkItem(scheduler, Task1, (IScheduledWorkItem *)task); + ok(hr == S_OK, "AddWorkItem error %#x\n", hr); + curfile = get_task_curfile(task, TRUE, FALSE, __LINE__); + ok(file_exists(curfile), "curfile should exist\n"); + ok(!lstrcmpW(curfile, task1_full_name), "name is wrong %s\n", wine_dbgstr_w(curfile)); hr = ITaskScheduler_AddWorkItem(scheduler, Task1, (IScheduledWorkItem *)task); ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_EXISTS), "wrong error %#x\n", hr); - curfile = get_task_curfile(task); + curfile = get_task_curfile(task, TRUE, FALSE, __LINE__); ok(file_exists(curfile), "curfile should exist\n"); + CoTaskMemFree(curfile); ITask_Release(task); task = NULL; @@ -361,16 +410,17 @@ static void test_task_storage(void) ok(hr == S_OK, "Activate error %#x\n", hr); ok(task != NULL, "task should not be set to NULL\n"); - curfile2 = get_task_curfile(task); - ok(file_exists(curfile2), "curfile2 should exist\n"); - ok(!lstrcmpW(curfile2, task_full_name), "name is wrong %s\n", wine_dbgstr_w(curfile2)); + curfile = get_task_curfile(task, TRUE, FALSE, __LINE__); + ok(file_exists(curfile), "curfile2 should exist\n"); + ok(!lstrcmpW(curfile, task1_full_name), "name is wrong %s\n", wine_dbgstr_w(curfile)); - CoTaskMemFree(curfile2); + CoTaskMemFree(curfile); test_save_task_curfile(task); - DeleteFileW(curfile); - CoTaskMemFree(curfile); + DeleteFileW(task1_full_name); + DeleteFileW(task2_full_name); + DeleteFileW(task3_full_name); ITask_Release(task); ITaskScheduler_Release(scheduler);
1
0
0
0
Dmitry Timoshkov : mstask: Implement ITaskScheduler::AddWorkItem().
by Alexandre Julliard
25 Apr '18
25 Apr '18
Module: wine Branch: master Commit: f429c8188b321246af6e2a7ce8feee96f458d7a4 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=f429c8188b321246af6e2a7c…
Author: Dmitry Timoshkov <dmitry(a)baikal.ru> Date: Wed Apr 25 11:34:52 2018 +0800 mstask: Implement ITaskScheduler::AddWorkItem(). Signed-off-by: Dmitry Timoshkov <dmitry(a)baikal.ru> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/mstask/task_scheduler.c | 29 +++++++++++++++++++++++------ dlls/mstask/tests/task_scheduler.c | 8 -------- 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/dlls/mstask/task_scheduler.c b/dlls/mstask/task_scheduler.c index dd6eaf6..c890cb6 100644 --- a/dlls/mstask/task_scheduler.c +++ b/dlls/mstask/task_scheduler.c @@ -331,13 +331,30 @@ static HRESULT WINAPI MSTASK_ITaskScheduler_NewWorkItem( return TaskConstructor(This->service, task_name, (ITask **)task); } -static HRESULT WINAPI MSTASK_ITaskScheduler_AddWorkItem( - ITaskScheduler* iface, - LPCWSTR pwszTaskName, - IScheduledWorkItem *pWorkItem) +static HRESULT WINAPI MSTASK_ITaskScheduler_AddWorkItem(ITaskScheduler *iface, LPCWSTR name, IScheduledWorkItem *item) { - FIXME("%p, %s, %p: stub\n", iface, debugstr_w(pwszTaskName), pWorkItem); - return E_NOTIMPL; + static const WCHAR tasksW[] = { '\\','T','a','s','k','s','\\',0 }; + static const WCHAR jobW[] = { '.','j','o','b',0 }; + WCHAR task_name[MAX_PATH]; + IPersistFile *pfile; + HRESULT hr; + + TRACE("%p, %s, %p\n", iface, debugstr_w(name), item); + + if (strchrW(name, '.')) return E_INVALIDARG; + + GetWindowsDirectoryW(task_name, MAX_PATH); + lstrcatW(task_name, tasksW); + lstrcatW(task_name, name); + lstrcatW(task_name, jobW); + + hr = IScheduledWorkItem_QueryInterface(item, &IID_IPersistFile, (void **)&pfile); + if (hr == S_OK) + { + hr = IPersistFile_Save(pfile, task_name, TRUE); + IPersistFile_Release(pfile); + } + return hr; } static HRESULT WINAPI MSTASK_ITaskScheduler_IsOfType( diff --git a/dlls/mstask/tests/task_scheduler.c b/dlls/mstask/tests/task_scheduler.c index fbee5ec..8482972 100644 --- a/dlls/mstask/tests/task_scheduler.c +++ b/dlls/mstask/tests/task_scheduler.c @@ -343,30 +343,23 @@ static void test_task_storage(void) ok(task2 == (ITask *)0xdeadbeef, "task should not be set to NULL\n"); hr = ITaskScheduler_AddWorkItem(scheduler, Task1, (IScheduledWorkItem *)task); -todo_wine ok(hr == S_OK, "AddWorkItem error %#x\n", hr); curfile = get_task_curfile(task); -todo_wine ok(file_exists(curfile), "curfile should exist\n"); hr = ITaskScheduler_AddWorkItem(scheduler, Task1, (IScheduledWorkItem *)task); -todo_wine ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_EXISTS), "wrong error %#x\n", hr); curfile = get_task_curfile(task); -todo_wine ok(file_exists(curfile), "curfile should exist\n"); ITask_Release(task); task = NULL; hr = ITaskScheduler_Activate(scheduler, Task1, &IID_ITask, (IUnknown **)&task); -todo_wine ok(hr == S_OK, "Activate error %#x\n", hr); -todo_wine ok(task != NULL, "task should not be set to NULL\n"); - if (task == NULL) goto fail; curfile2 = get_task_curfile(task); ok(file_exists(curfile2), "curfile2 should exist\n"); @@ -380,7 +373,6 @@ todo_wine CoTaskMemFree(curfile); ITask_Release(task); -fail: ITaskScheduler_Release(scheduler); }
1
0
0
0
Dmitry Timoshkov : mstask: Implement ITaskScheduler::Activate().
by Alexandre Julliard
25 Apr '18
25 Apr '18
Module: wine Branch: master Commit: bf635fd4f7893a079a5e867c361d69ae3fa8b731 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=bf635fd4f7893a079a5e867c…
Author: Dmitry Timoshkov <dmitry(a)baikal.ru> Date: Wed Apr 25 11:34:46 2018 +0800 mstask: Implement ITaskScheduler::Activate(). Signed-off-by: Dmitry Timoshkov <dmitry(a)baikal.ru> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/mstask/task_scheduler.c | 40 +++++++++++++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 9 deletions(-) diff --git a/dlls/mstask/task_scheduler.c b/dlls/mstask/task_scheduler.c index 6e17a57..dd6eaf6 100644 --- a/dlls/mstask/task_scheduler.c +++ b/dlls/mstask/task_scheduler.c @@ -268,16 +268,38 @@ static HRESULT WINAPI MSTASK_ITaskScheduler_Enum( return create_task_enum(tasks); } -static HRESULT WINAPI MSTASK_ITaskScheduler_Activate( - ITaskScheduler* iface, - LPCWSTR pwszName, - REFIID riid, - IUnknown **ppunk) +static HRESULT WINAPI MSTASK_ITaskScheduler_Activate(ITaskScheduler *iface, + LPCWSTR task_name, REFIID riid, IUnknown **unknown) { - TRACE("%p, %s, %s, %p: stub\n", iface, debugstr_w(pwszName), - debugstr_guid(riid), ppunk); - FIXME("Partial stub always returning ERROR_FILE_NOT_FOUND\n"); - return HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND); + ITask *task; + IPersistFile *pfile; + HRESULT hr; + + TRACE("%p, %s, %s, %p\n", iface, debugstr_w(task_name), debugstr_guid(riid), unknown); + + hr = ITaskScheduler_NewWorkItem(iface, task_name, &CLSID_CTask, riid, (IUnknown **)&task); + if (hr != S_OK) return hr; + + hr = ITask_QueryInterface(task, &IID_IPersistFile, (void **)&pfile); + if (hr == S_OK) + { + WCHAR *curfile; + + hr = IPersistFile_GetCurFile(pfile, &curfile); + if (hr == S_OK) + { + hr = IPersistFile_Load(pfile, curfile, STGM_READ | STGM_SHARE_DENY_WRITE); + CoTaskMemFree(curfile); + } + + IPersistFile_Release(pfile); + } + + if (hr == S_OK) + *unknown = (IUnknown *)task; + else + ITask_Release(task); + return hr; } static HRESULT WINAPI MSTASK_ITaskScheduler_Delete(
1
0
0
0
Dmitry Timoshkov : mstask: Return S_OK from ITask::SetFlags().
by Alexandre Julliard
25 Apr '18
25 Apr '18
Module: wine Branch: master Commit: 71c264526f31e7973136f4ee8a854509564e21b1 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=71c264526f31e7973136f4ee…
Author: Dmitry Timoshkov <dmitry(a)baikal.ru> Date: Wed Apr 25 11:34:42 2018 +0800 mstask: Return S_OK from ITask::SetFlags(). Signed-off-by: Dmitry Timoshkov <dmitry(a)baikal.ru> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/mstask/task.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/mstask/task.c b/dlls/mstask/task.c index 58e5c0e..bfac820 100644 --- a/dlls/mstask/task.c +++ b/dlls/mstask/task.c @@ -479,7 +479,7 @@ static HRESULT WINAPI MSTASK_ITask_SetFlags( DWORD dwFlags) { FIXME("(%p, 0x%08x): stub\n", iface, dwFlags); - return E_NOTIMPL; + return S_OK; } static HRESULT WINAPI MSTASK_ITask_GetFlags(ITask *iface, DWORD *flags)
1
0
0
0
Dmitry Timoshkov : mstask: Implement IPersistFile::Load().
by Alexandre Julliard
25 Apr '18
25 Apr '18
Module: wine Branch: master Commit: 114f86e74e8ab96bc630bd9cae8f774681b58a01 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=114f86e74e8ab96bc630bd9c…
Author: Dmitry Timoshkov <dmitry(a)baikal.ru> Date: Wed Apr 25 11:34:38 2018 +0800 mstask: Implement IPersistFile::Load(). Signed-off-by: Dmitry Timoshkov <dmitry(a)baikal.ru> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/mstask/task.c | 289 +++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 283 insertions(+), 6 deletions(-) diff --git a/dlls/mstask/task.c b/dlls/mstask/task.c index a7fe199..58e5c0e 100644 --- a/dlls/mstask/task.c +++ b/dlls/mstask/task.c @@ -787,13 +787,290 @@ static HRESULT WINAPI MSTASK_IPersistFile_IsDirty( return E_NOTIMPL; } -static HRESULT WINAPI MSTASK_IPersistFile_Load( - IPersistFile* iface, - LPCOLESTR pszFileName, - DWORD dwMode) +static DWORD load_unicode_strings(ITask *task, BYTE *data, DWORD limit) { - FIXME("(%p, %p, 0x%08x): stub\n", iface, pszFileName, dwMode); - return E_NOTIMPL; + DWORD i, data_size = 0; + USHORT len; + + for (i = 0; i < 5; i++) + { + if (limit < sizeof(USHORT)) + { + TRACE("invalid string %u offset\n", i); + break; + } + + len = *(USHORT *)data; + data += sizeof(USHORT); + data_size += sizeof(USHORT); + limit -= sizeof(USHORT); + if (limit < len * sizeof(WCHAR)) + { + TRACE("invalid string %u size\n", i); + break; + } + + TRACE("string %u: %s\n", i, wine_dbgstr_wn((const WCHAR *)data, len)); + + switch (i) + { + case 0: + ITask_SetApplicationName(task, (const WCHAR *)data); + break; + case 1: + ITask_SetParameters(task, (const WCHAR *)data); + break; + case 2: + ITask_SetWorkingDirectory(task, (const WCHAR *)data); + break; + case 3: + ITask_SetCreator(task, (const WCHAR *)data); + break; + case 4: + ITask_SetComment(task, (const WCHAR *)data); + break; + default: + break; + } + + data += len * sizeof(WCHAR); + data_size += len * sizeof(WCHAR); + } + + return data_size; +} + +static HRESULT load_job_data(TaskImpl *This, BYTE *data, DWORD size) +{ + ITask *task = &This->ITask_iface; + HRESULT hr; + const FIXDLEN_DATA *fixed; + const SYSTEMTIME *st; + DWORD unicode_strings_size, data_size, triggers_size; + USHORT instance_count, trigger_count, i; + const USHORT *signature; + TASK_TRIGGER *task_trigger; + + if (size < sizeof(*fixed)) + { + TRACE("no space for FIXDLEN_DATA\n"); + return SCHED_E_INVALID_TASK; + } + + fixed = (const FIXDLEN_DATA *)data; + + TRACE("product_version %04x\n", fixed->product_version); + TRACE("file_version %04x\n", fixed->file_version); + TRACE("uuid %s\n", wine_dbgstr_guid(&fixed->uuid)); + + if (fixed->file_version != 0x0001) + return SCHED_E_INVALID_TASK; + + TRACE("name_size_offset %04x\n", fixed->name_size_offset); + TRACE("trigger_offset %04x\n", fixed->trigger_offset); + TRACE("error_retry_count %u\n", fixed->error_retry_count); + TRACE("error_retry_interval %u\n", fixed->error_retry_interval); + TRACE("idle_deadline %u\n", fixed->idle_deadline); + This->deadline_minutes = fixed->idle_deadline; + TRACE("idle_wait %u\n", fixed->idle_wait); + This->idle_minutes = fixed->idle_wait; + TRACE("priority %08x\n", fixed->priority); + This->priority = fixed->priority; + TRACE("maximum_runtime %u\n", fixed->maximum_runtime); + This->maxRunTime = fixed->maximum_runtime; + TRACE("exit_code %#x\n", fixed->exit_code); + TRACE("status %08x\n", fixed->status); + TRACE("flags %08x\n", fixed->flags); + st = &fixed->last_runtime; + TRACE("last_runtime %d/%d/%d wday %d %d:%d:%d.%03d\n", + st->wDay, st->wMonth, st->wYear, st->wDayOfWeek, + st->wHour, st->wMinute, st->wSecond, st->wMilliseconds); + + /* Instance Count */ + if (size < sizeof(*fixed) + sizeof(USHORT)) + { + TRACE("no space for instance count\n"); + return SCHED_E_INVALID_TASK; + } + + instance_count = *(const USHORT *)(data + sizeof(*fixed)); + TRACE("instance count %u\n", instance_count); + + if (fixed->name_size_offset + sizeof(USHORT) < size) + unicode_strings_size = load_unicode_strings(task, data + fixed->name_size_offset, size - fixed->name_size_offset); + else + { + TRACE("invalid name_size_offset\n"); + return SCHED_E_INVALID_TASK; + } + TRACE("unicode strings end at %#x\n", fixed->name_size_offset + unicode_strings_size); + + if (size < fixed->trigger_offset + sizeof(USHORT)) + { + TRACE("no space for triggers count\n"); + return SCHED_E_INVALID_TASK; + } + trigger_count = *(const USHORT *)(data + fixed->trigger_offset); + TRACE("trigger_count %u\n", trigger_count); + triggers_size = size - fixed->trigger_offset - sizeof(USHORT); + TRACE("triggers_size %u\n", triggers_size); + task_trigger = (TASK_TRIGGER *)(data + fixed->trigger_offset + sizeof(USHORT)); + + data += fixed->name_size_offset + unicode_strings_size; + size -= fixed->name_size_offset + unicode_strings_size; + + /* User Data */ + if (size < sizeof(USHORT)) + { + TRACE("no space for user data size\n"); + return SCHED_E_INVALID_TASK; + } + + data_size = *(const USHORT *)data; + if (size < sizeof(USHORT) + data_size) + { + TRACE("no space for user data\n"); + return SCHED_E_INVALID_TASK; + } + TRACE("User Data size %#x\n", data_size); + ITask_SetWorkItemData(task, data_size, data + sizeof(USHORT)); + + size -= sizeof(USHORT) + data_size; + data += sizeof(USHORT) + data_size; + + /* Reserved Data */ + if (size < sizeof(USHORT)) + { + TRACE("no space for reserved data size\n"); + return SCHED_E_INVALID_TASK; + } + + data_size = *(const USHORT *)data; + if (size < sizeof(USHORT) + data_size) + { + TRACE("no space for reserved data\n"); + return SCHED_E_INVALID_TASK; + } + TRACE("Reserved Data size %#x\n", data_size); + + size -= sizeof(USHORT) + data_size; + data += sizeof(USHORT) + data_size; + + /* Trigger Data */ + TRACE("trigger_offset %04x, triggers end at %04x\n", fixed->trigger_offset, + (DWORD)(fixed->trigger_offset + sizeof(USHORT) + trigger_count * sizeof(TASK_TRIGGER))); + + This->trigger_count = *(const USHORT *)data; + TRACE("trigger_count %u\n", trigger_count); + task_trigger = (TASK_TRIGGER *)(data + sizeof(USHORT)); + + if (This->trigger_count * sizeof(TASK_TRIGGER) > triggers_size) + { + TRACE("no space for triggers data\n"); + return SCHED_E_INVALID_TASK; + } + + for (i = 0; i < This->trigger_count; i++) + { + ITaskTrigger *trigger; + WORD idx; + + hr = ITask_CreateTrigger(task, &idx, &trigger); + if (hr != S_OK) return hr; + + hr = ITaskTrigger_SetTrigger(trigger, &task_trigger[i]); + ITaskTrigger_Release(trigger); + if (hr != S_OK) + { + ITask_DeleteTrigger(task, idx); + return hr; + } + } + + size -= sizeof(USHORT) + This->trigger_count * sizeof(TASK_TRIGGER); + data += sizeof(USHORT) + This->trigger_count * sizeof(TASK_TRIGGER); + + if (size < 2 * sizeof(USHORT) + 64) + { + TRACE("no space for signature\n"); + return S_OK; /* signature is optional */ + } + + signature = (const USHORT *)data; + TRACE("signature version %04x, client version %04x\n", signature[0], signature[1]); + + return S_OK; +} + +static HRESULT WINAPI MSTASK_IPersistFile_Load(IPersistFile *iface, LPCOLESTR file_name, DWORD mode) +{ + TaskImpl *This = impl_from_IPersistFile(iface); + HRESULT hr; + HANDLE file, mapping; + DWORD access, sharing, size; + void *data; + + TRACE("(%p, %s, 0x%08x)\n", iface, debugstr_w(file_name), mode); + + switch (mode & 0x000f) + { + default: + case STGM_READ: + access = GENERIC_READ; + break; + case STGM_WRITE: + case STGM_READWRITE: + access = GENERIC_READ | GENERIC_WRITE; + break; + } + + switch (mode & 0x00f0) + { + default: + case STGM_SHARE_DENY_NONE: + sharing = FILE_SHARE_READ | FILE_SHARE_WRITE; + break; + case STGM_SHARE_DENY_READ: + sharing = FILE_SHARE_WRITE; + break; + case STGM_SHARE_DENY_WRITE: + sharing = FILE_SHARE_READ; + break; + case STGM_SHARE_EXCLUSIVE: + sharing = 0; + break; + } + + file = CreateFileW(file_name, access, sharing, NULL, OPEN_EXISTING, 0, 0); + if (file == INVALID_HANDLE_VALUE) + { + TRACE("Failed to open %s, error %u\n", debugstr_w(file_name), GetLastError()); + return HRESULT_FROM_WIN32(GetLastError()); + } + + size = GetFileSize(file, NULL); + + mapping = CreateFileMappingW(file, NULL, PAGE_READONLY, 0, 0, 0); + if (!mapping) + { + TRACE("Failed to create file mapping %s, error %u\n", debugstr_w(file_name), GetLastError()); + CloseHandle(file); + return HRESULT_FROM_WIN32(GetLastError()); + } + + data = MapViewOfFile(mapping, FILE_MAP_READ, 0, 0, 0); + if (data) + { + hr = load_job_data(This, data, size); + UnmapViewOfFile(data); + } + else + hr = HRESULT_FROM_WIN32(GetLastError()); + + CloseHandle(mapping); + CloseHandle(file); + + return hr; } static BOOL write_signature(HANDLE hfile)
1
0
0
0
← Newer
1
...
7
8
9
10
11
12
13
...
55
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
Results per page:
10
25
50
100
200