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: Make MsiProcessMessage() RPC-compatible.
by Alexandre Julliard
18 Apr '18
18 Apr '18
Module: wine Branch: master Commit: bbf0f2da8211da73066fb36a444593ab0e8901f2 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=bbf0f2da8211da73066fb36a…
Author: Zebediah Figura <z.figura12(a)gmail.com> Date: Tue Apr 17 19:11:29 2018 -0500 msi: Make MsiProcessMessage() RPC-compatible. Instead of passing a remote MSIHANDLE and creating a set of remote_Record*() methods, we marshal the whole record as a wire struct. We do this for two reasons: firstly, because chances are whoever is reading the record is going to want to read the whole thing, so it's much less taxing on IPC to just pass the whole record once; and secondly, because records can be created on the client side or returned from the server side, and we don't want to have to write a lot of extra code to deal with both possibilities. The wire_record struct is designed so that we can simply pass the relevant part of an MSIRECORD to the server. 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/msipriv.h | 2 ++ dlls/msi/package.c | 41 +++++++++++++++++++---------------------- dlls/msi/record.c | 43 +++++++++++++++++++++++++++++++++++++++++++ dlls/msi/winemsi.idl | 22 +++++++++++++++++++++- 4 files changed, 85 insertions(+), 23 deletions(-) diff --git a/dlls/msi/msipriv.h b/dlls/msi/msipriv.h index 9bc6413..3675042 100644 --- a/dlls/msi/msipriv.h +++ b/dlls/msi/msipriv.h @@ -39,6 +39,7 @@ #include "wine/debug.h" #include "msiserver.h" +#include "winemsi.h" static const BOOL is_64bit = sizeof(void *) > sizeof(int); BOOL is_wow64 DECLSPEC_HIDDEN; @@ -830,6 +831,7 @@ extern BOOL MSI_RecordsAreFieldsEqual(MSIRECORD *a, MSIRECORD *b, UINT field) DE extern UINT msi_record_set_string(MSIRECORD *, UINT, const WCHAR *, int) DECLSPEC_HIDDEN; extern const WCHAR *msi_record_get_string(const MSIRECORD *, UINT, int *) DECLSPEC_HIDDEN; extern void dump_record(MSIRECORD *) DECLSPEC_HIDDEN; +extern UINT unmarshal_record(const struct wire_record *in, MSIHANDLE *out) DECLSPEC_HIDDEN; /* stream internals */ extern void enum_stream_names( IStorage *stg ) DECLSPEC_HIDDEN; diff --git a/dlls/msi/package.c b/dlls/msi/package.c index b154423..a02eb91 100644 --- a/dlls/msi/package.c +++ b/dlls/msi/package.c @@ -2053,39 +2053,27 @@ INT WINAPI MsiProcessMessage( MSIHANDLE hInstall, INSTALLMESSAGE eMessageType, MsiRecordGetInteger(hRecord, 1) != 2) return -1; + record = msihandle2msiinfo(hRecord, MSIHANDLETYPE_RECORD); + if (!record) + return ERROR_INVALID_HANDLE; + package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE ); if( !package ) { MSIHANDLE remote; - HRESULT hr; if (!(remote = msi_get_remote(hInstall))) return ERROR_INVALID_HANDLE; - hr = remote_ProcessMessage(remote, eMessageType, hRecord); - - if (FAILED(hr)) - { - if (HRESULT_FACILITY(hr) == FACILITY_WIN32) - return HRESULT_CODE(hr); + ret = remote_ProcessMessage(remote, eMessageType, (struct wire_record *)&record->count); - return ERROR_FUNCTION_FAILED; - } - - return ERROR_SUCCESS; + msiobj_release(&record->hdr); + return ret; } - record = msihandle2msiinfo( hRecord, MSIHANDLETYPE_RECORD ); - if( !record ) - goto out; - ret = MSI_ProcessMessage( package, eMessageType, record ); -out: msiobj_release( &package->hdr ); - if( record ) - msiobj_release( &record->hdr ); - return ret; } @@ -2481,10 +2469,19 @@ UINT __cdecl remote_SetProperty(MSIHANDLE hinst, LPCWSTR property, LPCWSTR value return MsiSetPropertyW(hinst, property, value); } -HRESULT __cdecl remote_ProcessMessage(MSIHANDLE hinst, INSTALLMESSAGE message, MSIHANDLE record) +int __cdecl remote_ProcessMessage(MSIHANDLE hinst, INSTALLMESSAGE message, struct wire_record *remote_rec) { - UINT r = MsiProcessMessage(hinst, message, record); - return HRESULT_FROM_WIN32(r); + MSIHANDLE rec; + int ret; + UINT r; + + if ((r = unmarshal_record(remote_rec, &rec))) + return r; + + ret = MsiProcessMessage(hinst, message, rec); + + MsiCloseHandle(rec); + return ret; } HRESULT __cdecl remote_DoAction(MSIHANDLE hinst, BSTR action) diff --git a/dlls/msi/record.c b/dlls/msi/record.c index 8254b17..7b53d86 100644 --- a/dlls/msi/record.c +++ b/dlls/msi/record.c @@ -1054,3 +1054,46 @@ void dump_record(MSIRECORD *rec) } TRACE("]\n"); } + +UINT unmarshal_record(const struct wire_record *in, MSIHANDLE *out) +{ + MSIRECORD *rec; + unsigned int i; + UINT r; + + rec = MSI_CreateRecord(in->count); + if (!rec) return ERROR_OUTOFMEMORY; + + for (i = 0; i <= in->count; i++) + { + switch (in->fields[i].type) + { + case MSIFIELD_NULL: + break; + case MSIFIELD_INT: + r = MSI_RecordSetInteger(rec, i, in->fields[i].u.iVal); + break; + case MSIFIELD_WSTR: + r = MSI_RecordSetStringW(rec, i, in->fields[i].u.szwVal); + break; + case MSIFIELD_STREAM: + r = MSI_RecordSetIStream(rec, i, in->fields[i].u.stream); + break; + default: + ERR("invalid field type %d\n", in->fields[i].type); + break; + } + + if (r) + { + msiobj_release(&rec->hdr); + return r; + } + } + + *out = alloc_msihandle(&rec->hdr); + if (!*out) return ERROR_OUTOFMEMORY; + + msiobj_release(&rec->hdr); + return ERROR_SUCCESS; +} diff --git a/dlls/msi/winemsi.idl b/dlls/msi/winemsi.idl index 7ea2e3c..d97db4c 100644 --- a/dlls/msi/winemsi.idl +++ b/dlls/msi/winemsi.idl @@ -28,9 +28,29 @@ typedef int MSICONDITION; typedef int MSIRUNMODE; typedef int INSTALLSTATE; +#define MSIFIELD_NULL 0 +#define MSIFIELD_INT 1 +#define MSIFIELD_WSTR 3 +#define MSIFIELD_STREAM 4 cpp_quote("#endif") cpp_quote("#include \"msiquery.h\"") +struct wire_field { + unsigned int type; + [switch_is(type)] union { + [case(MSIFIELD_NULL)] ; + [case(MSIFIELD_INT)] int iVal; + [case(MSIFIELD_WSTR), string] LPWSTR szwVal; + [case(MSIFIELD_STREAM)] IStream *stream; + } u; + int len; +}; + +struct wire_record { + unsigned int count; + [size_is(count+1)] struct wire_field fields[]; +}; + [ uuid(56D58B64-8780-4c22-A8BC-8B0B29E4A9F8) ] @@ -44,7 +64,7 @@ interface IWineMsiRemote HRESULT remote_GetActiveDatabase( [in] MSIHANDLE hinst, [out] MSIHANDLE *handle ); 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 ); - HRESULT remote_ProcessMessage( [in] MSIHANDLE hinst, [in] INSTALLMESSAGE message, [in] MSIHANDLE record ); + int remote_ProcessMessage( [in] MSIHANDLE hinst, [in] INSTALLMESSAGE message, [in] struct wire_record *record ); HRESULT remote_DoAction( [in] MSIHANDLE hinst, [in] BSTR 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 );
1
0
0
0
Zebediah Figura : msi: Store a record's associated query privately.
by Alexandre Julliard
18 Apr '18
18 Apr '18
Module: wine Branch: master Commit: 9d121203955da5c761cfb5c22b6428278e41f0c7 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=9d121203955da5c761cfb5c2…
Author: Zebediah Figura <z.figura12(a)gmail.com> Date: Tue Apr 17 19:11:28 2018 -0500 msi: Store a record's associated query privately. 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/msipriv.h | 4 +--- dlls/msi/msiquery.c | 5 +++-- dlls/msi/record.c | 48 ------------------------------------------------ 3 files changed, 4 insertions(+), 53 deletions(-) diff --git a/dlls/msi/msipriv.h b/dlls/msi/msipriv.h index b2b3e7c..9bc6413 100644 --- a/dlls/msi/msipriv.h +++ b/dlls/msi/msipriv.h @@ -131,7 +131,6 @@ typedef struct tagMSIFIELD union { INT iVal; - INT_PTR pVal; LPWSTR szwVal; IStream *stream; } u; @@ -141,6 +140,7 @@ typedef struct tagMSIFIELD typedef struct tagMSIRECORD { MSIOBJECTHDR hdr; + MSIQUERY *query; UINT count; /* as passed to MsiCreateRecord */ MSIFIELD fields[1]; /* nb. array size is count+1 */ } MSIRECORD; @@ -813,13 +813,11 @@ extern UINT MSI_RecordGetIStream( MSIRECORD *, UINT, IStream **) DECLSPEC_HIDDEN extern const WCHAR *MSI_RecordGetString( const MSIRECORD *, UINT ) DECLSPEC_HIDDEN; extern MSIRECORD *MSI_CreateRecord( UINT ) DECLSPEC_HIDDEN; extern UINT MSI_RecordSetInteger( MSIRECORD *, UINT, int ) DECLSPEC_HIDDEN; -extern UINT MSI_RecordSetIntPtr( MSIRECORD *, UINT, INT_PTR ) DECLSPEC_HIDDEN; extern UINT MSI_RecordSetStringW( MSIRECORD *, UINT, LPCWSTR ) DECLSPEC_HIDDEN; extern BOOL MSI_RecordIsNull( MSIRECORD *, UINT ) DECLSPEC_HIDDEN; extern UINT MSI_RecordGetStringW( MSIRECORD * , UINT, LPWSTR, LPDWORD) DECLSPEC_HIDDEN; extern UINT MSI_RecordGetStringA( MSIRECORD *, UINT, LPSTR, LPDWORD) DECLSPEC_HIDDEN; extern int MSI_RecordGetInteger( MSIRECORD *, UINT ) DECLSPEC_HIDDEN; -extern INT_PTR MSI_RecordGetIntPtr( MSIRECORD *, UINT ) DECLSPEC_HIDDEN; extern UINT MSI_RecordReadStream( MSIRECORD *, UINT, char *, LPDWORD) DECLSPEC_HIDDEN; extern UINT MSI_RecordSetStream(MSIRECORD *, UINT, IStream *) DECLSPEC_HIDDEN; extern UINT MSI_RecordGetFieldCount( const MSIRECORD *rec ) DECLSPEC_HIDDEN; diff --git a/dlls/msi/msiquery.c b/dlls/msi/msiquery.c index f8ed4ce..1ba3076 100644 --- a/dlls/msi/msiquery.c +++ b/dlls/msi/msiquery.c @@ -374,7 +374,8 @@ UINT MSI_ViewFetch(MSIQUERY *query, MSIRECORD **prec) if (r == ERROR_SUCCESS) { query->row ++; - MSI_RecordSetIntPtr(*prec, 0, (INT_PTR)query); + (*prec)->query = query; + MSI_RecordSetInteger(*prec, 0, 1); } return r; @@ -608,7 +609,7 @@ UINT MSI_ViewModify( MSIQUERY *query, MSIMODIFY mode, MSIRECORD *rec ) if ( !view || !view->ops->modify) return ERROR_FUNCTION_FAILED; - if ( mode == MSIMODIFY_UPDATE && MSI_RecordGetIntPtr( rec, 0 ) != (INT_PTR)query ) + if ( mode == MSIMODIFY_UPDATE && rec->query != query ) return ERROR_FUNCTION_FAILED; r = view->ops->modify( view, mode, rec, query->row ); diff --git a/dlls/msi/record.c b/dlls/msi/record.c index de45191..8254b17 100644 --- a/dlls/msi/record.c +++ b/dlls/msi/record.c @@ -46,7 +46,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(msidb); #define MSIFIELD_INT 1 #define MSIFIELD_WSTR 3 #define MSIFIELD_STREAM 4 -#define MSIFIELD_INTPTR 5 static void MSI_FreeField( MSIFIELD *field ) { @@ -54,7 +53,6 @@ static void MSI_FreeField( MSIFIELD *field ) { case MSIFIELD_NULL: case MSIFIELD_INT: - case MSIFIELD_INTPTR: break; case MSIFIELD_WSTR: msi_free( field->u.szwVal); @@ -190,9 +188,6 @@ UINT MSI_RecordCopyField( MSIRECORD *in_rec, UINT in_n, case MSIFIELD_INT: out->u.iVal = in->u.iVal; break; - case MSIFIELD_INTPTR: - out->u.pVal = in->u.pVal; - break; case MSIFIELD_WSTR: if ((str = msi_strdupW( in->u.szwVal, in->len ))) { @@ -216,32 +211,6 @@ UINT MSI_RecordCopyField( MSIRECORD *in_rec, UINT in_n, return r; } -INT_PTR MSI_RecordGetIntPtr( MSIRECORD *rec, UINT iField ) -{ - int ret; - - TRACE( "%p %d\n", rec, iField ); - - if( iField > rec->count ) - return MININT_PTR; - - switch( rec->fields[iField].type ) - { - case MSIFIELD_INT: - return rec->fields[iField].u.iVal; - case MSIFIELD_INTPTR: - return rec->fields[iField].u.pVal; - case MSIFIELD_WSTR: - if( string2intW( rec->fields[iField].u.szwVal, &ret ) ) - return ret; - return MININT_PTR; - default: - break; - } - - return MININT_PTR; -} - int MSI_RecordGetInteger( MSIRECORD *rec, UINT iField) { int ret = 0; @@ -255,8 +224,6 @@ int MSI_RecordGetInteger( MSIRECORD *rec, UINT iField) { case MSIFIELD_INT: return rec->fields[iField].u.iVal; - case MSIFIELD_INTPTR: - return rec->fields[iField].u.pVal; case MSIFIELD_WSTR: if( string2intW( rec->fields[iField].u.szwVal, &ret ) ) return ret; @@ -311,20 +278,6 @@ UINT WINAPI MsiRecordClearData( MSIHANDLE handle ) return ERROR_SUCCESS; } -UINT MSI_RecordSetIntPtr( MSIRECORD *rec, UINT iField, INT_PTR pVal ) -{ - TRACE("%p %u %ld\n", rec, iField, pVal); - - if( iField > rec->count ) - return ERROR_INVALID_PARAMETER; - - MSI_FreeField( &rec->fields[iField] ); - rec->fields[iField].type = MSIFIELD_INTPTR; - rec->fields[iField].u.pVal = pVal; - - return ERROR_SUCCESS; -} - UINT MSI_RecordSetInteger( MSIRECORD *rec, UINT iField, int iVal ) { TRACE("%p %u %d\n", rec, iField, iVal); @@ -1095,7 +1048,6 @@ void dump_record(MSIRECORD *rec) case MSIFIELD_NULL: TRACE("(null)"); break; case MSIFIELD_INT: TRACE("%d", rec->fields[i].u.iVal); break; case MSIFIELD_WSTR: TRACE("%s", debugstr_w(rec->fields[i].u.szwVal)); break; - case MSIFIELD_INTPTR: TRACE("%ld", rec->fields[i].u.pVal); break; case MSIFIELD_STREAM: TRACE("%p", rec->fields[i].u.stream); break; } if (i < rec->count) TRACE(", ");
1
0
0
0
Zebediah Figura : msi/tests: Test properties from custom actions.
by Alexandre Julliard
17 Apr '18
17 Apr '18
Module: wine Branch: master Commit: 5808f1ddd49930ad49aeab640fced8305db476ea URL:
https://source.winehq.org/git/wine.git/?a=commit;h=5808f1ddd49930ad49aeab64…
Author: Zebediah Figura <z.figura12(a)gmail.com> Date: Tue Apr 17 10:35:40 2018 -0500 msi/tests: Test properties from custom actions. 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/tests/custom.c | 192 +++++++++++++++++++++++++++++++++++++++++++++++ dlls/msi/tests/install.c | 2 + 2 files changed, 194 insertions(+) diff --git a/dlls/msi/tests/custom.c b/dlls/msi/tests/custom.c index feb8061..9cf90dc 100644 --- a/dlls/msi/tests/custom.c +++ b/dlls/msi/tests/custom.c @@ -51,6 +51,196 @@ static void ok_(MSIHANDLE hinst, int todo, const char *file, int line, int condi #define ok(hinst, condition, ...) ok_(hinst, 0, __FILE__, __LINE__, condition, __VA_ARGS__) #define todo_wine_ok(hinst, condition, ...) ok_(hinst, 1, __FILE__, __LINE__, condition, __VA_ARGS__) +static const char *dbgstr_w(WCHAR *str) +{ + static char buffer[300], *p; + + if (!str) return "(null)"; + + p = buffer; + *p++ = 'L'; + *p++ = '"'; + while ((*p++ = *str++)); + *p++ = '"'; + *p++ = 0; + + return buffer; +} + +static void check_prop(MSIHANDLE hinst, const char *prop, const char *expect) +{ + char buffer[10] = "x"; + DWORD sz = sizeof(buffer); + UINT r = MsiGetPropertyA(hinst, prop, buffer, &sz); + ok(hinst, !r, "'%s': got %u\n", prop, r); + ok(hinst, sz == strlen(buffer), "'%s': expected %u, got %u\n", prop, strlen(buffer), sz); + ok(hinst, !strcmp(buffer, expect), "expected '%s', got '%s'\n", expect, buffer); +} + +static void test_props(MSIHANDLE hinst) +{ + static const WCHAR booW[] = {'b','o','o',0}; + static const WCHAR xyzW[] = {'x','y','z',0}; + static const WCHAR xyW[] = {'x','y',0}; + char buffer[10]; + WCHAR bufferW[10]; + DWORD sz; + UINT r; + + /* test invalid values */ + r = MsiGetPropertyA(hinst, NULL, NULL, NULL); + ok(hinst, r == ERROR_INVALID_PARAMETER, "got %u\n", r); + + r = MsiGetPropertyA(hinst, "boo", NULL, NULL); + ok(hinst, !r, "got %u\n", r); + + r = MsiGetPropertyA(hinst, "boo", buffer, NULL ); + ok(hinst, r == ERROR_INVALID_PARAMETER, "got %u\n", r); + + sz = 0; + r = MsiGetPropertyA(hinst, "boo", NULL, &sz); + ok(hinst, !r, "got %u\n", r); + ok(hinst, sz == 0, "got size %u\n", sz); + + sz = 0; + strcpy(buffer,"x"); + r = MsiGetPropertyA(hinst, "boo", buffer, &sz); + ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r); + ok(hinst, !strcmp(buffer, "x"), "got \"%s\"\n", buffer); + ok(hinst, sz == 0, "got size %u\n", sz); + + sz = 1; + strcpy(buffer,"x"); + r = MsiGetPropertyA(hinst, "boo", buffer, &sz); + ok(hinst, !r, "got %u\n", r); + ok(hinst, !buffer[0], "got \"%s\"\n", buffer); + ok(hinst, sz == 0, "got size %u\n", sz); + + /* set the property to something */ + r = MsiSetPropertyA(hinst, NULL, NULL); + ok(hinst, r == ERROR_INVALID_PARAMETER, "got %u\n", r); + + r = MsiSetPropertyA(hinst, "", NULL); + ok(hinst, !r, "got %u\n", r); + + r = MsiSetPropertyA(hinst, "", "asdf"); + ok(hinst, r == ERROR_FUNCTION_FAILED, "got %u\n", r); + + r = MsiSetPropertyA(hinst, "=", "asdf"); + ok(hinst, !r, "got %u\n", r); + check_prop(hinst, "=", "asdf"); + + r = MsiSetPropertyA(hinst, " ", "asdf"); + ok(hinst, !r, "got %u\n", r); + check_prop(hinst, " ", "asdf"); + + r = MsiSetPropertyA(hinst, "'", "asdf"); + ok(hinst, !r, "got %u\n", r); + check_prop(hinst, "'", "asdf"); + + r = MsiSetPropertyA(hinst, "boo", NULL); + ok(hinst, !r, "got %u\n", r); + check_prop(hinst, "boo", ""); + + r = MsiSetPropertyA(hinst, "boo", ""); + ok(hinst, !r, "got %u\n", r); + check_prop(hinst, "boo", ""); + + r = MsiSetPropertyA(hinst, "boo", "xyz"); + ok(hinst, !r, "got %u\n", r); + check_prop(hinst, "boo", "xyz"); + + r = MsiGetPropertyA(hinst, "boo", NULL, NULL); + ok(hinst, !r, "got %u\n", r); + + r = MsiGetPropertyA(hinst, "boo", 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 = MsiGetPropertyA(hinst, "boo", NULL, &sz); + ok(hinst, !r, "got %u\n", r); + ok(hinst, sz == 6, "got size %u\n", sz); + + sz = 0; + strcpy(buffer,"q"); + r = MsiGetPropertyA(hinst, "boo", 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 = MsiGetPropertyA(hinst, "boo", 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 = MsiGetPropertyA(hinst, "boo", buffer, &sz); + ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r); + ok(hinst, !strcmp(buffer, "xy"), "got \"%s\"\n", buffer); + todo_wine_ok(hinst, sz == 6, "got size %u\n", sz); + + sz = 4; + strcpy(buffer,"x"); + r = MsiGetPropertyA(hinst, "boo", buffer, &sz); + ok(hinst, !r, "got %u\n", r); + ok(hinst, !strcmp(buffer, "xyz"), "got \"%s\"\n", buffer); + ok(hinst, sz == 3, "got size %u\n", sz); + + sz = 0; + r = MsiGetPropertyW(hinst, booW, NULL, &sz); + ok(hinst, !r, "got %u\n", r); + ok(hinst, sz == 3, "got size %u\n", sz); + + sz = 0; + lstrcpyW(bufferW, booW); + r = MsiGetPropertyW(hinst, booW, bufferW, &sz); + ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r); + ok(hinst, !lstrcmpW(bufferW, booW), "got %s\n", dbgstr_w(bufferW)); + ok(hinst, sz == 3, "got size %u\n", sz); + + sz = 1; + lstrcpyW(bufferW, booW); + r = MsiGetPropertyW(hinst, booW, 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; + lstrcpyW(bufferW, booW); + r = MsiGetPropertyW(hinst, booW, 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; + lstrcpyW(bufferW, booW); + r = MsiGetPropertyW(hinst, booW, 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); + + r = MsiSetPropertyA(hinst, "boo", NULL); + ok(hinst, !r, "got %u\n", r); + check_prop(hinst, "boo", ""); + + sz = 0; + r = MsiGetPropertyA(hinst, "embednullprop", NULL, &sz); + ok(hinst, !r, "got %u\n", r); + ok(hinst, sz == 6, "got size %u\n", sz); + + sz = 4; + memset(buffer, 0xcc, sizeof(buffer)); + r = MsiGetPropertyA(hinst, "embednullprop", buffer, &sz); + ok(hinst, !r, "got %u\n", r); + ok(hinst, sz == 3, "got size %u\n", sz); + ok(hinst, !memcmp(buffer, "a\0\0\0\xcc", 5), "wrong data\n"); +} /* Main test. Anything that doesn't depend on a specific install configuration * or have undesired side effects should go here. */ @@ -70,6 +260,8 @@ UINT WINAPI main_test(MSIHANDLE hinst) res = MsiGetDatabaseState(hinst); todo_wine_ok(hinst, res == MSIDBSTATE_ERROR, "expected MSIDBSTATE_ERROR, got %u\n", res); + test_props(hinst); + return ERROR_SUCCESS; } diff --git a/dlls/msi/tests/install.c b/dlls/msi/tests/install.c index 69095cd..62fb81f 100644 --- a/dlls/msi/tests/install.c +++ b/dlls/msi/tests/install.c @@ -695,12 +695,14 @@ 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" + "embednull\t\t600\n" "maintest\tMAIN_TEST\t700\n" "testretval\tTEST_RETVAL\t710\n"; 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" "maintest\t1\tcustom.dll\tmain_test\n" "testretval\t1\tcustom.dll\ttest_retval\n";
1
0
0
0
Zebediah Figura : msi: Also null-terminate WCHAR strings.
by Alexandre Julliard
17 Apr '18
17 Apr '18
Module: wine Branch: master Commit: f37e61817f0393132c75b2e5d86778d1a4ceab45 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=f37e61817f0393132c75b2e5…
Author: Zebediah Figura <z.figura12(a)gmail.com> Date: Tue Apr 17 10:35:39 2018 -0500 msi: Also null-terminate WCHAR strings. 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 | 4 ++++ dlls/msi/tests/package.c | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/dlls/msi/install.c b/dlls/msi/install.c index 65840e2..814addc 100644 --- a/dlls/msi/install.c +++ b/dlls/msi/install.c @@ -180,7 +180,11 @@ UINT msi_strcpy_to_awstring( const WCHAR *str, int len, awstring *awbuf, DWORD * if (len < 0) len = strlenW( str ); if (awbuf->unicode && awbuf->str.w) + { memcpy( awbuf->str.w, str, min(len + 1, *sz) * sizeof(WCHAR) ); + if (*sz && len >= *sz) + awbuf->str.w[*sz - 1] = 0; + } else { int lenA = WideCharToMultiByte( CP_ACP, 0, str, len + 1, NULL, 0, NULL, NULL ); diff --git a/dlls/msi/tests/package.c b/dlls/msi/tests/package.c index 6414891..b85a3a8 100644 --- a/dlls/msi/tests/package.c +++ b/dlls/msi/tests/package.c @@ -2150,10 +2150,14 @@ static void check_prop(MSIHANDLE hpkg, const char *prop, const char *expect) static void test_props(void) { + static const WCHAR booW[] = {'b','o','o',0}; + static const WCHAR xyzW[] = {'x','y','z',0}; + static const WCHAR xyW[] = {'x','y',0}; MSIHANDLE hpkg, hdb; UINT r; DWORD sz; char buffer[0x100]; + WCHAR bufferW[10]; hdb = create_package_db(); @@ -2280,6 +2284,39 @@ static void test_props(void) ok(!strcmp(buffer,"xyz"), "got \"%s\"\n", buffer); ok(sz == 3, "got size %u\n", sz); + sz = 0; + r = MsiGetPropertyW(hpkg, booW, NULL, &sz); + ok(!r, "got %u\n", r); + ok(sz == 3, "got size %u\n", sz); + + sz = 0; + lstrcpyW(bufferW, booW); + r = MsiGetPropertyW(hpkg, booW, bufferW, &sz); + ok(r == ERROR_MORE_DATA, "got %u\n", r); + ok(!lstrcmpW(bufferW, booW), "got %s\n", wine_dbgstr_w(bufferW)); + ok(sz == 3, "got size %u\n", sz); + + sz = 1; + lstrcpyW(bufferW, booW); + r = MsiGetPropertyW(hpkg, booW, bufferW, &sz ); + ok(r == ERROR_MORE_DATA, "got %u\n", r); + ok(!bufferW[0], "got %s\n", wine_dbgstr_w(bufferW)); + ok(sz == 3, "got size %u\n", sz); + + sz = 3; + lstrcpyW(bufferW, booW); + r = MsiGetPropertyW(hpkg, booW, bufferW, &sz ); + ok(r == ERROR_MORE_DATA, "got %u\n", r); + ok(!lstrcmpW(bufferW, xyW), "got %s\n", wine_dbgstr_w(bufferW)); + ok(sz == 3, "got size %u\n", sz); + + sz = 4; + lstrcpyW(bufferW, booW); + r = MsiGetPropertyW(hpkg, booW, bufferW, &sz ); + ok(!r, "got %u\n", r); + ok(!lstrcmpW(bufferW, xyzW), "got %s\n", wine_dbgstr_w(bufferW)); + ok(sz == 3, "got size %u\n", sz); + /* properties are case-sensitive */ check_prop(hpkg, "BOO", "");
1
0
0
0
Zebediah Figura : msi/tests: Clean up property tests.
by Alexandre Julliard
17 Apr '18
17 Apr '18
Module: wine Branch: master Commit: c6b84cee179ac538c3a596fe9e7d10aaacd56321 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=c6b84cee179ac538c3a596fe…
Author: Zebediah Figura <z.figura12(a)gmail.com> Date: Tue Apr 17 10:35:38 2018 -0500 msi/tests: Clean up property tests. Remove many redundant tests, and print relevant values on failure. 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/tests/package.c | 220 +++++++++++++++-------------------------------- 1 file changed, 68 insertions(+), 152 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=c6b84cee179ac538c3a5…
1
0
0
0
Zebediah Figura : msi: Make MsiSetProperty() RPC-compatible.
by Alexandre Julliard
17 Apr '18
17 Apr '18
Module: wine Branch: master Commit: a73182ca542c00d15becd1d9e09f1c213082999d URL:
https://source.winehq.org/git/wine.git/?a=commit;h=a73182ca542c00d15becd1d9…
Author: Zebediah Figura <z.figura12(a)gmail.com> Date: Tue Apr 17 10:35:37 2018 -0500 msi: Make MsiSetProperty() 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/package.c | 31 +++---------------------------- dlls/msi/winemsi.idl | 2 +- 2 files changed, 4 insertions(+), 29 deletions(-) diff --git a/dlls/msi/package.c b/dlls/msi/package.c index 4986ec1..b154423 100644 --- a/dlls/msi/package.c +++ b/dlls/msi/package.c @@ -2203,35 +2203,11 @@ UINT WINAPI MsiSetPropertyW( MSIHANDLE hInstall, LPCWSTR szName, LPCWSTR szValue if( !package ) { MSIHANDLE remote; - HRESULT hr; - BSTR name = NULL, value = NULL; if (!(remote = msi_get_remote(hInstall))) return ERROR_INVALID_HANDLE; - name = SysAllocString( szName ); - value = SysAllocString( szValue ); - if ((!name && szName) || (!value && szValue)) - { - SysFreeString( name ); - SysFreeString( value ); - return ERROR_OUTOFMEMORY; - } - - hr = remote_SetProperty(remote, name, value); - - SysFreeString( name ); - SysFreeString( value ); - - if (FAILED(hr)) - { - if (HRESULT_FACILITY(hr) == FACILITY_WIN32) - return HRESULT_CODE(hr); - - return ERROR_FUNCTION_FAILED; - } - - return ERROR_SUCCESS; + return remote_SetProperty(remote, szName, szValue); } ret = msi_set_property( package->db, szName, szValue, -1 ); @@ -2500,10 +2476,9 @@ UINT __cdecl remote_GetProperty(MSIHANDLE hinst, LPCWSTR property, LPWSTR *value return r; } -HRESULT __cdecl remote_SetProperty(MSIHANDLE hinst, BSTR property, BSTR value) +UINT __cdecl remote_SetProperty(MSIHANDLE hinst, LPCWSTR property, LPCWSTR value) { - UINT r = MsiSetPropertyW(hinst, property, value); - return HRESULT_FROM_WIN32(r); + return MsiSetPropertyW(hinst, property, value); } HRESULT __cdecl remote_ProcessMessage(MSIHANDLE hinst, INSTALLMESSAGE message, MSIHANDLE record) diff --git a/dlls/msi/winemsi.idl b/dlls/msi/winemsi.idl index 07a315b..7ea2e3c 100644 --- a/dlls/msi/winemsi.idl +++ b/dlls/msi/winemsi.idl @@ -43,7 +43,7 @@ interface IWineMsiRemote HRESULT remote_GetActiveDatabase( [in] MSIHANDLE hinst, [out] MSIHANDLE *handle ); UINT remote_GetProperty( [in] MSIHANDLE hinst, [in, string] LPCWSTR property, [out, string] LPWSTR *value, [out] DWORD *size ); - HRESULT remote_SetProperty( [in] MSIHANDLE hinst, [in] BSTR property, [in] BSTR value ); + UINT remote_SetProperty( [in] MSIHANDLE hinst, [in, string, unique] LPCWSTR property, [in, string, unique] LPCWSTR value ); HRESULT remote_ProcessMessage( [in] MSIHANDLE hinst, [in] INSTALLMESSAGE message, [in] MSIHANDLE record ); HRESULT remote_DoAction( [in] MSIHANDLE hinst, [in] BSTR action ); HRESULT remote_Sequence( [in] MSIHANDLE hinst, [in] BSTR table, [in] int sequence );
1
0
0
0
Zebediah Figura : msi: Make MsiGetProperty() RPC-compatible.
by Alexandre Julliard
17 Apr '18
17 Apr '18
Module: wine Branch: master Commit: 2192c9a50a91d175f367534d2ed84fe24f4253aa URL:
https://source.winehq.org/git/wine.git/?a=commit;h=2192c9a50a91d175f367534d…
Author: Zebediah Figura <z.figura12(a)gmail.com> Date: Tue Apr 17 10:35:36 2018 -0500 msi: Make MsiGetProperty() 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/custom.c | 11 ++++++++ dlls/msi/package.c | 73 ++++++++++++++++++++++++---------------------------- dlls/msi/winemsi.idl | 2 +- 3 files changed, 46 insertions(+), 40 deletions(-) diff --git a/dlls/msi/custom.c b/dlls/msi/custom.c index e2ed5a4..83b1687 100644 --- a/dlls/msi/custom.c +++ b/dlls/msi/custom.c @@ -34,6 +34,7 @@ #include "msipriv.h" #include "winemsi.h" +#include "wine/heap.h" #include "wine/debug.h" #include "wine/unicode.h" #include "wine/exception.h" @@ -64,6 +65,16 @@ static CRITICAL_SECTION msi_custom_action_cs = { &msi_custom_action_cs_debug, -1 static struct list msi_pending_custom_actions = LIST_INIT( msi_pending_custom_actions ); +void __RPC_FAR * __RPC_USER MIDL_user_allocate(SIZE_T len) +{ + return heap_alloc(len); +} + +void __RPC_USER MIDL_user_free(void __RPC_FAR * ptr) +{ + heap_free(ptr); +} + UINT msi_schedule_action( MSIPACKAGE *package, UINT script, const WCHAR *action ) { UINT count; diff --git a/dlls/msi/package.c b/dlls/msi/package.c index 4e1ac2f..4986ec1 100644 --- a/dlls/msi/package.c +++ b/dlls/msi/package.c @@ -29,7 +29,6 @@ #include "winnls.h" #include "shlwapi.h" #include "wingdi.h" -#include "wine/debug.h" #include "msi.h" #include "msiquery.h" #include "objidl.h" @@ -39,11 +38,14 @@ #include "winver.h" #include "urlmon.h" #include "shlobj.h" -#include "wine/unicode.h" #include "objbase.h" #include "msidefs.h" #include "sddl.h" +#include "wine/heap.h" +#include "wine/debug.h" +#include "wine/unicode.h" + #include "msipriv.h" #include "winemsi.h" #include "resource.h" @@ -2396,52 +2398,34 @@ static UINT MSI_GetProperty( MSIHANDLE handle, LPCWSTR name, package = msihandle2msiinfo( handle, MSIHANDLETYPE_PACKAGE ); if (!package) { - HRESULT hr; - LPWSTR value = NULL; + LPWSTR value = NULL, buffer; MSIHANDLE remote; - BSTR bname; if (!(remote = msi_get_remote(handle))) return ERROR_INVALID_HANDLE; - bname = SysAllocString( name ); - if (!bname) - return ERROR_OUTOFMEMORY; - - hr = remote_GetProperty(remote, bname, NULL, &len); - if (FAILED(hr)) - goto done; + r = remote_GetProperty(remote, name, &value, &len); + if (r != ERROR_SUCCESS) + return r; - len++; - value = msi_alloc(len * sizeof(WCHAR)); - if (!value) + /* String might contain embedded nulls. + * Native returns the correct size but truncates the string. */ + buffer = heap_alloc_zero((len + 1) * sizeof(WCHAR)); + if (!buffer) { - r = ERROR_OUTOFMEMORY; - goto done; + midl_user_free(value); + return ERROR_OUTOFMEMORY; } + strcpyW(buffer, value); - hr = remote_GetProperty(remote, bname, value, &len); - if (FAILED(hr)) - goto done; - - r = msi_strcpy_to_awstring( value, len, szValueBuf, pchValueBuf ); + r = msi_strcpy_to_awstring(buffer, len, szValueBuf, pchValueBuf); /* Bug required by Adobe installers */ - if (!szValueBuf->unicode && !szValueBuf->str.a) + if (pchValueBuf && !szValueBuf->unicode && !szValueBuf->str.a) *pchValueBuf *= sizeof(WCHAR); -done: - SysFreeString(bname); - msi_free(value); - - if (FAILED(hr)) - { - if (HRESULT_FACILITY(hr) == FACILITY_WIN32) - return HRESULT_CODE(hr); - - return ERROR_FUNCTION_FAILED; - } - + heap_free(buffer); + midl_user_free(value); return r; } @@ -2498,11 +2482,22 @@ HRESULT __cdecl remote_GetActiveDatabase(MSIHANDLE hinst, MSIHANDLE *handle) return S_OK; } -HRESULT __cdecl remote_GetProperty(MSIHANDLE hinst, BSTR property, BSTR value, DWORD *size) +UINT __cdecl remote_GetProperty(MSIHANDLE hinst, LPCWSTR property, LPWSTR *value, DWORD *size) { - UINT r = MsiGetPropertyW(hinst, property, value, size); - if (r != ERROR_SUCCESS) return HRESULT_FROM_WIN32(r); - return S_OK; + WCHAR empty[1]; + UINT r; + + *size = 0; + r = MsiGetPropertyW(hinst, property, empty, size); + if (r == ERROR_MORE_DATA) + { + ++*size; + *value = midl_user_allocate(*size * sizeof(WCHAR)); + if (!*value) + return ERROR_OUTOFMEMORY; + r = MsiGetPropertyW(hinst, property, *value, size); + } + return r; } HRESULT __cdecl remote_SetProperty(MSIHANDLE hinst, BSTR property, BSTR value) diff --git a/dlls/msi/winemsi.idl b/dlls/msi/winemsi.idl index 560b306..07a315b 100644 --- a/dlls/msi/winemsi.idl +++ b/dlls/msi/winemsi.idl @@ -42,7 +42,7 @@ interface IWineMsiRemote HRESULT remote_DatabaseOpenView( [in] MSIHANDLE db, [in] LPCWSTR query, [out] MSIHANDLE *view ); HRESULT remote_GetActiveDatabase( [in] MSIHANDLE hinst, [out] MSIHANDLE *handle ); - HRESULT remote_GetProperty( [in] MSIHANDLE hinst, [in] BSTR property, [out, size_is(*size)] BSTR value, [in, out] DWORD *size ); + UINT remote_GetProperty( [in] MSIHANDLE hinst, [in, string] LPCWSTR property, [out, string] LPWSTR *value, [out] DWORD *size ); HRESULT remote_SetProperty( [in] MSIHANDLE hinst, [in] BSTR property, [in] BSTR value ); HRESULT remote_ProcessMessage( [in] MSIHANDLE hinst, [in] INSTALLMESSAGE message, [in] MSIHANDLE record ); HRESULT remote_DoAction( [in] MSIHANDLE hinst, [in] BSTR action );
1
0
0
0
Nikolay Sivov : d3d10: Allow setting multiple viewports.
by Alexandre Julliard
17 Apr '18
17 Apr '18
Module: wine Branch: master Commit: 72a04f4b377e9c376d4b1d7d5fbd999a1b1af7b1 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=72a04f4b377e9c376d4b1d7d…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Tue Apr 17 02:16:54 2018 +0300 d3d10: Allow setting multiple viewports. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/d3d10core/tests/device.c | 38 +++++++++++++++++++++++++++++--------- dlls/d3d11/device.c | 25 +++++++++++++------------ 2 files changed, 42 insertions(+), 21 deletions(-) diff --git a/dlls/d3d10core/tests/device.c b/dlls/d3d10core/tests/device.c index 0cfd547..140ffe6 100644 --- a/dlls/d3d10core/tests/device.c +++ b/dlls/d3d10core/tests/device.c @@ -5473,12 +5473,11 @@ float4 main(float4 color : COLOR) : SV_TARGET ID3D10Device_RSGetViewports(device, &count, tmp_viewport); for (i = 0; i < D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE; ++i) { - todo_wine_if(!i) - ok(!tmp_viewport[i].TopLeftX && !tmp_viewport[i].TopLeftY && !tmp_viewport[i].Width - && !tmp_viewport[i].Height && !tmp_viewport[i].MinDepth && !tmp_viewport[i].MaxDepth, - "Got unexpected viewport {%d, %d, %u, %u, %.8e, %.8e} in slot %u.\n", - tmp_viewport[i].TopLeftX, tmp_viewport[i].TopLeftY, tmp_viewport[i].Width, - tmp_viewport[i].Height, tmp_viewport[i].MinDepth, tmp_viewport[i].MaxDepth, i); + ok(!tmp_viewport[i].TopLeftX && !tmp_viewport[i].TopLeftY && !tmp_viewport[i].Width + && !tmp_viewport[i].Height && !tmp_viewport[i].MinDepth && !tmp_viewport[i].MaxDepth, + "Got unexpected viewport {%d, %d, %u, %u, %.8e, %.8e} in slot %u.\n", + tmp_viewport[i].TopLeftX, tmp_viewport[i].TopLeftY, tmp_viewport[i].Width, + tmp_viewport[i].Height, tmp_viewport[i].MinDepth, tmp_viewport[i].MaxDepth, i); } ID3D10Device_RSGetState(device, &tmp_rs_state); ok(!tmp_rs_state, "Got unexpected rasterizer state %p.\n", tmp_rs_state); @@ -16191,6 +16190,7 @@ static void test_multiple_viewports(void) unsigned int draw_id; unsigned int padding[3]; } constant; + D3D10_VIEWPORT vp[D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE + 1]; struct d3d10core_test_context test_context; D3D10_TEXTURE2D_DESC texture_desc; ID3D10RenderTargetView *rtv; @@ -16277,7 +16277,7 @@ static void test_multiple_viewports(void) {0.0f, 1.0f}, {1.0f, 1.0f}, {0.0f, 2.0f}, {0.5f, 0.5f}, {0.5f, 0.5f}, }; static const float clear_color[] = {0.5f, 0.5f, 0.0f, 0.0f}; - D3D10_VIEWPORT vp[2]; + unsigned int count, i; RECT rect; int width; @@ -16340,7 +16340,6 @@ static void test_multiple_viewports(void) SetRect(&rect, 0, 0, width - 1, texture_desc.Height - 1); check_texture_sub_resource_vec4(texture, 0, &rect, &expected_values[0], 1); SetRect(&rect, width, 0, 2 * width - 1, texture_desc.Height - 1); -todo_wine check_texture_sub_resource_vec4(texture, 0, &rect, &expected_values[1], 1); /* One viewport. */ @@ -16360,9 +16359,30 @@ todo_wine constant.draw_id = 3; ID3D10Device_UpdateSubresource(device, (ID3D10Resource *)cb, 0, NULL, &constant, 0, 0); draw_quad(&test_context); -todo_wine check_texture_sub_resource_vec4(texture, 0, NULL, &expected_values[4], 1); + /* Viewport count exceeding maximum value. */ + ID3D10Device_RSSetViewports(device, 1, vp); + + vp[0].TopLeftX = 1.0f; + vp[0].TopLeftY = 0.0f; + vp[0].Width = width; + vp[0].Height = texture_desc.Height; + vp[0].MinDepth = 0.0f; + vp[0].MaxDepth = 1.0f; + for (i = 1; i < ARRAY_SIZE(vp); ++i) + { + vp[i] = vp[0]; + } + ID3D10Device_RSSetViewports(device, ARRAY_SIZE(vp), vp); + + count = ARRAY_SIZE(vp); + memset(vp, 0, sizeof(vp)); + ID3D10Device_RSGetViewports(device, &count, vp); +todo_wine + ok(count == 1, "Unexpected viewport count %d.\n", count); + ok(vp[0].TopLeftX == 0.0f && vp[0].Width == width, "Unexpected viewport.\n"); + ID3D10RenderTargetView_Release(rtv); ID3D10Texture2D_Release(texture); diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c index 9f1533b..248cac6 100644 --- a/dlls/d3d11/device.c +++ b/dlls/d3d11/device.c @@ -4150,25 +4150,26 @@ static void STDMETHODCALLTYPE d3d10_device_RSSetViewports(ID3D10Device1 *iface, UINT viewport_count, const D3D10_VIEWPORT *viewports) { struct d3d_device *device = impl_from_ID3D10Device(iface); - struct wined3d_viewport wined3d_vp; + struct wined3d_viewport wined3d_vp[WINED3D_MAX_VIEWPORTS]; + unsigned int i; TRACE("iface %p, viewport_count %u, viewports %p.\n", iface, viewport_count, viewports); - if (viewport_count > 1) - FIXME("Multiple viewports not implemented.\n"); - - if (!viewport_count) + if (viewport_count > ARRAY_SIZE(wined3d_vp)) return; - wined3d_vp.x = viewports[0].TopLeftX; - wined3d_vp.y = viewports[0].TopLeftY; - wined3d_vp.width = viewports[0].Width; - wined3d_vp.height = viewports[0].Height; - wined3d_vp.min_z = viewports[0].MinDepth; - wined3d_vp.max_z = viewports[0].MaxDepth; + for (i = 0; i < viewport_count; ++i) + { + wined3d_vp[i].x = viewports[i].TopLeftX; + wined3d_vp[i].y = viewports[i].TopLeftY; + wined3d_vp[i].width = viewports[i].Width; + wined3d_vp[i].height = viewports[i].Height; + wined3d_vp[i].min_z = viewports[i].MinDepth; + wined3d_vp[i].max_z = viewports[i].MaxDepth; + } wined3d_mutex_lock(); - wined3d_device_set_viewports(device->wined3d_device, 1, &wined3d_vp); + wined3d_device_set_viewports(device->wined3d_device, viewport_count, wined3d_vp); wined3d_mutex_unlock(); }
1
0
0
0
Nikolay Sivov : d3d11: Allow setting multiple viewports.
by Alexandre Julliard
17 Apr '18
17 Apr '18
Module: wine Branch: master Commit: 5d4b1a85d4c714fde200730ef2cfe9e185835f1b URL:
https://source.winehq.org/git/wine.git/?a=commit;h=5d4b1a85d4c714fde200730e…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Tue Apr 17 02:16:53 2018 +0300 d3d11: Allow setting multiple viewports. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/d3d11/device.c | 25 +++++++++++++------------ dlls/d3d11/tests/d3d11.c | 28 ++++++++++++++++++++++++---- 2 files changed, 37 insertions(+), 16 deletions(-) diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c index 659b33c..9f1533b 100644 --- a/dlls/d3d11/device.c +++ b/dlls/d3d11/device.c @@ -961,25 +961,26 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_RSSetViewports(ID3D11Devic UINT viewport_count, const D3D11_VIEWPORT *viewports) { struct d3d_device *device = device_from_immediate_ID3D11DeviceContext(iface); - struct wined3d_viewport wined3d_vp; + struct wined3d_viewport wined3d_vp[WINED3D_MAX_VIEWPORTS]; + unsigned int i; TRACE("iface %p, viewport_count %u, viewports %p.\n", iface, viewport_count, viewports); - if (viewport_count > 1) - FIXME("Multiple viewports not implemented.\n"); - - if (!viewport_count) + if (viewport_count > ARRAY_SIZE(wined3d_vp)) return; - wined3d_vp.x = viewports[0].TopLeftX; - wined3d_vp.y = viewports[0].TopLeftY; - wined3d_vp.width = viewports[0].Width; - wined3d_vp.height = viewports[0].Height; - wined3d_vp.min_z = viewports[0].MinDepth; - wined3d_vp.max_z = viewports[0].MaxDepth; + for (i = 0; i < viewport_count; ++i) + { + wined3d_vp[i].x = viewports[i].TopLeftX; + wined3d_vp[i].y = viewports[i].TopLeftY; + wined3d_vp[i].width = viewports[i].Width; + wined3d_vp[i].height = viewports[i].Height; + wined3d_vp[i].min_z = viewports[i].MinDepth; + wined3d_vp[i].max_z = viewports[i].MaxDepth; + } wined3d_mutex_lock(); - wined3d_device_set_viewports(device->wined3d_device, 1, &wined3d_vp); + wined3d_device_set_viewports(device->wined3d_device, viewport_count, wined3d_vp); wined3d_mutex_unlock(); } diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c index 36320f4..b917dcf 100644 --- a/dlls/d3d11/tests/d3d11.c +++ b/dlls/d3d11/tests/d3d11.c @@ -10578,7 +10578,6 @@ static void test_clear_state(void) ID3D11DeviceContext_RSGetViewports(context, &count, tmp_viewport); for (i = 0; i < D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE; ++i) { - todo_wine_if(!i) ok(!tmp_viewport[i].TopLeftX && !tmp_viewport[i].TopLeftY && !tmp_viewport[i].Width && !tmp_viewport[i].Height && !tmp_viewport[i].MinDepth && !tmp_viewport[i].MaxDepth, "Got unexpected viewport {%.8e, %.8e, %.8e, %.8e, %.8e, %.8e} in slot %u.\n", @@ -25927,6 +25926,7 @@ static void test_multiple_viewports(void) unsigned int draw_id; unsigned int padding[3]; } constant; + D3D11_VIEWPORT vp[D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE + 1]; struct d3d11_test_context test_context; D3D11_TEXTURE2D_DESC texture_desc; ID3D11DeviceContext *context; @@ -26014,7 +26014,7 @@ static void test_multiple_viewports(void) {0.0f, 1.0f}, {1.0f, 1.0f}, {0.0f, 2.0f}, {0.5f, 0.5f}, {0.5f, 0.5f}, }; static const float clear_color[] = {0.5f, 0.5f, 0.0f, 0.0f}; - D3D11_VIEWPORT vp[2]; + unsigned int count, i; RECT rect; int width; @@ -26078,7 +26078,6 @@ static void test_multiple_viewports(void) SetRect(&rect, 0, 0, width - 1, texture_desc.Height - 1); check_texture_sub_resource_vec4(texture, 0, &rect, &expected_values[0], 1); SetRect(&rect, width, 0, 2 * width - 1, texture_desc.Height - 1); -todo_wine check_texture_sub_resource_vec4(texture, 0, &rect, &expected_values[1], 1); /* One viewport. */ @@ -26098,9 +26097,30 @@ todo_wine constant.draw_id = 3; ID3D11DeviceContext_UpdateSubresource(context, (ID3D11Resource *)cb, 0, NULL, &constant, 0, 0); draw_quad(&test_context); -todo_wine check_texture_sub_resource_vec4(texture, 0, NULL, &expected_values[4], 1); + /* Viewport count exceeding maximum value. */ + ID3D11DeviceContext_RSSetViewports(context, 1, vp); + + vp[0].TopLeftX = 1.0f; + vp[0].TopLeftY = 0.0f; + vp[0].Width = width; + vp[0].Height = texture_desc.Height; + vp[0].MinDepth = 0.0f; + vp[0].MaxDepth = 1.0f; + for (i = 1; i < ARRAY_SIZE(vp); ++i) + { + vp[i] = vp[0]; + } + ID3D11DeviceContext_RSSetViewports(context, ARRAY_SIZE(vp), vp); + + count = ARRAY_SIZE(vp); + memset(vp, 0, sizeof(vp)); + ID3D11DeviceContext_RSGetViewports(context, &count, vp); +todo_wine + ok(count == 1, "Unexpected viewport count %d.\n", count); + ok(vp[0].TopLeftX == 0.0f && vp[0].Width == width, "Unexpected viewport.\n"); + ID3D11RenderTargetView_Release(rtv); ID3D11Texture2D_Release(texture);
1
0
0
0
Józef Kucia : d3d9: Validate adapter format in CheckDeviceFormat().
by Alexandre Julliard
17 Apr '18
17 Apr '18
Module: wine Branch: master Commit: 17e04ba43972f259721dae004513251f44ef641c URL:
https://source.winehq.org/git/wine.git/?a=commit;h=17e04ba43972f259721dae00…
Author: Józef Kucia <jkucia(a)codeweavers.com> Date: Tue Apr 17 14:26:53 2018 +0200 d3d9: Validate adapter format in CheckDeviceFormat(). Signed-off-by: Józef Kucia <jkucia(a)codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/d3d9/directx.c | 6 ++++++ dlls/d3d9/tests/device.c | 17 +++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/dlls/d3d9/directx.c b/dlls/d3d9/directx.c index cdce669..98f4a99 100644 --- a/dlls/d3d9/directx.c +++ b/dlls/d3d9/directx.c @@ -254,6 +254,12 @@ static HRESULT WINAPI d3d9_CheckDeviceFormat(IDirect3D9Ex *iface, UINT adapter, TRACE("iface %p, adapter %u, device_type %#x, adapter_format %#x, usage %#x, resource_type %#x, format %#x.\n", iface, adapter, device_type, adapter_format, usage, resource_type, format); + if (!adapter_format) + { + WARN("Invalid adapter format.\n"); + return D3DERR_INVALIDCALL; + } + usage = usage & (WINED3DUSAGE_MASK | WINED3DUSAGE_QUERY_MASK); switch (resource_type) { diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c index dc900f1..0eba766 100644 --- a/dlls/d3d9/tests/device.c +++ b/dlls/d3d9/tests/device.c @@ -11638,6 +11638,7 @@ static void test_check_device_format(void) D3DFORMAT adapter_format, format; BOOL render_target_supported; + D3DDEVTYPE device_type; unsigned int i, j; IDirect3D9 *d3d; HRESULT hr; @@ -11660,6 +11661,22 @@ static void test_check_device_format(void) ok(FAILED(hr), "Got unexpected hr %#x.\n", hr); } + for (device_type = D3DDEVTYPE_HAL; device_type < D3DDEVTYPE_NULLREF; ++device_type) + { + hr = IDirect3D9_CheckDeviceFormat(d3d, 0, device_type, D3DFMT_UNKNOWN, + 0, D3DRTYPE_SURFACE, D3DFMT_A8R8G8B8); + ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x, device type %#x.\n", hr, device_type); + hr = IDirect3D9_CheckDeviceFormat(d3d, 0, device_type, D3DFMT_UNKNOWN, + 0, D3DRTYPE_TEXTURE, D3DFMT_A8R8G8B8); + ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x, device type %#x.\n", hr, device_type); + hr = IDirect3D9_CheckDeviceFormat(d3d, 0, device_type, D3DFMT_UNKNOWN, + 0, D3DRTYPE_SURFACE, D3DFMT_X8R8G8B8); + ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x, device type %#x.\n", hr, device_type); + hr = IDirect3D9_CheckDeviceFormat(d3d, 0, device_type, D3DFMT_UNKNOWN, + 0, D3DRTYPE_TEXTURE, D3DFMT_X8R8G8B8); + ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x, device type %#x.\n", hr, device_type); + } + hr = IDirect3D9_CheckDeviceFormat(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, 0, D3DRTYPE_VERTEXBUFFER, D3DFMT_VERTEXDATA); todo_wine ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
1
0
0
0
← Newer
1
...
24
25
26
27
28
29
30
...
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