Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/msi/install.c | 20 +------------------- dlls/msi/package.c | 5 ++--- dlls/msi/tests/custom.c | 21 +++++++++++++++++++++ dlls/msi/tests/custom.spec | 1 + dlls/msi/tests/install.c | 2 ++ dlls/msi/winemsi.idl | 2 +- 6 files changed, 28 insertions(+), 23 deletions(-)
diff --git a/dlls/msi/install.c b/dlls/msi/install.c index 814addc..f488674 100644 --- a/dlls/msi/install.c +++ b/dlls/msi/install.c @@ -75,29 +75,11 @@ UINT WINAPI MsiDoActionW( MSIHANDLE hInstall, LPCWSTR szAction ) if (!package) { MSIHANDLE remote; - HRESULT hr; - BSTR action;
if (!(remote = msi_get_remote(hInstall))) return ERROR_INVALID_HANDLE;
- action = SysAllocString( szAction ); - if (!action) - return ERROR_OUTOFMEMORY; - - hr = remote_DoAction(remote, action); - - SysFreeString( action ); - - if (FAILED(hr)) - { - if (HRESULT_FACILITY(hr) == FACILITY_WIN32) - return HRESULT_CODE(hr); - - return ERROR_FUNCTION_FAILED; - } - - return ERROR_SUCCESS; + return remote_DoAction(remote, szAction); }
ret = ACTION_PerformAction( package, szAction, SCRIPT_NONE ); diff --git a/dlls/msi/package.c b/dlls/msi/package.c index d18736b..0681189 100644 --- a/dlls/msi/package.c +++ b/dlls/msi/package.c @@ -2464,10 +2464,9 @@ int __cdecl remote_ProcessMessage(MSIHANDLE hinst, INSTALLMESSAGE message, struc return ret; }
-HRESULT __cdecl remote_DoAction(MSIHANDLE hinst, BSTR action) +UINT __cdecl remote_DoAction(MSIHANDLE hinst, LPCWSTR action) { - UINT r = MsiDoActionW(hinst, action); - return HRESULT_FROM_WIN32(r); + return MsiDoActionW(hinst, action); }
HRESULT __cdecl remote_Sequence(MSIHANDLE hinst, BSTR table, int sequence) diff --git a/dlls/msi/tests/custom.c b/dlls/msi/tests/custom.c index e782311..5bdb8d2 100644 --- a/dlls/msi/tests/custom.c +++ b/dlls/msi/tests/custom.c @@ -426,6 +426,26 @@ static void test_db(MSIHANDLE hinst) ok(hinst, !r, "got %u\n", r); }
+static void test_doaction(MSIHANDLE hinst) +{ + UINT r; + + r = MsiDoActionA(hinst, "nested51"); + ok(hinst, !r, "got %u\n", r); + check_prop(hinst, "nested", "1"); + + r = MsiDoActionA(hinst, "nested1"); + ok(hinst, !r, "got %u\n", r); + check_prop(hinst, "nested", "2"); +} + +UINT WINAPI nested(MSIHANDLE hinst) +{ + MsiSetPropertyA(hinst, "nested", "2"); + + return ERROR_SUCCESS; +} + /* 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) @@ -451,6 +471,7 @@ UINT WINAPI main_test(MSIHANDLE hinst)
test_props(hinst); test_db(hinst); + test_doaction(hinst);
return ERROR_SUCCESS; } diff --git a/dlls/msi/tests/custom.spec b/dlls/msi/tests/custom.spec index bb400ff..51bb60e 100644 --- a/dlls/msi/tests/custom.spec +++ b/dlls/msi/tests/custom.spec @@ -2,3 +2,4 @@ @ stdcall test_retval(long) @ stdcall da_immediate(long) @ stdcall da_deferred(long) +@ stdcall nested(long) diff --git a/dlls/msi/tests/install.c b/dlls/msi/tests/install.c index 41a77cd..b63e5da 100644 --- a/dlls/msi/tests/install.c +++ b/dlls/msi/tests/install.c @@ -703,6 +703,8 @@ static const CHAR ca1_custom_action_dat[] = "Action\tType\tSource\tTarget\n" "s72\ti2\tS64\tS0\n" "CustomAction\tAction\n" "embednull\t51\tembednullprop\ta[~]b\n" + "nested51\t51\tnested\t1\n" + "nested1\t1\tcustom.dll\tnested\n" "maintest\t1\tcustom.dll\tmain_test\n" "testretval\t1\tcustom.dll\ttest_retval\n";
diff --git a/dlls/msi/winemsi.idl b/dlls/msi/winemsi.idl index 7613fd3..57790d1 100644 --- a/dlls/msi/winemsi.idl +++ b/dlls/msi/winemsi.idl @@ -74,7 +74,7 @@ interface IWineMsiRemote UINT remote_GetProperty( [in] MSIHANDLE hinst, [in, string] LPCWSTR property, [out, string] LPWSTR *value, [out] DWORD *size ); UINT remote_SetProperty( [in] MSIHANDLE hinst, [in, string, unique] LPCWSTR property, [in, string, unique] LPCWSTR value ); int remote_ProcessMessage( [in] MSIHANDLE hinst, [in] INSTALLMESSAGE message, [in] struct wire_record *record ); - HRESULT remote_DoAction( [in] MSIHANDLE hinst, [in] BSTR action ); + UINT remote_DoAction( [in] MSIHANDLE hinst, [in, string] LPCWSTR action ); HRESULT remote_Sequence( [in] MSIHANDLE hinst, [in] BSTR table, [in] int sequence ); HRESULT remote_GetTargetPath( [in] MSIHANDLE hinst, [in] BSTR folder, [out, size_is(*size)] BSTR value, [in, out] DWORD *size ); HRESULT remote_SetTargetPath( [in] MSIHANDLE hinst, [in] BSTR folder, [in] BSTR value );
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/msi/install.c | 23 ++++------------------- dlls/msi/package.c | 5 ++--- dlls/msi/tests/custom.c | 7 +++++++ dlls/msi/tests/install.c | 7 +++++++ dlls/msi/winemsi.idl | 2 +- 5 files changed, 21 insertions(+), 23 deletions(-)
diff --git a/dlls/msi/install.c b/dlls/msi/install.c index f488674..2a5ff40 100644 --- a/dlls/msi/install.c +++ b/dlls/msi/install.c @@ -117,33 +117,18 @@ UINT WINAPI MsiSequenceW( MSIHANDLE hInstall, LPCWSTR szTable, INT iSequenceMode
TRACE("%s, %d\n", debugstr_w(szTable), iSequenceMode);
+ if (!szTable) + return ERROR_INVALID_PARAMETER; + package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE ); if (!package) { MSIHANDLE remote; - HRESULT hr; - BSTR table;
if (!(remote = msi_get_remote(hInstall))) return ERROR_INVALID_HANDLE;
- table = SysAllocString( szTable ); - if (!table) - return ERROR_OUTOFMEMORY; - - hr = remote_Sequence(remote, table, iSequenceMode); - - SysFreeString( table ); - - if (FAILED(hr)) - { - if (HRESULT_FACILITY(hr) == FACILITY_WIN32) - return HRESULT_CODE(hr); - - return ERROR_FUNCTION_FAILED; - } - - return ERROR_SUCCESS; + return remote_Sequence(remote, szTable, iSequenceMode); } ret = MSI_Sequence( package, szTable ); msiobj_release( &package->hdr ); diff --git a/dlls/msi/package.c b/dlls/msi/package.c index 0681189..161ba81 100644 --- a/dlls/msi/package.c +++ b/dlls/msi/package.c @@ -2469,10 +2469,9 @@ UINT __cdecl remote_DoAction(MSIHANDLE hinst, LPCWSTR action) return MsiDoActionW(hinst, action); }
-HRESULT __cdecl remote_Sequence(MSIHANDLE hinst, BSTR table, int sequence) +UINT __cdecl remote_Sequence(MSIHANDLE hinst, LPCWSTR table, int sequence) { - UINT r = MsiSequenceW(hinst, table, sequence); - return HRESULT_FROM_WIN32(r); + return MsiSequenceW(hinst, table, sequence); }
HRESULT __cdecl remote_GetTargetPath(MSIHANDLE hinst, BSTR folder, BSTR value, DWORD *size) diff --git a/dlls/msi/tests/custom.c b/dlls/msi/tests/custom.c index 5bdb8d2..bfd1e85 100644 --- a/dlls/msi/tests/custom.c +++ b/dlls/msi/tests/custom.c @@ -437,6 +437,13 @@ static void test_doaction(MSIHANDLE hinst) r = MsiDoActionA(hinst, "nested1"); ok(hinst, !r, "got %u\n", r); check_prop(hinst, "nested", "2"); + + r = MsiSequenceA(hinst, NULL, 0); + ok(hinst, r == ERROR_INVALID_PARAMETER, "got %u\n", r); + + r = MsiSequenceA(hinst, "TestSequence", 0); + ok(hinst, !r, "got %u\n", r); + check_prop(hinst, "nested", "1"); }
UINT WINAPI nested(MSIHANDLE hinst) diff --git a/dlls/msi/tests/install.c b/dlls/msi/tests/install.c index b63e5da..c5d9243 100644 --- a/dlls/msi/tests/install.c +++ b/dlls/msi/tests/install.c @@ -708,6 +708,12 @@ static const CHAR ca1_custom_action_dat[] = "Action\tType\tSource\tTarget\n" "maintest\t1\tcustom.dll\tmain_test\n" "testretval\t1\tcustom.dll\ttest_retval\n";
+static const CHAR ca1_test_seq_dat[] = "Action\tCondition\tSequence\n" + "s72\tS255\tI2\n" + "TestSequence\tAction\n" + "nested1\t\t1\n" + "nested51\t\t2\n"; + static const CHAR ca51_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n" "s72\tS38\ts72\ti2\tS255\tS72\n" "Component\tComponent\n" @@ -1706,6 +1712,7 @@ static const msi_table ca1_tables[] = ADD_TABLE(property), ADD_TABLE(ca1_install_exec_seq), ADD_TABLE(ca1_custom_action), + ADD_TABLE(ca1_test_seq), };
static const msi_table ca51_tables[] = diff --git a/dlls/msi/winemsi.idl b/dlls/msi/winemsi.idl index 57790d1..d103e9a 100644 --- a/dlls/msi/winemsi.idl +++ b/dlls/msi/winemsi.idl @@ -75,7 +75,7 @@ interface IWineMsiRemote UINT remote_SetProperty( [in] MSIHANDLE hinst, [in, string, unique] LPCWSTR property, [in, string, unique] LPCWSTR value ); int remote_ProcessMessage( [in] MSIHANDLE hinst, [in] INSTALLMESSAGE message, [in] struct wire_record *record ); UINT remote_DoAction( [in] MSIHANDLE hinst, [in, string] LPCWSTR action ); - HRESULT remote_Sequence( [in] MSIHANDLE hinst, [in] BSTR table, [in] int sequence ); + UINT remote_Sequence( [in] MSIHANDLE hinst, [in, string] LPCWSTR table, [in] int sequence ); HRESULT remote_GetTargetPath( [in] MSIHANDLE hinst, [in] BSTR folder, [out, size_is(*size)] BSTR value, [in, out] DWORD *size ); HRESULT remote_SetTargetPath( [in] MSIHANDLE hinst, [in] BSTR folder, [in] BSTR value ); HRESULT remote_GetSourcePath( [in] MSIHANDLE hinst, [in] BSTR folder, [out, size_is(*size)] BSTR value, [in, out] DWORD *size );
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=37895
Your paranoid android.
=== w7u (32 bit install) === The task timed out
=== 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
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/msi/install.c | 46 +++++------------------- dlls/msi/package.c | 17 +++++++-- dlls/msi/tests/custom.c | 91 ++++++++++++++++++++++++++++++++++++++++++++++++ dlls/msi/tests/install.c | 11 ++++++ dlls/msi/winemsi.idl | 2 +- 5 files changed, 125 insertions(+), 42 deletions(-)
diff --git a/dlls/msi/install.c b/dlls/msi/install.c index 2a5ff40..68d8eb5 100644 --- a/dlls/msi/install.c +++ b/dlls/msi/install.c @@ -27,7 +27,6 @@ #include "windef.h" #include "winbase.h" #include "winerror.h" -#include "wine/debug.h" #include "msi.h" #include "msidefs.h" #include "objbase.h" @@ -35,6 +34,8 @@
#include "msipriv.h" #include "winemsi.h" +#include "wine/heap.h" +#include "wine/debug.h" #include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(msi); @@ -200,50 +201,19 @@ static UINT MSI_GetTargetPath( MSIHANDLE hInstall, LPCWSTR szFolder, package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE ); if (!package) { - MSIHANDLE remote; - HRESULT hr; LPWSTR value = NULL; - BSTR folder; - DWORD len; + MSIHANDLE remote;
if (!(remote = msi_get_remote(hInstall))) return ERROR_INVALID_HANDLE;
- folder = SysAllocString( szFolder ); - if (!folder) - return ERROR_OUTOFMEMORY; + r = remote_GetTargetPath(remote, szFolder, &value); + if (r != ERROR_SUCCESS) + return r;
- len = 0; - hr = remote_GetTargetPath(remote, folder, NULL, &len); - if (FAILED(hr)) - goto done; - - len++; - value = msi_alloc(len * sizeof(WCHAR)); - if (!value) - { - r = ERROR_OUTOFMEMORY; - goto done; - } - - hr = remote_GetTargetPath(remote, folder, value, &len); - if (FAILED(hr)) - goto done; - - r = msi_strcpy_to_awstring( value, len, szPathBuf, pcchPathBuf ); - -done: - SysFreeString( folder ); - msi_free( 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, szPathBuf, pcchPathBuf);
+ midl_user_free(value); return r; }
diff --git a/dlls/msi/package.c b/dlls/msi/package.c index 161ba81..d1a6923 100644 --- a/dlls/msi/package.c +++ b/dlls/msi/package.c @@ -2474,10 +2474,21 @@ UINT __cdecl remote_Sequence(MSIHANDLE hinst, LPCWSTR table, int sequence) return MsiSequenceW(hinst, table, sequence); }
-HRESULT __cdecl remote_GetTargetPath(MSIHANDLE hinst, BSTR folder, BSTR value, DWORD *size) +UINT __cdecl remote_GetTargetPath(MSIHANDLE hinst, LPCWSTR folder, LPWSTR *value) { - UINT r = MsiGetTargetPathW(hinst, folder, value, size); - return HRESULT_FROM_WIN32(r); + WCHAR empty[1]; + DWORD size = 0; + UINT r; + + r = MsiGetTargetPathW(hinst, folder, empty, &size); + if (r == ERROR_MORE_DATA) + { + *value = midl_user_allocate(++size * sizeof(WCHAR)); + if (!*value) + return ERROR_OUTOFMEMORY; + r = MsiGetTargetPathW(hinst, folder, *value, &size); + } + return r; }
HRESULT __cdecl remote_SetTargetPath(MSIHANDLE hinst, BSTR folder, BSTR value) diff --git a/dlls/msi/tests/custom.c b/dlls/msi/tests/custom.c index bfd1e85..5062ecd 100644 --- a/dlls/msi/tests/custom.c +++ b/dlls/msi/tests/custom.c @@ -453,6 +453,96 @@ UINT WINAPI nested(MSIHANDLE hinst) return ERROR_SUCCESS; }
+static void test_targetpath(MSIHANDLE hinst) +{ + static const WCHAR targetdirW[] = {'T','A','R','G','E','T','D','I','R',0}; + static const WCHAR xyzW[] = {'C',':','\',0}; + static const WCHAR xyW[] = {'C',':',0}; + char buffer[20]; + WCHAR bufferW[20]; + DWORD sz; + UINT r; + + /* test invalid values */ + r = MsiGetTargetPathA(hinst, NULL, NULL, NULL); + ok(hinst, r == ERROR_INVALID_PARAMETER, "got %u\n", r); + + r = MsiGetTargetPathA(hinst, "TARGETDIR", NULL, NULL ); + ok(hinst, !r, "got %u\n", r); + + r = MsiGetTargetPathA(hinst, "TARGETDIR", buffer, NULL ); + ok(hinst, r == ERROR_INVALID_PARAMETER, "got %u\n", r); + + /* Returned size is in bytes, not chars, but only for custom actions. + * Seems to be a casualty of RPC... */ + + sz = 0; + r = MsiGetTargetPathA(hinst, "TARGETDIR", NULL, &sz); + ok(hinst, !r, "got %u\n", r); + todo_wine_ok(hinst, sz == 6, "got size %u\n", sz); + + sz = 0; + strcpy(buffer,"q"); + r = MsiGetTargetPathA(hinst, "TARGETDIR", 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 == 6, "got size %u\n", sz); + + sz = 1; + strcpy(buffer,"x"); + r = MsiGetTargetPathA(hinst, "TARGETDIR", 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 == 6, "got size %u\n", sz); + + sz = 3; + strcpy(buffer,"x"); + r = MsiGetTargetPathA(hinst, "TARGETDIR", buffer, &sz); + ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r); + ok(hinst, !strcmp(buffer, "C:"), "got "%s"\n", buffer); + todo_wine_ok(hinst, sz == 6, "got size %u\n", sz); + + sz = 4; + strcpy(buffer,"x"); + r = MsiGetTargetPathA(hinst, "TARGETDIR", buffer, &sz); + ok(hinst, !r, "got %u\n", r); + ok(hinst, !strcmp(buffer, "C:\"), "got "%s"\n", buffer); + ok(hinst, sz == 3, "got size %u\n", sz); + + sz = 0; + r = MsiGetTargetPathW(hinst, targetdirW, NULL, &sz); + ok(hinst, !r, "got %u\n", r); + ok(hinst, sz == 3, "got size %u\n", sz); + + sz = 0; + bufferW[0] = 'q'; + r = MsiGetTargetPathW(hinst, targetdirW, 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 == 3, "got size %u\n", sz); + + sz = 1; + bufferW[0] = 'q'; + r = MsiGetTargetPathW(hinst, targetdirW, 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 == 3, "got size %u\n", sz); + + sz = 3; + bufferW[0] = 'q'; + r = MsiGetTargetPathW(hinst, targetdirW, 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 == 3, "got size %u\n", sz); + + sz = 4; + bufferW[0] = 'q'; + r = MsiGetTargetPathW(hinst, targetdirW, bufferW, &sz); + ok(hinst, !r, "got %u\n", r); + ok(hinst, !lstrcmpW(bufferW, xyzW), "got %s\n", dbgstr_w(bufferW)); + ok(hinst, sz == 3, "got size %u\n", sz); +} + /* 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) @@ -479,6 +569,7 @@ UINT WINAPI main_test(MSIHANDLE hinst) test_props(hinst); test_db(hinst); test_doaction(hinst); + test_targetpath(hinst);
return ERROR_SUCCESS; } diff --git a/dlls/msi/tests/install.c b/dlls/msi/tests/install.c index c5d9243..6a7383b 100644 --- a/dlls/msi/tests/install.c +++ b/dlls/msi/tests/install.c @@ -695,6 +695,9 @@ static const CHAR wrv_component_dat[] = "Component\tComponentId\tDirectory_\tAtt static const CHAR ca1_install_exec_seq_dat[] = "Action\tCondition\tSequence\n" "s72\tS255\tI2\n" "InstallExecuteSequence\tAction\n" + "CostInitialize\t\t100\n" + "FileCost\t\t200\n" + "CostFinalize\t\t300\n" "embednull\t\t600\n" "maintest\tMAIN_TEST\t700\n" "testretval\tTEST_RETVAL\t710\n"; @@ -1709,7 +1712,13 @@ static const msi_table sf_tables[] =
static const msi_table ca1_tables[] = { + ADD_TABLE(component), + ADD_TABLE(directory), + ADD_TABLE(feature), + ADD_TABLE(feature_comp), + ADD_TABLE(file), ADD_TABLE(property), + ADD_TABLE(directory), ADD_TABLE(ca1_install_exec_seq), ADD_TABLE(ca1_custom_action), ADD_TABLE(ca1_test_seq), @@ -4120,6 +4129,7 @@ static void test_customaction1(void) MSIHANDLE hdb, record; UINT r;
+ create_test_files(); create_database(msifile, ca1_tables, sizeof(ca1_tables) / sizeof(msi_table)); add_custom_dll();
@@ -4158,6 +4168,7 @@ static void test_customaction1(void) r = MsiInstallProductA(msifile, "TEST_RETVAL=1"); ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
+ delete_test_files(); DeleteFileA(msifile); DeleteFileA("unus"); DeleteFileA("duo"); diff --git a/dlls/msi/winemsi.idl b/dlls/msi/winemsi.idl index d103e9a..5e09c85 100644 --- a/dlls/msi/winemsi.idl +++ b/dlls/msi/winemsi.idl @@ -76,7 +76,7 @@ interface IWineMsiRemote int remote_ProcessMessage( [in] MSIHANDLE hinst, [in] INSTALLMESSAGE message, [in] struct wire_record *record ); UINT remote_DoAction( [in] MSIHANDLE hinst, [in, string] LPCWSTR action ); UINT remote_Sequence( [in] MSIHANDLE hinst, [in, string] LPCWSTR table, [in] int sequence ); - HRESULT remote_GetTargetPath( [in] MSIHANDLE hinst, [in] BSTR folder, [out, size_is(*size)] BSTR value, [in, out] DWORD *size ); + UINT remote_GetTargetPath( [in] MSIHANDLE hinst, [in, string] LPCWSTR folder, [out, string] LPWSTR *value ); HRESULT remote_SetTargetPath( [in] MSIHANDLE hinst, [in] BSTR folder, [in] BSTR value ); HRESULT remote_GetSourcePath( [in] MSIHANDLE hinst, [in] BSTR folder, [out, size_is(*size)] BSTR value, [in, out] DWORD *size ); HRESULT remote_GetMode( [in] MSIHANDLE hinst, [in] MSIRUNMODE mode, [out] BOOL *ret );
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=37896
Your paranoid android.
=== w7pro64 (64 bit custom) === The previous 1 run(s) terminated abnormally
=== w7u (32 bit install) === 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 | 26 +------------------------- dlls/msi/package.c | 5 ++--- dlls/msi/tests/custom.c | 16 ++++++++++++++++ dlls/msi/winemsi.idl | 2 +- 4 files changed, 20 insertions(+), 29 deletions(-)
diff --git a/dlls/msi/install.c b/dlls/msi/install.c index 68d8eb5..ba329eb 100644 --- a/dlls/msi/install.c +++ b/dlls/msi/install.c @@ -535,36 +535,12 @@ UINT WINAPI MsiSetTargetPathW(MSIHANDLE hInstall, LPCWSTR szFolder, package = msihandle2msiinfo(hInstall, MSIHANDLETYPE_PACKAGE); if (!package) { - HRESULT hr; - BSTR folder, path; MSIHANDLE remote;
if (!(remote = msi_get_remote(hInstall))) return ERROR_INVALID_HANDLE;
- folder = SysAllocString( szFolder ); - path = SysAllocString( szFolderPath ); - if (!folder || !path) - { - SysFreeString(folder); - SysFreeString(path); - return ERROR_OUTOFMEMORY; - } - - hr = remote_SetTargetPath(remote, folder, path); - - SysFreeString(folder); - SysFreeString(path); - - if (FAILED(hr)) - { - if (HRESULT_FACILITY(hr) == FACILITY_WIN32) - return HRESULT_CODE(hr); - - return ERROR_FUNCTION_FAILED; - } - - return ERROR_SUCCESS; + return remote_SetTargetPath(remote, szFolder, szFolderPath); }
ret = MSI_SetTargetPathW( package, szFolder, szFolderPath ); diff --git a/dlls/msi/package.c b/dlls/msi/package.c index d1a6923..220692b 100644 --- a/dlls/msi/package.c +++ b/dlls/msi/package.c @@ -2491,10 +2491,9 @@ UINT __cdecl remote_GetTargetPath(MSIHANDLE hinst, LPCWSTR folder, LPWSTR *value return r; }
-HRESULT __cdecl remote_SetTargetPath(MSIHANDLE hinst, BSTR folder, BSTR value) +UINT __cdecl remote_SetTargetPath(MSIHANDLE hinst, LPCWSTR folder, LPCWSTR value) { - UINT r = MsiSetTargetPathW(hinst, folder, value); - return HRESULT_FROM_WIN32(r); + return MsiSetTargetPathW(hinst, folder, value); }
HRESULT __cdecl remote_GetSourcePath(MSIHANDLE hinst, BSTR folder, BSTR value, DWORD *size) diff --git a/dlls/msi/tests/custom.c b/dlls/msi/tests/custom.c index 5062ecd..111032c 100644 --- a/dlls/msi/tests/custom.c +++ b/dlls/msi/tests/custom.c @@ -541,6 +541,22 @@ static void test_targetpath(MSIHANDLE hinst) ok(hinst, !r, "got %u\n", r); ok(hinst, !lstrcmpW(bufferW, xyzW), "got %s\n", dbgstr_w(bufferW)); ok(hinst, sz == 3, "got size %u\n", sz); + + r = MsiSetTargetPathA(hinst, NULL, "C:\subdir"); + ok(hinst, r == ERROR_INVALID_PARAMETER, "got %u\n", r); + + r = MsiSetTargetPathA(hinst, "TARGETDIR", NULL); + ok(hinst, r == ERROR_INVALID_PARAMETER, "got %u\n", r); + + r = MsiSetTargetPathA(hinst, "TARGETDIR", "C:\subdir"); + ok(hinst, !r, "got %u\n", r); + + sz = sizeof(buffer); + r = MsiGetTargetPathA(hinst, "TARGETDIR", buffer, &sz); + ok(hinst, !r, "got %u\n", r); + ok(hinst, !strcmp(buffer, "C:\subdir\"), "got "%s"\n", buffer); + + r = MsiSetTargetPathA(hinst, "TARGETDIR", "C:\"); }
/* Main test. Anything that doesn't depend on a specific install configuration diff --git a/dlls/msi/winemsi.idl b/dlls/msi/winemsi.idl index 5e09c85..a0e1ddb 100644 --- a/dlls/msi/winemsi.idl +++ b/dlls/msi/winemsi.idl @@ -77,7 +77,7 @@ interface IWineMsiRemote UINT remote_DoAction( [in] MSIHANDLE hinst, [in, string] LPCWSTR action ); UINT remote_Sequence( [in] MSIHANDLE hinst, [in, string] LPCWSTR table, [in] int sequence ); UINT remote_GetTargetPath( [in] MSIHANDLE hinst, [in, string] LPCWSTR folder, [out, string] LPWSTR *value ); - HRESULT remote_SetTargetPath( [in] MSIHANDLE hinst, [in] BSTR folder, [in] BSTR value ); + UINT remote_SetTargetPath( [in] MSIHANDLE hinst, [in, string] LPCWSTR folder, [in, string] LPCWSTR value ); HRESULT remote_GetSourcePath( [in] MSIHANDLE hinst, [in] BSTR folder, [out, size_is(*size)] BSTR value, [in, out] DWORD *size ); HRESULT remote_GetMode( [in] MSIHANDLE hinst, [in] MSIRUNMODE mode, [out] BOOL *ret ); HRESULT remote_SetMode( [in] MSIHANDLE hinst, [in] MSIRUNMODE mode, [in] BOOL 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=37897
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 | 41 +++-------------------- dlls/msi/package.c | 17 ++++++++-- dlls/msi/tests/custom.c | 89 +++++++++++++++++++++++++++++++++++++++++++++++-- dlls/msi/winemsi.idl | 2 +- 4 files changed, 106 insertions(+), 43 deletions(-)
diff --git a/dlls/msi/install.c b/dlls/msi/install.c index ba329eb..88b3ff5 100644 --- a/dlls/msi/install.c +++ b/dlls/msi/install.c @@ -334,50 +334,19 @@ static UINT MSI_GetSourcePath( MSIHANDLE hInstall, LPCWSTR szFolder, package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE ); if (!package) { - HRESULT hr; LPWSTR value = NULL; MSIHANDLE remote; - BSTR folder; - DWORD len;
if (!(remote = msi_get_remote(hInstall))) return ERROR_INVALID_HANDLE;
- folder = SysAllocString( szFolder ); - if (!folder) - return ERROR_OUTOFMEMORY; + r = remote_GetSourcePath(remote, szFolder, &value); + if (r != ERROR_SUCCESS) + return r;
- len = 0; - hr = remote_GetSourcePath(remote, folder, NULL, &len); - if (FAILED(hr)) - goto done; - - len++; - value = msi_alloc(len * sizeof(WCHAR)); - if (!value) - { - r = ERROR_OUTOFMEMORY; - goto done; - } - - hr = remote_GetSourcePath(remote, folder, value, &len); - if (FAILED(hr)) - goto done; - - r = msi_strcpy_to_awstring( value, len, szPathBuf, pcchPathBuf ); - -done: - SysFreeString( folder ); - msi_free( 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, szPathBuf, pcchPathBuf);
+ midl_user_free(value); return r; }
diff --git a/dlls/msi/package.c b/dlls/msi/package.c index 220692b..1790918 100644 --- a/dlls/msi/package.c +++ b/dlls/msi/package.c @@ -2496,10 +2496,21 @@ UINT __cdecl remote_SetTargetPath(MSIHANDLE hinst, LPCWSTR folder, LPCWSTR value return MsiSetTargetPathW(hinst, folder, value); }
-HRESULT __cdecl remote_GetSourcePath(MSIHANDLE hinst, BSTR folder, BSTR value, DWORD *size) +UINT __cdecl remote_GetSourcePath(MSIHANDLE hinst, LPCWSTR folder, LPWSTR *value) { - UINT r = MsiGetSourcePathW(hinst, folder, value, size); - return HRESULT_FROM_WIN32(r); + WCHAR empty[1]; + DWORD size = 1; + UINT r; + + r = MsiGetSourcePathW(hinst, folder, empty, &size); + if (r == ERROR_MORE_DATA) + { + *value = midl_user_allocate(++size * sizeof(WCHAR)); + if (!*value) + return ERROR_OUTOFMEMORY; + r = MsiGetSourcePathW(hinst, folder, *value, &size); + } + return r; }
HRESULT __cdecl remote_GetMode(MSIHANDLE hinst, MSIRUNMODE mode, BOOL *ret) diff --git a/dlls/msi/tests/custom.c b/dlls/msi/tests/custom.c index 111032c..d596f1e 100644 --- a/dlls/msi/tests/custom.c +++ b/dlls/msi/tests/custom.c @@ -458,9 +458,9 @@ static void test_targetpath(MSIHANDLE hinst) static const WCHAR targetdirW[] = {'T','A','R','G','E','T','D','I','R',0}; static const WCHAR xyzW[] = {'C',':','\',0}; static const WCHAR xyW[] = {'C',':',0}; - char buffer[20]; - WCHAR bufferW[20]; - DWORD sz; + WCHAR bufferW[100]; + char buffer[100]; + DWORD sz, srcsz; UINT r;
/* test invalid values */ @@ -557,6 +557,89 @@ static void test_targetpath(MSIHANDLE hinst) ok(hinst, !strcmp(buffer, "C:\subdir\"), "got "%s"\n", buffer);
r = MsiSetTargetPathA(hinst, "TARGETDIR", "C:\"); + + /* test GetSourcePath() */ + + r = MsiGetSourcePathA(hinst, NULL, NULL, NULL); + ok(hinst, r == ERROR_INVALID_PARAMETER, "got %u\n", r); + + r = MsiGetSourcePathA(hinst, "TARGETDIR", NULL, NULL ); + ok(hinst, !r, "got %u\n", r); + + r = MsiGetSourcePathA(hinst, "TARGETDIR", buffer, NULL ); + ok(hinst, r == ERROR_INVALID_PARAMETER, "got %u\n", r); + + /* Returned size is in bytes, not chars, but only for custom actions. + * Seems to be a casualty of RPC... */ + + srcsz = 0; + MsiGetSourcePathW(hinst, targetdirW, NULL, &srcsz); + + sz = 0; + r = MsiGetSourcePathA(hinst, "TARGETDIR", NULL, &sz); + ok(hinst, !r, "got %u\n", r); + todo_wine_ok(hinst, sz == srcsz * 2, "got size %u\n", sz); + + sz = 0; + strcpy(buffer,"q"); + r = MsiGetSourcePathA(hinst, "TARGETDIR", 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 == srcsz * 2, "got size %u\n", sz); + + sz = 1; + strcpy(buffer,"x"); + r = MsiGetSourcePathA(hinst, "TARGETDIR", 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 == srcsz * 2, "got size %u\n", sz); + + sz = srcsz; + strcpy(buffer,"x"); + r = MsiGetSourcePathA(hinst, "TARGETDIR", buffer, &sz); + ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r); + ok(hinst, strlen(buffer) == srcsz - 1, "wrong buffer length %d\n", strlen(buffer)); + todo_wine_ok(hinst, sz == srcsz * 2, "got size %u\n", sz); + + sz = srcsz + 1; + strcpy(buffer,"x"); + r = MsiGetSourcePathA(hinst, "TARGETDIR", buffer, &sz); + ok(hinst, !r, "got %u\n", r); + ok(hinst, strlen(buffer) == srcsz, "wrong buffer length %d\n", strlen(buffer)); + ok(hinst, sz == srcsz, "got size %u\n", sz); + + sz = 0; + r = MsiGetSourcePathW(hinst, targetdirW, NULL, &sz); + ok(hinst, !r, "got %u\n", r); + ok(hinst, sz == srcsz, "got size %u\n", sz); + + sz = 0; + bufferW[0] = 'q'; + r = MsiGetSourcePathW(hinst, targetdirW, 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 == srcsz, "got size %u\n", sz); + + sz = 1; + bufferW[0] = 'q'; + r = MsiGetSourcePathW(hinst, targetdirW, 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 == srcsz, "got size %u\n", sz); + + sz = srcsz; + bufferW[0] = 'q'; + r = MsiGetSourcePathW(hinst, targetdirW, bufferW, &sz); + ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r); + ok(hinst, lstrlenW(bufferW) == srcsz - 1, "wrong buffer length %d\n", lstrlenW(bufferW)); + ok(hinst, sz == srcsz, "got size %u\n", sz); + + sz = srcsz + 1; + bufferW[0] = 'q'; + r = MsiGetSourcePathW(hinst, targetdirW, bufferW, &sz); + ok(hinst, !r, "got %u\n", r); + ok(hinst, lstrlenW(bufferW) == srcsz, "wrong buffer length %d\n", lstrlenW(bufferW)); + ok(hinst, sz == srcsz, "got size %u\n", sz); }
/* Main test. Anything that doesn't depend on a specific install configuration diff --git a/dlls/msi/winemsi.idl b/dlls/msi/winemsi.idl index a0e1ddb..06db52e 100644 --- a/dlls/msi/winemsi.idl +++ b/dlls/msi/winemsi.idl @@ -78,7 +78,7 @@ interface IWineMsiRemote UINT remote_Sequence( [in] MSIHANDLE hinst, [in, string] LPCWSTR table, [in] int sequence ); UINT remote_GetTargetPath( [in] MSIHANDLE hinst, [in, string] LPCWSTR folder, [out, string] LPWSTR *value ); UINT remote_SetTargetPath( [in] MSIHANDLE hinst, [in, string] LPCWSTR folder, [in, string] LPCWSTR value ); - HRESULT remote_GetSourcePath( [in] MSIHANDLE hinst, [in] BSTR folder, [out, size_is(*size)] BSTR value, [in, out] DWORD *size ); + UINT remote_GetSourcePath( [in] MSIHANDLE hinst, [in, string] LPCWSTR folder, [out, string] LPWSTR *value ); HRESULT remote_GetMode( [in] MSIHANDLE hinst, [in] MSIRUNMODE mode, [out] BOOL *ret ); HRESULT remote_SetMode( [in] MSIHANDLE hinst, [in] MSIRUNMODE mode, [in] BOOL state ); HRESULT remote_GetFeatureState( [in] MSIHANDLE hinst, [in] BSTR feature, [out] INSTALLSTATE *installed, [out] INSTALLSTATE *action );
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=37898
Your paranoid android.
=== 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=37894
Your paranoid android.
=== w7pro64 (32 bit custom) === The previous 1 run(s) terminated abnormally
=== w7pro64 (64 bit custom) === The previous 1 run(s) terminated abnormally