ReactOS.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
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
List overview
Download
Ros-diffs
March 2022
----- 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
ros-diffs@reactos.org
20 participants
436 discussions
Start a n
N
ew thread
[reactos] 281/360: [WINESYNC] msi: Support ALTER TABLE when MSITRANSFORM_ERROR_VIEWTRANSFORM flag is used.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=28c50c1ac7ffcd7911052…
commit 28c50c1ac7ffcd79110523e12e938a03c4e7edb7 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sun Mar 13 19:08:39 2022 +0100 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Sun Mar 20 19:28:29 2022 +0100 [WINESYNC] msi: Support ALTER TABLE when MSITRANSFORM_ERROR_VIEWTRANSFORM flag is used. Signed-off-by: Piotr Caban <piotr(a)codeweavers.com> Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id ae6fd7b14792b932832da6f5d5088d500723c386 by Piotr Caban <piotr(a)codeweavers.com> --- dll/win32/msi/table.c | 152 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 149 insertions(+), 3 deletions(-) diff --git a/dll/win32/msi/table.c b/dll/win32/msi/table.c index 6929bf25602..56d55d32cc1 100644 --- a/dll/win32/msi/table.c +++ b/dll/win32/msi/table.c @@ -2256,7 +2256,7 @@ static UINT TransformView_fetch_int( MSIVIEW *view, UINT row, UINT col, UINT *va { MSITABLEVIEW *tv = (MSITABLEVIEW*)view; - if (!tv->table) + if (!tv->table || col > tv->table->col_count) { *val = 0; return ERROR_SUCCESS; @@ -2268,7 +2268,7 @@ static UINT TransformView_fetch_stream( MSIVIEW *view, UINT row, UINT col, IStre { MSITABLEVIEW *tv = (MSITABLEVIEW*)view; - if (!tv->table) + if (!tv->table || col > tv->table->col_count) { *stm = NULL; return ERROR_SUCCESS; @@ -2452,6 +2452,59 @@ static UINT TransformView_create_table( MSITABLEVIEW *tv, MSIRECORD *rec ) return r; } +static UINT TransformView_add_column( MSITABLEVIEW *tv, MSIRECORD *rec ) +{ + static const WCHAR query_pfx[] = + L"INSERT INTO `_TransformView` (`Table`, `Current`, `Column`, `Data`) VALUES ('"; + + WCHAR buf[256], *query = buf; + UINT i, p, len, r, qlen; + MSIQUERY *q; + + qlen = p = wcslen( query_pfx ); + for (i = 1; i <= 4; i++) + { + r = MSI_RecordGetStringW( rec, i, NULL, &len ); + if (r != ERROR_SUCCESS) + return r; + qlen += len + 3; /* strlen( "','" ) */ + } + + if (qlen > ARRAY_SIZE(buf)) + { + query = msi_alloc( len * sizeof(WCHAR) ); + qlen = len; + if (!query) + return ERROR_OUTOFMEMORY; + } + + memcpy( query, query_pfx, p * sizeof(WCHAR) ); + for (i = 1; i <= 4; i++) + { + len = qlen - p; + MSI_RecordGetStringW( rec, i, query + p, &len ); + p += len; + query[p++] = '\''; + if (i != 4) + { + query[p++] = ','; + query[p++] = '\''; + } + } + query[p++] = ')'; + query[p++] = 0; + + r = MSI_DatabaseOpenViewW( tv->db, query, &q ); + if (query != buf) + msi_free( query ); + if (r != ERROR_SUCCESS) + return r; + + r = MSI_ViewExecute( q, NULL ); + msiobj_release( &q->hdr ); + return r; +} + static UINT TransformView_insert_row( MSIVIEW *view, MSIRECORD *rec, UINT row, BOOL temporary ) { MSITABLEVIEW *tv = (MSITABLEVIEW*)view; @@ -2459,6 +2512,9 @@ static UINT TransformView_insert_row( MSIVIEW *view, MSIRECORD *rec, UINT row, B if (!wcscmp(tv->name, szTables)) return TransformView_create_table( tv, rec ); + if (!wcscmp(tv->name, szColumns)) + return TransformView_add_column( tv, rec ); + FIXME("\n"); return ERROR_CALL_NOT_IMPLEMENTED; } @@ -2492,6 +2548,9 @@ static UINT TransformView_get_column_info( MSIVIEW *view, UINT n, LPCWSTR *name, static UINT TransformView_delete( MSIVIEW *view ) { + MSITABLEVIEW *tv = (MSITABLEVIEW*)view; + if (!tv->table || tv->columns != tv->table->colinfo) + msi_free( tv->columns ); return TABLE_delete( view ); } @@ -2520,8 +2579,15 @@ static const MSIVIEWOPS transform_view_ops = UINT TransformView_Create( MSIDATABASE *db, string_table *st, LPCWSTR name, MSIVIEW **view ) { - UINT r, name_len, size; + static const WCHAR query_pfx[] = L"SELECT `Column`, `Data`, `Current` FROM `_TransformView` WHERE `Table`='"; + static const WCHAR query_sfx[] = L"' AND `Row` IS NULL AND `Current` IS NOT NULL"; + + WCHAR buf[256], *query = buf; + UINT r, len, name_len, size, add_col; + MSICOLUMNINFO *colinfo; MSITABLEVIEW *tv; + MSIRECORD *rec; + MSIQUERY *q; name_len = wcslen( name ); @@ -2548,6 +2614,86 @@ UINT TransformView_Create( MSIDATABASE *db, string_table *st, LPCWSTR name, MSIV } tv->view.ops = &transform_view_ops; + + len = ARRAY_SIZE(query_pfx) + name_len + ARRAY_SIZE(query_sfx) - 1; + if (len > ARRAY_SIZE(buf)) + { + query = msi_alloc( len * sizeof(WCHAR) ); + if (!query) + { + msi_free( tv ); + return ERROR_OUTOFMEMORY; + } + } + memcpy( query, query_pfx, ARRAY_SIZE(query_pfx) * sizeof(WCHAR) ); + len = ARRAY_SIZE(query_pfx) - 1; + memcpy( query + len, name, name_len * sizeof(WCHAR) ); + len += name_len; + memcpy( query + len, query_sfx, ARRAY_SIZE(query_sfx) * sizeof(WCHAR) ); + + r = MSI_DatabaseOpenViewW( tv->db, query, &q ); + if (query != buf) + msi_free( query ); + if (r != ERROR_SUCCESS) + { + msi_free( tv ); + return r; + } + + r = MSI_ViewExecute( q, NULL ); + if (r != ERROR_SUCCESS) + { + msi_free( tv ); + return r; + } + + r = q->view->ops->get_dimensions( q->view, &add_col, NULL ); + if (r != ERROR_SUCCESS) + { + MSI_ViewClose( q ); + msiobj_release( &q->hdr ); + msi_free( tv ); + return r; + } + if (!add_col) + { + MSI_ViewClose( q ); + msiobj_release( &q->hdr ); + return ERROR_SUCCESS; + } + + colinfo = msi_alloc_zero( (add_col + tv->num_cols) * sizeof(*colinfo) ); + if (!colinfo) + { + MSI_ViewClose( q ); + msiobj_release( &q->hdr ); + msi_free( tv ); + return r; + } + + while (MSI_ViewFetch( q, &rec ) == ERROR_SUCCESS) + { + int name_len; + const WCHAR *name = msi_record_get_string( rec, 1, &name_len ); + const WCHAR *type = msi_record_get_string( rec, 2, NULL ); + UINT name_id, idx; + + idx = _wtoi( msi_record_get_string(rec, 3, NULL) ); + colinfo[idx - 1].number = idx; + colinfo[idx - 1].type = _wtoi( type ); + + r = msi_string2id( st, name, name_len, &name_id ); + if (r == ERROR_SUCCESS) + colinfo[idx - 1].colname = msi_string_lookup( st, name_id, NULL ); + else + ERR( "column name %s is not defined in strings table\n", wine_dbgstr_w(name) ); + } + MSI_ViewClose( q ); + msiobj_release( &q->hdr ); + + memcpy( colinfo, tv->columns, tv->num_cols * sizeof(*colinfo) ); + tv->columns = colinfo; + tv->num_cols += add_col; return ERROR_SUCCESS; }
2 years, 9 months
1
0
0
0
[reactos] 280/360: [WINESYNC] msi: Support CREATE when MSITRANSFORM_ERROR_VIEWTRANSFORM flag is used.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=27a430bda6068f04a21a0…
commit 27a430bda6068f04a21a0d37191ae7e079bcc103 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sun Mar 13 19:08:38 2022 +0100 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Sun Mar 20 19:28:29 2022 +0100 [WINESYNC] msi: Support CREATE when MSITRANSFORM_ERROR_VIEWTRANSFORM flag is used. Signed-off-by: Piotr Caban <piotr(a)codeweavers.com> Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id 7e4077fb6d77810e40e842e7557c03ab3abe0593 by Piotr Caban <piotr(a)codeweavers.com> --- dll/win32/msi/table.c | 73 ++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 69 insertions(+), 4 deletions(-) diff --git a/dll/win32/msi/table.c b/dll/win32/msi/table.c index 9a839439e6c..6929bf25602 100644 --- a/dll/win32/msi/table.c +++ b/dll/win32/msi/table.c @@ -2254,11 +2254,25 @@ static UINT msi_record_stream_name( const MSITABLEVIEW *tv, MSIRECORD *rec, LPWS static UINT TransformView_fetch_int( MSIVIEW *view, UINT row, UINT col, UINT *val ) { + MSITABLEVIEW *tv = (MSITABLEVIEW*)view; + + if (!tv->table) + { + *val = 0; + return ERROR_SUCCESS; + } return TABLE_fetch_int( view, row, col, val ); } static UINT TransformView_fetch_stream( MSIVIEW *view, UINT row, UINT col, IStream **stm ) { + MSITABLEVIEW *tv = (MSITABLEVIEW*)view; + + if (!tv->table) + { + *stm = NULL; + return ERROR_SUCCESS; + } return TABLE_fetch_stream( view, row, col, stm ); } @@ -2403,8 +2417,48 @@ static UINT TransformView_set_row( MSIVIEW *view, UINT row, MSIRECORD *rec, UINT return ERROR_SUCCESS; } +static UINT TransformView_create_table( MSITABLEVIEW *tv, MSIRECORD *rec ) +{ + static const WCHAR query_fmt[] = + L"INSERT INTO `_TransformView` (`Table`, `Column`) VALUES ('%s', 'CREATE')"; + + WCHAR buf[256], *query = buf; + const WCHAR *name; + MSIQUERY *q; + int len; + UINT r; + + name = msi_record_get_string( rec, 1, &len ); + if (!name) + return ERROR_INSTALL_TRANSFORM_FAILURE; + + len = _snwprintf( NULL, 0, query_fmt, name ) + 1; + if (len > ARRAY_SIZE(buf)) + { + query = msi_alloc( len * sizeof(WCHAR) ); + if (!query) + return ERROR_OUTOFMEMORY; + } + swprintf( query, len, query_fmt, name ); + + r = MSI_DatabaseOpenViewW( tv->db, query, &q ); + if (query != buf) + msi_free( query ); + if (r != ERROR_SUCCESS) + return r; + + r = MSI_ViewExecute( q, NULL ); + msiobj_release( &q->hdr ); + return r; +} + static UINT TransformView_insert_row( MSIVIEW *view, MSIRECORD *rec, UINT row, BOOL temporary ) { + MSITABLEVIEW *tv = (MSITABLEVIEW*)view; + + if (!wcscmp(tv->name, szTables)) + return TransformView_create_table( tv, rec ); + FIXME("\n"); return ERROR_CALL_NOT_IMPLEMENTED; } @@ -2466,15 +2520,23 @@ static const MSIVIEWOPS transform_view_ops = UINT TransformView_Create( MSIDATABASE *db, string_table *st, LPCWSTR name, MSIVIEW **view ) { + UINT r, name_len, size; MSITABLEVIEW *tv; - UINT r; + + name_len = wcslen( name ); r = TABLE_CreateView( db, name, view ); if (r == ERROR_INVALID_PARAMETER) { /* table does not exist */ - FIXME("\n"); - return ERROR_CALL_NOT_IMPLEMENTED; + size = FIELD_OFFSET( MSITABLEVIEW, name[name_len + 1] ); + tv = msi_alloc_zero( size ); + if (!tv) + return ERROR_OUTOFMEMORY; + + tv->db = db; + memcpy( tv->name, name, name_len * sizeof(WCHAR) ); + *view = (MSIVIEW*)tv; } else if (r != ERROR_SUCCESS) { @@ -2912,7 +2974,10 @@ static UINT msi_table_load_transform( MSIDATABASE *db, IStorage *stg, if (TRACE_ON(msidb)) dump_record( rec ); - r = msi_table_find_row( tv, rec, &row, NULL ); + if (tv->table) + r = msi_table_find_row( tv, rec, &row, NULL ); + else + r = ERROR_FUNCTION_FAILED; if (r == ERROR_SUCCESS) { if (!mask)
2 years, 9 months
1
0
0
0
[reactos] 279/360: [WINESYNC] msi: Support UPDATE when MSITRANSFORM_ERROR_VIEWTRANSFORM flag is used.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=317c1f6c0560a1b94c869…
commit 317c1f6c0560a1b94c869c938d70657adfced87d Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sun Mar 13 19:08:38 2022 +0100 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Sun Mar 20 19:28:29 2022 +0100 [WINESYNC] msi: Support UPDATE when MSITRANSFORM_ERROR_VIEWTRANSFORM flag is used. Signed-off-by: Piotr Caban <piotr(a)codeweavers.com> Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id 6e7303a7006538d3df1a09e13f5a5f469098b35f by Piotr Caban <piotr(a)codeweavers.com> --- dll/win32/msi/table.c | 183 +++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 173 insertions(+), 10 deletions(-) diff --git a/dll/win32/msi/table.c b/dll/win32/msi/table.c index ff61f2f6828..9a839439e6c 100644 --- a/dll/win32/msi/table.c +++ b/dll/win32/msi/table.c @@ -2188,6 +2188,38 @@ UINT TABLE_CreateView( MSIDATABASE *db, LPCWSTR name, MSIVIEW **view ) return ERROR_SUCCESS; } +static WCHAR* create_key_string(MSITABLEVIEW *tv, MSIRECORD *rec) +{ + DWORD i, p, len, key_len = 0; + WCHAR *key; + + for (i = 0; i < tv->num_cols; i++) + { + if (!(tv->columns[i].type & MSITYPE_KEY)) + continue; + if (MSI_RecordGetStringW( rec, i+1, NULL, &len ) == ERROR_SUCCESS) + key_len += len; + key_len++; + } + + key = msi_alloc( key_len * sizeof(WCHAR) ); + if(!key) + return NULL; + + p = 0; + for (i = 0; i < tv->num_cols; i++) + { + if (!(tv->columns[i].type & MSITYPE_KEY)) + continue; + if (p) + key[p++] = '\t'; + len = key_len - p; + if (MSI_RecordGetStringW( rec, i+1, key + p, &len ) == ERROR_SUCCESS) + p += len; + } + return key; +} + static UINT msi_record_stream_name( const MSITABLEVIEW *tv, MSIRECORD *rec, LPWSTR name, UINT *len ) { UINT p = 0, l, i, r; @@ -2222,20 +2254,153 @@ static UINT msi_record_stream_name( const MSITABLEVIEW *tv, MSIRECORD *rec, LPWS static UINT TransformView_fetch_int( MSIVIEW *view, UINT row, UINT col, UINT *val ) { - FIXME("\n"); - return ERROR_CALL_NOT_IMPLEMENTED; + return TABLE_fetch_int( view, row, col, val ); } static UINT TransformView_fetch_stream( MSIVIEW *view, UINT row, UINT col, IStream **stm ) { - FIXME("\n"); - return ERROR_CALL_NOT_IMPLEMENTED; + return TABLE_fetch_stream( view, row, col, stm ); } static UINT TransformView_set_row( MSIVIEW *view, UINT row, MSIRECORD *rec, UINT mask ) { - FIXME("\n"); - return ERROR_CALL_NOT_IMPLEMENTED; + static const WCHAR query_pfx[] = + L"INSERT INTO `_TransformView` (`Table`, `Column`, `Row`, `Data`, `Current`) VALUES ('"; + + MSITABLEVIEW *tv = (MSITABLEVIEW*)view; + WCHAR buf[256], *query = buf; + MSIRECORD *old_rec; + MSIQUERY *q; + WCHAR *key; + UINT i, p, r, len, qlen; + + if (!wcscmp( tv->name, szColumns )) + { + ERR( "trying to modify existing column\n" ); + return ERROR_INSTALL_TRANSFORM_FAILURE; + } + + if (!wcscmp( tv->name, szTables )) + { + ERR( "trying to modify existing table\n" ); + return ERROR_INSTALL_TRANSFORM_FAILURE; + } + + key = create_key_string( tv, rec ); + if (!key) + return ERROR_OUTOFMEMORY; + + r = msi_view_get_row( tv->db, view, row, &old_rec ); + if (r != ERROR_SUCCESS) + old_rec = NULL; + + for (i = 0; i < tv->num_cols; i++) + { + if (!(mask & (1 << i))) + continue; + if (tv->columns[i].type & MSITYPE_KEY) + continue; + + qlen = p = wcslen( query_pfx ); + qlen += wcslen( tv->name ) + 3; /* strlen("','") */ + qlen += wcslen( tv->columns[i].colname ) + 3; + qlen += wcslen( key ) + 3; + if (MSITYPE_IS_BINARY( tv->columns[i].type )) + r = msi_record_stream_name( tv, rec, NULL, &len ); + else + r = MSI_RecordGetStringW( rec, i + 1, NULL, &len ); + if (r != ERROR_SUCCESS) + { + if (old_rec) + msiobj_release( &old_rec->hdr ); + msi_free( key ); + return r; + } + qlen += len + 3; + if (old_rec && (r = MSI_RecordGetStringW( old_rec, i+1, NULL, &len ))) + { + msiobj_release( &old_rec->hdr ); + msi_free( key ); + return r; + } + qlen += len + 3; /* strlen("')") + 1 */ + + if (qlen > ARRAY_SIZE(buf)) + { + query = msi_alloc( qlen * sizeof(WCHAR) ); + if (!query) + { + if (old_rec) + msiobj_release( &old_rec->hdr ); + msi_free( key ); + return ERROR_OUTOFMEMORY; + } + } + + memcpy( query, query_pfx, p * sizeof(WCHAR) ); + len = wcslen( tv->name ); + memcpy( query + p, tv->name, len * sizeof(WCHAR) ); + p += len; + query[p++] = '\''; + query[p++] = ','; + query[p++] = '\''; + len = wcslen( tv->columns[i].colname ); + memcpy( query + p, tv->columns[i].colname, len * sizeof(WCHAR) ); + p += len; + query[p++] = '\''; + query[p++] = ','; + query[p++] = '\''; + len = wcslen( key ); + memcpy( query + p, key, len * sizeof(WCHAR) ); + p += len; + query[p++] = '\''; + query[p++] = ','; + query[p++] = '\''; + len = qlen - p; + if (MSITYPE_IS_BINARY( tv->columns[i].type )) + msi_record_stream_name( tv, rec, query + p, &len ); + else + MSI_RecordGetStringW( rec, i + 1, query + p, &len ); + p += len; + query[p++] = '\''; + query[p++] = ','; + query[p++] = '\''; + if (old_rec) + { + len = qlen - p; + MSI_RecordGetStringW( old_rec, i + 1, query + p, &len ); + p += len; + } + query[p++] = '\''; + query[p++] = ')'; + query[p++] = 0; + + r = MSI_DatabaseOpenViewW( tv->db, query, &q ); + if (query != buf) + msi_free( query ); + if (r != ERROR_SUCCESS) + { + if (old_rec) + msiobj_release( &old_rec->hdr ); + msi_free( key ); + return r; + } + + r = MSI_ViewExecute( q, NULL ); + msiobj_release( &q->hdr ); + if (r != ERROR_SUCCESS) + { + if (old_rec) + msiobj_release( &old_rec->hdr ); + msi_free( key ); + return r; + } + } + + if (old_rec) + msiobj_release( &old_rec->hdr ); + msi_free( key ); + return ERROR_SUCCESS; } static UINT TransformView_insert_row( MSIVIEW *view, MSIRECORD *rec, UINT row, BOOL temporary ) @@ -2262,15 +2427,13 @@ static UINT TransformView_close( MSIVIEW *view ) static UINT TransformView_get_dimensions( MSIVIEW *view, UINT *rows, UINT *cols ) { - FIXME("\n"); - return ERROR_CALL_NOT_IMPLEMENTED; + return TABLE_get_dimensions( view, rows, cols ); } static UINT TransformView_get_column_info( MSIVIEW *view, UINT n, LPCWSTR *name, UINT *type, BOOL *temporary, LPCWSTR *table_name ) { - FIXME("\n"); - return ERROR_CALL_NOT_IMPLEMENTED; + return TABLE_get_column_info( view, n, name, type, temporary, table_name ); } static UINT TransformView_delete( MSIVIEW *view )
2 years, 9 months
1
0
0
0
[reactos] 278/360: [WINESYNC] msi: Add stub support for MSITRANSFORM_ERROR_VIEWTRANSFORM flag in MsiApplyTransform.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=1bbb87bb269b82238f412…
commit 1bbb87bb269b82238f412fa262a7fff4b8406790 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sun Mar 13 19:08:38 2022 +0100 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Sun Mar 20 19:28:28 2022 +0100 [WINESYNC] msi: Add stub support for MSITRANSFORM_ERROR_VIEWTRANSFORM flag in MsiApplyTransform. Signed-off-by: Piotr Caban <piotr(a)codeweavers.com> Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id 8bc835b4517728fac8ff8a9cfa5e59b843e9a8df by Piotr Caban <piotr(a)codeweavers.com> --- dll/win32/msi/msipriv.h | 2 +- dll/win32/msi/msiquery.c | 4 +- dll/win32/msi/patch.c | 2 +- dll/win32/msi/table.c | 168 +++++++++++++++++++++++++++++++++++++++++++---- 4 files changed, 161 insertions(+), 15 deletions(-) diff --git a/dll/win32/msi/msipriv.h b/dll/win32/msi/msipriv.h index 2832461528e..6f2992d10ea 100644 --- a/dll/win32/msi/msipriv.h +++ b/dll/win32/msi/msipriv.h @@ -794,7 +794,7 @@ extern UINT write_stream_data( IStorage *stg, LPCWSTR stname, LPCVOID data, UINT sz, BOOL bTable ) DECLSPEC_HIDDEN; /* transform functions */ -extern UINT msi_table_apply_transform( MSIDATABASE *db, IStorage *stg ) DECLSPEC_HIDDEN; +extern UINT msi_table_apply_transform( MSIDATABASE *db, IStorage *stg, int err_cond ) DECLSPEC_HIDDEN; extern UINT MSI_DatabaseApplyTransformW( MSIDATABASE *db, LPCWSTR szTransformFile, int iErrorCond ) DECLSPEC_HIDDEN; extern void append_storage_to_db( MSIDATABASE *db, IStorage *stg ) DECLSPEC_HIDDEN; diff --git a/dll/win32/msi/msiquery.c b/dll/win32/msi/msiquery.c index a64bbc08899..b55e8b920fd 100644 --- a/dll/win32/msi/msiquery.c +++ b/dll/win32/msi/msiquery.c @@ -907,7 +907,7 @@ UINT MSI_DatabaseApplyTransformW( MSIDATABASE *db, const WCHAR *transform, int e if (!IsEqualGUID( &stat.clsid, &CLSID_MsiTransform )) goto end; if (TRACE_ON( msi )) enum_stream_names( stg ); - ret = msi_table_apply_transform( db, stg ); + ret = msi_table_apply_transform( db, stg, error_cond ); end: IStorage_Release( stg ); @@ -919,7 +919,7 @@ UINT WINAPI MsiDatabaseApplyTransformW( MSIHANDLE hdb, const WCHAR *transform, i MSIDATABASE *db; UINT r; - if (error_cond) FIXME( "ignoring error conditions\n" ); + if (error_cond & ~MSITRANSFORM_ERROR_VIEWTRANSFORM) FIXME( "ignoring error conditions\n" ); if (!(db = msihandle2msiinfo(hdb, MSIHANDLETYPE_DATABASE))) return ERROR_INVALID_HANDLE; diff --git a/dll/win32/msi/patch.c b/dll/win32/msi/patch.c index 35b8463858e..1233ec306bf 100644 --- a/dll/win32/msi/patch.c +++ b/dll/win32/msi/patch.c @@ -274,7 +274,7 @@ static UINT apply_substorage_transform( MSIPACKAGE *package, MSIDATABASE *patch_ { ret = check_transform_applicable( package, stg ); if (ret == ERROR_SUCCESS) - msi_table_apply_transform( package->db, stg ); + msi_table_apply_transform( package->db, stg, 0 ); else TRACE("substorage transform %s wasn't applicable\n", debugstr_w(name)); IStorage_Release( stg ); diff --git a/dll/win32/msi/table.c b/dll/win32/msi/table.c index f0c36b00131..ff61f2f6828 100644 --- a/dll/win32/msi/table.c +++ b/dll/win32/msi/table.c @@ -2220,6 +2220,112 @@ static UINT msi_record_stream_name( const MSITABLEVIEW *tv, MSIRECORD *rec, LPWS return ERROR_SUCCESS; } +static UINT TransformView_fetch_int( MSIVIEW *view, UINT row, UINT col, UINT *val ) +{ + FIXME("\n"); + return ERROR_CALL_NOT_IMPLEMENTED; +} + +static UINT TransformView_fetch_stream( MSIVIEW *view, UINT row, UINT col, IStream **stm ) +{ + FIXME("\n"); + return ERROR_CALL_NOT_IMPLEMENTED; +} + +static UINT TransformView_set_row( MSIVIEW *view, UINT row, MSIRECORD *rec, UINT mask ) +{ + FIXME("\n"); + return ERROR_CALL_NOT_IMPLEMENTED; +} + +static UINT TransformView_insert_row( MSIVIEW *view, MSIRECORD *rec, UINT row, BOOL temporary ) +{ + FIXME("\n"); + return ERROR_CALL_NOT_IMPLEMENTED; +} + +static UINT TransformView_delete_row( MSIVIEW *view, UINT row ) +{ + FIXME("\n"); + return ERROR_CALL_NOT_IMPLEMENTED; +} + +static UINT TransformView_execute( MSIVIEW *view, MSIRECORD *record ) +{ + return ERROR_SUCCESS; +} + +static UINT TransformView_close( MSIVIEW *view ) +{ + return ERROR_SUCCESS; +} + +static UINT TransformView_get_dimensions( MSIVIEW *view, UINT *rows, UINT *cols ) +{ + FIXME("\n"); + return ERROR_CALL_NOT_IMPLEMENTED; +} + +static UINT TransformView_get_column_info( MSIVIEW *view, UINT n, LPCWSTR *name, UINT *type, + BOOL *temporary, LPCWSTR *table_name ) +{ + FIXME("\n"); + return ERROR_CALL_NOT_IMPLEMENTED; +} + +static UINT TransformView_delete( MSIVIEW *view ) +{ + return TABLE_delete( view ); +} + +static const MSIVIEWOPS transform_view_ops = +{ + TransformView_fetch_int, + TransformView_fetch_stream, + NULL, + NULL, + NULL, + TransformView_set_row, + TransformView_insert_row, + TransformView_delete_row, + TransformView_execute, + TransformView_close, + TransformView_get_dimensions, + TransformView_get_column_info, + NULL, + TransformView_delete, + NULL, + NULL, + NULL, + NULL, + NULL +}; + +UINT TransformView_Create( MSIDATABASE *db, string_table *st, LPCWSTR name, MSIVIEW **view ) +{ + MSITABLEVIEW *tv; + UINT r; + + r = TABLE_CreateView( db, name, view ); + if (r == ERROR_INVALID_PARAMETER) + { + /* table does not exist */ + FIXME("\n"); + return ERROR_CALL_NOT_IMPLEMENTED; + } + else if (r != ERROR_SUCCESS) + { + return r; + } + else + { + tv = (MSITABLEVIEW*)*view; + } + + tv->view.ops = &transform_view_ops; + return ERROR_SUCCESS; +} + UINT MSI_CommitTables( MSIDATABASE *db ) { UINT r, bytes_per_strref; @@ -2510,7 +2616,7 @@ typedef struct static UINT msi_table_load_transform( MSIDATABASE *db, IStorage *stg, string_table *st, TRANSFORMDATA *transform, - UINT bytes_per_strref ) + UINT bytes_per_strref, int err_cond ) { BYTE *rawdata = NULL; MSITABLEVIEW *tv = NULL; @@ -2536,7 +2642,10 @@ static UINT msi_table_load_transform( MSIDATABASE *db, IStorage *stg, } /* create a table view */ - r = TABLE_CreateView( db, name, (MSIVIEW**) &tv ); + if ( err_cond & MSITRANSFORM_ERROR_VIEWTRANSFORM ) + r = TransformView_Create( db, st, name, (MSIVIEW**) &tv ); + else + r = TABLE_CreateView( db, name, (MSIVIEW**) &tv ); if( r != ERROR_SUCCESS ) goto err; @@ -2646,21 +2755,21 @@ static UINT msi_table_load_transform( MSIDATABASE *db, IStorage *stg, if (!mask) { TRACE("deleting row [%d]:\n", row); - r = TABLE_delete_row( &tv->view, row ); + r = tv->view.ops->delete_row( &tv->view, row ); if (r != ERROR_SUCCESS) WARN("failed to delete row %u\n", r); } else if (mask & 1) { TRACE("modifying full row [%d]:\n", row); - r = TABLE_set_row( &tv->view, row, rec, (1 << tv->num_cols) - 1 ); + r = tv->view.ops->set_row( &tv->view, row, rec, (1 << tv->num_cols) - 1 ); if (r != ERROR_SUCCESS) WARN("failed to modify row %u\n", r); } else { TRACE("modifying masked row [%d]:\n", row); - r = TABLE_set_row( &tv->view, row, rec, mask ); + r = tv->view.ops->set_row( &tv->view, row, rec, mask ); if (r != ERROR_SUCCESS) WARN("failed to modify row %u\n", r); } @@ -2668,12 +2777,13 @@ static UINT msi_table_load_transform( MSIDATABASE *db, IStorage *stg, else { TRACE("inserting row\n"); - r = TABLE_insert_row( &tv->view, rec, -1, FALSE ); + r = tv->view.ops->insert_row( &tv->view, rec, -1, FALSE ); if (r != ERROR_SUCCESS) WARN("failed to insert row %u\n", r); } - if (!wcscmp( name, szColumns )) + if (!(err_cond & MSITRANSFORM_ERROR_VIEWTRANSFORM) && + !wcscmp( name, szColumns )) msi_update_table_columns( db, table ); msiobj_release( &rec->hdr ); @@ -2696,7 +2806,7 @@ err: * * Enumerate the table transforms in a transform storage and apply each one. */ -UINT msi_table_apply_transform( MSIDATABASE *db, IStorage *stg ) +UINT msi_table_apply_transform( MSIDATABASE *db, IStorage *stg, int err_cond ) { struct list transforms; IEnumSTATSTG *stgenum = NULL; @@ -2708,6 +2818,7 @@ UINT msi_table_apply_transform( MSIDATABASE *db, IStorage *stg ) UINT ret = ERROR_FUNCTION_FAILED; UINT bytes_per_strref; BOOL property_update = FALSE; + BOOL free_transform_view = FALSE; TRACE("%p %p\n", db, stg ); @@ -2770,15 +2881,39 @@ UINT msi_table_apply_transform( MSIDATABASE *db, IStorage *stg ) tv->view.ops->delete( &tv->view ); } + if (err_cond & MSITRANSFORM_ERROR_VIEWTRANSFORM) + { + static const WCHAR create_query[] = L"CREATE TABLE `_TransformView` ( " + L"`Table` CHAR(0) NOT NULL TEMPORARY, `Column` CHAR(0) NOT NULL TEMPORARY, " + L"`Row` CHAR(0) TEMPORARY, `Data` CHAR(0) TEMPORARY, `Current` CHAR(0) TEMPORARY " + L"PRIMARY KEY `Table`, `Column`, `Row` ) HOLD"; + MSIQUERY *query; + UINT r; + + r = MSI_DatabaseOpenViewW( db, create_query, &query ); + if (r != ERROR_SUCCESS) + goto end; + + r = MSI_ViewExecute( query, NULL ); + if (r == ERROR_SUCCESS) + MSI_ViewClose( query ); + msiobj_release( &query->hdr ); + if (r == ERROR_BAD_QUERY_SYNTAX) + FIXME( "support adding to _TransformView\n" ); + if (r != ERROR_SUCCESS) + goto end; + free_transform_view = TRUE; + } + /* * Apply _Tables and _Columns transforms first so that * the table metadata is correct, and empty tables exist. */ - ret = msi_table_load_transform( db, stg, strings, tables, bytes_per_strref ); + ret = msi_table_load_transform( db, stg, strings, tables, bytes_per_strref, err_cond ); if (ret != ERROR_SUCCESS && ret != ERROR_INVALID_TABLE) goto end; - ret = msi_table_load_transform( db, stg, strings, columns, bytes_per_strref ); + ret = msi_table_load_transform( db, stg, strings, columns, bytes_per_strref, err_cond ); if (ret != ERROR_SUCCESS && ret != ERROR_INVALID_TABLE) goto end; @@ -2792,7 +2927,7 @@ UINT msi_table_apply_transform( MSIDATABASE *db, IStorage *stg ) wcscmp( transform->name, szTables ) && ret == ERROR_SUCCESS ) { - ret = msi_table_load_transform( db, stg, strings, transform, bytes_per_strref ); + ret = msi_table_load_transform( db, stg, strings, transform, bytes_per_strref, err_cond ); } list_remove( &transform->entry ); @@ -2811,6 +2946,17 @@ end: IEnumSTATSTG_Release( stgenum ); if ( strings ) msi_destroy_stringtable( strings ); + if (ret != ERROR_SUCCESS && free_transform_view) + { + MSIQUERY *query; + if (MSI_DatabaseOpenViewW( db, L"ALTER TABLE `_TransformView` FREE", + &query ) == ERROR_SUCCESS) + { + if (MSI_ViewExecute( query, NULL ) == ERROR_SUCCESS) + MSI_ViewClose( query ); + msiobj_release( &query->hdr ); + } + } return ret; }
2 years, 9 months
1
0
0
0
[reactos] 277/360: [WINESYNC] msi: Introduce msi_record_stream_name helper.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=8e75cb8a26b8ba1b58c59…
commit 8e75cb8a26b8ba1b58c5978d0cf73ae9f7c8ac37 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sun Mar 13 19:08:37 2022 +0100 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Sun Mar 20 19:28:28 2022 +0100 [WINESYNC] msi: Introduce msi_record_stream_name helper. Signed-off-by: Piotr Caban <piotr(a)codeweavers.com> Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id 5fc68884adec547a5343e8713e8727282b5aa25a by Piotr Caban <piotr(a)codeweavers.com> --- dll/win32/msi/table.c | 93 ++++++++++++++++++++++++++------------------------- 1 file changed, 47 insertions(+), 46 deletions(-) diff --git a/dll/win32/msi/table.c b/dll/win32/msi/table.c index c0ffa99e1d6..f0c36b00131 100644 --- a/dll/win32/msi/table.c +++ b/dll/win32/msi/table.c @@ -2188,6 +2188,38 @@ UINT TABLE_CreateView( MSIDATABASE *db, LPCWSTR name, MSIVIEW **view ) return ERROR_SUCCESS; } +static UINT msi_record_stream_name( const MSITABLEVIEW *tv, MSIRECORD *rec, LPWSTR name, UINT *len ) +{ + UINT p = 0, l, i, r; + + l = wcslen( tv->name ); + if (name && *len > l) + memcpy(name, tv->name, l * sizeof(WCHAR)); + p += l; + + for ( i = 0; i < tv->num_cols; i++ ) + { + if (!(tv->columns[i].type & MSITYPE_KEY)) + continue; + + if (name && *len > p + 1) + name[p] = '.'; + p++; + + l = (*len > p ? *len - p : 0); + r = MSI_RecordGetStringW( rec, i + 1, name ? name + p : NULL, &l ); + if (r != ERROR_SUCCESS) + return r; + p += l; + } + + if (name && *len > p) + name[p] = 0; + + *len = p; + return ERROR_SUCCESS; +} + UINT MSI_CommitTables( MSIDATABASE *db ) { UINT r, bytes_per_strref; @@ -2252,61 +2284,30 @@ static UINT read_raw_int(const BYTE *data, UINT col, UINT bytes) static UINT msi_record_encoded_stream_name( const MSITABLEVIEW *tv, MSIRECORD *rec, LPWSTR *pstname ) { - LPWSTR stname = NULL, sval, p; - DWORD len; - UINT i, r; + UINT r, len; + WCHAR *name; TRACE("%p %p\n", tv, rec); - len = lstrlenW( tv->name ) + 1; - stname = msi_alloc( len*sizeof(WCHAR) ); - if ( !stname ) - { - r = ERROR_OUTOFMEMORY; - goto err; - } + r = msi_record_stream_name( tv, rec, NULL, &len ); + if (r != ERROR_SUCCESS) + return r; + len++; - lstrcpyW( stname, tv->name ); + name = msi_alloc( len * sizeof(WCHAR) ); + if (!name) + return ERROR_OUTOFMEMORY; - for ( i = 0; i < tv->num_cols; i++ ) + r = msi_record_stream_name( tv, rec, name, &len ); + if (r != ERROR_SUCCESS) { - if ( tv->columns[i].type & MSITYPE_KEY ) - { - sval = msi_dup_record_field( rec, i + 1 ); - if ( !sval ) - { - r = ERROR_OUTOFMEMORY; - goto err; - } - - len += lstrlenW( szDot ) + lstrlenW ( sval ); - p = msi_realloc ( stname, len*sizeof(WCHAR) ); - if ( !p ) - { - r = ERROR_OUTOFMEMORY; - msi_free(sval); - goto err; - } - stname = p; - - lstrcatW( stname, szDot ); - lstrcatW( stname, sval ); - - msi_free( sval ); - } - else - continue; + msi_free( name ); + return r; } - *pstname = encode_streamname( FALSE, stname ); - msi_free( stname ); - + *pstname = encode_streamname( FALSE, name ); + msi_free( name ); return ERROR_SUCCESS; - -err: - msi_free ( stname ); - *pstname = NULL; - return r; } static MSIRECORD *msi_get_transform_record( const MSITABLEVIEW *tv, const string_table *st,
2 years, 9 months
1
0
0
0
[reactos] 276/360: [WINESYNC] include: Add MSITRANSFORM_ERROR enum definition.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=ce486a09ef4c7004d7975…
commit ce486a09ef4c7004d7975a5e4ac792a925a1d739 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sun Mar 13 19:08:37 2022 +0100 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Sun Mar 20 19:28:28 2022 +0100 [WINESYNC] include: Add MSITRANSFORM_ERROR enum definition. Signed-off-by: Piotr Caban <piotr(a)codeweavers.com> Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id 57b870007dddd86c6772ce1707148ec7ad8bd8db by Piotr Caban <piotr(a)codeweavers.com> --- sdk/include/psdk/msiquery.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sdk/include/psdk/msiquery.h b/sdk/include/psdk/msiquery.h index 7b4f04fccb2..72589f018c1 100644 --- a/sdk/include/psdk/msiquery.h +++ b/sdk/include/psdk/msiquery.h @@ -145,6 +145,17 @@ typedef enum tagMSIDBSTATE MSIDBSTATE_WRITE = 1 } MSIDBSTATE; +typedef enum tagMSITRANSFORM_ERROR +{ + MSITRANSFORM_ERROR_ADDEXISTINGROW = 0x00000001, + MSITRANSFORM_ERROR_DELMISSINGROW = 0x00000002, + MSITRANSFORM_ERROR_ADDEXISTINGTABLE = 0x00000004, + MSITRANSFORM_ERROR_DELMISSINGTABLE = 0x00000008, + MSITRANSFORM_ERROR_UPDATEMISSINGROW = 0x00000010, + MSITRANSFORM_ERROR_CHANGECODEPAGE = 0x00000020, + MSITRANSFORM_ERROR_VIEWTRANSFORM = 0x00000100 +} MSITRANSFORM_ERROR; + typedef enum tagMSITRANSFORM_VALIDATE { MSITRANSFORM_VALIDATE_LANGUAGE = 0x00000001,
2 years, 9 months
1
0
0
0
[reactos] 275/360: [WINESYNC] msi: Fix installing from administrative image with compressed source files.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=5c7b97165c5fdc6e1cddc…
commit 5c7b97165c5fdc6e1cddce1bbe73be1f5647433d Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sun Mar 13 19:08:35 2022 +0100 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Sun Mar 20 19:28:28 2022 +0100 [WINESYNC] msi: Fix installing from administrative image with compressed source files. Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=49352
Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id 15c8e5dee6fa3b7eac1d1b3cd6d27aa744faff4d by Hans Leidekker <hans(a)codeweavers.com> --- dll/win32/msi/action.c | 10 ++---- modules/rostests/winetests/msi/install.c | 58 ++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 7 deletions(-) diff --git a/dll/win32/msi/action.c b/dll/win32/msi/action.c index 8776ac30078..762d734fcbd 100644 --- a/dll/win32/msi/action.c +++ b/dll/win32/msi/action.c @@ -1230,10 +1230,9 @@ static UINT load_file(MSIRECORD *row, LPVOID param) */ if (package->WordCount & msidbSumInfoSourceTypeAdminImage) { - file->IsCompressed = FALSE; + file->IsCompressed = package->WordCount & msidbSumInfoSourceTypeCompressed; } - else if (file->Attributes & - (msidbFileAttributesCompressed | msidbFileAttributesPatchAdded)) + else if (file->Attributes & (msidbFileAttributesCompressed | msidbFileAttributesPatchAdded)) { file->IsCompressed = TRUE; } @@ -1241,10 +1240,7 @@ static UINT load_file(MSIRECORD *row, LPVOID param) { file->IsCompressed = FALSE; } - else - { - file->IsCompressed = package->WordCount & msidbSumInfoSourceTypeCompressed; - } + else file->IsCompressed = package->WordCount & msidbSumInfoSourceTypeCompressed; load_file_hash(package, file); load_file_disk_id(package, file); diff --git a/modules/rostests/winetests/msi/install.c b/modules/rostests/winetests/msi/install.c index 99d53e56570..2cfa810e1da 100644 --- a/modules/rostests/winetests/msi/install.c +++ b/modules/rostests/winetests/msi/install.c @@ -1392,6 +1392,34 @@ static const CHAR sr_custom_action_dat[] = "sourcedir_unset\t19\t\tSourceDir should not be set\n" "sourcedir_set\t19\t\tSourceDir should be set\n"; +static const CHAR ai2_file_dat[] = + "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n" + "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n" + "File\tFile\n" + "five.txt\tFive\tfive.txt\t1000\t\t\t0\t5\n" + "four.txt\tFour\tfour.txt\t1000\t\t\t0\t4\n"; + +static const CHAR ai2_component_dat[] = + "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n" + "s72\tS38\ts72\ti2\tS255\tS72\n" + "Component\tComponent\n" + "Five\t{8CC92E9D-14B2-4CA4-B2AA-B11D02078087}\tNEWDIR\t2\t\tfive.txt\n" + "Four\t{FD37B4EA-7209-45C0-8917-535F35A2F080}\tCABOUTDIR\t2\t\tfour.txt\n"; + +static const CHAR ai2_feature_dat[] = + "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n" + "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n" + "Feature\tFeature\n" + "Five\t\tFive\tThe Five Feature\t5\t3\tNEWDIR\t0\n" + "Four\t\tFour\tThe Four Feature\t4\t3\tCABOUTDIR\t0\n"; + +static const CHAR ai2_feature_comp_dat[] = + "Feature_\tComponent_\n" + "s38\ts72\n" + "FeatureComponents\tFeature_\tComponent_\n" + "Five\tFive\n" + "Four\tFour\n"; + static const msi_table tables[] = { ADD_TABLE(component), @@ -1821,6 +1849,18 @@ static const msi_table ai_tables[] = ADD_TABLE(property) }; +static const msi_table ai2_tables[] = +{ + ADD_TABLE(ai2_component), + ADD_TABLE(directory), + ADD_TABLE(ai2_feature), + ADD_TABLE(ai2_feature_comp), + ADD_TABLE(ai2_file), + ADD_TABLE(install_exec_seq), + ADD_TABLE(media), + ADD_TABLE(property) +}; + static const msi_table pc_tables[] = { ADD_TABLE(ca51_component), @@ -4865,6 +4905,24 @@ static void test_adminimage(void) delete_pf_files(); + create_file("four.txt", 100); + create_file("five.txt", 100); + create_cab_file("msitest.cab", MEDIA_SIZE, "four.txt\0five.txt\0"); + create_database_wordcount(msifile, ai2_tables, ARRAY_SIZE(ai2_tables), + 100, msidbSumInfoSourceTypeAdminImage|msidbSumInfoSourceTypeCompressed, + ";1033", "{004757CA-5092-49C2-AD20-28E1CE0DF5F2}"); + + MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL); + + r = MsiInstallProductA(msifile, NULL); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); + + ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n"); + ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n"); + ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n"); + ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n"); + ok(delete_pf("msitest", FALSE), "Directory not created\n"); + error: DeleteFileA("msifile"); DeleteFileA("msitest\\cabout\\new\\five.txt");
2 years, 9 months
1
0
0
0
[reactos] 274/360: [WINESYNC] msi: Return void from init_automation_object.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=1c0e89646f10912bb8cbc…
commit 1c0e89646f10912bb8cbcee50bae7bba8b110df2 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sun Mar 13 19:08:30 2022 +0100 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Sun Mar 20 19:28:28 2022 +0100 [WINESYNC] msi: Return void from init_automation_object. Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id 1726b7f46c03a543f5d682d951f29a4af41001e7 by Hans Leidekker <hans(a)codeweavers.com> --- dll/win32/msi/automation.c | 72 +++++++++------------------------------------- 1 file changed, 14 insertions(+), 58 deletions(-) diff --git a/dll/win32/msi/automation.c b/dll/win32/msi/automation.c index ba3a068a74b..87c7815094a 100644 --- a/dll/win32/msi/automation.c +++ b/dll/win32/msi/automation.c @@ -543,18 +543,15 @@ static const IProvideMultipleClassInfoVtbl ProvideMultipleClassInfoVtbl = ProvideMultipleClassInfo_GetInfoOfIndex }; -static HRESULT init_automation_object(AutomationObject *This, MSIHANDLE msiHandle, tid_t tid) +static void init_automation_object(AutomationObject *This, MSIHANDLE msiHandle, tid_t tid) { TRACE("(%p, %d, %s)\n", This, msiHandle, debugstr_guid(get_riid_from_tid(tid))); This->IDispatch_iface.lpVtbl = &AutomationObjectVtbl; This->IProvideMultipleClassInfo_iface.lpVtbl = &ProvideMultipleClassInfoVtbl; This->ref = 1; - This->msiHandle = msiHandle; This->tid = tid; - - return S_OK; } /* @@ -1002,21 +999,15 @@ static HRESULT record_invoke( static HRESULT create_record(MSIHANDLE msiHandle, IDispatch **disp) { AutomationObject *record; - HRESULT hr; record = msi_alloc(sizeof(*record)); if (!record) return E_OUTOFMEMORY; - hr = init_automation_object(record, msiHandle, Record_tid); - if (hr != S_OK) - { - msi_free(record); - return hr; - } + init_automation_object(record, msiHandle, Record_tid); *disp = &record->IDispatch_iface; - return hr; + return S_OK; } static HRESULT list_invoke( @@ -1123,12 +1114,7 @@ static HRESULT create_list(const WCHAR *product, IDispatch **dispatch) list = msi_alloc_zero(sizeof(ListObject)); if (!list) return E_OUTOFMEMORY; - hr = init_automation_object(&list->autoobj, 0, StringList_tid); - if (hr != S_OK) - { - msi_free(list); - return hr; - } + init_automation_object(&list->autoobj, 0, StringList_tid); *dispatch = &list->autoobj.IDispatch_iface; @@ -2442,7 +2428,6 @@ static HRESULT installer_invoke( HRESULT create_msiserver(IUnknown *outer, void **ppObj) { AutomationObject *installer; - HRESULT hr; TRACE("(%p %p)\n", outer, ppObj); @@ -2452,99 +2437,70 @@ HRESULT create_msiserver(IUnknown *outer, void **ppObj) installer = msi_alloc(sizeof(AutomationObject)); if (!installer) return E_OUTOFMEMORY; - hr = init_automation_object(installer, 0, Installer_tid); - if (hr != S_OK) - { - msi_free(installer); - return hr; - } + init_automation_object(installer, 0, Installer_tid); *ppObj = &installer->IDispatch_iface; - return hr; + return S_OK; } HRESULT create_session(MSIHANDLE msiHandle, IDispatch *installer, IDispatch **disp) { SessionObject *session; - HRESULT hr; session = msi_alloc(sizeof(SessionObject)); if (!session) return E_OUTOFMEMORY; - hr = init_automation_object(&session->autoobj, msiHandle, Session_tid); - if (hr != S_OK) - { - msi_free(session); - return hr; - } + init_automation_object(&session->autoobj, msiHandle, Session_tid); session->installer = installer; *disp = &session->autoobj.IDispatch_iface; - return hr; + return S_OK; } static HRESULT create_database(MSIHANDLE msiHandle, IDispatch **dispatch) { AutomationObject *database; - HRESULT hr; TRACE("(%d %p)\n", msiHandle, dispatch); database = msi_alloc(sizeof(AutomationObject)); if (!database) return E_OUTOFMEMORY; - hr = init_automation_object(database, msiHandle, Database_tid); - if (hr != S_OK) - { - msi_free(database); - return hr; - } + init_automation_object(database, msiHandle, Database_tid); *dispatch = &database->IDispatch_iface; - return hr; + return S_OK; } static HRESULT create_view(MSIHANDLE msiHandle, IDispatch **dispatch) { AutomationObject *view; - HRESULT hr; TRACE("(%d %p)\n", msiHandle, dispatch); view = msi_alloc(sizeof(AutomationObject)); if (!view) return E_OUTOFMEMORY; - hr = init_automation_object(view, msiHandle, View_tid); - if (hr != S_OK) - { - msi_free(view); - return hr; - } + init_automation_object(view, msiHandle, View_tid); *dispatch = &view->IDispatch_iface; - return hr; + return S_OK; } static HRESULT create_summaryinfo(MSIHANDLE msiHandle, IDispatch **disp) { AutomationObject *info; - HRESULT hr; info = msi_alloc(sizeof(*info)); if (!info) return E_OUTOFMEMORY; - hr = init_automation_object(info, msiHandle, SummaryInfo_tid); - if (hr != S_OK) - { - msi_free(info); - return hr; - } + init_automation_object(info, msiHandle, SummaryInfo_tid); *disp = &info->IDispatch_iface; - return hr; + return S_OK; }
2 years, 9 months
1
0
0
0
[reactos] 273/360: [WINESYNC] msi: Add support for bitmap buttons.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=c65efd0116fa0cca85865…
commit c65efd0116fa0cca85865d88170e0f5dc92e7019 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sun Mar 13 19:08:28 2022 +0100 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Sun Mar 20 19:28:27 2022 +0100 [WINESYNC] msi: Add support for bitmap buttons. Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=48974
Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id 9cc044957791e0658ec3d0d8ad08eebfc08b522c by Hans Leidekker <hans(a)codeweavers.com> --- dll/win32/msi/dialog.c | 166 +++++++++++++++++++++++++++---------------------- 1 file changed, 91 insertions(+), 75 deletions(-) diff --git a/dll/win32/msi/dialog.c b/dll/win32/msi/dialog.c index 58f0b236642..fa4853eb3ce 100644 --- a/dll/win32/msi/dialog.c +++ b/dll/win32/msi/dialog.c @@ -1014,38 +1014,120 @@ static UINT msi_dialog_button_handler( msi_dialog *dialog, msi_control *control, return r; } +static HBITMAP msi_load_picture( MSIDATABASE *db, const WCHAR *name, INT cx, INT cy, DWORD flags ) +{ + HBITMAP hOleBitmap = 0, hBitmap = 0, hOldSrcBitmap, hOldDestBitmap; + MSIRECORD *rec = NULL; + IStream *stm = NULL; + IPicture *pic = NULL; + HDC srcdc, destdc; + BITMAP bm; + UINT r; + + rec = msi_get_binary_record( db, name ); + if (!rec) + goto end; + + r = MSI_RecordGetIStream( rec, 2, &stm ); + msiobj_release( &rec->hdr ); + if (r != ERROR_SUCCESS) + goto end; + + r = OleLoadPicture( stm, 0, TRUE, &IID_IPicture, (void **)&pic ); + IStream_Release( stm ); + if (FAILED( r )) + { + ERR("failed to load picture\n"); + goto end; + } + + r = IPicture_get_Handle( pic, (OLE_HANDLE *)&hOleBitmap ); + if (FAILED( r )) + { + ERR("failed to get bitmap handle\n"); + goto end; + } + + /* make the bitmap the desired size */ + r = GetObjectW( hOleBitmap, sizeof(bm), &bm ); + if (r != sizeof(bm)) + { + ERR("failed to get bitmap size\n"); + goto end; + } + + if (flags & LR_DEFAULTSIZE) + { + cx = bm.bmWidth; + cy = bm.bmHeight; + } + + srcdc = CreateCompatibleDC( NULL ); + hOldSrcBitmap = SelectObject( srcdc, hOleBitmap ); + destdc = CreateCompatibleDC( NULL ); + hBitmap = CreateCompatibleBitmap( srcdc, cx, cy ); + hOldDestBitmap = SelectObject( destdc, hBitmap ); + StretchBlt( destdc, 0, 0, cx, cy, srcdc, 0, 0, bm.bmWidth, bm.bmHeight, SRCCOPY ); + SelectObject( srcdc, hOldSrcBitmap ); + SelectObject( destdc, hOldDestBitmap ); + DeleteDC( srcdc ); + DeleteDC( destdc ); + +end: + if (pic) IPicture_Release( pic ); + return hBitmap; +} + static UINT msi_dialog_button_control( msi_dialog *dialog, MSIRECORD *rec ) { msi_control *control; - UINT attributes, style; + UINT attributes, style, cx = 0, cy = 0, flags = 0; + WCHAR *name = NULL; TRACE("%p %p\n", dialog, rec); style = WS_TABSTOP; attributes = MSI_RecordGetInteger( rec, 8 ); - if( attributes & msidbControlAttributesIcon ) - style |= BS_ICON; + if (attributes & msidbControlAttributesIcon) style |= BS_ICON; + else if (attributes & msidbControlAttributesBitmap) + { + style |= BS_BITMAP; + if (attributes & msidbControlAttributesFixedSize) flags |= LR_DEFAULTSIZE; + else + { + cx = msi_dialog_scale_unit( dialog, MSI_RecordGetInteger(rec, 6) ); + cy = msi_dialog_scale_unit( dialog, MSI_RecordGetInteger(rec, 7) ); + } + } control = msi_dialog_add_control( dialog, rec, szButton, style ); - if( !control ) + if (!control) return ERROR_FUNCTION_FAILED; control->handler = msi_dialog_button_handler; if (attributes & msidbControlAttributesIcon) { - /* set the icon */ - LPWSTR name = msi_get_binary_name( dialog->package, rec ); + name = msi_get_binary_name( dialog->package, rec ); control->hIcon = msi_load_icon( dialog->package->db, name, attributes ); if (control->hIcon) { SendMessageW( control->hwnd, BM_SETIMAGE, IMAGE_ICON, (LPARAM) control->hIcon ); } - else - ERR("Failed to load icon %s\n", debugstr_w(name)); - msi_free( name ); + else ERR("Failed to load icon %s\n", debugstr_w(name)); + } + else if (attributes & msidbControlAttributesBitmap) + { + name = msi_get_binary_name( dialog->package, rec ); + control->hBitmap = msi_load_picture( dialog->package->db, name, cx, cy, flags ); + if (control->hBitmap) + { + SendMessageW( control->hwnd, BM_SETIMAGE, IMAGE_BITMAP, (LPARAM) control->hBitmap ); + } + else ERR("Failed to load bitmap %s\n", debugstr_w(name)); } + msi_free( name ); return ERROR_SUCCESS; } @@ -1341,72 +1423,6 @@ static UINT msi_dialog_scrolltext_control( msi_dialog *dialog, MSIRECORD *rec ) return ERROR_SUCCESS; } -static HBITMAP msi_load_picture( MSIDATABASE *db, LPCWSTR name, - INT cx, INT cy, DWORD flags ) -{ - HBITMAP hOleBitmap = 0, hBitmap = 0, hOldSrcBitmap, hOldDestBitmap; - MSIRECORD *rec = NULL; - IStream *stm = NULL; - IPicture *pic = NULL; - HDC srcdc, destdc; - BITMAP bm; - UINT r; - - rec = msi_get_binary_record( db, name ); - if( !rec ) - goto end; - - r = MSI_RecordGetIStream( rec, 2, &stm ); - msiobj_release( &rec->hdr ); - if( r != ERROR_SUCCESS ) - goto end; - - r = OleLoadPicture( stm, 0, TRUE, &IID_IPicture, (LPVOID*) &pic ); - IStream_Release( stm ); - if( FAILED( r ) ) - { - ERR("failed to load picture\n"); - goto end; - } - - r = IPicture_get_Handle( pic, (OLE_HANDLE*) &hOleBitmap ); - if( FAILED( r ) ) - { - ERR("failed to get bitmap handle\n"); - goto end; - } - - /* make the bitmap the desired size */ - r = GetObjectW( hOleBitmap, sizeof bm, &bm ); - if (r != sizeof bm ) - { - ERR("failed to get bitmap size\n"); - goto end; - } - - if (flags & LR_DEFAULTSIZE) - { - cx = bm.bmWidth; - cy = bm.bmHeight; - } - - srcdc = CreateCompatibleDC( NULL ); - hOldSrcBitmap = SelectObject( srcdc, hOleBitmap ); - destdc = CreateCompatibleDC( NULL ); - hBitmap = CreateCompatibleBitmap( srcdc, cx, cy ); - hOldDestBitmap = SelectObject( destdc, hBitmap ); - StretchBlt( destdc, 0, 0, cx, cy, - srcdc, 0, 0, bm.bmWidth, bm.bmHeight, SRCCOPY); - SelectObject( srcdc, hOldSrcBitmap ); - SelectObject( destdc, hOldDestBitmap ); - DeleteDC( srcdc ); - DeleteDC( destdc ); - -end: - if ( pic ) - IPicture_Release( pic ); - return hBitmap; -} static UINT msi_dialog_bitmap_control( msi_dialog *dialog, MSIRECORD *rec ) {
2 years, 9 months
1
0
0
0
[reactos] 272/360: [WINESYNC] msi: Report the real NT version number up to 6.3.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=f4d2571b7e191883b789f…
commit f4d2571b7e191883b789f2d92693c4f1d41905b2 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sun Mar 13 19:08:27 2022 +0100 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Sun Mar 20 19:28:27 2022 +0100 [WINESYNC] msi: Report the real NT version number up to 6.3. MSI always reports 6.3 even without a manifest, but does not report anything higher. Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=48959
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> wine commit id 658183a803fced017e1e29f4001cec8b48748327 by Zebediah Figura <z.figura12(a)gmail.com> --- dll/win32/msi/custom.c | 6 ++++++ dll/win32/msi/package.c | 19 ++++++++++++++++--- dll/win32/msi/precomp.h | 3 +++ 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/dll/win32/msi/custom.c b/dll/win32/msi/custom.c index 55504c2c737..8753a60a279 100644 --- a/dll/win32/msi/custom.c +++ b/dll/win32/msi/custom.c @@ -38,6 +38,12 @@ #include "wine/unicode.h" #include "wine/exception.h" +#ifdef __REACTOS__ +#ifndef STATUS_ACCESS_VIOLATION +#define STATUS_ACCESS_VIOLATION ((NTSTATUS)0xC0000005) +#endif +#endif + WINE_DEFAULT_DEBUG_CHANNEL(msi); #define CUSTOM_ACTION_TYPE_MASK 0x3F diff --git a/dll/win32/msi/package.c b/dll/win32/msi/package.c index 4390a709ece..cd8977724ce 100644 --- a/dll/win32/msi/package.c +++ b/dll/win32/msi/package.c @@ -21,12 +21,20 @@ #define NONAMELESSUNION #define NONAMELESSSTRUCT #define COBJMACROS +#ifdef __REACTOS__ +#define WIN32_NO_STATUS +#endif #include <stdarg.h> #include "windef.h" #include "winbase.h" #include "winreg.h" #include "winnls.h" +#ifdef __REACTOS__ +#include <ndk/rtlfuncs.h> +#else +#include "winternl.h" +#endif #include "shlwapi.h" #include "wingdi.h" #include "msi.h" @@ -668,7 +676,7 @@ done: static VOID set_installer_properties(MSIPACKAGE *package) { WCHAR *ptr; - OSVERSIONINFOEXW OSVersion; + RTL_OSVERSIONINFOEXW OSVersion; MEMORYSTATUSEX msex; DWORD verval, len, type; WCHAR pth[MAX_PATH], verstr[11], bufstr[22]; @@ -860,9 +868,14 @@ static VOID set_installer_properties(MSIPACKAGE *package) msi_set_property( package->db, szPrivileged, szOne, -1 ); /* set the os things */ - OSVersion.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXW); - GetVersionExW((OSVERSIONINFOW *)&OSVersion); + OSVersion.dwOSVersionInfoSize = sizeof(OSVersion); + RtlGetVersion((PRTL_OSVERSIONINFOW)&OSVersion); verval = OSVersion.dwMinorVersion + OSVersion.dwMajorVersion * 100; + if (verval > 603) + { + verval = 603; + OSVersion.dwBuildNumber = 9600; + } len = swprintf( verstr, ARRAY_SIZE(verstr), szFormat, verval ); switch (OSVersion.dwPlatformId) { diff --git a/dll/win32/msi/precomp.h b/dll/win32/msi/precomp.h index f4951c71ee1..47defd80631 100644 --- a/dll/win32/msi/precomp.h +++ b/dll/win32/msi/precomp.h @@ -8,6 +8,9 @@ #define _INC_WINDOWS #define COM_NO_WINDOWS_H +#ifdef __REACTOS__ +#define WIN32_NO_STATUS +#endif #define COBJMACROS #define NONAMELESSUNION
2 years, 9 months
1
0
0
0
← Newer
1
...
10
11
12
13
14
15
16
...
44
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
Results per page:
10
25
50
100
200