winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
September 2006
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
3 participants
651 discussions
Start a n
N
ew thread
Mike McCormack : msi: Create MSI_ViewGetColumnInfo for accessing MsiViewGetColumnInfo internally .
by Alexandre Julliard
07 Sep '06
07 Sep '06
Module: wine Branch: master Commit: a426b18efdcc98617551ccb6c5c5ad27a4a4837c URL:
http://source.winehq.org/git/?p=wine.git;a=commit;h=a426b18efdcc98617551ccb…
Author: Mike McCormack <mike(a)codeweavers.com> Date: Thu Aug 31 19:50:11 2006 +0900 msi: Create MSI_ViewGetColumnInfo for accessing MsiViewGetColumnInfo internally. --- dlls/msi/msipriv.h | 5 ++- dlls/msi/msiquery.c | 74 +++++++++++++++++++++++++++------------------------ 2 files changed, 42 insertions(+), 37 deletions(-) diff --git a/dlls/msi/msipriv.h b/dlls/msi/msipriv.h index 191c770..8db0074 100644 --- a/dlls/msi/msipriv.h +++ b/dlls/msi/msipriv.h @@ -334,8 +334,6 @@ extern const WCHAR *msi_string_lookup_id extern UINT msi_string_get_codepage( string_table *st ); -extern UINT VIEW_find_column( MSIVIEW *view, LPCWSTR name, UINT *n ); - extern BOOL TABLE_Exists( MSIDATABASE *db, LPWSTR name ); extern UINT read_raw_stream_data( MSIDATABASE*, LPCWSTR stname, @@ -393,6 +391,9 @@ extern UINT MSI_DatabaseGetPrimaryKeys( extern UINT MSI_ViewExecute( MSIQUERY*, MSIRECORD * ); extern UINT MSI_ViewFetch( MSIQUERY*, MSIRECORD ** ); extern UINT MSI_ViewClose( MSIQUERY* ); +extern UINT MSI_ViewGetColumnInfo(MSIQUERY *, MSICOLINFO, MSIRECORD **); +extern UINT VIEW_find_column( MSIVIEW *, LPCWSTR, UINT * ); + /* install internals */ extern UINT MSI_SetInstallLevel( MSIPACKAGE *package, int iInstallLevel ); diff --git a/dlls/msi/msiquery.c b/dlls/msi/msiquery.c index 27d93f6..ba7fc1b 100644 --- a/dlls/msi/msiquery.c +++ b/dlls/msi/msiquery.c @@ -479,48 +479,28 @@ static UINT msi_set_record_type_string( return MSI_RecordSetStringW( rec, field, szType ); } -UINT WINAPI MsiViewGetColumnInfo(MSIHANDLE hView, MSICOLINFO info, MSIHANDLE *hRec) +UINT MSI_ViewGetColumnInfo( MSIQUERY *query, MSICOLINFO info, MSIRECORD **prec ) { - MSIVIEW *view = NULL; - MSIQUERY *query = NULL; - MSIRECORD *rec = NULL; UINT r = ERROR_FUNCTION_FAILED, i, count = 0, type; + MSIRECORD *rec; + MSIVIEW *view = query->view; LPWSTR name; - TRACE("%ld %d %p\n", hView, info, hRec); - - if( !hRec ) - return ERROR_INVALID_PARAMETER; - - if( info != MSICOLINFO_NAMES && info != MSICOLINFO_TYPES ) - return ERROR_INVALID_PARAMETER; - - query = msihandle2msiinfo( hView, MSIHANDLETYPE_VIEW ); - if( !query ) - return ERROR_INVALID_HANDLE; - - view = query->view; if( !view ) - goto out; + return ERROR_FUNCTION_FAILED; if( !view->ops->get_dimensions ) - goto out; + return ERROR_FUNCTION_FAILED; r = view->ops->get_dimensions( view, NULL, &count ); - if( r ) - goto out; + if( r != ERROR_SUCCESS ) + return r; if( !count ) - { - r = ERROR_INVALID_PARAMETER; - goto out; - } + return ERROR_INVALID_PARAMETER; rec = MSI_CreateRecord( count ); if( !rec ) - { - r = ERROR_FUNCTION_FAILED; - goto out; - } + return ERROR_FUNCTION_FAILED; for( i=0; i<count; i++ ) { @@ -535,14 +515,38 @@ UINT WINAPI MsiViewGetColumnInfo(MSIHAND msi_free( name ); } - *hRec = alloc_msihandle( &rec->hdr ); - if (! *hRec) - r = ERROR_NOT_ENOUGH_MEMORY; + *prec = rec; + return ERROR_SUCCESS; +} -out: - msiobj_release( &query->hdr ); - if( rec ) +UINT WINAPI MsiViewGetColumnInfo(MSIHANDLE hView, MSICOLINFO info, MSIHANDLE *hRec) +{ + MSIQUERY *query = NULL; + MSIRECORD *rec = NULL; + UINT r; + + TRACE("%ld %d %p\n", hView, info, hRec); + + if( !hRec ) + return ERROR_INVALID_PARAMETER; + + if( info != MSICOLINFO_NAMES && info != MSICOLINFO_TYPES ) + return ERROR_INVALID_PARAMETER; + + query = msihandle2msiinfo( hView, MSIHANDLETYPE_VIEW ); + if( !query ) + return ERROR_INVALID_HANDLE; + + r = MSI_ViewGetColumnInfo( query, info, &rec ); + if ( r == ERROR_SUCCESS ) + { + *hRec = alloc_msihandle( &rec->hdr ); + if ( !*hRec ) + r = ERROR_NOT_ENOUGH_MEMORY; msiobj_release( &rec->hdr ); + } + + msiobj_release( &query->hdr ); return r; }
1
0
0
0
Mike McCormack : msi: Make sure there' s a value for each column when inserting data.
by Alexandre Julliard
07 Sep '06
07 Sep '06
Module: wine Branch: master Commit: 5699936cf1eace4274cb002afa9722255ce3309c URL:
http://source.winehq.org/git/?p=wine.git;a=commit;h=5699936cf1eace4274cb002…
Author: Mike McCormack <mike(a)codeweavers.com> Date: Thu Aug 31 17:22:24 2006 +0900 msi: Make sure there's a value for each column when inserting data. --- dlls/msi/insert.c | 14 +++++++++++++- dlls/msi/tests/db.c | 5 ----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/dlls/msi/insert.c b/dlls/msi/insert.c index eb65904..2b0f68a 100644 --- a/dlls/msi/insert.c +++ b/dlls/msi/insert.c @@ -234,6 +234,14 @@ static const MSIVIEWOPS insert_ops = INSERT_find_matching_rows }; +static UINT count_column_info( column_info *ci ) +{ + UINT n = 0; + for ( ; ci; ci = ci->next ) + n++; + return n; +} + UINT INSERT_CreateView( MSIDATABASE *db, MSIVIEW **view, LPWSTR table, column_info *columns, column_info *values, BOOL temp ) { @@ -243,6 +251,10 @@ UINT INSERT_CreateView( MSIDATABASE *db, TRACE("%p\n", iv ); + /* there should be one value for each column */ + if ( count_column_info( columns ) != count_column_info(values) ) + return ERROR_BAD_QUERY_SYNTAX; + r = TABLE_CreateView( db, table, &tv ); if( r != ERROR_SUCCESS ) return r; @@ -254,7 +266,7 @@ UINT INSERT_CreateView( MSIDATABASE *db, tv->ops->delete( tv ); return r; } - + iv = msi_alloc_zero( sizeof *iv ); if( !iv ) return ERROR_FUNCTION_FAILED; diff --git a/dlls/msi/tests/db.c b/dlls/msi/tests/db.c index a35b685..b61e643 100644 --- a/dlls/msi/tests/db.c +++ b/dlls/msi/tests/db.c @@ -162,17 +162,12 @@ static void test_msiinsert(void) r = do_query(hdb, query, &hrec); ok(r == ERROR_NO_MORE_ITEMS, "MsiViewFetch failed\n"); - todo_wine { /* now try a few bad INSERT xqueries */ query = "INSERT INTO `phone` ( `id`, `name`, `number` )" "VALUES(?, ?)"; r = MsiDatabaseOpenView(hdb, query, &hview); ok(r == ERROR_BAD_QUERY_SYNTAX, "MsiDatabaseOpenView failed\n"); - if (r == ERROR_SUCCESS) - r = MsiCloseHandle(hview); - } - /* construct a record to insert */ hrec = MsiCreateRecord(4); r = MsiRecordSetInteger(hrec, 1, 2);
1
0
0
0
Mike McCormack : msi: Validate database fields before inserting them.
by Alexandre Julliard
07 Sep '06
07 Sep '06
Module: wine Branch: master Commit: 533833b4e154782d1d05ac9c1bdc17e0af4be4d4 URL:
http://source.winehq.org/git/?p=wine.git;a=commit;h=533833b4e154782d1d05ac9…
Author: Mike McCormack <mike(a)codeweavers.com> Date: Thu Aug 31 17:06:20 2006 +0900 msi: Validate database fields before inserting them. --- dlls/msi/table.c | 39 +++++++++++++++++++++++++++++++++++---- dlls/msi/tests/db.c | 5 +---- 2 files changed, 36 insertions(+), 8 deletions(-) diff --git a/dlls/msi/table.c b/dlls/msi/table.c index fb468bc..51986d7 100644 --- a/dlls/msi/table.c +++ b/dlls/msi/table.c @@ -1302,12 +1302,38 @@ static UINT msi_table_find_row( MSITABLE static UINT table_validate_new( MSITABLEVIEW *tv, MSIRECORD *rec ) { - UINT r, row; + UINT r, row, i; + /* check there's no null values where they're not allowed */ + for( i = 0; i < tv->num_cols; i++ ) + { + if ( tv->columns[i].type & MSITYPE_NULLABLE ) + continue; + + if ( tv->columns[i].type & MSITYPE_STRING ) + { + LPCWSTR str; + + str = MSI_RecordGetString( rec, i+1 ); + if (str == NULL || str[0] == 0) + return ERROR_INVALID_DATA; + } + else + { + UINT n; + + n = MSI_RecordGetInteger( rec, i+1 ); + if (n == MSI_NULL_INTEGER) + return ERROR_INVALID_DATA; + } + } + + /* check there's no duplicate keys */ r = msi_table_find_row( tv, rec, &row ); - if (r != ERROR_SUCCESS) - return ERROR_SUCCESS; - return ERROR_INVALID_DATA; + if (r == ERROR_SUCCESS) + return ERROR_INVALID_DATA; + + return ERROR_SUCCESS; } static UINT msi_table_modify_row( MSITABLEVIEW *tv, MSIRECORD *rec, @@ -1352,6 +1378,11 @@ static UINT TABLE_insert_row( struct tag TRACE("%p %p\n", tv, rec ); + /* check that the key is unique - can we find a matching row? */ + r = table_validate_new( tv, rec ); + if( r != ERROR_SUCCESS ) + return ERROR_FUNCTION_FAILED; + r = table_create_new_row( view, &row ); TRACE("insert_row returned %08x\n", r); if( r != ERROR_SUCCESS ) diff --git a/dlls/msi/tests/db.c b/dlls/msi/tests/db.c index c8d42f9..a35b685 100644 --- a/dlls/msi/tests/db.c +++ b/dlls/msi/tests/db.c @@ -1323,10 +1323,7 @@ static void test_markers(void) MsiRecordSetString(rec, 3, "haha"); query = "INSERT INTO `?` ( `One`, `Two` ) VALUES ( ?, '?' )"; r = run_query(hdb, rec, query); - todo_wine - { - ok(r == ERROR_FUNCTION_FAILED, "Expected ERROR_FUNCTION_FAILED, got %d\n", r); - } + ok(r == ERROR_FUNCTION_FAILED, "Expected ERROR_FUNCTION_FAILED, got %d\n", r); /* try all markers */ MsiCloseHandle(rec);
1
0
0
0
Mike McCormack : msi: Create a function to copy record fields, use it to order INSERT fields correctly.
by Alexandre Julliard
07 Sep '06
07 Sep '06
Module: wine Branch: master Commit: 71d8f4ebf6bfab3450f914408ed89144f56d19a2 URL:
http://source.winehq.org/git/?p=wine.git;a=commit;h=71d8f4ebf6bfab3450f9144…
Author: Mike McCormack <mike(a)codeweavers.com> Date: Thu Aug 31 17:05:45 2006 +0900 msi: Create a function to copy record fields, use it to order INSERT fields correctly. --- dlls/msi/insert.c | 6 +----- dlls/msi/msipriv.h | 1 + dlls/msi/record.c | 48 +++++++++++++++++++++++++++++++++++++++++++++++- dlls/msi/select.c | 27 ++++++++++++++++++++++++--- 4 files changed, 73 insertions(+), 9 deletions(-) diff --git a/dlls/msi/insert.c b/dlls/msi/insert.c index 85c9f51..eb65904 100644 --- a/dlls/msi/insert.c +++ b/dlls/msi/insert.c @@ -66,7 +66,6 @@ static MSIRECORD *INSERT_merge_record( U { MSIRECORD *merged; DWORD wildcard_count = 1, i; - const WCHAR *str; merged = MSI_CreateRecord( fields ); for( i=1; i <= fields; i++ ) @@ -88,10 +87,7 @@ static MSIRECORD *INSERT_merge_record( U case EXPR_WILDCARD: if( !rec ) goto err; - if( MSI_RecordIsNull( rec, wildcard_count ) ) - goto err; - str = MSI_RecordGetString( rec, wildcard_count ); - MSI_RecordSetStringW( merged, i, str ); + MSI_RecordCopyField( rec, wildcard_count, merged, i ); wildcard_count++; break; default: diff --git a/dlls/msi/msipriv.h b/dlls/msi/msipriv.h index 991c11c..191c770 100644 --- a/dlls/msi/msipriv.h +++ b/dlls/msi/msipriv.h @@ -371,6 +371,7 @@ extern UINT MSI_RecordSetStreamW( MSIREC extern UINT MSI_RecordSetStreamA( MSIRECORD *, unsigned int, LPCSTR ); extern UINT MSI_RecordDataSize( MSIRECORD *, unsigned int ); extern UINT MSI_RecordStreamToFile( MSIRECORD *, unsigned int, LPCWSTR ); +extern UINT MSI_RecordCopyField( MSIRECORD *, unsigned int, MSIRECORD *, unsigned int ); /* stream internals */ extern UINT get_raw_stream( MSIHANDLE hdb, LPCWSTR stname, IStream **stm ); diff --git a/dlls/msi/record.c b/dlls/msi/record.c index 6c9a567..8bc3871 100644 --- a/dlls/msi/record.c +++ b/dlls/msi/record.c @@ -43,7 +43,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(msidb); #define MSIFIELD_NULL 0 #define MSIFIELD_INT 1 -#define MSIFIELD_STR 2 #define MSIFIELD_WSTR 3 #define MSIFIELD_STREAM 4 @@ -154,6 +153,53 @@ static BOOL string2intW( LPCWSTR str, in return TRUE; } +UINT MSI_RecordCopyField( MSIRECORD *in_rec, unsigned int in_n, + MSIRECORD *out_rec, unsigned int out_n ) +{ + UINT r = ERROR_SUCCESS; + + msiobj_lock( &in_rec->hdr ); + + if ( in_n > in_rec->count || out_n > out_rec->count ) + r = ERROR_FUNCTION_FAILED; + else if ( in_rec != out_rec || in_n != out_n ) + { + LPWSTR str; + MSIFIELD *in, *out; + + in = &in_rec->fields[in_n]; + out = &out_rec->fields[out_n]; + + switch ( in->type ) + { + case MSIFIELD_NULL: + break; + case MSIFIELD_INT: + out->u.iVal = in->u.iVal; + break; + case MSIFIELD_WSTR: + str = strdupW( in->u.szwVal ); + if ( !str ) + r = ERROR_OUTOFMEMORY; + else + out->u.szwVal = str; + break; + case MSIFIELD_STREAM: + IStream_AddRef( in->u.stream ); + out->u.stream = in->u.stream; + break; + default: + ERR("invalid field type %d\n", in->type); + } + if (r == ERROR_SUCCESS) + out->type = in->type; + } + + msiobj_unlock( &in_rec->hdr ); + + return r; +} + int MSI_RecordGetInteger( MSIRECORD *rec, unsigned int iField) { int ret = 0; diff --git a/dlls/msi/select.c b/dlls/msi/select.c index abb2dbd..d47792b 100644 --- a/dlls/msi/select.c +++ b/dlls/msi/select.c @@ -102,13 +102,34 @@ static UINT SELECT_set_int( struct tagMS static UINT SELECT_insert_row( struct tagMSIVIEW *view, MSIRECORD *record ) { MSISELECTVIEW *sv = (MSISELECTVIEW*)view; + UINT i, table_cols, r; + MSIRECORD *outrec; TRACE("%p %p\n", sv, record ); - if( !sv->table ) - return ERROR_FUNCTION_FAILED; + if ( !sv->table ) + return ERROR_FUNCTION_FAILED; + + /* rearrange the record to suit the table */ + r = sv->table->ops->get_dimensions( sv->table, NULL, &table_cols ); + if (r != ERROR_SUCCESS) + return r; + + outrec = MSI_CreateRecord( table_cols + 1 ); - return sv->table->ops->insert_row( sv->table, record ); + for (i=0; i<sv->num_cols; i++) + { + r = MSI_RecordCopyField( record, i+1, outrec, sv->cols[i] ); + if (r != ERROR_SUCCESS) + goto fail; + } + + r = sv->table->ops->insert_row( sv->table, outrec ); + +fail: + msiobj_release( &outrec->hdr ); + + return r; } static UINT SELECT_execute( struct tagMSIVIEW *view, MSIRECORD *record )
1
0
0
0
Mike McCormack : msi: Add a few more tests for MSI_NULL_INTEGER.
by Alexandre Julliard
07 Sep '06
07 Sep '06
Module: wine Branch: master Commit: 6b4ada6f43afcec8d231de18565c8d8ef199d991 URL:
http://source.winehq.org/git/?p=wine.git;a=commit;h=6b4ada6f43afcec8d231de1…
Author: Mike McCormack <mike(a)codeweavers.com> Date: Thu Aug 31 17:05:05 2006 +0900 msi: Add a few more tests for MSI_NULL_INTEGER. --- dlls/msi/tests/record.c | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/dlls/msi/tests/record.c b/dlls/msi/tests/record.c index f6e11a9..8bf6489 100644 --- a/dlls/msi/tests/record.c +++ b/dlls/msi/tests/record.c @@ -234,6 +234,18 @@ static void test_msirecord(void) ok(i == ERROR_SUCCESS, "Failed to set string at 0\n"); i = MsiRecordGetInteger(h, 0); ok(i == 1, "should get one\n"); + i = MsiRecordSetString(h,0,"foo"); + ok(i == ERROR_SUCCESS, "Failed to set string at 0\n"); + i = MsiRecordGetInteger(h, 0); + ok(i == MSI_NULL_INTEGER, "should get zero\n"); + i = MsiRecordSetString(h,0,""); + ok(i == ERROR_SUCCESS, "Failed to set string at 0\n"); + i = MsiRecordGetInteger(h, 0); + ok(i == MSI_NULL_INTEGER, "should get zero\n"); + i = MsiRecordSetString(h,0,"+1"); + ok(i == ERROR_SUCCESS, "Failed to set string at 0\n"); + i = MsiRecordGetInteger(h, 0); + ok(i == MSI_NULL_INTEGER, "should get zero\n"); /* same record, try converting integers to strings */ r = MsiRecordSetInteger(h, 0, 32);
1
0
0
0
Mike McCormack : msi: Check that column names are unique when creating a table.
by Alexandre Julliard
07 Sep '06
07 Sep '06
Module: wine Branch: master Commit: 2924501a6807803fd145f8e52b96fede3d84fa6a URL:
http://source.winehq.org/git/?p=wine.git;a=commit;h=2924501a6807803fd145f8e…
Author: Mike McCormack <mike(a)codeweavers.com> Date: Thu Aug 31 17:04:40 2006 +0900 msi: Check that column names are unique when creating a table. --- dlls/msi/create.c | 20 +++++++++++++++++++- dlls/msi/tests/db.c | 15 +++++++++++---- 2 files changed, 30 insertions(+), 5 deletions(-) diff --git a/dlls/msi/create.c b/dlls/msi/create.c index a8fe65c..740f563 100644 --- a/dlls/msi/create.c +++ b/dlls/msi/create.c @@ -221,17 +221,35 @@ static const MSIVIEWOPS create_ops = CREATE_delete }; +static UINT check_columns( column_info *col_info ) +{ + column_info *c1, *c2; + + /* check for two columns with the same name */ + for( c1 = col_info; c1; c1 = c1->next ) + for( c2 = c1->next; c2; c2 = c2->next ) + if (!lstrcmpW(c1->column, c2->column)) + return ERROR_BAD_QUERY_SYNTAX; + + return ERROR_SUCCESS; +} + UINT CREATE_CreateView( MSIDATABASE *db, MSIVIEW **view, LPWSTR table, column_info *col_info, BOOL temp ) { MSICREATEVIEW *cv = NULL; + UINT r; TRACE("%p\n", cv ); + r = check_columns( col_info ); + if( r != ERROR_SUCCESS ) + return r; + cv = msi_alloc_zero( sizeof *cv ); if( !cv ) return ERROR_FUNCTION_FAILED; - + /* fill the structure */ cv->view.ops = &create_ops; msiobj_addref( &db->hdr ); diff --git a/dlls/msi/tests/db.c b/dlls/msi/tests/db.c index 6b5336d..c8d42f9 100644 --- a/dlls/msi/tests/db.c +++ b/dlls/msi/tests/db.c @@ -1203,6 +1203,13 @@ static void test_markers(void) r = run_query(hdb, rec, query); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + /* verify that we just created a table called '?', not 'Fable' */ + r = try_query(hdb, "SELECT * from `Fable`"); + ok(r == ERROR_BAD_QUERY_SYNTAX, "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r); + + r = try_query(hdb, "SELECT * from `?`"); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + /* try table name as marker without backticks */ MsiRecordSetString(rec, 1, "Mable"); query = "CREATE TABLE ? ( `One` SHORT NOT NULL, `Two` CHAR(255) PRIMARY KEY `One`)"; @@ -1232,10 +1239,7 @@ static void test_markers(void) MsiRecordSetString(rec, 3, "One"); query = "CREATE TABLE `Mable` ( `?` SHORT NOT NULL, `?` CHAR(255) PRIMARY KEY `?`)"; r = run_query(hdb, rec, query); - todo_wine - { - ok(r == ERROR_BAD_QUERY_SYNTAX, "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r); - } + ok(r == ERROR_BAD_QUERY_SYNTAX, "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r); /* try names with backticks, minus definitions */ query = "CREATE TABLE `Mable` ( `?`, `?` PRIMARY KEY `?`)"; @@ -1271,6 +1275,9 @@ static void test_markers(void) r = run_query(hdb, 0, query); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + r = try_query(hdb, "SELECT * from `Table`"); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + /* try values as markers */ MsiCloseHandle(rec); rec = MsiCreateRecord(2);
1
0
0
0
Huw Davies : rpcrt4: Add delegating stub support.
by Alexandre Julliard
07 Sep '06
07 Sep '06
Module: wine Branch: master Commit: bd9891ffed347bce23e864b5d5a017d7ba423a2b URL:
http://source.winehq.org/git/?p=wine.git;a=commit;h=bd9891ffed347bce23e864b…
Author: Huw Davies <huw(a)codeweavers.com> Date: Thu Aug 31 15:40:05 2006 +0100 rpcrt4: Add delegating stub support. --- dlls/rpcrt4/cpsf.c | 7 ++ dlls/rpcrt4/cpsf.h | 9 +++ dlls/rpcrt4/cstub.c | 135 +++++++++++++++++++++++++++++++++++++++++---- dlls/rpcrt4/tests/cstub.c | 100 +++++++++++++++++++++++++++++---- 4 files changed, 225 insertions(+), 26 deletions(-) Diff:
http://source.winehq.org/git/?p=wine.git;a=commitdiff;h=bd9891ffed347bce23e…
1
0
0
0
Huw Davies : rpcrt4: Add infrastructure to create and manage a variable sized vtbl
by Alexandre Julliard
07 Sep '06
07 Sep '06
Module: wine Branch: master Commit: b058e6e7295e9c3f264a750c8e73dfd95de97661 URL:
http://source.winehq.org/git/?p=wine.git;a=commit;h=b058e6e7295e9c3f264a750…
Author: Huw Davies <huw(a)codeweavers.com> Date: Thu Aug 31 14:58:26 2006 +0100 rpcrt4: Add infrastructure to create and manage a variable sized vtbl that will be used as the server object for delegated stubs. --- dlls/rpcrt4/cpsf.c | 8 ++ dlls/rpcrt4/cpsf.h | 2 + dlls/rpcrt4/cstub.c | 175 ++++++++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 181 insertions(+), 4 deletions(-) diff --git a/dlls/rpcrt4/cpsf.c b/dlls/rpcrt4/cpsf.c index a350c40..a90dc2f 100644 --- a/dlls/rpcrt4/cpsf.c +++ b/dlls/rpcrt4/cpsf.c @@ -138,6 +138,7 @@ HRESULT WINAPI NdrDllGetClassObject(REFC *ppv = NULL; if (!pPSFactoryBuffer->lpVtbl) { const ProxyFileInfo **pProxyFileList2; + int max_delegating_vtbl_size = 0; pPSFactoryBuffer->lpVtbl = &CStdPSFactory_Vtbl; pPSFactoryBuffer->RefCount = 0; pPSFactoryBuffer->pProxyFileList = pProxyFileList; @@ -150,11 +151,18 @@ HRESULT WINAPI NdrDllGetClassObject(REFC void **pRpcStubVtbl = (void **)&(*pProxyFileList2)->pStubVtblList[i]->Vtbl; int j; + if ((*pProxyFileList2)->pDelegatedIIDs && (*pProxyFileList2)->pDelegatedIIDs[i]) { + if ((*pProxyFileList2)->pStubVtblList[i]->header.DispatchTableCount > max_delegating_vtbl_size) + max_delegating_vtbl_size = (*pProxyFileList2)->pStubVtblList[i]->header.DispatchTableCount; + } + for (j = 0; j < sizeof(IRpcStubBufferVtbl)/sizeof(void *); j++) if (!pRpcStubVtbl[j]) pRpcStubVtbl[j] = pSrcRpcStubVtbl[j]; } } + if(max_delegating_vtbl_size > 0) + create_delegating_vtbl(max_delegating_vtbl_size); } if (IsEqualGUID(rclsid, pclsid)) return IPSFactoryBuffer_QueryInterface((LPPSFACTORYBUFFER)pPSFactoryBuffer, iid, ppv); diff --git a/dlls/rpcrt4/cpsf.h b/dlls/rpcrt4/cpsf.h index 785a87c..599dec1 100644 --- a/dlls/rpcrt4/cpsf.h +++ b/dlls/rpcrt4/cpsf.h @@ -40,6 +40,8 @@ const MIDL_SERVER_INFO *CStdStubBuffer_G const IRpcStubBufferVtbl CStdStubBuffer_Vtbl; +void create_delegating_vtbl(DWORD num_methods); + HRESULT create_stub(REFIID iid, IUnknown *pUnk, IRpcStubBuffer **ppstub); #endif /* __WINE_CPSF_H */ diff --git a/dlls/rpcrt4/cstub.c b/dlls/rpcrt4/cstub.c index b33363b..a613164 100644 --- a/dlls/rpcrt4/cstub.c +++ b/dlls/rpcrt4/cstub.c @@ -46,6 +46,18 @@ static WINE_EXCEPTION_FILTER(stub_filter return EXCEPTION_EXECUTE_HANDLER; } +typedef struct +{ + IUnknownVtbl *base_obj; + IRpcStubBuffer *base_stub; + CStdStubBuffer stub_buffer; +} cstdstubbuffer_delegating_t; + +static inline cstdstubbuffer_delegating_t *impl_from_delegating( IRpcStubBuffer *iface ) +{ + return (cstdstubbuffer_delegating_t*)((char *)iface - FIELD_OFFSET(cstdstubbuffer_delegating_t, stub_buffer)); +} + HRESULT WINAPI CStdStubBuffer_Construct(REFIID riid, LPUNKNOWN pUnkServer, PCInterfaceName name, @@ -85,6 +97,161 @@ HRESULT WINAPI CStdStubBuffer_Construct( return S_OK; } +static CRITICAL_SECTION delegating_vtbl_section; +static CRITICAL_SECTION_DEBUG critsect_debug = +{ + 0, 0, &delegating_vtbl_section, + { &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList }, + 0, 0, { (DWORD_PTR)(__FILE__ ": delegating_vtbl_section") } +}; +static CRITICAL_SECTION delegating_vtbl_section = { &critsect_debug, -1, 0, 0, 0, 0 }; + +typedef struct +{ + DWORD ref; + IUnknownVtbl vtbl; +} ref_counted_vtbl; + +static struct +{ + ref_counted_vtbl *table; + DWORD size; +} current_vtbl; + + +static HRESULT WINAPI delegating_QueryInterface(IUnknown *pUnk, REFIID iid, void **ppv) +{ + *ppv = (void *)pUnk; + return S_OK; +} + +static ULONG WINAPI delegating_AddRef(IUnknown *pUnk) +{ + return 1; +} + +static ULONG WINAPI delegating_Release(IUnknown *pUnk) +{ + return 1; +} + +#if defined(__i386__) + +/* The idea here is to replace the first param on the stack + ie. This (which will point to cstdstubbuffer_delegating_t) + with This->stub_buffer.pvServerObject and then jump to the + relevant offset in This->stub_buffer.pvServerObject's vtbl. +*/ +#include "pshpack1.h" +typedef struct { + DWORD mov1; /* mov 0x4(%esp), %eax 8b 44 24 04 */ + WORD mov2; /* mov 0x10(%eax), %eax 8b 40 */ + BYTE sixteen; /* 10 */ + DWORD mov3; /* mov %eax, 0x4(%esp) 89 44 24 04 */ + WORD mov4; /* mov (%eax), %eax 8b 00 */ + WORD mov5; /* mov offset(%eax), %eax 8b 80 */ + DWORD offset; /* xx xx xx xx */ + WORD jmp; /* jmp *%eax ff e0 */ + BYTE pad[3]; /* lea 0x0(%esi), %esi 8d 76 00 */ +} vtbl_method_t; +#include "poppack.h" + +static void fill_table(IUnknownVtbl *vtbl, DWORD num) +{ + vtbl_method_t *method; + void **entry; + DWORD i; + + vtbl->QueryInterface = delegating_QueryInterface; + vtbl->AddRef = delegating_AddRef; + vtbl->Release = delegating_Release; + + method = (vtbl_method_t*)((void **)vtbl + num); + entry = (void**)(vtbl + 1); + + for(i = 3; i < num; i++) + { + *entry = method; + method->mov1 = 0x0424448b; + method->mov2 = 0x408b; + method->sixteen = 0x10; + method->mov3 = 0x04244489; + method->mov4 = 0x008b; + method->mov5 = 0x808b; + method->offset = i << 2; + method->jmp = 0xe0ff; + method->pad[0] = 0x8d; + method->pad[1] = 0x76; + method->pad[2] = 0x00; + + method++; + entry++; + } +} + +#else /* __i386__ */ + +typedef struct {int dummy;} vtbl_method_t; +static void fill_table(IUnknownVtbl *vtbl, DWORD num) +{ + ERR("delegated stubs are not supported on this architecture\n"); +} + +#endif /* __i386__ */ + +void create_delegating_vtbl(DWORD num_methods) +{ + TRACE("%ld\n", num_methods); + if(num_methods <= 3) + { + ERR("should have more than %ld methods\n", num_methods); + return; + } + + EnterCriticalSection(&delegating_vtbl_section); + if(num_methods > current_vtbl.size) + { + DWORD size; + if(current_vtbl.table && current_vtbl.table->ref == 0) + { + TRACE("freeing old table\n"); + HeapFree(GetProcessHeap(), 0, current_vtbl.table); + } + size = sizeof(DWORD) + num_methods * sizeof(void*) + (num_methods - 3) * sizeof(vtbl_method_t); + current_vtbl.table = HeapAlloc(GetProcessHeap(), 0, size); + fill_table(¤t_vtbl.table->vtbl, num_methods); + current_vtbl.table->ref = 0; + current_vtbl.size = num_methods; + } + LeaveCriticalSection(&delegating_vtbl_section); +} + +static IUnknownVtbl *get_delegating_vtbl(void) +{ + IUnknownVtbl *ret; + + EnterCriticalSection(&delegating_vtbl_section); + current_vtbl.table->ref++; + ret = ¤t_vtbl.table->vtbl; + LeaveCriticalSection(&delegating_vtbl_section); + return ret; +} + +static void release_delegating_vtbl(IUnknownVtbl *vtbl) +{ + ref_counted_vtbl *table = (ref_counted_vtbl*)((DWORD *)vtbl - 1); + + EnterCriticalSection(&delegating_vtbl_section); + table->ref--; + TRACE("ref now %ld\n", table->ref); + if(table->ref == 0 && table != current_vtbl.table) + { + TRACE("... and we're not current so free'ing\n"); + HeapFree(GetProcessHeap(), 0, table); + } + LeaveCriticalSection(&delegating_vtbl_section); +} + HRESULT WINAPI CStdStubBuffer_QueryInterface(LPRPCSTUBBUFFER iface, REFIID riid, LPVOID *obj) @@ -250,19 +417,19 @@ const MIDL_SERVER_INFO *CStdStubBuffer_G /************************************************************************ * NdrStubForwardingFunction [RPCRT4.@] */ -void __RPC_STUB NdrStubForwardingFunction( IRpcStubBuffer *This, IRpcChannelBuffer *pChannel, +void __RPC_STUB NdrStubForwardingFunction( IRpcStubBuffer *iface, IRpcChannelBuffer *pChannel, PRPC_MESSAGE pMsg, DWORD *pdwStubPhase ) { /* Once stub delegation is implemented, this should call IRpcStubBuffer_Invoke on the stub's base interface. The - IRpcStubBuffer for this interface is stored at (void**)This-1. + IRpcStubBuffer for this interface is stored at (void**)iface-1. The pChannel and pMsg parameters are passed intact (RPCOLEMESSAGE is basically a RPC_MESSAGE). If Invoke returns with a failure then an exception is raised (to see this, change the return value in the test). - IRpcStubBuffer *base_this = *(IRpcStubBuffer**)((void**)This - 1); - HRESULT r = IRpcStubBuffer_Invoke(base_this, (RPCOLEMESSAGE*)pMsg, pChannel); + cstdstubbuffer_delegating_t *This = impl_from_delegating(iface); + HRESULT r = IRpcStubBuffer_Invoke(This->base_stub, (RPCOLEMESSAGE*)pMsg, pChannel); if(FAILED(r)) RpcRaiseException(r); return; */
1
0
0
0
Paul Vriens : wintrust: Moved the generation of the guidstring to a separate function.
by Alexandre Julliard
07 Sep '06
07 Sep '06
Module: wine Branch: master Commit: d22003e3e8bf37ddb365a759d69e2c0a31141140 URL:
http://source.winehq.org/git/?p=wine.git;a=commit;h=d22003e3e8bf37ddb365a75…
Author: Paul Vriens <Paul.Vriens(a)xs4all.nl> Date: Thu Aug 31 19:23:25 2006 +0200 wintrust: Moved the generation of the guidstring to a separate function. --- dlls/wintrust/register.c | 34 ++++++++++++++++++++-------------- 1 files changed, 20 insertions(+), 14 deletions(-) diff --git a/dlls/wintrust/register.c b/dlls/wintrust/register.c index 10ccbae..3b0da2e 100644 --- a/dlls/wintrust/register.c +++ b/dlls/wintrust/register.c @@ -50,6 +50,23 @@ static const WCHAR DiagnosticPolicy[] = static const WCHAR Cleanup[] = {'C','l','e','a','n','u','p','\\', 0}; /*********************************************************************** + * WINTRUST_guid2wstr + * + * Create a wide-string from a GUID + * + */ +static void WINTRUST_Guid2Wstr(GUID* pgActionID, WCHAR* GuidString) +{ + static const WCHAR wszFormat[] = {'{','%','0','8','l','X','-','%','0','4','X','-','%','0','4','X','-', + '%','0','2','X','%','0','2','X','-','%','0','2','X','%','0','2','X','%','0','2','X','%','0','2', + 'X','%','0','2','X','%','0','2','X','}', 0}; + + wsprintfW(GuidString, wszFormat, pgActionID->Data1, pgActionID->Data2, pgActionID->Data3, + pgActionID->Data4[0], pgActionID->Data4[1], pgActionID->Data4[2], pgActionID->Data4[3], + pgActionID->Data4[4], pgActionID->Data4[5], pgActionID->Data4[6], pgActionID->Data4[7]); +} + +/*********************************************************************** * WINTRUST_WriteProviderToReg * * Helper function for WintrustAddActionID @@ -118,10 +135,6 @@ error_close_key: BOOL WINAPI WintrustAddActionID( GUID* pgActionID, DWORD fdwFlags, CRYPT_REGISTER_ACTIONID* psProvInfo) { - static const WCHAR wszFormat[] = {'{','%','0','8','l','X','-','%','0','4','X','-','%','0','4','X','-', - '%','0','2','X','%','0','2','X','-','%','0','2','X','%','0','2','X','%','0','2','X','%','0','2', - 'X','%','0','2','X','%','0','2','X','}', 0}; - WCHAR GuidString[39]; LONG Res; LONG WriteActionError = ERROR_SUCCESS; @@ -141,9 +154,8 @@ BOOL WINAPI WintrustAddActionID( GUID* p } /* Create this string only once, instead of in the helper function */ - wsprintfW(GuidString, wszFormat, pgActionID->Data1, pgActionID->Data2, pgActionID->Data3, - pgActionID->Data4[0], pgActionID->Data4[1], pgActionID->Data4[2], pgActionID->Data4[3], - pgActionID->Data4[4], pgActionID->Data4[5], pgActionID->Data4[6], pgActionID->Data4[7]); + WINTRUST_Guid2Wstr( pgActionID, GuidString); + /* Write the information to the registry */ Res = WINTRUST_WriteProviderToReg(GuidString, Initialization , psProvInfo->sInitProvider); @@ -223,10 +235,6 @@ static void WINTRUST_RemoveProviderFromR */ BOOL WINAPI WintrustRemoveActionID( GUID* pgActionID ) { - static const WCHAR wszFormat[] = {'{','%','0','8','l','X','-','%','0','4','X','-','%','0','4','X','-', - '%','0','2','X','%','0','2','X','-','%','0','2','X','%','0','2','X','%','0','2','X','%','0','2', - 'X','%','0','2','X','%','0','2','X','}', 0}; - WCHAR GuidString[39]; TRACE("(%s)\n", debugstr_guid(pgActionID)); @@ -238,9 +246,7 @@ BOOL WINAPI WintrustRemoveActionID( GUID } /* Create this string only once, instead of in the helper function */ - wsprintfW(GuidString, wszFormat, pgActionID->Data1, pgActionID->Data2, pgActionID->Data3, - pgActionID->Data4[0], pgActionID->Data4[1], pgActionID->Data4[2], pgActionID->Data4[3], - pgActionID->Data4[4], pgActionID->Data4[5], pgActionID->Data4[6], pgActionID->Data4[7]); + WINTRUST_Guid2Wstr( pgActionID, GuidString); /* We don't care about success or failure */ WINTRUST_RemoveProviderFromReg(GuidString, Initialization);
1
0
0
0
Paul Vriens : wintrust: Implementation of WintrustAddActionID.
by Alexandre Julliard
07 Sep '06
07 Sep '06
Module: wine Branch: master Commit: 3747f223377e47b56fcd4547cd549a4c41c455fe URL:
http://source.winehq.org/git/?p=wine.git;a=commit;h=3747f223377e47b56fcd454…
Author: Paul Vriens <Paul.Vriens(a)xs4all.nl> Date: Thu Aug 31 16:37:19 2006 +0200 wintrust: Implementation of WintrustAddActionID. --- dlls/wintrust/register.c | 110 +++++++++++++++++++++++++++++++++++++++- dlls/wintrust/tests/register.c | 54 +++++++------------- include/wintrust.h | 1 3 files changed, 125 insertions(+), 40 deletions(-) Diff:
http://source.winehq.org/git/?p=wine.git;a=commitdiff;h=3747f223377e47b56fc…
1
0
0
0
← Newer
1
...
58
59
60
61
62
63
64
65
66
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
Results per page:
10
25
50
100
200