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] 181/360: [WINESYNC] msi: Get rid of the remove_column() view operation.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=fb72dff218860f243c054…
commit fb72dff218860f243c0544eeb3691429461c5ba8 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sun Mar 13 00:16:28 2022 +0100 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Sun Mar 20 19:28:09 2022 +0100 [WINESYNC] msi: Get rid of the remove_column() view operation. It was added to the structure, rather unnecessarily, by ccef56f2c. 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 c2810f40a0af6496cfbb7d87685e2e018befd43b by Zebediah Figura <z.figura12(a)gmail.com> --- dll/win32/msi/alter.c | 1 - dll/win32/msi/create.c | 1 - dll/win32/msi/delete.c | 1 - dll/win32/msi/distinct.c | 1 - dll/win32/msi/drop.c | 1 - dll/win32/msi/insert.c | 1 - dll/win32/msi/msipriv.h | 5 ----- dll/win32/msi/select.c | 1 - dll/win32/msi/storages.c | 1 - dll/win32/msi/streams.c | 1 - dll/win32/msi/table.c | 1 - dll/win32/msi/update.c | 1 - dll/win32/msi/where.c | 1 - 13 files changed, 17 deletions(-) diff --git a/dll/win32/msi/alter.c b/dll/win32/msi/alter.c index 8899c4499da..011a2dcfb81 100644 --- a/dll/win32/msi/alter.c +++ b/dll/win32/msi/alter.c @@ -240,7 +240,6 @@ static const MSIVIEWOPS alter_ops = NULL, NULL, NULL, - NULL, }; UINT ALTER_CreateView( MSIDATABASE *db, MSIVIEW **view, LPCWSTR name, column_info *colinfo, int hold ) diff --git a/dll/win32/msi/create.c b/dll/win32/msi/create.c index 0a60066d8e2..dd4739df12f 100644 --- a/dll/win32/msi/create.c +++ b/dll/win32/msi/create.c @@ -141,7 +141,6 @@ static const MSIVIEWOPS create_ops = NULL, NULL, NULL, - NULL, }; static UINT check_columns( const column_info *col_info ) diff --git a/dll/win32/msi/delete.c b/dll/win32/msi/delete.c index 4ed5384b8d1..468115186b6 100644 --- a/dll/win32/msi/delete.c +++ b/dll/win32/msi/delete.c @@ -183,7 +183,6 @@ static const MSIVIEWOPS delete_ops = NULL, NULL, NULL, - NULL, }; UINT DELETE_CreateView( MSIDATABASE *db, MSIVIEW **view, MSIVIEW *table ) diff --git a/dll/win32/msi/distinct.c b/dll/win32/msi/distinct.c index ff292f16bc4..b1945a15465 100644 --- a/dll/win32/msi/distinct.c +++ b/dll/win32/msi/distinct.c @@ -266,7 +266,6 @@ static const MSIVIEWOPS distinct_ops = NULL, NULL, NULL, - NULL, }; UINT DISTINCT_CreateView( MSIDATABASE *db, MSIVIEW **view, MSIVIEW *table ) diff --git a/dll/win32/msi/drop.c b/dll/win32/msi/drop.c index 41dbc8d4e28..3179f14219e 100644 --- a/dll/win32/msi/drop.c +++ b/dll/win32/msi/drop.c @@ -111,7 +111,6 @@ static const MSIVIEWOPS drop_ops = NULL, NULL, NULL, - NULL, }; UINT DROP_CreateView(MSIDATABASE *db, MSIVIEW **view, LPCWSTR name) diff --git a/dll/win32/msi/insert.c b/dll/win32/msi/insert.c index 0ae0cdc77fb..a5333c9cdc6 100644 --- a/dll/win32/msi/insert.c +++ b/dll/win32/msi/insert.c @@ -337,7 +337,6 @@ static const MSIVIEWOPS insert_ops = NULL, NULL, NULL, - NULL, }; static UINT count_column_info( const column_info *ci ) diff --git a/dll/win32/msi/msipriv.h b/dll/win32/msi/msipriv.h index 79c50062ef8..90fd569aea8 100644 --- a/dll/win32/msi/msipriv.h +++ b/dll/win32/msi/msipriv.h @@ -316,11 +316,6 @@ typedef struct tagMSIVIEWOPS */ UINT (*add_column)( struct tagMSIVIEW *view, LPCWSTR table, UINT number, LPCWSTR column, UINT type, BOOL hold ); - /* - * remove_column - removes the column represented by table name and column number from the table - */ - UINT (*remove_column)( struct tagMSIVIEW *view, LPCWSTR table, UINT number ); - /* * sort - orders the table by columns */ diff --git a/dll/win32/msi/select.c b/dll/win32/msi/select.c index 70d2c329505..8bd4509c0e5 100644 --- a/dll/win32/msi/select.c +++ b/dll/win32/msi/select.c @@ -350,7 +350,6 @@ static const MSIVIEWOPS select_ops = NULL, NULL, NULL, - NULL, }; static UINT SELECT_AddColumn( MSISELECTVIEW *sv, LPCWSTR name, diff --git a/dll/win32/msi/storages.c b/dll/win32/msi/storages.c index f0b960d7c8b..9d262b78f72 100644 --- a/dll/win32/msi/storages.c +++ b/dll/win32/msi/storages.c @@ -434,7 +434,6 @@ static const MSIVIEWOPS storages_ops = NULL, NULL, NULL, - NULL, }; static INT add_storages_to_table(MSISTORAGESVIEW *sv) diff --git a/dll/win32/msi/streams.c b/dll/win32/msi/streams.c index 05367a42741..78d8aaa69c2 100644 --- a/dll/win32/msi/streams.c +++ b/dll/win32/msi/streams.c @@ -380,7 +380,6 @@ static const MSIVIEWOPS streams_ops = NULL, NULL, NULL, - NULL, }; static HRESULT open_stream( MSIDATABASE *db, const WCHAR *name, IStream **stream ) diff --git a/dll/win32/msi/table.c b/dll/win32/msi/table.c index e24b0bd0e53..4a0633441f0 100644 --- a/dll/win32/msi/table.c +++ b/dll/win32/msi/table.c @@ -2072,7 +2072,6 @@ static const MSIVIEWOPS table_ops = TABLE_add_ref, TABLE_release, TABLE_add_column, - TABLE_remove_column, NULL, TABLE_drop, }; diff --git a/dll/win32/msi/update.c b/dll/win32/msi/update.c index ed81447aa5e..ff4e1abf5f5 100644 --- a/dll/win32/msi/update.c +++ b/dll/win32/msi/update.c @@ -213,7 +213,6 @@ static const MSIVIEWOPS update_ops = NULL, NULL, NULL, - NULL, }; UINT UPDATE_CreateView( MSIDATABASE *db, MSIVIEW **view, LPWSTR table, diff --git a/dll/win32/msi/where.c b/dll/win32/msi/where.c index b493bda7dd8..6c08471bbf7 100644 --- a/dll/win32/msi/where.c +++ b/dll/win32/msi/where.c @@ -1081,7 +1081,6 @@ static const MSIVIEWOPS where_ops = NULL, NULL, NULL, - NULL, WHERE_sort, NULL, };
2 years, 9 months
1
0
0
0
[reactos] 180/360: [WINESYNC] msi: Get rid of the find_matching_rows() view operation.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=43025b17d11ae59128826…
commit 43025b17d11ae59128826acdcb3811b4770a1a93 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sun Mar 13 00:16:26 2022 +0100 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Sun Mar 20 19:28:08 2022 +0100 [WINESYNC] msi: Get rid of the find_matching_rows() view operation. It was introduced in 9f487ba1d as part of an optimization, but ceased to be used in a52c2bf94. 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 ced768f2ec163e25b7e1cf54a87f4b01369a846e by Zebediah Figura <z.figura12(a)gmail.com> --- dll/win32/msi/alter.c | 9 ------ dll/win32/msi/create.c | 1 - dll/win32/msi/delete.c | 10 ------ dll/win32/msi/distinct.c | 22 ------------- dll/win32/msi/drop.c | 1 - dll/win32/msi/insert.c | 10 ------ dll/win32/msi/msipriv.h | 13 -------- dll/win32/msi/select.c | 20 ------------ dll/win32/msi/storages.c | 30 ------------------ dll/win32/msi/streams.c | 30 ------------------ dll/win32/msi/table.c | 80 ------------------------------------------------ dll/win32/msi/update.c | 9 ------ dll/win32/msi/where.c | 31 ------------------- 13 files changed, 266 deletions(-) diff --git a/dll/win32/msi/alter.c b/dll/win32/msi/alter.c index 8b11351f8be..8899c4499da 100644 --- a/dll/win32/msi/alter.c +++ b/dll/win32/msi/alter.c @@ -221,14 +221,6 @@ static UINT ALTER_delete( struct tagMSIVIEW *view ) return ERROR_SUCCESS; } -static UINT ALTER_find_matching_rows( struct tagMSIVIEW *view, UINT col, - UINT val, UINT *row, MSIITERHANDLE *handle ) -{ - TRACE("%p, %d, %u, %p\n", view, col, val, *handle); - - return ERROR_FUNCTION_FAILED; -} - static const MSIVIEWOPS alter_ops = { ALTER_fetch_int, @@ -243,7 +235,6 @@ static const MSIVIEWOPS alter_ops = ALTER_get_column_info, ALTER_modify, ALTER_delete, - ALTER_find_matching_rows, NULL, NULL, NULL, diff --git a/dll/win32/msi/create.c b/dll/win32/msi/create.c index c679d6b131f..0a60066d8e2 100644 --- a/dll/win32/msi/create.c +++ b/dll/win32/msi/create.c @@ -142,7 +142,6 @@ static const MSIVIEWOPS create_ops = NULL, NULL, NULL, - NULL, }; static UINT check_columns( const column_info *col_info ) diff --git a/dll/win32/msi/delete.c b/dll/win32/msi/delete.c index 4472409a0a0..4ed5384b8d1 100644 --- a/dll/win32/msi/delete.c +++ b/dll/win32/msi/delete.c @@ -164,15 +164,6 @@ static UINT DELETE_delete( struct tagMSIVIEW *view ) return ERROR_SUCCESS; } -static UINT DELETE_find_matching_rows( struct tagMSIVIEW *view, UINT col, - UINT val, UINT *row, MSIITERHANDLE *handle ) -{ - TRACE("%p, %d, %u, %p\n", view, col, val, *handle); - - return ERROR_FUNCTION_FAILED; -} - - static const MSIVIEWOPS delete_ops = { DELETE_fetch_int, @@ -187,7 +178,6 @@ static const MSIVIEWOPS delete_ops = DELETE_get_column_info, DELETE_modify, DELETE_delete, - DELETE_find_matching_rows, NULL, NULL, NULL, diff --git a/dll/win32/msi/distinct.c b/dll/win32/msi/distinct.c index 04f09fa4913..ff292f16bc4 100644 --- a/dll/win32/msi/distinct.c +++ b/dll/win32/msi/distinct.c @@ -247,27 +247,6 @@ static UINT DISTINCT_delete( struct tagMSIVIEW *view ) return ERROR_SUCCESS; } -static UINT DISTINCT_find_matching_rows( struct tagMSIVIEW *view, UINT col, - UINT val, UINT *row, MSIITERHANDLE *handle ) -{ - MSIDISTINCTVIEW *dv = (MSIDISTINCTVIEW*)view; - UINT r; - - TRACE("%p, %d, %u, %p\n", view, col, val, *handle); - - if( !dv->table ) - return ERROR_FUNCTION_FAILED; - - r = dv->table->ops->find_matching_rows( dv->table, col, val, row, handle ); - - if( *row > dv->row_count ) - return ERROR_NO_MORE_ITEMS; - - *row = dv->translation[ *row ]; - - return r; -} - static const MSIVIEWOPS distinct_ops = { DISTINCT_fetch_int, @@ -282,7 +261,6 @@ static const MSIVIEWOPS distinct_ops = DISTINCT_get_column_info, DISTINCT_modify, DISTINCT_delete, - DISTINCT_find_matching_rows, NULL, NULL, NULL, diff --git a/dll/win32/msi/drop.c b/dll/win32/msi/drop.c index f0b58039fd3..41dbc8d4e28 100644 --- a/dll/win32/msi/drop.c +++ b/dll/win32/msi/drop.c @@ -112,7 +112,6 @@ static const MSIVIEWOPS drop_ops = NULL, NULL, NULL, - NULL, }; UINT DROP_CreateView(MSIDATABASE *db, MSIVIEW **view, LPCWSTR name) diff --git a/dll/win32/msi/insert.c b/dll/win32/msi/insert.c index c404929f285..0ae0cdc77fb 100644 --- a/dll/win32/msi/insert.c +++ b/dll/win32/msi/insert.c @@ -318,15 +318,6 @@ static UINT INSERT_delete( struct tagMSIVIEW *view ) return ERROR_SUCCESS; } -static UINT INSERT_find_matching_rows( struct tagMSIVIEW *view, UINT col, - UINT val, UINT *row, MSIITERHANDLE *handle ) -{ - TRACE("%p, %d, %u, %p\n", view, col, val, *handle); - - return ERROR_FUNCTION_FAILED; -} - - static const MSIVIEWOPS insert_ops = { INSERT_fetch_int, @@ -341,7 +332,6 @@ static const MSIVIEWOPS insert_ops = INSERT_get_column_info, INSERT_modify, INSERT_delete, - INSERT_find_matching_rows, NULL, NULL, NULL, diff --git a/dll/win32/msi/msipriv.h b/dll/win32/msi/msipriv.h index a637cfcc80d..79c50062ef8 100644 --- a/dll/win32/msi/msipriv.h +++ b/dll/win32/msi/msipriv.h @@ -301,19 +301,6 @@ typedef struct tagMSIVIEWOPS */ UINT (*delete)( struct tagMSIVIEW * ); - /* - * find_matching_rows - iterates through rows that match a value - * - * If the column type is a string then a string ID should be passed in. - * If the value to be looked up is an integer then no transformation of - * the input value is required, except if the column is a string, in which - * case a string ID should be passed in. - * The handle is an input/output parameter that keeps track of the current - * position in the iteration. It must be initialised to zero before the - * first call and continued to be passed in to subsequent calls. - */ - UINT (*find_matching_rows)( struct tagMSIVIEW *view, UINT col, UINT val, UINT *row, MSIITERHANDLE *handle ); - /* * add_ref - increases the reference count of the table */ diff --git a/dll/win32/msi/select.c b/dll/win32/msi/select.c index e8f38855a86..70d2c329505 100644 --- a/dll/win32/msi/select.c +++ b/dll/win32/msi/select.c @@ -331,25 +331,6 @@ static UINT SELECT_delete( struct tagMSIVIEW *view ) return ERROR_SUCCESS; } -static UINT SELECT_find_matching_rows( struct tagMSIVIEW *view, UINT col, - UINT val, UINT *row, MSIITERHANDLE *handle ) -{ - MSISELECTVIEW *sv = (MSISELECTVIEW*)view; - - TRACE("%p, %d, %u, %p\n", view, col, val, *handle); - - if( !sv->table ) - return ERROR_FUNCTION_FAILED; - - if( (col==0) || (col>sv->num_cols) ) - return ERROR_FUNCTION_FAILED; - - col = sv->cols[ col - 1 ]; - - return sv->table->ops->find_matching_rows( sv->table, col, val, row, handle ); -} - - static const MSIVIEWOPS select_ops = { SELECT_fetch_int, @@ -364,7 +345,6 @@ static const MSIVIEWOPS select_ops = SELECT_get_column_info, SELECT_modify, SELECT_delete, - SELECT_find_matching_rows, NULL, NULL, NULL, diff --git a/dll/win32/msi/storages.c b/dll/win32/msi/storages.c index 3ca708cb5bc..f0b960d7c8b 100644 --- a/dll/win32/msi/storages.c +++ b/dll/win32/msi/storages.c @@ -415,35 +415,6 @@ static UINT STORAGES_delete(struct tagMSIVIEW *view) return ERROR_SUCCESS; } -static UINT STORAGES_find_matching_rows(struct tagMSIVIEW *view, UINT col, - UINT val, UINT *row, MSIITERHANDLE *handle) -{ - MSISTORAGESVIEW *sv = (MSISTORAGESVIEW *)view; - UINT index = PtrToUlong(*handle); - - TRACE("(%d, %d): %d\n", *row, col, val); - - if (col == 0 || col > NUM_STORAGES_COLS) - return ERROR_INVALID_PARAMETER; - - while (index < sv->num_rows) - { - if (sv->storages[index]->str_index == val) - { - *row = index; - break; - } - - index++; - } - - *handle = UlongToPtr(++index); - if (index >= sv->num_rows) - return ERROR_NO_MORE_ITEMS; - - return ERROR_SUCCESS; -} - static const MSIVIEWOPS storages_ops = { STORAGES_fetch_int, @@ -458,7 +429,6 @@ static const MSIVIEWOPS storages_ops = STORAGES_get_column_info, STORAGES_modify, STORAGES_delete, - STORAGES_find_matching_rows, NULL, NULL, NULL, diff --git a/dll/win32/msi/streams.c b/dll/win32/msi/streams.c index e3a8c7bc30b..05367a42741 100644 --- a/dll/win32/msi/streams.c +++ b/dll/win32/msi/streams.c @@ -361,35 +361,6 @@ static UINT STREAMS_delete(struct tagMSIVIEW *view) return ERROR_SUCCESS; } -static UINT STREAMS_find_matching_rows(struct tagMSIVIEW *view, UINT col, - UINT val, UINT *row, MSIITERHANDLE *handle) -{ - MSISTREAMSVIEW *sv = (MSISTREAMSVIEW *)view; - UINT index = PtrToUlong(*handle); - - TRACE("(%p, %d, %d, %p, %p)\n", view, col, val, row, handle); - - if (!col || col > sv->num_cols) - return ERROR_INVALID_PARAMETER; - - while (index < sv->db->num_streams) - { - if (sv->db->streams[index].str_index == val) - { - *row = index; - break; - } - index++; - } - - *handle = UlongToPtr(++index); - - if (index > sv->db->num_streams) - return ERROR_NO_MORE_ITEMS; - - return ERROR_SUCCESS; -} - static const MSIVIEWOPS streams_ops = { STREAMS_fetch_int, @@ -404,7 +375,6 @@ static const MSIVIEWOPS streams_ops = STREAMS_get_column_info, STREAMS_modify, STREAMS_delete, - STREAMS_find_matching_rows, NULL, NULL, NULL, diff --git a/dll/win32/msi/table.c b/dll/win32/msi/table.c index e046c5c9e27..e24b0bd0e53 100644 --- a/dll/win32/msi/table.c +++ b/dll/win32/msi/table.c @@ -1875,85 +1875,6 @@ static UINT TABLE_delete( struct tagMSIVIEW *view ) return ERROR_SUCCESS; } -static UINT TABLE_find_matching_rows( struct tagMSIVIEW *view, UINT col, - UINT val, UINT *row, MSIITERHANDLE *handle ) -{ - MSITABLEVIEW *tv = (MSITABLEVIEW*)view; - const MSICOLUMNHASHENTRY *entry; - - TRACE("%p, %d, %u, %p\n", view, col, val, *handle); - - if( !tv->table ) - return ERROR_INVALID_PARAMETER; - - if( (col==0) || (col > tv->num_cols) ) - return ERROR_INVALID_PARAMETER; - - if( !tv->columns[col-1].hash_table ) - { - UINT i; - UINT num_rows = tv->table->row_count; - MSICOLUMNHASHENTRY **hash_table; - MSICOLUMNHASHENTRY *new_entry; - - if( tv->columns[col-1].offset >= tv->row_size ) - { - ERR("Stuffed up %d >= %d\n", tv->columns[col-1].offset, tv->row_size ); - ERR("%p %p\n", tv, tv->columns ); - return ERROR_FUNCTION_FAILED; - } - - /* allocate contiguous memory for the table and its entries so we - * don't have to do an expensive cleanup */ - hash_table = msi_alloc(MSITABLE_HASH_TABLE_SIZE * sizeof(MSICOLUMNHASHENTRY*) + - num_rows * sizeof(MSICOLUMNHASHENTRY)); - if (!hash_table) - return ERROR_OUTOFMEMORY; - - memset(hash_table, 0, MSITABLE_HASH_TABLE_SIZE * sizeof(MSICOLUMNHASHENTRY*)); - tv->columns[col-1].hash_table = hash_table; - - new_entry = (MSICOLUMNHASHENTRY *)(hash_table + MSITABLE_HASH_TABLE_SIZE); - - for (i = 0; i < num_rows; i++, new_entry++) - { - UINT row_value; - - if (view->ops->fetch_int( view, i, col, &row_value ) != ERROR_SUCCESS) - continue; - - new_entry->next = NULL; - new_entry->value = row_value; - new_entry->row = i; - if (hash_table[row_value % MSITABLE_HASH_TABLE_SIZE]) - { - MSICOLUMNHASHENTRY *prev_entry = hash_table[row_value % MSITABLE_HASH_TABLE_SIZE]; - while (prev_entry->next) - prev_entry = prev_entry->next; - prev_entry->next = new_entry; - } - else - hash_table[row_value % MSITABLE_HASH_TABLE_SIZE] = new_entry; - } - } - - if( !*handle ) - entry = tv->columns[col-1].hash_table[val % MSITABLE_HASH_TABLE_SIZE]; - else - entry = (*handle)->next; - - while (entry && entry->value != val) - entry = entry->next; - - *handle = entry; - if (!entry) - return ERROR_NO_MORE_ITEMS; - - *row = entry->row; - - return ERROR_SUCCESS; -} - static UINT TABLE_add_ref(struct tagMSIVIEW *view) { MSITABLEVIEW *tv = (MSITABLEVIEW*)view; @@ -2148,7 +2069,6 @@ static const MSIVIEWOPS table_ops = TABLE_get_column_info, TABLE_modify, TABLE_delete, - TABLE_find_matching_rows, TABLE_add_ref, TABLE_release, TABLE_add_column, diff --git a/dll/win32/msi/update.c b/dll/win32/msi/update.c index d0e3c28f792..ed81447aa5e 100644 --- a/dll/win32/msi/update.c +++ b/dll/win32/msi/update.c @@ -195,14 +195,6 @@ static UINT UPDATE_delete( struct tagMSIVIEW *view ) return ERROR_SUCCESS; } -static UINT UPDATE_find_matching_rows( struct tagMSIVIEW *view, UINT col, UINT val, UINT *row, MSIITERHANDLE *handle ) -{ - TRACE("%p %d %d %p\n", view, col, val, *handle ); - - return ERROR_FUNCTION_FAILED; -} - - static const MSIVIEWOPS update_ops = { UPDATE_fetch_int, @@ -217,7 +209,6 @@ static const MSIVIEWOPS update_ops = UPDATE_get_column_info, UPDATE_modify, UPDATE_delete, - UPDATE_find_matching_rows, NULL, NULL, NULL, diff --git a/dll/win32/msi/where.c b/dll/win32/msi/where.c index ddd8c07fab5..b493bda7dd8 100644 --- a/dll/win32/msi/where.c +++ b/dll/win32/msi/where.c @@ -1015,36 +1015,6 @@ static UINT WHERE_delete( struct tagMSIVIEW *view ) return ERROR_SUCCESS; } -static UINT WHERE_find_matching_rows( struct tagMSIVIEW *view, UINT col, - UINT val, UINT *row, MSIITERHANDLE *handle ) -{ - MSIWHEREVIEW *wv = (MSIWHEREVIEW*)view; - UINT i, row_value; - - TRACE("%p, %d, %u, %p\n", view, col, val, *handle); - - if (!wv->tables) - return ERROR_FUNCTION_FAILED; - - if (col == 0 || col > wv->col_count) - return ERROR_INVALID_PARAMETER; - - for (i = PtrToUlong(*handle); i < wv->row_count; i++) - { - if (view->ops->fetch_int( view, i, col, &row_value ) != ERROR_SUCCESS) - continue; - - if (row_value == val) - { - *row = i; - *handle = UlongToPtr(i + 1); - return ERROR_SUCCESS; - } - } - - return ERROR_NO_MORE_ITEMS; -} - static UINT WHERE_sort(struct tagMSIVIEW *view, column_info *columns) { MSIWHEREVIEW *wv = (MSIWHEREVIEW *)view; @@ -1108,7 +1078,6 @@ static const MSIVIEWOPS where_ops = WHERE_get_column_info, WHERE_modify, WHERE_delete, - WHERE_find_matching_rows, NULL, NULL, NULL,
2 years, 9 months
1
0
0
0
[reactos] 179/360: [WINESYNC] msi/tests: Use check_record() in more places.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=eaa4c035ac301497b2580…
commit eaa4c035ac301497b25801b8b80b55991df3dfb0 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sun Mar 13 00:16:23 2022 +0100 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Sun Mar 20 19:28:08 2022 +0100 [WINESYNC] msi/tests: Use check_record() in more places. 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 fe23e015278e318f9642c67384887f865e5f2ed3 by Zebediah Figura <z.figura12(a)gmail.com> --- modules/rostests/winetests/msi/db.c | 644 +++++------------------------------- 1 file changed, 76 insertions(+), 568 deletions(-) diff --git a/modules/rostests/winetests/msi/db.c b/modules/rostests/winetests/msi/db.c index d97c3502193..09ba4b8293d 100644 --- a/modules/rostests/winetests/msi/db.c +++ b/modules/rostests/winetests/msi/db.c @@ -1021,19 +1021,7 @@ static void test_viewmodify(void) r = MsiViewFetch(hview, &hrec); ok(r == ERROR_SUCCESS, "MsiViewFetch failed\n"); - - r = MsiRecordGetInteger(hrec, 1); - ok(r == 1, "Expected 1, got %d\n", r); - - sz = sizeof(buffer); - r = MsiRecordGetStringA(hrec, 2, buffer, &sz); - ok(r == ERROR_SUCCESS, "MsiRecordGetString failed\n"); - ok(!lstrcmpA(buffer, "bob"), "Expected bob, got %s\n", buffer); - - sz = sizeof(buffer); - r = MsiRecordGetStringA(hrec, 3, buffer, &sz); - ok(r == ERROR_SUCCESS, "MsiRecordGetString failed\n"); - ok(!lstrcmpA(buffer, "7654321"), "Expected 7654321, got %s\n", buffer); + check_record(hrec, 3, "1", "bob", "7654321"); /* update the view, non-primary key */ r = MsiRecordSetStringA(hrec, 3, "3141592"); @@ -1070,20 +1058,7 @@ static void test_viewmodify(void) r = MsiViewFetch(hview, &hrec); ok(r == ERROR_SUCCESS, "MsiViewFetch failed\n"); - - r = MsiRecordGetInteger(hrec, 1); - ok(r == 1, "Expected 1, got %d\n", r); - - sz = sizeof(buffer); - r = MsiRecordGetStringA(hrec, 2, buffer, &sz); - ok(r == ERROR_SUCCESS, "MsiRecordGetString failed\n"); - ok(!lstrcmpA(buffer, "bob"), "Expected bob, got %s\n", buffer); - - sz = sizeof(buffer); - r = MsiRecordGetStringA(hrec, 3, buffer, &sz); - ok(r == ERROR_SUCCESS, "MsiRecordGetString failed\n"); - ok(!lstrcmpA(buffer, "3141592"), "Expected 3141592, got %s\n", buffer); - + check_record(hrec, 3, "1", "bob", "3141592"); r = MsiCloseHandle(hrec); ok(r == ERROR_SUCCESS, "failed to close record\n"); @@ -1218,15 +1193,13 @@ static void test_getcolinfo(void) { MSIHANDLE hdb, hview = 0, rec = 0; UINT r; - DWORD sz; - char buffer[0x20]; /* create an empty db */ hdb = create_db(); ok( hdb, "failed to create db\n"); /* tables should be present */ - r = MsiDatabaseOpenViewA(hdb, "select * from _Tables", &hview); + r = MsiDatabaseOpenViewA(hdb, "select Name from _Tables", &hview); ok( r == ERROR_SUCCESS, "failed to open query\n"); r = MsiViewExecute(hview, 0); @@ -1236,10 +1209,7 @@ static void test_getcolinfo(void) rec = 0; r = MsiViewGetColumnInfo( hview, MSICOLINFO_NAMES, &rec ); ok( r == ERROR_SUCCESS, "failed to get names\n"); - sz = sizeof buffer; - r = MsiRecordGetStringA(rec, 1, buffer, &sz ); - ok( r == ERROR_SUCCESS, "failed to get string\n"); - ok( !strcmp(buffer,"Name"), "_Tables has wrong column name\n"); + check_record(rec, 1, "Name"); r = MsiCloseHandle( rec ); ok( r == ERROR_SUCCESS, "failed to close record handle\n"); @@ -1247,10 +1217,7 @@ static void test_getcolinfo(void) rec = 0; r = MsiViewGetColumnInfo( hview, MSICOLINFO_TYPES, &rec ); ok( r == ERROR_SUCCESS, "failed to get names\n"); - sz = sizeof buffer; - r = MsiRecordGetStringA(rec, 1, buffer, &sz ); - ok( r == ERROR_SUCCESS, "failed to get string\n"); - ok( !strcmp(buffer,"s64"), "_Tables has wrong column type\n"); + check_record(rec, 1, "s64"); r = MsiCloseHandle( rec ); ok( r == ERROR_SUCCESS, "failed to close record handle\n"); @@ -2025,9 +1992,6 @@ static void test_where(void) MSIHANDLE hdb = 0, rec, view; LPCSTR query; UINT r; - DWORD size; - CHAR buf[MAX_PATH]; - UINT count; hdb = create_db(); ok( hdb, "failed to create db\n"); @@ -2068,11 +2032,6 @@ static void test_where(void) r = do_query(hdb, query, &rec); ok(r == ERROR_SUCCESS, "MsiViewFetch failed: %d\n", r); check_record(rec, 6, "2", "1", "", "one.cab", "", ""); - - r = MsiRecordGetInteger(rec, 1); - ok( 2 == r, "field wrong\n"); - r = MsiRecordGetInteger(rec, 2); - ok( 1 == r, "field wrong\n"); MsiCloseHandle( rec ); query = "SELECT `DiskId` FROM `Media` WHERE `LastSequence` >= 1 AND DiskId >= 0"; @@ -2084,23 +2043,12 @@ static void test_where(void) r = MsiViewFetch(view, &rec); ok( r == ERROR_SUCCESS, "failed to fetch view: %d\n", r ); - - count = MsiRecordGetFieldCount( rec ); - ok( count == 1, "Expected 1 record fields, got %d\n", count ); - - size = MAX_PATH; - r = MsiRecordGetStringA( rec, 1, buf, &size ); - ok( r == ERROR_SUCCESS, "failed to get record string: %d\n", r ); - ok( !lstrcmpA( buf, "2" ), "For (row %d, column 1) expected '%d', got %s\n", 0, 2, buf ); + check_record(rec, 1, "2"); MsiCloseHandle( rec ); r = MsiViewFetch(view, &rec); ok( r == ERROR_SUCCESS, "failed to fetch view: %d\n", r ); - - size = MAX_PATH; - r = MsiRecordGetStringA( rec, 1, buf, &size ); - ok( r == ERROR_SUCCESS, "failed to get record string: %d\n", r ); - ok( !lstrcmpA( buf, "3" ), "For (row %d, column 1) expected '%d', got %s\n", 1, 3, buf ); + check_record(rec, 1, "3"); MsiCloseHandle( rec ); r = MsiViewFetch(view, &rec); @@ -3202,40 +3150,12 @@ static void test_try_transform(void) r = MsiViewFetch(hview, &hrec); ok(r == ERROR_SUCCESS, "view fetch failed\n"); - - r = MsiRecordGetInteger(hrec, 1); - ok(r == 1, "Expected 1, got %d\n", r); - - sz = sizeof buffer; - r = MsiRecordGetStringA(hrec, 2, buffer, &sz); - ok(r == ERROR_SUCCESS, "record get string failed\n"); - ok(!lstrcmpA(buffer, "c"), "Expected c, got %s\n", buffer); - - r = MsiRecordGetInteger(hrec, 3); - ok(r == 0x80000000, "Expected 0x80000000, got %d\n", r); - - r = MsiRecordGetInteger(hrec, 4); - ok(r == 5, "Expected 5, got %d\n", r); - + check_record(hrec, 4, "1", "c", "", "5"); MsiCloseHandle(hrec); r = MsiViewFetch(hview, &hrec); ok(r == ERROR_SUCCESS, "view fetch failed\n"); - - r = MsiRecordGetInteger(hrec, 1); - ok(r == 2, "Expected 2, got %d\n", r); - - sz = sizeof buffer; - r = MsiRecordGetStringA(hrec, 2, buffer, &sz); - ok(r == ERROR_SUCCESS, "record get string failed\n"); - ok(!lstrcmpA(buffer, "b"), "Expected b, got %s\n", buffer); - - r = MsiRecordGetInteger(hrec, 3); - ok(r == 0x80000000, "Expected 0x80000000, got %d\n", r); - - r = MsiRecordGetInteger(hrec, 4); - ok(r == 0x80000000, "Expected 0x80000000, got %d\n", r); - + check_record(hrec, 4, "2", "b", "", ""); MsiCloseHandle(hrec); r = MsiViewFetch(hview, &hrec); @@ -3748,8 +3668,6 @@ static void test_temporary_table(void) MSIHANDLE hdb = 0, view = 0, rec; const char *query; UINT r; - char buf[0x10]; - DWORD sz; cond = MsiDatabaseIsTablePersistentA(0, NULL); ok( cond == MSICONDITION_ERROR, "wrong return condition\n"); @@ -3828,18 +3746,9 @@ static void test_temporary_table(void) ok(r == ERROR_SUCCESS, "failed to query table\n"); r = MsiViewGetColumnInfo(view, MSICOLINFO_TYPES, &rec); ok(r == ERROR_SUCCESS, "failed to get column info\n"); - - sz = sizeof buf; - r = MsiRecordGetStringA(rec, 1, buf, &sz); - ok(r == ERROR_SUCCESS, "failed to get string\n"); - ok( 0 == strcmp("G255", buf), "wrong column type\n"); - - sz = sizeof buf; - r = MsiRecordGetStringA(rec, 2, buf, &sz); - ok(r == ERROR_SUCCESS, "failed to get string\n"); - ok( 0 == strcmp("j2", buf), "wrong column type\n"); - + check_record(rec, 2, "G255", "j2"); MsiCloseHandle( rec ); + MsiViewClose( view ); MsiCloseHandle( view ); @@ -4152,9 +4061,7 @@ static void test_integers(void) static void test_update(void) { MSIHANDLE hdb = 0, view = 0, rec = 0; - CHAR result[MAX_PATH]; const char *query; - DWORD size; UINT r; /* just MsiOpenDatabase should not create a file */ @@ -4253,22 +4160,12 @@ static void test_update(void) r = MsiViewFetch(view, &rec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - size = MAX_PATH; - r = MsiRecordGetStringA(rec, 1, result, &size); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(result, "this is text"), "Expected `this is text`, got %s\n", result); - + check_record(rec, 1, "this is text"); MsiCloseHandle(rec); r = MsiViewFetch(view, &rec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - size = MAX_PATH; - r = MsiRecordGetStringA(rec, 1, result, &size); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!result[0], "Expected an empty string, got %s\n", result); - + check_record(rec, 1, ""); MsiCloseHandle(rec); r = MsiViewFetch(view, &rec); @@ -4299,22 +4196,12 @@ static void test_update(void) r = MsiViewFetch(view, &rec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - size = MAX_PATH; - r = MsiRecordGetStringA(rec, 1, result, &size); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(result, "this is text"), "Expected `this is text`, got %s\n", result); - + check_record(rec, 1, "this is text"); MsiCloseHandle(rec); r = MsiViewFetch(view, &rec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - size = MAX_PATH; - r = MsiRecordGetStringA(rec, 1, result, &size); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!result[0], "Expected an empty string, got %s\n", result); - + check_record(rec, 1, ""); MsiCloseHandle(rec); r = MsiViewFetch(view, &rec); @@ -4345,32 +4232,17 @@ static void test_update(void) r = MsiViewFetch(view, &rec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - size = MAX_PATH; - r = MsiRecordGetStringA(rec, 1, result, &size); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(result, "this is text"), "Expected `this is text`, got %s\n", result); - + check_record(rec, 1, "this is text"); MsiCloseHandle(rec); r = MsiViewFetch(view, &rec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - size = MAX_PATH; - r = MsiRecordGetStringA(rec, 1, result, &size); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(result, "this is text"), "Expected `this is text`, got %s\n", result); - + check_record(rec, 1, "this is text"); MsiCloseHandle(rec); r = MsiViewFetch(view, &rec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - size = MAX_PATH; - r = MsiRecordGetStringA(rec, 1, result, &size); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(result, "this is text"), "Expected `this is text`, got %s\n", result); - + check_record(rec, 1, "this is text"); MsiCloseHandle(rec); r = MsiViewFetch(view, &rec); @@ -4498,8 +4370,6 @@ static void test_tables_order(void) const char *query; MSIHANDLE hdb = 0, hview = 0, hrec = 0; UINT r; - char buffer[100]; - DWORD sz; r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_CREATE, &hdb); ok(r == ERROR_SUCCESS, "MsiOpenDatabase failed\n"); @@ -4524,7 +4394,7 @@ static void test_tables_order(void) /* The names of the tables in the _Tables table must be in the same order as these names are created in the strings table. */ - query = "SELECT * FROM `_Tables`"; + query = "SELECT `Name` FROM `_Tables`"; r = MsiDatabaseOpenViewA(hdb, query, &hview); ok(r == ERROR_SUCCESS, "MsiDatabaseOpenView failed\n"); r = MsiViewExecute(hview, 0); @@ -4532,28 +4402,19 @@ static void test_tables_order(void) r = MsiViewFetch(hview, &hrec); ok(r == ERROR_SUCCESS, "MsiViewFetch failed\n"); - sz = sizeof(buffer); - r = MsiRecordGetStringA(hrec, 1, buffer, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buffer, "foo"), "Expected foo, got %s\n", buffer); + check_record(hrec, 1, "foo"); r = MsiCloseHandle(hrec); ok(r == ERROR_SUCCESS, "failed to close record\n"); r = MsiViewFetch(hview, &hrec); ok(r == ERROR_SUCCESS, "MsiViewFetch failed\n"); - sz = sizeof(buffer); - r = MsiRecordGetStringA(hrec, 1, buffer, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buffer, "baz"), "Expected baz, got %s\n", buffer); + check_record(hrec, 1, "baz"); r = MsiCloseHandle(hrec); ok(r == ERROR_SUCCESS, "failed to close record\n"); r = MsiViewFetch(hview, &hrec); ok(r == ERROR_SUCCESS, "MsiViewFetch failed\n"); - sz = sizeof(buffer); - r = MsiRecordGetStringA(hrec, 1, buffer, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buffer, "bar"), "Expected bar, got %s\n", buffer); + check_record(hrec, 1, "bar"); r = MsiCloseHandle(hrec); ok(r == ERROR_SUCCESS, "failed to close record\n"); @@ -4565,7 +4426,7 @@ static void test_tables_order(void) /* The names of the tables in the _Columns table must be in the same order as these names are created in the strings table. */ - query = "SELECT * FROM `_Columns`"; + query = "SELECT `Table`, `Number`, `Name` FROM `_Columns`"; r = MsiDatabaseOpenViewA(hdb, query, &hview); ok(r == ERROR_SUCCESS, "MsiDatabaseOpenView failed\n"); r = MsiViewExecute(hview, 0); @@ -4573,66 +4434,31 @@ static void test_tables_order(void) r = MsiViewFetch(hview, &hrec); ok(r == ERROR_SUCCESS, "MsiViewFetch failed\n"); - sz = sizeof(buffer); - r = MsiRecordGetStringA(hrec, 1, buffer, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buffer, "foo"), "Expected foo, got %s\n", buffer); - sz = sizeof(buffer); - r = MsiRecordGetStringA(hrec, 3, buffer, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buffer, "baz"), "Expected baz, got %s\n", buffer); + check_record(hrec, 3, "foo", "1", "baz"); r = MsiCloseHandle(hrec); ok(r == ERROR_SUCCESS, "failed to close record\n"); r = MsiViewFetch(hview, &hrec); ok(r == ERROR_SUCCESS, "MsiViewFetch failed\n"); - sz = sizeof(buffer); - r = MsiRecordGetStringA(hrec, 1, buffer, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buffer, "baz"), "Expected baz, got %s\n", buffer); - sz = sizeof(buffer); - r = MsiRecordGetStringA(hrec, 3, buffer, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buffer, "bar"), "Expected bar, got %s\n", buffer); + check_record(hrec, 3, "baz", "1", "bar"); r = MsiCloseHandle(hrec); ok(r == ERROR_SUCCESS, "failed to close record\n"); r = MsiViewFetch(hview, &hrec); ok(r == ERROR_SUCCESS, "MsiViewFetch failed\n"); - sz = sizeof(buffer); - r = MsiRecordGetStringA(hrec, 1, buffer, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buffer, "baz"), "Expected baz, got %s\n", buffer); - sz = sizeof(buffer); - r = MsiRecordGetStringA(hrec, 3, buffer, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buffer, "baz"), "Expected baz, got %s\n", buffer); + check_record(hrec, 3, "baz", "2", "baz"); r = MsiCloseHandle(hrec); ok(r == ERROR_SUCCESS, "failed to close record\n"); r = MsiViewFetch(hview, &hrec); ok(r == ERROR_SUCCESS, "MsiViewFetch failed\n"); - sz = sizeof(buffer); - r = MsiRecordGetStringA(hrec, 1, buffer, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buffer, "baz"), "Expected baz, got %s\n", buffer); - sz = sizeof(buffer); - r = MsiRecordGetStringA(hrec, 3, buffer, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buffer, "foo"), "Expected foo, got %s\n", buffer); + check_record(hrec, 3, "baz", "3", "foo"); r = MsiCloseHandle(hrec); ok(r == ERROR_SUCCESS, "failed to close record\n"); r = MsiViewFetch(hview, &hrec); ok(r == ERROR_SUCCESS, "MsiViewFetch failed\n"); - sz = sizeof(buffer); - r = MsiRecordGetStringA(hrec, 1, buffer, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buffer, "bar"), "Expected bar, got %s\n", buffer); - sz = sizeof(buffer); - r = MsiRecordGetStringA(hrec, 3, buffer, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buffer, "foo"), "Expected foo, got %s\n", buffer); + check_record(hrec, 3, "bar", "1", "foo"); r = MsiCloseHandle(hrec); ok(r == ERROR_SUCCESS, "failed to close record\n"); @@ -4652,8 +4478,6 @@ static void test_rows_order(void) const char *query; MSIHANDLE hdb = 0, hview = 0, hrec = 0; UINT r; - char buffer[100]; - DWORD sz; r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_CREATE, &hdb); ok(r == ERROR_SUCCESS, "MsiOpenDatabase failed\n"); @@ -4722,53 +4546,25 @@ static void test_rows_order(void) r = MsiViewFetch(hview, &hrec); ok(r == ERROR_SUCCESS, "MsiViewFetch failed\n"); - sz = sizeof(buffer); - r = MsiRecordGetStringA(hrec, 1, buffer, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buffer, "A"), "Expected A, got %s\n", buffer); - sz = sizeof(buffer); - r = MsiRecordGetStringA(hrec, 2, buffer, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buffer, "B"), "Expected B, got %s\n", buffer); + check_record(hrec, 2, "A", "B"); r = MsiCloseHandle(hrec); ok(r == ERROR_SUCCESS, "failed to close record\n"); r = MsiViewFetch(hview, &hrec); ok(r == ERROR_SUCCESS, "MsiViewFetch failed\n"); - sz = sizeof(buffer); - r = MsiRecordGetStringA(hrec, 1, buffer, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buffer, "C"), "Expected E, got %s\n", buffer); - sz = sizeof(buffer); - r = MsiRecordGetStringA(hrec, 2, buffer, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buffer, "E"), "Expected E, got %s\n", buffer); + check_record(hrec, 2, "C", "E"); r = MsiCloseHandle(hrec); ok(r == ERROR_SUCCESS, "failed to close record\n"); r = MsiViewFetch(hview, &hrec); ok(r == ERROR_SUCCESS, "MsiViewFetch failed\n"); - sz = sizeof(buffer); - r = MsiRecordGetStringA(hrec, 1, buffer, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buffer, "D"), "Expected D, got %s\n", buffer); - sz = sizeof(buffer); - r = MsiRecordGetStringA(hrec, 2, buffer, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buffer, "E"), "Expected E, got %s\n", buffer); + check_record(hrec, 2, "D", "E"); r = MsiCloseHandle(hrec); ok(r == ERROR_SUCCESS, "failed to close record\n"); r = MsiViewFetch(hview, &hrec); ok(r == ERROR_SUCCESS, "MsiViewFetch failed\n"); - sz = sizeof(buffer); - r = MsiRecordGetStringA(hrec, 1, buffer, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buffer, "F"), "Expected F, got %s\n", buffer); - sz = sizeof(buffer); - r = MsiRecordGetStringA(hrec, 2, buffer, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buffer, "A"), "Expected A, got %s\n", buffer); + check_record(hrec, 2, "F", "A"); r = MsiCloseHandle(hrec); ok(r == ERROR_SUCCESS, "failed to close record\n"); @@ -4954,8 +4750,6 @@ static void test_select_markers(void) MSIHANDLE hdb = 0, rec, view, res; LPCSTR query; UINT r; - DWORD size; - CHAR buf[MAX_PATH]; hdb = create_db(); ok( hdb, "failed to create db\n"); @@ -4993,38 +4787,12 @@ static void test_select_markers(void) r = MsiViewFetch(view, &res); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - size = MAX_PATH; - r = MsiRecordGetStringA(res, 1, buf, &size); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buf, "apple"), "Expected apple, got %s\n", buf); - - size = MAX_PATH; - r = MsiRecordGetStringA(res, 2, buf, &size); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buf, "two"), "Expected two, got %s\n", buf); - - r = MsiRecordGetInteger(res, 3); - ok(r == 1, "Expected 1, got %d\n", r); - + check_record(res, 3, "apple", "two", "1"); MsiCloseHandle(res); r = MsiViewFetch(view, &res); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - size = MAX_PATH; - r = MsiRecordGetStringA(res, 1, buf, &size); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buf, "apple"), "Expected apple, got %s\n", buf); - - size = MAX_PATH; - r = MsiRecordGetStringA(res, 2, buf, &size); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buf, "two"), "Expected two, got %s\n", buf); - - r = MsiRecordGetInteger(res, 3); - ok(r == 2, "Expected 2, got %d\n", r); - + check_record(res, 3, "apple", "two", "2"); MsiCloseHandle(res); r = MsiViewFetch(view, &res); @@ -5046,38 +4814,12 @@ static void test_select_markers(void) r = MsiViewFetch(view, &res); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - size = MAX_PATH; - r = MsiRecordGetStringA(res, 1, buf, &size); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buf, "apple"), "Expected apple, got %s\n", buf); - - size = MAX_PATH; - r = MsiRecordGetStringA(res, 2, buf, &size); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buf, "two"), "Expected two, got %s\n", buf); - - r = MsiRecordGetInteger(res, 3); - ok(r == 2, "Expected 2, got %d\n", r); - + check_record(res, 3, "apple", "two", "2"); MsiCloseHandle(res); r = MsiViewFetch(view, &res); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - size = MAX_PATH; - r = MsiRecordGetStringA(res, 1, buf, &size); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buf, "banana"), "Expected banana, got %s\n", buf); - - size = MAX_PATH; - r = MsiRecordGetStringA(res, 2, buf, &size); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buf, "three"), "Expected three, got %s\n", buf); - - r = MsiRecordGetInteger(res, 3); - ok(r == 3, "Expected 3, got %d\n", r); - + check_record(res, 3, "banana", "three", "3"); MsiCloseHandle(res); r = MsiViewFetch(view, &res); @@ -5508,7 +5250,7 @@ static void test_stringtable(void) const char *query; char buffer[MAX_PATH]; WCHAR data[MAX_PATH]; - DWORD sz, read; + DWORD read; UINT r; static const DWORD mode = STGM_DIRECT | STGM_READ | STGM_SHARE_DENY_WRITE; @@ -5593,18 +5335,7 @@ static void test_stringtable(void) r = MsiViewFetch(hview, &hrec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - r = MsiRecordGetFieldCount(hrec); - ok(r == 2, "Expected 2, got %d\n", r); - - r = MsiRecordGetInteger(hrec, 1); - ok(r == 1, "Expected 1, got %d\n", r); - - sz = sizeof(buffer); - r = MsiRecordGetStringA(hrec, 2, buffer, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buffer, "one"), "Expected one, got '%s'\n", buffer); - + check_record(hrec, 2, "1", "one"); r = MsiCloseHandle(hrec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); @@ -5627,35 +5358,13 @@ static void test_stringtable(void) r = MsiViewFetch(hview, &hrec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - r = MsiRecordGetFieldCount(hrec); - ok(r == 2, "Expected 2, got %d\n", r); - - r = MsiRecordGetInteger(hrec, 1); - ok(r == 2, "Expected 2, got %d\n", r); - - sz = sizeof(buffer); - r = MsiRecordGetStringA(hrec, 2, buffer, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buffer, "two"), "Expected two, got '%s'\n", buffer); - + check_record(hrec, 2, "2", "two"); r = MsiCloseHandle(hrec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); r = MsiViewFetch(hview, &hrec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - r = MsiRecordGetFieldCount(hrec); - ok(r == 2, "Expected 2, got %d\n", r); - - r = MsiRecordGetInteger(hrec, 1); - ok(r == 5, "Expected 5, got %d\n", r); - - sz = sizeof(buffer); - r = MsiRecordGetStringA(hrec, 2, buffer, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buffer, "five"), "Expected five, got '%s'\n", buffer); - + check_record(hrec, 2, "5", "five"); r = MsiCloseHandle(hrec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); @@ -5741,8 +5450,6 @@ static void test_viewmodify_delete(void) MSIHANDLE hdb = 0, hview = 0, hrec = 0; UINT r; const char *query; - char buffer[0x100]; - DWORD sz; DeleteFileA(msifile); @@ -5806,20 +5513,7 @@ static void test_viewmodify_delete(void) ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); r = MsiViewFetch(hview, &hrec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - r = MsiRecordGetInteger(hrec, 1); - ok(r == 3, "Expected 3, got %d\n", r); - - sz = sizeof(buffer); - r = MsiRecordGetStringA(hrec, 2, buffer, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buffer, "Cindy"), "Expected Cindy, got %s\n", buffer); - - sz = sizeof(buffer); - r = MsiRecordGetStringA(hrec, 3, buffer, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buffer, "2937550"), "Expected 2937550, got %s\n", buffer); - + check_record(hrec, 3, "3", "Cindy", "2937550"); r = MsiCloseHandle(hrec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); @@ -5942,10 +5636,9 @@ static void test_defaultdatabase(void) static void test_order(void) { MSIHANDLE hdb, hview, hrec; - CHAR buffer[MAX_PATH]; LPCSTR query; - UINT r, sz; int val; + UINT r; hdb = create_db(); ok(hdb, "failed to create db\n"); @@ -6178,15 +5871,7 @@ static void test_order(void) r = MsiViewFetch(hview, &hrec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - sz = sizeof(buffer); - r = MsiRecordGetStringA(hrec, 1, buffer, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buffer, "dos"), "Expected \"dos\", got \"%s\"\n", buffer); - - r = MsiRecordGetInteger(hrec, 2); - ok(r == 3, "Expected 3, got %d\n", r); - + check_record(hrec, 2, "dos", "3"); MsiCloseHandle(hrec); r = MsiViewFetch(hview, &hrec); @@ -6317,9 +6002,7 @@ static void test_deleterow(void) { MSIHANDLE hdb, hview, hrec; const char *query; - char buf[MAX_PATH]; UINT r; - DWORD size; DeleteFileA(msifile); @@ -6358,12 +6041,7 @@ static void test_deleterow(void) r = MsiViewFetch(hview, &hrec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - size = MAX_PATH; - r = MsiRecordGetStringA(hrec, 1, buf, &size); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buf, "two"), "Expected two, got %s\n", buf); - + check_record(hrec, 1, "two"); MsiCloseHandle(hrec); r = MsiViewFetch(hview, &hrec); @@ -6384,9 +6062,7 @@ static void test_quotes(void) { MSIHANDLE hdb, hview, hrec; const char *query; - char buf[MAX_PATH]; UINT r; - DWORD size; DeleteFileA(msifile); @@ -6437,13 +6113,7 @@ static void test_quotes(void) r = MsiViewFetch(hview, &hrec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - size = MAX_PATH; - r = MsiRecordGetStringA(hrec, 1, buf, &size); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buf, "This is a \"string\" ok"), - "Expected \"This is a \"string\" ok\", got %s\n", buf); - + check_record(hrec, 1, "This is a \"string\" ok"); MsiCloseHandle(hrec); r = MsiViewFetch(hview, &hrec); @@ -6468,13 +6138,7 @@ static void test_quotes(void) r = MsiViewFetch(hview, &hrec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - size = MAX_PATH; - r = MsiRecordGetStringA(hrec, 1, buf, &size); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buf, "This is a new 'string' ok"), - "Expected \"This is a new 'string' ok\", got %s\n", buf); - + check_record(hrec, 1, "This is a new 'string' ok"); MsiCloseHandle(hrec); r = MsiViewFetch(hview, &hrec); @@ -6490,9 +6154,7 @@ static void test_carriagereturn(void) { MSIHANDLE hdb, hview, hrec; const char *query; - char buf[MAX_PATH]; UINT r; - DWORD size; DeleteFileA(msifile); @@ -6626,7 +6288,7 @@ static void test_carriagereturn(void) ok(r == ERROR_BAD_QUERY_SYNTAX, "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r); - query = "SELECT * FROM `_Tables`"; + query = "SELECT `Name` FROM `_Tables`"; r = MsiDatabaseOpenViewA(hdb, query, &hview); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); r = MsiViewExecute(hview, 0); @@ -6634,32 +6296,17 @@ static void test_carriagereturn(void) r = MsiViewFetch(hview, &hrec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - size = MAX_PATH; - r = MsiRecordGetStringA(hrec, 1, buf, &size); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buf, "\rOne"), "Expected \"\\rOne\", got \"%s\"\n", buf); - + check_record(hrec, 1, "\rOne"); MsiCloseHandle(hrec); r = MsiViewFetch(hview, &hrec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - size = MAX_PATH; - r = MsiRecordGetStringA(hrec, 1, buf, &size); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buf, "Tw\ro"), "Expected \"Tw\\ro\", got \"%s\"\n", buf); - + check_record(hrec, 1, "Tw\ro"); MsiCloseHandle(hrec); r = MsiViewFetch(hview, &hrec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - size = MAX_PATH; - r = MsiRecordGetStringA(hrec, 1, buf, &size); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buf, "Three\r"), "Expected \"Three\r\", got \"%s\"\n", buf); - + check_record(hrec, 1, "Three\r"); MsiCloseHandle(hrec); r = MsiViewFetch(hview, &hrec); @@ -6676,9 +6323,7 @@ static void test_noquotes(void) { MSIHANDLE hdb, hview, hrec; const char *query; - char buf[MAX_PATH]; UINT r; - DWORD size; DeleteFileA(msifile); @@ -6701,7 +6346,7 @@ static void test_noquotes(void) r = run_query(hdb, 0, query); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - query = "SELECT * FROM `_Tables`"; + query = "SELECT `Name` FROM `_Tables`"; r = MsiDatabaseOpenViewA(hdb, query, &hview); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); r = MsiViewExecute(hview, 0); @@ -6709,32 +6354,17 @@ static void test_noquotes(void) r = MsiViewFetch(hview, &hrec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - size = MAX_PATH; - r = MsiRecordGetStringA(hrec, 1, buf, &size); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buf, "Table"), "Expected \"Table\", got \"%s\"\n", buf); - + check_record(hrec, 1, "Table"); MsiCloseHandle(hrec); r = MsiViewFetch(hview, &hrec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - size = MAX_PATH; - r = MsiRecordGetStringA(hrec, 1, buf, &size); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buf, "Table2"), "Expected \"Table2\", got \"%s\"\n", buf); - + check_record(hrec, 1, "Table2"); MsiCloseHandle(hrec); r = MsiViewFetch(hview, &hrec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - size = MAX_PATH; - r = MsiRecordGetStringA(hrec, 1, buf, &size); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buf, "Table3"), "Expected \"Table3\", got \"%s\"\n", buf); - + check_record(hrec, 1, "Table3"); MsiCloseHandle(hrec); r = MsiViewFetch(hview, &hrec); @@ -6743,7 +6373,7 @@ static void test_noquotes(void) MsiViewClose(hview); MsiCloseHandle(hview); - query = "SELECT * FROM `_Columns`"; + query = "SELECT `Table`, `Number`, `Name` FROM `_Columns`"; r = MsiDatabaseOpenViewA(hdb, query, &hview); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); r = MsiViewExecute(hview, 0); @@ -6751,56 +6381,17 @@ static void test_noquotes(void) r = MsiViewFetch(hview, &hrec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - size = MAX_PATH; - r = MsiRecordGetStringA(hrec, 1, buf, &size); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buf, "Table"), "Expected \"Table\", got \"%s\"\n", buf); - - r = MsiRecordGetInteger(hrec, 2); - ok(r == 1, "Expected 1, got %d\n", r); - - size = MAX_PATH; - r = MsiRecordGetStringA(hrec, 3, buf, &size); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buf, "A"), "Expected \"A\", got \"%s\"\n", buf); - + check_record(hrec, 3, "Table", "1", "A"); MsiCloseHandle(hrec); r = MsiViewFetch(hview, &hrec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - size = MAX_PATH; - r = MsiRecordGetStringA(hrec, 1, buf, &size); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buf, "Table2"), "Expected \"Table2\", got \"%s\"\n", buf); - - r = MsiRecordGetInteger(hrec, 2); - ok(r == 1, "Expected 1, got %d\n", r); - - size = MAX_PATH; - r = MsiRecordGetStringA(hrec, 3, buf, &size); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buf, "A"), "Expected \"A\", got \"%s\"\n", buf); - + check_record(hrec, 3, "Table2", "1", "A"); MsiCloseHandle(hrec); r = MsiViewFetch(hview, &hrec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - size = MAX_PATH; - r = MsiRecordGetStringA(hrec, 1, buf, &size); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buf, "Table3"), "Expected \"Table3\", got \"%s\"\n", buf); - - r = MsiRecordGetInteger(hrec, 2); - ok(r == 1, "Expected 1, got %d\n", r); - - size = MAX_PATH; - r = MsiRecordGetStringA(hrec, 3, buf, &size); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buf, "A"), "Expected \"A\", got \"%s\"\n", buf); - + check_record(hrec, 3, "Table3", "1", "A"); MsiCloseHandle(hrec); r = MsiViewFetch(hview, &hrec); @@ -6853,12 +6444,7 @@ static void test_noquotes(void) r = MsiViewFetch(hview, &hrec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - size = MAX_PATH; - r = MsiRecordGetStringA(hrec, 1, buf, &size); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buf, "hi"), "Expected \"hi\", got \"%s\"\n", buf); - + check_record(hrec, 1, "hi"); MsiCloseHandle(hrec); r = MsiViewFetch(hview, &hrec); @@ -6955,9 +6541,7 @@ static void test_viewmodify_refresh(void) { MSIHANDLE hdb, hview, hrec; const char *query; - char buffer[MAX_PATH]; UINT r; - DWORD size; DeleteFileA(msifile); @@ -6987,17 +6571,9 @@ static void test_viewmodify_refresh(void) r = MsiViewModify(hview, MSIMODIFY_REFRESH, hrec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - size = MAX_PATH; - r = MsiRecordGetStringA(hrec, 1, buffer, &size); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buffer, "hi"), "Expected \"hi\", got \"%s\"\n", buffer); - ok(size == 2, "Expected 2, got %d\n", size); - - r = MsiRecordGetInteger(hrec, 2); - ok(r == 2, "Expected 2, got %d\n", r); - + check_record(hrec, 2, "hi", "2"); MsiCloseHandle(hrec); + MsiViewClose(hview); MsiCloseHandle(hview); @@ -7024,17 +6600,9 @@ static void test_viewmodify_refresh(void) r = MsiViewModify(hview, MSIMODIFY_REFRESH, hrec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - size = MAX_PATH; - r = MsiRecordGetStringA(hrec, 1, buffer, &size); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buffer, "hello"), "Expected \"hello\", got \"%s\"\n", buffer); - ok(size == 5, "Expected 5, got %d\n", size); - - r = MsiRecordGetInteger(hrec, 2); - ok(r == 2, "Expected 2, got %d\n", r); - + check_record(hrec, 2, "hello", "2"); MsiCloseHandle(hrec); + MsiViewClose(hview); MsiCloseHandle(hview); MsiCloseHandle(hdb); @@ -7421,9 +6989,7 @@ error: static void test_droptable(void) { MSIHANDLE hdb, hview, hrec; - CHAR buf[MAX_PATH]; LPCSTR query; - DWORD size; UINT r; r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_CREATE, &hdb); @@ -7437,7 +7003,7 @@ static void test_droptable(void) r = do_query(hdb, query, &hrec); ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); - query = "SELECT * FROM `_Tables` WHERE `Name` = 'One'"; + query = "SELECT `Name` FROM `_Tables` WHERE `Name` = 'One'"; r = MsiDatabaseOpenViewA(hdb, query, &hview); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); r = MsiViewExecute(hview, 0); @@ -7445,17 +7011,13 @@ static void test_droptable(void) r = MsiViewFetch(hview, &hrec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - size = MAX_PATH; - r = MsiRecordGetStringA(hrec, 1, buf, &size); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buf, "One"), "Expected \"One\", got \"%s\"\n", buf); - + check_record(hrec, 1, "One"); MsiCloseHandle(hrec); + MsiViewClose(hview); MsiCloseHandle(hview); - query = "SELECT * FROM `_Columns` WHERE `Table` = 'One'"; + query = "SELECT `Table`, `Number`, `Name` FROM `_Columns` WHERE `Table` = 'One'"; r = MsiDatabaseOpenViewA(hdb, query, &hview); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); r = MsiViewExecute(hview, 0); @@ -7463,20 +7025,7 @@ static void test_droptable(void) r = MsiViewFetch(hview, &hrec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - size = MAX_PATH; - r = MsiRecordGetStringA(hrec, 1, buf, &size); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buf, "One"), "Expected \"One\", got \"%s\"\n", buf); - - r = MsiRecordGetInteger(hrec, 2); - ok(r == 1, "Expected 1, got %d\n", r); - - size = MAX_PATH; - r = MsiRecordGetStringA(hrec, 3, buf, &size); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buf, "A"), "Expected \"A\", got \"%s\"\n", buf); - + check_record(hrec, 3, "One", "1", "A"); MsiCloseHandle(hrec); r = MsiViewFetch(hview, &hrec); @@ -7549,7 +7098,7 @@ static void test_droptable(void) r = do_query(hdb, query, &hrec); ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); - query = "SELECT * FROM `_Tables` WHERE `Name` = 'One'"; + query = "SELECT `Name` FROM `_Tables` WHERE `Name` = 'One'"; r = MsiDatabaseOpenViewA(hdb, query, &hview); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); r = MsiViewExecute(hview, 0); @@ -7557,17 +7106,13 @@ static void test_droptable(void) r = MsiViewFetch(hview, &hrec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - size = MAX_PATH; - r = MsiRecordGetStringA(hrec, 1, buf, &size); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buf, "One"), "Expected \"One\", got \"%s\"\n", buf); - + check_record(hrec, 1, "One"); MsiCloseHandle(hrec); + MsiViewClose(hview); MsiCloseHandle(hview); - query = "SELECT * FROM `_Columns` WHERE `Table` = 'One'"; + query = "SELECT `Table`, `Number`, `Name` FROM `_Columns` WHERE `Table` = 'One'"; r = MsiDatabaseOpenViewA(hdb, query, &hview); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); r = MsiViewExecute(hview, 0); @@ -7575,38 +7120,12 @@ static void test_droptable(void) r = MsiViewFetch(hview, &hrec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - size = MAX_PATH; - r = MsiRecordGetStringA(hrec, 1, buf, &size); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buf, "One"), "Expected \"One\", got \"%s\"\n", buf); - - r = MsiRecordGetInteger(hrec, 2); - ok(r == 1, "Expected 1, got %d\n", r); - - size = MAX_PATH; - r = MsiRecordGetStringA(hrec, 3, buf, &size); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buf, "B"), "Expected \"B\", got \"%s\"\n", buf); - + check_record(hrec, 3, "One", "1", "B"); MsiCloseHandle(hrec); r = MsiViewFetch(hview, &hrec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - size = MAX_PATH; - r = MsiRecordGetStringA(hrec, 1, buf, &size); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buf, "One"), "Expected \"One\", got \"%s\"\n", buf); - - r = MsiRecordGetInteger(hrec, 2); - ok(r == 2, "Expected 2, got %d\n", r); - - size = MAX_PATH; - r = MsiRecordGetStringA(hrec, 3, buf, &size); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buf, "C"), "Expected \"C\", got \"%s\"\n", buf); - + check_record(hrec, 3, "One", "2", "C"); MsiCloseHandle(hrec); r = MsiViewFetch(hview, &hrec); @@ -8644,12 +8163,7 @@ static void test_createtable(void) res = MsiViewGetColumnInfo( htab, MSICOLINFO_NAMES, &hrec ); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); - - buffer[0] = 0; - size = sizeof(buffer); - res = MsiRecordGetStringA(hrec, 1, buffer, &size ); - ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); - ok(!strcmp(buffer,"b"), "b != %s\n", buffer); + check_record(hrec, 1, "b"); MsiCloseHandle( hrec ); res = MsiViewClose( htab ); @@ -8673,13 +8187,7 @@ static void test_createtable(void) res = MsiViewGetColumnInfo( htab, MSICOLINFO_NAMES, &hrec ); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); - - buffer[0] = 0; - size = sizeof(buffer); - res = MsiRecordGetStringA(hrec, 1, buffer, &size ); - ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); - ok(!strcmp(buffer,"b"), "b != %s\n", buffer); - + check_record(hrec, 1, "b"); res = MsiCloseHandle( hrec ); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2 years, 9 months
1
0
0
0
[reactos] 178/360: [WINESYNC] msi/tests: Use check_record() in test_join().
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=88f53494e93ed81be438a…
commit 88f53494e93ed81be438aeea91408eeb3d6a70e3 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sun Mar 13 00:16:23 2022 +0100 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Sun Mar 20 19:28:08 2022 +0100 [WINESYNC] msi/tests: Use check_record() in test_join(). 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 5eab4a59de5f77f3d747b0f3e9eadd2c45dc7cf5 by Zebediah Figura <z.figura12(a)gmail.com> --- modules/rostests/winetests/msi/db.c | 284 ++++-------------------------------- 1 file changed, 32 insertions(+), 252 deletions(-) diff --git a/modules/rostests/winetests/msi/db.c b/modules/rostests/winetests/msi/db.c index f63fb10b488..d97c3502193 100644 --- a/modules/rostests/winetests/msi/db.c +++ b/modules/rostests/winetests/msi/db.c @@ -3267,31 +3267,7 @@ error: DeleteFileA(mstfile); } -struct join_res -{ - const CHAR one[MAX_PATH]; - const CHAR two[MAX_PATH]; -}; - -struct join_res_4col -{ - const CHAR one[MAX_PATH]; - const CHAR two[MAX_PATH]; - const CHAR three[MAX_PATH]; - const CHAR four[MAX_PATH]; -}; - -struct join_res_uint -{ - UINT one; - UINT two; - UINT three; - UINT four; - UINT five; - UINT six; -}; - -static const struct join_res join_res_first[] = +static const char *join_res_first[][2] = { { "alveolar", "procerus" }, { "septum", "procerus" }, @@ -3300,29 +3276,29 @@ static const struct join_res join_res_first[] = { "malar", "mentalis" }, }; -static const struct join_res join_res_second[] = +static const char *join_res_second[][2] = { { "nasal", "septum" }, { "mandible", "ramus" }, }; -static const struct join_res join_res_third[] = +static const char *join_res_third[][2] = { { "msvcp.dll", "abcdefgh" }, { "msvcr.dll", "ijklmnop" }, }; -static const struct join_res join_res_fourth[] = +static const char *join_res_fourth[][2] = { { "msvcp.dll.01234", "single.dll.31415" }, }; -static const struct join_res join_res_fifth[] = +static const char *join_res_fifth[][2] = { { "malar", "procerus" }, }; -static const struct join_res join_res_sixth[] = +static const char *join_res_sixth[][2] = { { "malar", "procerus" }, { "malar", "procerus" }, @@ -3332,14 +3308,14 @@ static const struct join_res join_res_sixth[] = { "malar", "mentalis" }, }; -static const struct join_res join_res_seventh[] = +static const char *join_res_seventh[][2] = { { "malar", "nasalis" }, { "malar", "nasalis" }, { "malar", "nasalis" }, }; -static const struct join_res_4col join_res_eighth[] = +static const char *join_res_eighth[][4] = { { "msvcp.dll", "msvcp.dll.01234", "msvcp.dll.01234", "abcdefgh" }, { "msvcr.dll", "msvcr.dll.56789", "msvcp.dll.01234", "abcdefgh" }, @@ -3349,24 +3325,22 @@ static const struct join_res_4col join_res_eighth[] = { "msvcr.dll", "msvcr.dll.56789", "single.dll.31415", "msvcp.dll" }, }; -static const struct join_res_uint join_res_ninth[] = +static const char *join_res_ninth[][6] = { - { 1, 2, 3, 4, 7, 8 }, - { 1, 2, 5, 6, 7, 8 }, - { 1, 2, 3, 4, 9, 10 }, - { 1, 2, 5, 6, 9, 10 }, - { 1, 2, 3, 4, 11, 12 }, - { 1, 2, 5, 6, 11, 12 }, + { "1", "2", "3", "4", "7", "8" }, + { "1", "2", "5", "6", "7", "8" }, + { "1", "2", "3", "4", "9", "10" }, + { "1", "2", "5", "6", "9", "10" }, + { "1", "2", "3", "4", "11", "12" }, + { "1", "2", "5", "6", "11", "12" }, }; static void test_join(void) { MSIHANDLE hdb, hview, hrec; LPCSTR query; - CHAR buf[MAX_PATH]; - UINT r, count; - DWORD size, i; - BOOL data_correct; + UINT r; + DWORD i; hdb = create_db(); ok( hdb, "failed to create db\n"); @@ -3459,25 +3433,10 @@ static void test_join(void) i = 0; while ((r = MsiViewFetch(hview, &hrec)) == ERROR_SUCCESS) { - count = MsiRecordGetFieldCount( hrec ); - ok( count == 2, "Expected 2 record fields, got %d\n", count ); - - size = MAX_PATH; - r = MsiRecordGetStringA( hrec, 1, buf, &size ); - ok( r == ERROR_SUCCESS, "failed to get record string: %d\n", r ); - ok( !lstrcmpA( buf, join_res_first[i].one ), - "For (row %d, column 1) expected '%s', got %s\n", i, join_res_first[i].one, buf ); - - size = MAX_PATH; - r = MsiRecordGetStringA( hrec, 2, buf, &size ); - ok( r == ERROR_SUCCESS, "failed to get record string: %d\n", r ); - ok( !lstrcmpA( buf, join_res_first[i].two ), - "For (row %d, column 2) expected '%s', got %s\n", i, join_res_first[i].two, buf ); - + check_record(hrec, 2, join_res_first[i][0], join_res_first[i][1]); i++; MsiCloseHandle(hrec); } - ok( i == 5, "Expected 5 rows, got %d\n", i ); ok( r == ERROR_NO_MORE_ITEMS, "expected no more items: %d\n", r ); @@ -3514,30 +3473,13 @@ static void test_join(void) ok( r == ERROR_SUCCESS, "failed to execute view: %d\n", r ); i = 0; - data_correct = TRUE; while ((r = MsiViewFetch(hview, &hrec)) == ERROR_SUCCESS) { - count = MsiRecordGetFieldCount( hrec ); - ok( count == 2, "Expected 2 record fields, got %d\n", count ); - - size = MAX_PATH; - r = MsiRecordGetStringA( hrec, 1, buf, &size ); - ok( r == ERROR_SUCCESS, "failed to get record string: %d\n", r ); - if( lstrcmpA( buf, join_res_second[i].one )) - data_correct = FALSE; - - size = MAX_PATH; - r = MsiRecordGetStringA( hrec, 2, buf, &size ); - ok( r == ERROR_SUCCESS, "failed to get record string: %d\n", r ); - if( lstrcmpA( buf, join_res_second[i].two )) - data_correct = FALSE; - + check_record(hrec, 2, join_res_second[i][0], join_res_second[i][1]); i++; MsiCloseHandle(hrec); } - ok( data_correct, "data returned in the wrong order\n"); - ok( i == 2, "Expected 2 rows, got %d\n", i ); ok( r == ERROR_NO_MORE_ITEMS, "expected no more items: %d\n", r ); @@ -3555,31 +3497,13 @@ static void test_join(void) ok( r == ERROR_SUCCESS, "failed to execute view: %d\n", r ); i = 0; - data_correct = TRUE; while ((r = MsiViewFetch(hview, &hrec)) == ERROR_SUCCESS) { - count = MsiRecordGetFieldCount( hrec ); - ok( count == 2, "Expected 2 record fields, got %d\n", count ); - - size = MAX_PATH; - r = MsiRecordGetStringA( hrec, 1, buf, &size ); - ok( r == ERROR_SUCCESS, "failed to get record string: %d\n", r ); - if( lstrcmpA( buf, join_res_third[i].one ) ) - data_correct = FALSE; - - size = MAX_PATH; - r = MsiRecordGetStringA( hrec, 2, buf, &size ); - ok( r == ERROR_SUCCESS, "failed to get record string: %d\n", r ); - if( lstrcmpA( buf, join_res_third[i].two ) ) - data_correct = FALSE; - + check_record(hrec, 2, join_res_third[i][0], join_res_third[i][1]); i++; MsiCloseHandle(hrec); } - ok( data_correct, "data returned in the wrong order\n"); - ok( i == 2, "Expected 2 rows, got %d\n", i ); - ok( r == ERROR_NO_MORE_ITEMS, "expected no more items: %d\n", r ); MsiViewClose(hview); @@ -3596,29 +3520,12 @@ static void test_join(void) ok( r == ERROR_SUCCESS, "failed to execute view: %d\n", r ); i = 0; - data_correct = TRUE; while ((r = MsiViewFetch(hview, &hrec)) == ERROR_SUCCESS) { - count = MsiRecordGetFieldCount( hrec ); - ok( count == 2, "Expected 2 record fields, got %d\n", count ); - - size = MAX_PATH; - r = MsiRecordGetStringA( hrec, 1, buf, &size ); - ok( r == ERROR_SUCCESS, "failed to get record string: %d\n", r ); - if( lstrcmpA( buf, join_res_fourth[i].one )) - data_correct = FALSE; - - size = MAX_PATH; - r = MsiRecordGetStringA( hrec, 2, buf, &size ); - ok( r == ERROR_SUCCESS, "failed to get record string: %d\n", r ); - if( lstrcmpA( buf, join_res_fourth[i].two )) - data_correct = FALSE; - + check_record(hrec, 2, join_res_fourth[i][0], join_res_fourth[i][1]); i++; MsiCloseHandle(hrec); } - ok( data_correct, "data returned in the wrong order\n"); - ok( i == 1, "Expected 1 rows, got %d\n", i ); ok( r == ERROR_NO_MORE_ITEMS, "expected no more items: %d\n", r ); @@ -3637,29 +3544,12 @@ static void test_join(void) ok( r == ERROR_SUCCESS, "failed to execute view: %d\n", r ); i = 0; - data_correct = TRUE; while ((r = MsiViewFetch(hview, &hrec)) == ERROR_SUCCESS) { - count = MsiRecordGetFieldCount( hrec ); - ok( count == 2, "Expected 2 record fields, got %d\n", count ); - - size = MAX_PATH; - r = MsiRecordGetStringA( hrec, 1, buf, &size ); - ok( r == ERROR_SUCCESS, "failed to get record string: %d\n", r ); - if( lstrcmpA( buf, join_res_fifth[i].one )) - data_correct = FALSE; - - size = MAX_PATH; - r = MsiRecordGetStringA( hrec, 2, buf, &size ); - ok( r == ERROR_SUCCESS, "failed to get record string: %d\n", r ); - if( lstrcmpA( buf, join_res_fifth[i].two )) - data_correct = FALSE; - + check_record(hrec, 2, join_res_fifth[i][0], join_res_fifth[i][1]); i++; MsiCloseHandle(hrec); } - ok( data_correct, "data returned in the wrong order\n"); - ok( i == 1, "Expected 1 rows, got %d\n", i ); ok( r == ERROR_NO_MORE_ITEMS, "expected no more items: %d\n", r ); @@ -3677,29 +3567,12 @@ static void test_join(void) ok( r == ERROR_SUCCESS, "failed to execute view: %d\n", r ); i = 0; - data_correct = TRUE; while ((r = MsiViewFetch(hview, &hrec)) == ERROR_SUCCESS) { - count = MsiRecordGetFieldCount( hrec ); - ok( count == 2, "Expected 2 record fields, got %d\n", count ); - - size = MAX_PATH; - r = MsiRecordGetStringA( hrec, 1, buf, &size ); - ok( r == ERROR_SUCCESS, "failed to get record string: %d\n", r ); - if( lstrcmpA( buf, join_res_sixth[i].one )) - data_correct = FALSE; - - size = MAX_PATH; - r = MsiRecordGetStringA( hrec, 2, buf, &size ); - ok( r == ERROR_SUCCESS, "failed to get record string: %d\n", r ); - if( lstrcmpA( buf, join_res_sixth[i].two )) - data_correct = FALSE; - + check_record(hrec, 2, join_res_sixth[i][0], join_res_sixth[i][1]); i++; MsiCloseHandle(hrec); } - ok( data_correct, "data returned in the wrong order\n"); - ok( i == 6, "Expected 6 rows, got %d\n", i ); ok( r == ERROR_NO_MORE_ITEMS, "expected no more items: %d\n", r ); @@ -3718,29 +3591,12 @@ static void test_join(void) ok( r == ERROR_SUCCESS, "failed to execute view: %d\n", r ); i = 0; - data_correct = TRUE; while ((r = MsiViewFetch(hview, &hrec)) == ERROR_SUCCESS) { - count = MsiRecordGetFieldCount( hrec ); - ok( count == 2, "Expected 2 record fields, got %d\n", count ); - - size = MAX_PATH; - r = MsiRecordGetStringA( hrec, 1, buf, &size ); - ok( r == ERROR_SUCCESS, "failed to get record string: %d\n", r ); - if( lstrcmpA( buf, join_res_seventh[i].one )) - data_correct = FALSE; - - size = MAX_PATH; - r = MsiRecordGetStringA( hrec, 2, buf, &size ); - ok( r == ERROR_SUCCESS, "failed to get record string: %d\n", r ); - if( lstrcmpA( buf, join_res_seventh[i].two )) - data_correct = FALSE; - + check_record(hrec, 2, join_res_seventh[i][0], join_res_seventh[i][1]); i++; MsiCloseHandle(hrec); } - - ok( data_correct, "data returned in the wrong order\n"); ok( i == 3, "Expected 3 rows, got %d\n", i ); ok( r == ERROR_NO_MORE_ITEMS, "expected no more items: %d\n", r ); @@ -3756,29 +3612,12 @@ static void test_join(void) ok( r == ERROR_SUCCESS, "failed to execute view: %d\n", r ); i = 0; - data_correct = TRUE; while ((r = MsiViewFetch(hview, &hrec)) == ERROR_SUCCESS) { - count = MsiRecordGetFieldCount( hrec ); - ok( count == 2, "Expected 2 record fields, got %d\n", count ); - - size = MAX_PATH; - r = MsiRecordGetStringA( hrec, 1, buf, &size ); - ok( r == ERROR_SUCCESS, "failed to get record string: %d\n", r ); - if( lstrcmpA( buf, join_res_eighth[i].one )) - data_correct = FALSE; - - size = MAX_PATH; - r = MsiRecordGetStringA( hrec, 2, buf, &size ); - ok( r == ERROR_SUCCESS, "failed to get record string: %d\n", r ); - if( lstrcmpA( buf, join_res_eighth[i].four )) - data_correct = FALSE; - + check_record(hrec, 2, join_res_eighth[i][0], join_res_eighth[i][3]); i++; MsiCloseHandle(hrec); } - - ok( data_correct, "data returned in the wrong order\n"); ok( i == 6, "Expected 6 rows, got %d\n", i ); ok( r == ERROR_NO_MORE_ITEMS, "expected no more items: %d\n", r ); @@ -3793,41 +3632,13 @@ static void test_join(void) ok( r == ERROR_SUCCESS, "failed to execute view: %d\n", r ); i = 0; - data_correct = TRUE; while ((r = MsiViewFetch(hview, &hrec)) == ERROR_SUCCESS) { - count = MsiRecordGetFieldCount( hrec ); - ok( count == 4, "Expected 4 record fields, got %d\n", count ); - - size = MAX_PATH; - r = MsiRecordGetStringA( hrec, 1, buf, &size ); - ok( r == ERROR_SUCCESS, "failed to get record string: %d\n", r ); - if( lstrcmpA( buf, join_res_eighth[i].one )) - data_correct = FALSE; - - size = MAX_PATH; - r = MsiRecordGetStringA( hrec, 2, buf, &size ); - ok( r == ERROR_SUCCESS, "failed to get record string: %d\n", r ); - if( lstrcmpA( buf, join_res_eighth[i].two )) - data_correct = FALSE; - - size = MAX_PATH; - r = MsiRecordGetStringA( hrec, 3, buf, &size ); - ok( r == ERROR_SUCCESS, "failed to get record string: %d\n", r ); - if( lstrcmpA( buf, join_res_eighth[i].three )) - data_correct = FALSE; - - size = MAX_PATH; - r = MsiRecordGetStringA( hrec, 4, buf, &size ); - ok( r == ERROR_SUCCESS, "failed to get record string: %d\n", r ); - if( lstrcmpA( buf, join_res_eighth[i].four )) - data_correct = FALSE; - + check_record(hrec, 4, join_res_eighth[i][0], join_res_eighth[i][1], + join_res_eighth[i][2], join_res_eighth[i][3]); i++; MsiCloseHandle(hrec); } - ok( data_correct, "data returned in the wrong order\n"); - ok( i == 6, "Expected 6 rows, got %d\n", i ); ok( r == ERROR_NO_MORE_ITEMS, "expected no more items: %d\n", r ); @@ -3842,41 +3653,14 @@ static void test_join(void) ok( r == ERROR_SUCCESS, "failed to execute view: %d\n", r ); i = 0; - data_correct = TRUE; while ((r = MsiViewFetch(hview, &hrec)) == ERROR_SUCCESS) { - count = MsiRecordGetFieldCount( hrec ); - ok( count == 6, "Expected 6 record fields, got %d\n", count ); - - r = MsiRecordGetInteger( hrec, 1 ); - if( r != join_res_ninth[i].one ) - data_correct = FALSE; - - r = MsiRecordGetInteger( hrec, 2 ); - if( r != join_res_ninth[i].two ) - data_correct = FALSE; - - r = MsiRecordGetInteger( hrec, 3 ); - if( r != join_res_ninth[i].three ) - data_correct = FALSE; - - r = MsiRecordGetInteger( hrec, 4 ); - if( r != join_res_ninth[i].four ) - data_correct = FALSE; - - r = MsiRecordGetInteger( hrec, 5 ); - if( r != join_res_ninth[i].five ) - data_correct = FALSE; - - r = MsiRecordGetInteger( hrec, 6); - if( r != join_res_ninth[i].six ) - data_correct = FALSE; - + check_record(hrec, 6, join_res_ninth[i][0], join_res_ninth[i][1], + join_res_ninth[i][2], join_res_ninth[i][3], + join_res_ninth[i][4], join_res_ninth[i][5]); i++; MsiCloseHandle(hrec); } - ok( data_correct, "data returned in the wrong order\n"); - ok( i == 6, "Expected 6 rows, got %d\n", i ); ok( r == ERROR_NO_MORE_ITEMS, "expected no more items: %d\n", r ); @@ -3948,13 +3732,9 @@ static void test_join(void) r = MsiViewFetch(hview, &hrec); ok(r == ERROR_SUCCESS, "MsiViewFetch failed\n"); - - size = MAX_PATH; - r = MsiRecordGetStringA( hrec, 1, buf, &size ); - ok( r == ERROR_SUCCESS, "failed to get record string: %d\n", r ); - ok( !lstrcmpA( buf, "epicranius" ), "expected 'epicranius', got %s\n", buf ); - + check_record(hrec, 2, "epicranius", "procerus"); MsiCloseHandle(hrec); + MsiViewClose(hview); MsiCloseHandle(hview);
2 years, 9 months
1
0
0
0
[reactos] 177/360: [WINESYNC] msi/tests: Use check_record() in test_select_column_names().
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=8376f7c354679b848f730…
commit 8376f7c354679b848f730ed40ff6dc184b17712b Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sun Mar 13 00:16:23 2022 +0100 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Sun Mar 20 19:28:08 2022 +0100 [WINESYNC] msi/tests: Use check_record() in test_select_column_names(). 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 d7879eaa99b45d9f1263cad5f7e3699450ec1557 by Zebediah Figura <z.figura12(a)gmail.com> --- modules/rostests/winetests/msi/db.c | 118 ++++++------------------------------ 1 file changed, 18 insertions(+), 100 deletions(-) diff --git a/modules/rostests/winetests/msi/db.c b/modules/rostests/winetests/msi/db.c index 4cdc14cc294..f63fb10b488 100644 --- a/modules/rostests/winetests/msi/db.c +++ b/modules/rostests/winetests/msi/db.c @@ -8955,9 +8955,8 @@ static void test_embedded_nulls(void) static void test_select_column_names(void) { - MSIHANDLE hdb = 0, rec, rec2, view; - char buffer[32]; - UINT r, size; + MSIHANDLE hdb = 0, rec, view; + UINT r; DeleteFileA(msifile); @@ -9008,43 +9007,22 @@ static void test_select_column_names(void) r = MsiViewFetch( view, &rec ); ok( r == ERROR_SUCCESS, "unexpected result: %u\n", r ); - r = MsiRecordGetFieldCount( rec ); - ok( r == 1, "got %u\n", r ); - r = MsiViewGetColumnInfo( view, MSICOLINFO_NAMES, &rec2 ); - ok( r == ERROR_SUCCESS, "unexpected result: %u\n", r ); - r = MsiRecordGetFieldCount( rec2 ); - ok( r == 1, "got %u\n", r ); - size = sizeof(buffer); - memset( buffer, 0x55, sizeof(buffer) ); - r = MsiRecordGetStringA( rec2, 1, buffer, &size ); - ok( r == ERROR_SUCCESS, "unexpected result: %u\n", r ); - ok( !buffer[0], "got \"%s\"\n", buffer ); - MsiCloseHandle( rec2 ); - r = MsiViewGetColumnInfo( view, MSICOLINFO_TYPES, &rec2 ); - ok( r == ERROR_SUCCESS, "unexpected result: %u\n", r ); - r = MsiRecordGetFieldCount( rec2 ); - ok( r == 1, "got %u\n", r ); - size = sizeof(buffer); - memset( buffer, 0x55, sizeof(buffer) ); - r = MsiRecordGetStringA( rec2, 1, buffer, &size ); + check_record(rec, 1, ""); + MsiCloseHandle(rec); + + r = MsiViewGetColumnInfo(view, MSICOLINFO_NAMES, &rec); ok( r == ERROR_SUCCESS, "unexpected result: %u\n", r ); - ok( !lstrcmpA( buffer, "f0" ), "got \"%s\"\n", buffer ); - MsiCloseHandle( rec2 ); + check_record(rec, 1, ""); + MsiCloseHandle(rec); - size = sizeof(buffer); - memset( buffer, 0x55, sizeof(buffer) ); - r = MsiRecordGetStringA( rec, 1, buffer, &size ); + r = MsiViewGetColumnInfo(view, MSICOLINFO_TYPES, &rec); ok( r == ERROR_SUCCESS, "unexpected result: %u\n", r ); - ok( !buffer[0], "got \"%s\"\n", buffer ); - MsiCloseHandle( rec ); + check_record(rec, 1, "f0"); + MsiCloseHandle(rec); r = MsiViewFetch( view, &rec ); ok( r == ERROR_SUCCESS, "unexpected result: %u\n", r ); - size = sizeof(buffer); - memset( buffer, 0x55, sizeof(buffer) ); - r = MsiRecordGetStringA( rec, 1, buffer, &size ); - ok( r == ERROR_SUCCESS, "unexpected result: %u\n", r ); - ok( !buffer[0], "got \"%s\"\n", buffer ); + check_record(rec, 1, ""); MsiCloseHandle( rec ); r = MsiViewFetch( view, &rec ); @@ -9062,22 +9040,12 @@ static void test_select_column_names(void) r = MsiViewFetch( view, &rec ); ok( r == ERROR_SUCCESS, "unexpected result: %u\n", r ); - r = MsiRecordGetFieldCount( rec ); - ok( r == 2, "got %u\n", r ); - size = sizeof(buffer); - memset( buffer, 0x55, sizeof(buffer) ); - r = MsiRecordGetStringA( rec, 1, buffer, &size ); - ok( r == ERROR_SUCCESS, "unexpected result: %u\n", r ); - ok( !lstrcmpA( buffer, "1" ), "got \"%s\"\n", buffer ); + check_record(rec, 2, "1", ""); MsiCloseHandle( rec ); r = MsiViewFetch( view, &rec ); ok( r == ERROR_SUCCESS, "unexpected result: %u\n", r ); - size = sizeof(buffer); - memset( buffer, 0x55, sizeof(buffer) ); - r = MsiRecordGetStringA( rec, 2, buffer, &size ); - ok( r == ERROR_SUCCESS, "unexpected result: %u\n", r ); - ok( !buffer[0], "got \"%s\"\n", buffer ); + check_record(rec, 2, "3", ""); MsiCloseHandle( rec ); r = MsiViewFetch( view, &rec ); @@ -9095,32 +9063,12 @@ static void test_select_column_names(void) r = MsiViewFetch( view, &rec ); ok( r == ERROR_SUCCESS, "unexpected result: %u\n", r ); - r = MsiRecordGetFieldCount( rec ); - ok( r == 2, "got %u\n", r ); - size = sizeof(buffer); - memset( buffer, 0x55, sizeof(buffer) ); - r = MsiRecordGetStringA( rec, 1, buffer, &size ); - ok( r == ERROR_SUCCESS, "unexpected result: %u\n", r ); - ok( !buffer[0], "got \"%s\"\n", buffer ); - size = sizeof(buffer); - memset( buffer, 0x55, sizeof(buffer) ); - r = MsiRecordGetStringA( rec, 2, buffer, &size ); - ok( r == ERROR_SUCCESS, "unexpected result: %u\n", r ); - ok( !lstrcmpA( buffer, "1" ), "got \"%s\"\n", buffer ); + check_record(rec, 2, "", "1"); MsiCloseHandle( rec ); r = MsiViewFetch( view, &rec ); ok( r == ERROR_SUCCESS, "unexpected result: %u\n", r ); - size = sizeof(buffer); - memset( buffer, 0x55, sizeof(buffer) ); - r = MsiRecordGetStringA( rec, 1, buffer, &size ); - ok( r == ERROR_SUCCESS, "unexpected result: %u\n", r ); - ok( !buffer[0], "got \"%s\"\n", buffer ); - size = sizeof(buffer); - memset( buffer, 0x55, sizeof(buffer) ); - r = MsiRecordGetStringA( rec, 2, buffer, &size ); - ok( r == ERROR_SUCCESS, "unexpected result: %u\n", r ); - ok( !lstrcmpA( buffer, "3" ), "got \"%s\"\n", buffer ); + check_record(rec, 2, "", "3"); MsiCloseHandle( rec ); r = MsiViewFetch( view, &rec ); @@ -9138,42 +9086,12 @@ static void test_select_column_names(void) r = MsiViewFetch( view, &rec ); ok( r == ERROR_SUCCESS, "unexpected result: %u\n", r ); - r = MsiRecordGetFieldCount( rec ); - ok( r == 3, "got %u\n", r ); - size = sizeof(buffer); - memset( buffer, 0x55, sizeof(buffer) ); - r = MsiRecordGetStringA( rec, 1, buffer, &size ); - ok( r == ERROR_SUCCESS, "unexpected result: %u\n", r ); - ok( !lstrcmpA( buffer, "1" ), "got \"%s\"\n", buffer ); - size = sizeof(buffer); - memset( buffer, 0x55, sizeof(buffer) ); - r = MsiRecordGetStringA( rec, 2, buffer, &size ); - ok( r == ERROR_SUCCESS, "unexpected result: %u\n", r ); - ok( !buffer[0], "got \"%s\"\n", buffer ); - size = sizeof(buffer); - memset( buffer, 0x55, sizeof(buffer) ); - r = MsiRecordGetStringA( rec, 3, buffer, &size ); - ok( r == ERROR_SUCCESS, "unexpected result: %u\n", r ); - ok( !lstrcmpA( buffer, "2" ), "got \"%s\"\n", buffer ); + check_record(rec, 3, "1", "", "2"); MsiCloseHandle( rec ); r = MsiViewFetch( view, &rec ); ok( r == ERROR_SUCCESS, "unexpected result: %u\n", r ); - size = sizeof(buffer); - memset( buffer, 0x55, sizeof(buffer) ); - r = MsiRecordGetStringA( rec, 1, buffer, &size ); - ok( r == ERROR_SUCCESS, "unexpected result: %u\n", r ); - ok( !lstrcmpA( buffer, "3" ), "got \"%s\"\n", buffer ); - size = sizeof(buffer); - memset( buffer, 0x55, sizeof(buffer) ); - r = MsiRecordGetStringA( rec, 2, buffer, &size ); - ok( r == ERROR_SUCCESS, "unexpected result: %u\n", r ); - ok( !buffer[0], "got \"%s\"\n", buffer ); - size = sizeof(buffer); - memset( buffer, 0x55, sizeof(buffer) ); - r = MsiRecordGetStringA( rec, 3, buffer, &size ); - ok( r == ERROR_SUCCESS, "unexpected result: %u\n", r ); - ok( !lstrcmpA( buffer, "4" ), "got \"%s\"\n", buffer ); + check_record(rec, 3, "3", "", "4"); MsiCloseHandle( rec ); r = MsiViewFetch( view, &rec );
2 years, 9 months
1
0
0
0
[reactos] 176/360: [WINESYNC] msi/tests: Use check_record() in test_dbmerge().
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=b883a2b27141efe6372c2…
commit b883a2b27141efe6372c2e1f5547d1d32bc5eece Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sun Mar 13 00:16:22 2022 +0100 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Sun Mar 20 19:28:08 2022 +0100 [WINESYNC] msi/tests: Use check_record() in test_dbmerge(). 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 2ea8d809e9d2bc575abc3beb5b7c0de99e20f9f8 by Zebediah Figura <z.figura12(a)gmail.com> --- modules/rostests/winetests/msi/db.c | 86 ++++--------------------------------- 1 file changed, 9 insertions(+), 77 deletions(-) diff --git a/modules/rostests/winetests/msi/db.c b/modules/rostests/winetests/msi/db.c index 04b1a926db7..4cdc14cc294 100644 --- a/modules/rostests/winetests/msi/db.c +++ b/modules/rostests/winetests/msi/db.c @@ -8170,15 +8170,7 @@ static void test_dbmerge(void) query = "SELECT * FROM `MergeErrors`"; r = do_query(hdb, query, &hrec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - size = MAX_PATH; - r = MsiRecordGetStringA(hrec, 1, buf, &size); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buf, "One"), "Expected \"One\", got \"%s\"\n", buf); - - r = MsiRecordGetInteger(hrec, 2); - ok(r == 2, "Expected 2, got %d\n", r); - + check_record(hrec, 2, "One", "2"); MsiCloseHandle(hrec); r = MsiDatabaseOpenViewA(hdb, "SELECT * FROM `MergeErrors`", &hview); @@ -8186,34 +8178,14 @@ static void test_dbmerge(void) r = MsiViewGetColumnInfo(hview, MSICOLINFO_NAMES, &hrec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - size = MAX_PATH; - r = MsiRecordGetStringA(hrec, 1, buf, &size); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buf, "Table"), "Expected \"Table\", got \"%s\"\n", buf); - - size = MAX_PATH; - r = MsiRecordGetStringA(hrec, 2, buf, &size); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buf, "NumRowMergeConflicts"), - "Expected \"NumRowMergeConflicts\", got \"%s\"\n", buf); - + check_record(hrec, 2, "Table", "NumRowMergeConflicts"); MsiCloseHandle(hrec); r = MsiViewGetColumnInfo(hview, MSICOLINFO_TYPES, &hrec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - size = MAX_PATH; - r = MsiRecordGetStringA(hrec, 1, buf, &size); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buf, "s255"), "Expected \"s255\", got \"%s\"\n", buf); - - size = MAX_PATH; - r = MsiRecordGetStringA(hrec, 2, buf, &size); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buf, "i2"), "Expected \"i2\", got \"%s\"\n", buf); - + check_record(hrec, 2, "s255", "i2"); MsiCloseHandle(hrec); + MsiViewClose(hview); MsiCloseHandle(hview); @@ -8244,15 +8216,7 @@ static void test_dbmerge(void) query = "SELECT * FROM `One`"; r = do_query(hdb, query, &hrec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - r = MsiRecordGetInteger(hrec, 1); - ok(r == 1, "Expected 1, got %d\n", r); - - size = MAX_PATH; - r = MsiRecordGetStringA(hrec, 2, buf, &size); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buf, "hi"), "Expected \"hi\", got \"%s\"\n", buf); - + check_record(hrec, 2, "1", "hi"); MsiCloseHandle(hrec); /* nothing in MergeErrors */ @@ -8290,15 +8254,7 @@ static void test_dbmerge(void) query = "SELECT * FROM `One`"; r = do_query(hdb, query, &hrec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - size = MAX_PATH; - r = MsiRecordGetStringA(hrec, 1, buf, &size); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buf, "hi"), "Expected \"hi\", got \"%s\"\n", buf); - - r = MsiRecordGetInteger(hrec, 2); - ok(r == 1, "Expected 1, got %d\n", r); - + check_record(hrec, 2, "hi", "1"); MsiCloseHandle(hrec); /* nothing in MergeErrors */ @@ -8342,15 +8298,7 @@ static void test_dbmerge(void) query = "SELECT * FROM `One`"; r = do_query(hdb, query, &hrec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - r = MsiRecordGetInteger(hrec, 1); - ok(r == 1, "Expected 1, got %d\n", r); - - size = MAX_PATH; - r = MsiRecordGetStringA(hrec, 2, buf, &size); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buf, "hi"), "Expected \"hi\", got \"%s\"\n", buf); - + check_record(hrec, 2, "1", "hi"); MsiCloseHandle(hrec); /* nothing in MergeErrors */ @@ -8444,28 +8392,12 @@ static void test_dbmerge(void) r = MsiViewFetch(hview, &hrec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - r = MsiRecordGetInteger(hrec, 1); - ok(r == 1, "Expected 1, got %d\n", r); - - size = MAX_PATH; - r = MsiRecordGetStringA(hrec, 2, buf, &size); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buf, "foo"), "Expected \"foo\", got \"%s\"\n", buf); - + check_record(hrec, 2, "1", "foo"); MsiCloseHandle(hrec); r = MsiViewFetch(hview, &hrec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - r = MsiRecordGetInteger(hrec, 1); - ok(r == 2, "Expected 2, got %d\n", r); - - size = MAX_PATH; - r = MsiRecordGetStringA(hrec, 2, buf, &size); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA(buf, "bar"), "Expected \"bar\", got \"%s\"\n", buf); - + check_record(hrec, 2, "2", "bar"); MsiCloseHandle(hrec); r = MsiViewFetch(hview, &hrec);
2 years, 9 months
1
0
0
0
[reactos] 175/360: [WINESYNC] msi/tests: Use check_record() in test_columnorder().
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=c4131daacc134094f579d…
commit c4131daacc134094f579d2da41b4ce3f012dd9c2 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sun Mar 13 00:16:22 2022 +0100 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Sun Mar 20 19:28:07 2022 +0100 [WINESYNC] msi/tests: Use check_record() in test_columnorder(). 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 d2edcc9e24cf9919825dcd0480b3f22e25dc7115 by Zebediah Figura <z.figura12(a)gmail.com> --- modules/rostests/winetests/msi/db.c | 352 ++---------------------------------- 1 file changed, 20 insertions(+), 332 deletions(-) diff --git a/modules/rostests/winetests/msi/db.c b/modules/rostests/winetests/msi/db.c index 111f809b8d7..04b1a926db7 100644 --- a/modules/rostests/winetests/msi/db.c +++ b/modules/rostests/winetests/msi/db.c @@ -8706,9 +8706,7 @@ static void test_insertorder(void) static void test_columnorder(void) { MSIHANDLE hdb, view, rec; - char buf[MAX_PATH]; LPCSTR query; - DWORD sz; UINT r; hdb = create_db(); @@ -8746,73 +8744,14 @@ static void test_columnorder(void) r = MsiViewGetColumnInfo(view, MSICOLINFO_TYPES, &rec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 1, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("s255", buf), "Expected \"s255\", got \"%s\"\n", buf); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 2, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("I2", buf), "Expected \"I2\", got \"%s\"\n", buf); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 3, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("S255", buf), "Expected \"S255\", got \"%s\"\n", buf); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 4, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("i2", buf), "Expected \"i2\", got \"%s\"\n", buf); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 5, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("i2", buf), "Expected \"i2\", got \"%s\"\n", buf); - + check_record(rec, 5, "s255", "I2", "S255", "i2", "i2"); MsiCloseHandle(rec); r = MsiViewGetColumnInfo(view, MSICOLINFO_NAMES, &rec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 1, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("D", buf), "Expected \"D\", got \"%s\"\n", buf); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 2, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("E", buf), "Expected \"E\", got \"%s\"\n", buf); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 3, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("A", buf), "Expected \"A\", got \"%s\"\n", buf); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 4, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("C", buf), "Expected \"C\", got \"%s\"\n", buf); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 5, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("B", buf), "Expected \"B\", got \"%s\"\n", buf); - + check_record(rec, 5, "D", "E", "A", "C", "B"); MsiCloseHandle(rec); + MsiViewClose(view); MsiCloseHandle(view); @@ -8824,31 +8763,10 @@ static void test_columnorder(void) query = "SELECT * FROM `T`"; r = do_query(hdb, query, &rec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 1, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("bc", buf), "Expected \"bc\", got \"%s\"\n", buf); - - r = MsiRecordGetInteger(rec, 2); - ok(r == 3, "Expected 3, got %d\n", r); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 3, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("a", buf), "Expected \"a\", got \"%s\"\n", buf); - - r = MsiRecordGetInteger(rec, 4); - ok(r == 2, "Expected 2, got %d\n", r); - - r = MsiRecordGetInteger(rec, 5); - ok(r == 1, "Expected 1, got %d\n", r); - + check_record(rec, 5, "bc", "3", "a", "2", "1"); MsiCloseHandle(rec); - query = "SELECT * FROM `_Columns` WHERE `Table` = 'T'"; + query = "SELECT `Table`, `Number`, `Name` FROM `_Columns` WHERE `Table` = 'T'"; r = MsiDatabaseOpenViewA(hdb, query, &view); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); r = MsiViewExecute(view, 0); @@ -8856,102 +8774,27 @@ static void test_columnorder(void) r = MsiViewFetch(view, &rec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 1, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("T", buf), "Expected \"T\", got \"%s\"\n", buf); - - r = MsiRecordGetInteger(rec, 2); - ok(r == 1, "Expected 1, got %d\n", r); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 3, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("D", buf), "Expected \"D\", got \"%s\"\n", buf); - + check_record(rec, 3, "T", "1", "D"); MsiCloseHandle(rec); r = MsiViewFetch(view, &rec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 1, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("T", buf), "Expected \"T\", got \"%s\"\n", buf); - - r = MsiRecordGetInteger(rec, 2); - ok(r == 2, "Expected 2, got %d\n", r); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 3, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("E", buf), "Expected \"E\", got \"%s\"\n", buf); - + check_record(rec, 3, "T", "2", "E"); MsiCloseHandle(rec); r = MsiViewFetch(view, &rec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 1, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("T", buf), "Expected \"T\", got \"%s\"\n", buf); - - r = MsiRecordGetInteger(rec, 2); - ok(r == 3, "Expected 3, got %d\n", r); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 3, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("A", buf), "Expected \"A\", got \"%s\"\n", buf); - + check_record(rec, 3, "T", "3", "A"); MsiCloseHandle(rec); r = MsiViewFetch(view, &rec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 1, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("T", buf), "Expected \"T\", got \"%s\"\n", buf); - - r = MsiRecordGetInteger(rec, 2); - ok(r == 4, "Expected 4, got %d\n", r); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 3, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("C", buf), "Expected \"C\", got \"%s\"\n", buf); - + check_record(rec, 3, "T", "4", "C"); MsiCloseHandle(rec); r = MsiViewFetch(view, &rec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 1, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("T", buf), "Expected \"T\", got \"%s\"\n", buf); - - r = MsiRecordGetInteger(rec, 2); - ok(r == 5, "Expected 5, got %d\n", r); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 3, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("B", buf), "Expected \"B\", got \"%s\"\n", buf); - + check_record(rec, 3, "T", "5", "B"); MsiCloseHandle(rec); r = MsiViewFetch(view, &rec); @@ -8972,73 +8815,14 @@ static void test_columnorder(void) r = MsiViewGetColumnInfo(view, MSICOLINFO_TYPES, &rec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 1, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("i2", buf), "Expected \"i2\", got \"%s\"\n", buf); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 2, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("S255", buf), "Expected \"S255\", got \"%s\"\n", buf); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 3, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("s255", buf), "Expected \"s255\", got \"%s\"\n", buf); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 4, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("I2", buf), "Expected \"I2\", got \"%s\"\n", buf); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 5, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("i2", buf), "Expected \"i2\", got \"%s\"\n", buf); - + check_record(rec, 5, "i2", "S255", "s255", "I2", "i2"); MsiCloseHandle(rec); r = MsiViewGetColumnInfo(view, MSICOLINFO_NAMES, &rec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 1, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("C", buf), "Expected \"C\", got \"%s\"\n", buf); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 2, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("A", buf), "Expected \"A\", got \"%s\"\n", buf); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 3, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("D", buf), "Expected \"D\", got \"%s\"\n", buf); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 4, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("E", buf), "Expected \"E\", got \"%s\"\n", buf); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 5, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("B", buf), "Expected \"B\", got \"%s\"\n", buf); - + check_record(rec, 5, "C", "A", "D", "E", "B"); MsiCloseHandle(rec); + MsiViewClose(view); MsiCloseHandle(view); @@ -9050,31 +8834,10 @@ static void test_columnorder(void) query = "SELECT * FROM `Z`"; r = do_query(hdb, query, &rec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - r = MsiRecordGetInteger(rec, 1); - ok(r == 2, "Expected 2, got %d\n", r); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 2, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("a", buf), "Expected \"a\", got \"%s\"\n", buf); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 3, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("bc", buf), "Expected \"bc\", got \"%s\"\n", buf); - - r = MsiRecordGetInteger(rec, 4); - ok(r == 3, "Expected 3, got %d\n", r); - - r = MsiRecordGetInteger(rec, 5); - ok(r == 1, "Expected 1, got %d\n", r); - + check_record(rec, 5, "2", "a", "bc", "3", "1"); MsiCloseHandle(rec); - query = "SELECT * FROM `_Columns` WHERE `Table` = 'T'"; + query = "SELECT `Table`, `Number`, `Name` FROM `_Columns` WHERE `Table` = 'T'"; r = MsiDatabaseOpenViewA(hdb, query, &view); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); r = MsiViewExecute(view, 0); @@ -9082,102 +8845,27 @@ static void test_columnorder(void) r = MsiViewFetch(view, &rec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 1, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("T", buf), "Expected \"T\", got \"%s\"\n", buf); - - r = MsiRecordGetInteger(rec, 2); - ok(r == 1, "Expected 1, got %d\n", r); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 3, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("D", buf), "Expected \"D\", got \"%s\"\n", buf); - + check_record(rec, 3, "T", "1", "D"); MsiCloseHandle(rec); r = MsiViewFetch(view, &rec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 1, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("T", buf), "Expected \"T\", got \"%s\"\n", buf); - - r = MsiRecordGetInteger(rec, 2); - ok(r == 2, "Expected 2, got %d\n", r); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 3, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("E", buf), "Expected \"E\", got \"%s\"\n", buf); - + check_record(rec, 3, "T", "2", "E"); MsiCloseHandle(rec); r = MsiViewFetch(view, &rec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 1, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("T", buf), "Expected \"T\", got \"%s\"\n", buf); - - r = MsiRecordGetInteger(rec, 2); - ok(r == 3, "Expected 3, got %d\n", r); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 3, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("A", buf), "Expected \"A\", got \"%s\"\n", buf); - + check_record(rec, 3, "T", "3", "A"); MsiCloseHandle(rec); r = MsiViewFetch(view, &rec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 1, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("T", buf), "Expected \"T\", got \"%s\"\n", buf); - - r = MsiRecordGetInteger(rec, 2); - ok(r == 4, "Expected 4, got %d\n", r); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 3, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("C", buf), "Expected \"C\", got \"%s\"\n", buf); - + check_record(rec, 3, "T", "4", "C"); MsiCloseHandle(rec); r = MsiViewFetch(view, &rec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 1, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("T", buf), "Expected \"T\", got \"%s\"\n", buf); - - r = MsiRecordGetInteger(rec, 2); - ok(r == 5, "Expected 5, got %d\n", r); - - sz = MAX_PATH; - lstrcpyA(buf, "kiwi"); - r = MsiRecordGetStringA(rec, 3, buf, &sz); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrcmpA("B", buf), "Expected \"B\", got \"%s\"\n", buf); - + check_record(rec, 3, "T", "5", "B"); MsiCloseHandle(rec); r = MsiViewFetch(view, &rec);
2 years, 9 months
1
0
0
0
[reactos] 174/360: [WINESYNC] msi/tests: Introduce a variadic check_record() helper.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=3417cf865978d26946ed7…
commit 3417cf865978d26946ed74fc175d7246b5943b41 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sun Mar 13 00:16:22 2022 +0100 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Sun Mar 20 19:28:07 2022 +0100 [WINESYNC] msi/tests: Introduce a variadic check_record() helper. 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 7e083034d665fa8873c6d87a90d959f3351de7d3 by Zebediah Figura <z.figura12(a)gmail.com> --- modules/rostests/winetests/msi/db.c | 264 ++++++++++-------------------------- 1 file changed, 73 insertions(+), 191 deletions(-) diff --git a/modules/rostests/winetests/msi/db.c b/modules/rostests/winetests/msi/db.c index 2b927b78f26..111f809b8d7 100644 --- a/modules/rostests/winetests/msi/db.c +++ b/modules/rostests/winetests/msi/db.c @@ -36,6 +36,31 @@ static const char *mstfile = "winetst-db.mst"; static const WCHAR msifileW[] = {'w','i','n','e','t','e','s','t','-','d','b','.','m','s','i',0}; static const WCHAR msifile2W[] = {'w','i','n','e','t','s','t','2','-','d','b','.','m','s','i',0}; +static void check_record_(int line, MSIHANDLE rec, UINT count, ...) +{ + va_list args; + UINT i; + + ok_(__FILE__, line)(count == MsiRecordGetFieldCount(rec), + "expected %u fields, got %u\n", count, MsiRecordGetFieldCount(rec)); + + va_start(args, count); + + for (i = 1; i <= count; ++i) + { + const char *expect = va_arg(args, const char *); + char buffer[200] = "x"; + DWORD sz = sizeof(buffer); + UINT r = MsiRecordGetStringA(rec, i, buffer, &sz); + ok_(__FILE__, line)(r == ERROR_SUCCESS, "field %u: got unexpected error %u\n", i, r); + ok_(__FILE__, line)(!strcmp(buffer, expect), + "field %u: expected \"%s\", got \"%s\"\n", i, expect, buffer); + } + + va_end(args); +} +#define check_record(rec, ...) check_record_(__LINE__, rec, __VA_ARGS__) + static void test_msidatabase(void) { MSIHANDLE hdb = 0, hdb2 = 0; @@ -1299,17 +1324,6 @@ static UINT get_columns_table_type(MSIHANDLE hdb, const char *table, UINT field) return type; } -static BOOL check_record( MSIHANDLE rec, UINT field, LPCSTR val ) -{ - CHAR buffer[0x20]; - UINT r; - DWORD sz; - - sz = sizeof buffer; - r = MsiRecordGetStringA( rec, field, buffer, &sz ); - return (r == ERROR_SUCCESS ) && !strcmp(val, buffer); -} - static void test_viewgetcolumninfo(void) { MSIHANDLE hdb = 0, rec; @@ -1335,17 +1349,7 @@ static void test_viewgetcolumninfo(void) /* check the column types */ rec = get_column_info( hdb, "select * from `Properties`", MSICOLINFO_TYPES ); ok( rec, "failed to get column info record\n" ); - - ok( check_record( rec, 1, "S255"), "wrong record type\n"); - ok( check_record( rec, 2, "S1"), "wrong record type\n"); - ok( check_record( rec, 3, "I2"), "wrong record type\n"); - ok( check_record( rec, 4, "I2"), "wrong record type\n"); - ok( check_record( rec, 5, "I2"), "wrong record type\n"); - ok( check_record( rec, 6, "I4"), "wrong record type\n"); - ok( check_record( rec, 7, "S0"), "wrong record type\n"); - ok( check_record( rec, 8, "S0"), "wrong record type\n"); - ok( check_record( rec, 9, "L0"), "wrong record type\n"); - + check_record(rec, 9, "S255", "S1", "I2", "I2", "I2", "I4", "S0", "S0", "L0"); MsiCloseHandle( rec ); /* check the type in _Columns */ @@ -1362,17 +1366,8 @@ static void test_viewgetcolumninfo(void) /* now try the names */ rec = get_column_info( hdb, "select * from `Properties`", MSICOLINFO_NAMES ); ok( rec, "failed to get column info record\n" ); - - ok( check_record( rec, 1, "Property"), "wrong record type\n"); - ok( check_record( rec, 2, "Value"), "wrong record type\n"); - ok( check_record( rec, 3, "Intvalue"), "wrong record type\n"); - ok( check_record( rec, 4, "Integervalue"), "wrong record type\n"); - ok( check_record( rec, 5, "Shortvalue"), "wrong record type\n"); - ok( check_record( rec, 6, "Longvalue"), "wrong record type\n"); - ok( check_record( rec, 7, "Longcharvalue"), "wrong record type\n"); - ok( check_record( rec, 8, "Charvalue"), "wrong record type\n"); - ok( check_record( rec, 9, "Localizablevalue"), "wrong record type\n"); - + check_record(rec, 9, "Property", "Value", "Intvalue", "Integervalue", "Shortvalue", + "Longvalue", "Longcharvalue", "Charvalue", "Localizablevalue"); MsiCloseHandle( rec ); r = run_query( hdb, 0, @@ -1383,10 +1378,7 @@ static void test_viewgetcolumninfo(void) /* check the column types */ rec = get_column_info( hdb, "select * from `Binary`", MSICOLINFO_TYPES ); ok( rec, "failed to get column info record\n" ); - - ok( check_record( rec, 1, "S255"), "wrong record type\n"); - ok( check_record( rec, 2, "V0"), "wrong record type\n"); - + check_record(rec, 2, "S255", "V0"); MsiCloseHandle( rec ); /* check the type in _Columns */ @@ -1396,9 +1388,7 @@ static void test_viewgetcolumninfo(void) /* now try the names */ rec = get_column_info( hdb, "select * from `Binary`", MSICOLINFO_NAMES ); ok( rec, "failed to get column info record\n" ); - - ok( check_record( rec, 1, "Name"), "wrong record type\n"); - ok( check_record( rec, 2, "Data"), "wrong record type\n"); + check_record(rec, 2, "Name", "Data"); MsiCloseHandle( rec ); r = run_query( hdb, 0, @@ -1411,14 +1401,12 @@ static void test_viewgetcolumninfo(void) rec = get_column_info( hdb, "select * from `UIText`", MSICOLINFO_NAMES ); ok( rec, "failed to get column info record\n" ); - ok( check_record( rec, 1, "Key"), "wrong record type\n"); - ok( check_record( rec, 2, "Text"), "wrong record type\n"); + check_record(rec, 2, "Key", "Text"); MsiCloseHandle( rec ); rec = get_column_info( hdb, "select * from `UIText`", MSICOLINFO_TYPES ); ok( rec, "failed to get column info record\n" ); - ok( check_record( rec, 1, "s72"), "wrong record type\n"); - ok( check_record( rec, 2, "L255"), "wrong record type\n"); + check_record(rec, 2, "s72", "L255"); MsiCloseHandle( rec ); MsiCloseHandle( hdb ); @@ -1613,19 +1601,13 @@ static void test_streamtable(void) /* check the column types */ rec = get_column_info( hdb, "select * from `_Streams`", MSICOLINFO_TYPES ); ok( rec, "failed to get column info record\n" ); - - ok( check_record( rec, 1, "s62"), "wrong record type\n"); - ok( check_record( rec, 2, "V0"), "wrong record type\n"); - + check_record(rec, 2, "s62", "V0"); MsiCloseHandle( rec ); /* now try the names */ rec = get_column_info( hdb, "select * from `_Streams`", MSICOLINFO_NAMES ); ok( rec, "failed to get column info record\n" ); - - ok( check_record( rec, 1, "Name"), "wrong record type\n"); - ok( check_record( rec, 2, "Data"), "wrong record type\n"); - + check_record(rec, 2, "Name", "Data"); MsiCloseHandle( rec ); r = MsiDatabaseOpenViewA( hdb, @@ -2022,16 +2004,14 @@ static void test_where_not_in_selected(void) r = MsiViewFetch(view, &rec); ok( r == ERROR_SUCCESS, "failed to fetch view: %d\n", r ); - - ok( check_record( rec, 1, "cond2"), "wrong condition\n"); - + check_record(rec, 1, "cond2"); MsiCloseHandle( rec ); + r = MsiViewFetch(view, &rec); ok( r == ERROR_SUCCESS, "failed to fetch view: %d\n", r ); - - ok( check_record( rec, 1, "cond3"), "wrong condition\n"); - + check_record(rec, 1, "cond3"); MsiCloseHandle( rec ); + MsiViewClose(view); MsiCloseHandle(view); @@ -2081,13 +2061,13 @@ static void test_where(void) query = "SELECT * FROM `Media`"; r = do_query(hdb, query, &rec); ok(r == ERROR_SUCCESS, "MsiViewFetch failed: %d\n", r); - ok( check_record( rec, 4, "zero.cab"), "wrong cabinet\n"); + check_record(rec, 6, "1", "0", "", "zero.cab", "", ""); MsiCloseHandle( rec ); query = "SELECT * FROM `Media` WHERE `LastSequence` >= 1"; r = do_query(hdb, query, &rec); ok(r == ERROR_SUCCESS, "MsiViewFetch failed: %d\n", r); - ok( check_record( rec, 4, "one.cab"), "wrong cabinet\n"); + check_record(rec, 6, "2", "1", "", "one.cab", "", ""); r = MsiRecordGetInteger(rec, 1); ok( 2 == r, "field wrong\n"); @@ -2373,8 +2353,7 @@ static void test_msiimport(void) { MSIHANDLE hdb, view, rec; LPCSTR query; - UINT r, count; - signed int i; + UINT r; GetCurrentDirectoryA(MAX_PATH, CURR_DIR); @@ -2405,58 +2384,23 @@ static void test_msiimport(void) r = MsiViewGetColumnInfo(view, MSICOLINFO_NAMES, &rec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - count = MsiRecordGetFieldCount(rec); - ok(count == 9, "Expected 9, got %d\n", count); - ok(check_record(rec, 1, "FirstPrimaryColumn"), "Expected FirstPrimaryColumn\n"); - ok(check_record(rec, 2, "SecondPrimaryColumn"), "Expected SecondPrimaryColumn\n"); - ok(check_record(rec, 3, "ShortInt"), "Expected ShortInt\n"); - ok(check_record(rec, 4, "ShortIntNullable"), "Expected ShortIntNullalble\n"); - ok(check_record(rec, 5, "LongInt"), "Expected LongInt\n"); - ok(check_record(rec, 6, "LongIntNullable"), "Expected LongIntNullalble\n"); - ok(check_record(rec, 7, "String"), "Expected String\n"); - ok(check_record(rec, 8, "LocalizableString"), "Expected LocalizableString\n"); - ok(check_record(rec, 9, "LocalizableStringNullable"), "Expected LocalizableStringNullable\n"); + check_record(rec, 9, "FirstPrimaryColumn", "SecondPrimaryColumn", "ShortInt", + "ShortIntNullable", "LongInt", "LongIntNullable", "String", + "LocalizableString", "LocalizableStringNullable"); MsiCloseHandle(rec); r = MsiViewGetColumnInfo(view, MSICOLINFO_TYPES, &rec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - count = MsiRecordGetFieldCount(rec); - ok(count == 9, "Expected 9, got %d\n", count); - ok(check_record(rec, 1, "s255"), "Expected s255\n"); - ok(check_record(rec, 2, "i2"), "Expected i2\n"); - ok(check_record(rec, 3, "i2"), "Expected i2\n"); - ok(check_record(rec, 4, "I2"), "Expected I2\n"); - ok(check_record(rec, 5, "i4"), "Expected i4\n"); - ok(check_record(rec, 6, "I4"), "Expected I4\n"); - ok(check_record(rec, 7, "S255"), "Expected S255\n"); - ok(check_record(rec, 8, "S0"), "Expected S0\n"); - ok(check_record(rec, 9, "s0"), "Expected s0\n"); + check_record(rec, 9, "s255", "i2", "i2", "I2", "i4", "I4", "S255", "S0", "s0"); MsiCloseHandle(rec); query = "SELECT * FROM `TestTable`"; r = do_query(hdb, query, &rec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(check_record(rec, 1, "stringage"), "Expected 'stringage'\n"); - ok(check_record(rec, 7, "another string"), "Expected 'another string'\n"); - ok(check_record(rec, 8, "localizable"), "Expected 'localizable'\n"); - ok(check_record(rec, 9, "duh"), "Expected 'duh'\n"); - - i = MsiRecordGetInteger(rec, 2); - ok(i == 5, "Expected 5, got %d\n", i); - - i = MsiRecordGetInteger(rec, 3); - ok(i == 2, "Expected 2, got %d\n", i); - - i = MsiRecordGetInteger(rec, 4); - ok(i == MSI_NULL_INTEGER, "Expected MSI_NULL_INTEGER, got %d\n", i); - - i = MsiRecordGetInteger(rec, 5); - ok(i == 2147483640, "Expected 2147483640, got %d\n", i); - - i = MsiRecordGetInteger(rec, 6); - ok(i == -2147483640, "Expected -2147483640, got %d\n", i); - + check_record(rec, 9, "stringage", "5", "2", "", "2147483640", "-2147483640", + "another string", "localizable", "duh"); MsiCloseHandle(rec); + MsiViewClose(view); MsiCloseHandle(view); @@ -2466,19 +2410,12 @@ static void test_msiimport(void) r = MsiViewGetColumnInfo(view, MSICOLINFO_NAMES, &rec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - count = MsiRecordGetFieldCount(rec); - ok(count == 2, "Expected 2, got %d\n", count); - ok(check_record(rec, 1, "PrimaryOne"), "Expected PrimaryOne\n"); - ok(check_record(rec, 2, "PrimaryTwo"), "Expected PrimaryTwo\n"); - + check_record(rec, 2, "PrimaryOne", "PrimaryTwo"); MsiCloseHandle(rec); r = MsiViewGetColumnInfo(view, MSICOLINFO_TYPES, &rec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - count = MsiRecordGetFieldCount(rec); - ok(count == 2, "Expected 2, got %d\n", count); - ok(check_record(rec, 1, "s255"), "Expected s255\n"); - ok(check_record(rec, 2, "s255"), "Expected s255\n"); + check_record(rec, 2, "s255", "s255"); MsiCloseHandle(rec); r = MsiViewExecute(view, 0); @@ -2486,18 +2423,12 @@ static void test_msiimport(void) r = MsiViewFetch(view, &rec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - ok(check_record(rec, 1, "papaya"), "Expected 'papaya'\n"); - ok(check_record(rec, 2, "leaf"), "Expected 'leaf'\n"); - + check_record(rec, 2, "papaya", "leaf"); MsiCloseHandle(rec); r = MsiViewFetch(view, &rec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - - ok(check_record(rec, 1, "papaya"), "Expected 'papaya'\n"); - ok(check_record(rec, 2, "flower"), "Expected 'flower'\n"); - + check_record(rec, 2, "papaya", "flower"); MsiCloseHandle(rec); r = MsiViewFetch(view, &rec); @@ -2515,26 +2446,12 @@ static void test_msiimport(void) r = MsiViewGetColumnInfo(view, MSICOLINFO_NAMES, &rec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - count = MsiRecordGetFieldCount(rec); - ok(count == 6, "Expected 6, got %d\n", count); - ok(check_record(rec, 1, "A"), "Expected A\n"); - ok(check_record(rec, 2, "B"), "Expected B\n"); - ok(check_record(rec, 3, "C"), "Expected C\n"); - ok(check_record(rec, 4, "D"), "Expected D\n"); - ok(check_record(rec, 5, "E"), "Expected E\n"); - ok(check_record(rec, 6, "F"), "Expected F\n"); + check_record(rec, 6, "A", "B", "C", "D", "E", "F"); MsiCloseHandle(rec); r = MsiViewGetColumnInfo(view, MSICOLINFO_TYPES, &rec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - count = MsiRecordGetFieldCount(rec); - ok(count == 6, "Expected 6, got %d\n", count); - ok(check_record(rec, 1, "s72"), "Expected s72\n"); - ok(check_record(rec, 2, "s72"), "Expected s72\n"); - ok(check_record(rec, 3, "s72"), "Expected s72\n"); - ok(check_record(rec, 4, "s72"), "Expected s72\n"); - ok(check_record(rec, 5, "s72"), "Expected s72\n"); - ok(check_record(rec, 6, "s72"), "Expected s72\n"); + check_record(rec, 6, "s72", "s72", "s72", "s72", "s72", "s72"); MsiCloseHandle(rec); MsiViewClose(view); @@ -2549,24 +2466,12 @@ static void test_msiimport(void) r = MsiViewFetch(view, &rec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(check_record(rec, 1, "a"), "Expected 'a'\n"); - ok(check_record(rec, 2, "b"), "Expected 'b'\n"); - ok(check_record(rec, 3, "c"), "Expected 'c'\n"); - ok(check_record(rec, 4, "d"), "Expected 'd'\n"); - ok(check_record(rec, 5, "e"), "Expected 'e'\n"); - ok(check_record(rec, 6, "f"), "Expected 'f'\n"); - + check_record(rec, 6, "a", "b", "c", "d", "e", "f"); MsiCloseHandle(rec); r = MsiViewFetch(view, &rec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(check_record(rec, 1, "g"), "Expected 'g'\n"); - ok(check_record(rec, 2, "h"), "Expected 'h'\n"); - ok(check_record(rec, 3, "i"), "Expected 'i'\n"); - ok(check_record(rec, 4, "j"), "Expected 'j'\n"); - ok(check_record(rec, 5, "k"), "Expected 'k'\n"); - ok(check_record(rec, 6, "l"), "Expected 'l'\n"); - + check_record(rec, 6, "g", "h", "i", "j", "k", "l"); MsiCloseHandle(rec); r = MsiViewFetch(view, &rec); @@ -4358,7 +4263,7 @@ static void test_alter(void) static void test_integers(void) { MSIHANDLE hdb = 0, view = 0, rec = 0; - DWORD count, i; + DWORD i; const char *query; UINT r; @@ -4387,30 +4292,12 @@ static void test_integers(void) r = MsiViewGetColumnInfo(view, MSICOLINFO_NAMES, &rec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - count = MsiRecordGetFieldCount(rec); - ok(count == 8, "Expected 8, got %d\n", count); - ok(check_record(rec, 1, "one"), "Expected one\n"); - ok(check_record(rec, 2, "two"), "Expected two\n"); - ok(check_record(rec, 3, "three"), "Expected three\n"); - ok(check_record(rec, 4, "four"), "Expected four\n"); - ok(check_record(rec, 5, "five"), "Expected five\n"); - ok(check_record(rec, 6, "six"), "Expected six\n"); - ok(check_record(rec, 7, "seven"), "Expected seven\n"); - ok(check_record(rec, 8, "eight"), "Expected eight\n"); + check_record(rec, 8, "one", "two", "three", "four", "five", "six", "seven", "eight"); MsiCloseHandle(rec); r = MsiViewGetColumnInfo(view, MSICOLINFO_TYPES, &rec); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - count = MsiRecordGetFieldCount(rec); - ok(count == 8, "Expected 8, got %d\n", count); - ok(check_record(rec, 1, "I2"), "Expected I2\n"); - ok(check_record(rec, 2, "I2"), "Expected I2\n"); - ok(check_record(rec, 3, "I2"), "Expected I2\n"); - ok(check_record(rec, 4, "I4"), "Expected I4\n"); - ok(check_record(rec, 5, "i2"), "Expected i2\n"); - ok(check_record(rec, 6, "i2"), "Expected i2\n"); - ok(check_record(rec, 7, "i2"), "Expected i2\n"); - ok(check_record(rec, 8, "i4"), "Expected i4\n"); + check_record(rec, 8, "I2", "I2", "I2", "I4", "i2", "i2", "i2", "i4"); MsiCloseHandle(rec); MsiViewClose(view); @@ -7533,17 +7420,13 @@ static void test_storages_table(void) /* check the column types */ hrec = get_column_info(hdb, "SELECT * FROM `_Storages`", MSICOLINFO_TYPES); ok(hrec, "failed to get column info hrecord\n"); - ok(check_record(hrec, 1, "s62"), "wrong hrecord type\n"); - ok(check_record(hrec, 2, "V0"), "wrong hrecord type\n"); - + check_record(hrec, 2, "s62", "V0"); MsiCloseHandle(hrec); /* now try the names */ hrec = get_column_info(hdb, "SELECT * FROM `_Storages`", MSICOLINFO_NAMES); ok(hrec, "failed to get column info hrecord\n"); - ok(check_record(hrec, 1, "Name"), "wrong hrecord type\n"); - ok(check_record(hrec, 2, "Data"), "wrong hrecord type\n"); - + check_record(hrec, 2, "Name", "Data"); MsiCloseHandle(hrec); create_storage("storage.bin"); @@ -9702,6 +9585,8 @@ static void test_select_column_names(void) static void test_primary_keys(void) { MSIHANDLE hdb, keys; + char buffer[5]; + DWORD size; UINT r; hdb = create_db(); @@ -9714,12 +9599,11 @@ static void test_primary_keys(void) r = MsiDatabaseGetPrimaryKeysA(hdb, "T", &keys); ok(!r, "got %u\n", r); - - r = MsiRecordGetFieldCount(keys); - ok(r == 1, "got %d\n", r); - ok(check_record(keys, 0, "T"), "expected 'T'\n"); - ok(check_record(keys, 1, "A"), "expected 'A'\n"); - + check_record(keys, 1, "A"); + size = sizeof(buffer); + r = MsiRecordGetStringA(keys, 0, buffer, &size); + ok(!r, "got %u\n", r); + ok(!strcmp(buffer, "T"), "got \"%s\"\n", buffer); MsiCloseHandle(keys); r = run_query(hdb, 0, "CREATE TABLE `U` (`A` SHORT, `B` SHORT, `C` SHORT PRIMARY KEY `B`, `C`)"); @@ -9727,13 +9611,11 @@ static void test_primary_keys(void) r = MsiDatabaseGetPrimaryKeysA(hdb, "U", &keys); ok(!r, "got %u\n", r); - - r = MsiRecordGetFieldCount(keys); - ok(r == 2, "got %d\n", r); - ok(check_record(keys, 0, "U"), "expected 'U'\n"); - ok(check_record(keys, 1, "B"), "expected 'B'\n"); - ok(check_record(keys, 2, "C"), "expected 'C'\n"); - + check_record(keys, 2, "B", "C"); + size = sizeof(buffer); + r = MsiRecordGetStringA(keys, 0, buffer, &size); + ok(!r, "got %u\n", r); + ok(!strcmp(buffer, "U"), "got \"%s\"\n", buffer); MsiCloseHandle(keys); MsiCloseHandle(hdb); DeleteFileA(msifile);
2 years, 9 months
1
0
0
0
[reactos] 173/360: [WINESYNC] msi/tests: Add a trailing '\n' to an ok() call.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=f8514c722bbc31d90911d…
commit f8514c722bbc31d90911d64c560e555bc91ee6dc Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sun Mar 13 00:16:21 2022 +0100 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Sun Mar 20 19:28:07 2022 +0100 [WINESYNC] msi/tests: Add a trailing '\n' to an ok() call. Signed-off-by: Francois Gouget <fgouget(a)free.fr> Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id ad735ca1f329b9419aaaf59bda4e3c936f9d92f5 by Francois Gouget <fgouget(a)free.fr> --- modules/rostests/winetests/msi/msi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/rostests/winetests/msi/msi.c b/modules/rostests/winetests/msi/msi.c index cf7649a0219..9b31231e6bc 100644 --- a/modules/rostests/winetests/msi/msi.c +++ b/modules/rostests/winetests/msi/msi.c @@ -14221,7 +14221,7 @@ static void test_setpropertyfolder(void) ok(delete_pf("msitest\\maximus", TRUE), "file not installed\n"); ok(delete_pf("msitest", FALSE), "directory not created\n"); - ok(DeleteFileA("c:\\parent\\child\\Shortcut.lnk"), "file not installed"); + ok(DeleteFileA("c:\\parent\\child\\Shortcut.lnk"), "file not installed\n"); ok(RemoveDirectoryA("c:\\parent\\child"), "directory not created\n"); ok(RemoveDirectoryA("c:\\parent"), "directory not created\n");
2 years, 9 months
1
0
0
0
[reactos] 172/360: [WINESYNC] msi: Only perform the media check if the label of the disk entry differs from the last.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=8c4b2b004b6f6818be7b1…
commit 8c4b2b004b6f6818be7b10baf58732fba3fef2af Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sun Mar 13 00:16:21 2022 +0100 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Sun Mar 20 19:28:07 2022 +0100 [WINESYNC] msi: Only perform the media check if the label of the disk entry differs from the last. Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=40433
Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id 85fea53af80d324a4cf7f80a45f43fed8d8d65e1 by Hans Leidekker <hans(a)codeweavers.com> --- dll/win32/msi/media.c | 26 +++++++++++++++++--------- dll/win32/msi/msipriv.h | 1 + 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/dll/win32/msi/media.c b/dll/win32/msi/media.c index 5f8c26a3443..09aac094183 100644 --- a/dll/win32/msi/media.c +++ b/dll/win32/msi/media.c @@ -664,6 +664,7 @@ void msi_free_media_info(MSIMEDIAINFO *mi) msi_free(mi->disk_prompt); msi_free(mi->cabinet); msi_free(mi->volume_label); + msi_free(mi->last_volume); msi_free(mi); } @@ -898,20 +899,27 @@ UINT ready_media( MSIPACKAGE *package, BOOL compressed, MSIMEDIAINFO *mi ) } } /* check volume matches, change media if not */ - if (mi->volume_label && mi->disk_id > 1) + if (mi->volume_label) { - WCHAR *source = msi_dup_property( package->db, szSourceDir ); - BOOL match = source_matches_volume( mi, source ); - msi_free( source ); - - if (!match && (mi->type == DRIVE_CDROM || mi->type == DRIVE_REMOVABLE)) + /* assume first volume is in the drive */ + if (mi->last_volume && strcmpiW( mi->last_volume, mi->volume_label )) { - if ((rc = msi_change_media( package, mi )) != ERROR_SUCCESS) + WCHAR *source = msi_dup_property( package->db, szSourceDir ); + BOOL match = source_matches_volume( mi, source ); + msi_free( source ); + + if (!match && (mi->type == DRIVE_CDROM || mi->type == DRIVE_REMOVABLE)) { - msi_free( cabinet_file ); - return rc; + if ((rc = msi_change_media( package, mi )) != ERROR_SUCCESS) + { + msi_free( cabinet_file ); + return rc; + } } } + + msi_free(mi->last_volume); + mi->last_volume = strdupW(mi->volume_label); } if (mi->cabinet) { diff --git a/dll/win32/msi/msipriv.h b/dll/win32/msi/msipriv.h index c59ce940c6d..a637cfcc80d 100644 --- a/dll/win32/msi/msipriv.h +++ b/dll/win32/msi/msipriv.h @@ -173,6 +173,7 @@ typedef struct tagMSIMEDIAINFO LPWSTR disk_prompt; LPWSTR cabinet; LPWSTR volume_label; + LPWSTR last_volume; BOOL is_continuous; BOOL is_extracted; WCHAR sourcedir[MAX_PATH];
2 years, 9 months
1
0
0
0
← Newer
1
...
20
21
22
23
24
25
26
...
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