Commit 9d121203 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

msi: Store a record's associated query privately.

parent 5808f1dd
...@@ -131,7 +131,6 @@ typedef struct tagMSIFIELD ...@@ -131,7 +131,6 @@ typedef struct tagMSIFIELD
union union
{ {
INT iVal; INT iVal;
INT_PTR pVal;
LPWSTR szwVal; LPWSTR szwVal;
IStream *stream; IStream *stream;
} u; } u;
...@@ -141,6 +140,7 @@ typedef struct tagMSIFIELD ...@@ -141,6 +140,7 @@ typedef struct tagMSIFIELD
typedef struct tagMSIRECORD typedef struct tagMSIRECORD
{ {
MSIOBJECTHDR hdr; MSIOBJECTHDR hdr;
MSIQUERY *query;
UINT count; /* as passed to MsiCreateRecord */ UINT count; /* as passed to MsiCreateRecord */
MSIFIELD fields[1]; /* nb. array size is count+1 */ MSIFIELD fields[1]; /* nb. array size is count+1 */
} MSIRECORD; } MSIRECORD;
...@@ -813,13 +813,11 @@ extern UINT MSI_RecordGetIStream( MSIRECORD *, UINT, IStream **) DECLSPEC_HIDDEN ...@@ -813,13 +813,11 @@ extern UINT MSI_RecordGetIStream( MSIRECORD *, UINT, IStream **) DECLSPEC_HIDDEN
extern const WCHAR *MSI_RecordGetString( const MSIRECORD *, UINT ) DECLSPEC_HIDDEN; extern const WCHAR *MSI_RecordGetString( const MSIRECORD *, UINT ) DECLSPEC_HIDDEN;
extern MSIRECORD *MSI_CreateRecord( UINT ) DECLSPEC_HIDDEN; extern MSIRECORD *MSI_CreateRecord( UINT ) DECLSPEC_HIDDEN;
extern UINT MSI_RecordSetInteger( MSIRECORD *, UINT, int ) DECLSPEC_HIDDEN; extern UINT MSI_RecordSetInteger( MSIRECORD *, UINT, int ) DECLSPEC_HIDDEN;
extern UINT MSI_RecordSetIntPtr( MSIRECORD *, UINT, INT_PTR ) DECLSPEC_HIDDEN;
extern UINT MSI_RecordSetStringW( MSIRECORD *, UINT, LPCWSTR ) DECLSPEC_HIDDEN; extern UINT MSI_RecordSetStringW( MSIRECORD *, UINT, LPCWSTR ) DECLSPEC_HIDDEN;
extern BOOL MSI_RecordIsNull( MSIRECORD *, UINT ) DECLSPEC_HIDDEN; extern BOOL MSI_RecordIsNull( MSIRECORD *, UINT ) DECLSPEC_HIDDEN;
extern UINT MSI_RecordGetStringW( MSIRECORD * , UINT, LPWSTR, LPDWORD) DECLSPEC_HIDDEN; extern UINT MSI_RecordGetStringW( MSIRECORD * , UINT, LPWSTR, LPDWORD) DECLSPEC_HIDDEN;
extern UINT MSI_RecordGetStringA( MSIRECORD *, UINT, LPSTR, LPDWORD) DECLSPEC_HIDDEN; extern UINT MSI_RecordGetStringA( MSIRECORD *, UINT, LPSTR, LPDWORD) DECLSPEC_HIDDEN;
extern int MSI_RecordGetInteger( MSIRECORD *, UINT ) DECLSPEC_HIDDEN; extern int MSI_RecordGetInteger( MSIRECORD *, UINT ) DECLSPEC_HIDDEN;
extern INT_PTR MSI_RecordGetIntPtr( MSIRECORD *, UINT ) DECLSPEC_HIDDEN;
extern UINT MSI_RecordReadStream( MSIRECORD *, UINT, char *, LPDWORD) DECLSPEC_HIDDEN; extern UINT MSI_RecordReadStream( MSIRECORD *, UINT, char *, LPDWORD) DECLSPEC_HIDDEN;
extern UINT MSI_RecordSetStream(MSIRECORD *, UINT, IStream *) DECLSPEC_HIDDEN; extern UINT MSI_RecordSetStream(MSIRECORD *, UINT, IStream *) DECLSPEC_HIDDEN;
extern UINT MSI_RecordGetFieldCount( const MSIRECORD *rec ) DECLSPEC_HIDDEN; extern UINT MSI_RecordGetFieldCount( const MSIRECORD *rec ) DECLSPEC_HIDDEN;
......
...@@ -374,7 +374,8 @@ UINT MSI_ViewFetch(MSIQUERY *query, MSIRECORD **prec) ...@@ -374,7 +374,8 @@ UINT MSI_ViewFetch(MSIQUERY *query, MSIRECORD **prec)
if (r == ERROR_SUCCESS) if (r == ERROR_SUCCESS)
{ {
query->row ++; query->row ++;
MSI_RecordSetIntPtr(*prec, 0, (INT_PTR)query); (*prec)->query = query;
MSI_RecordSetInteger(*prec, 0, 1);
} }
return r; return r;
...@@ -608,7 +609,7 @@ UINT MSI_ViewModify( MSIQUERY *query, MSIMODIFY mode, MSIRECORD *rec ) ...@@ -608,7 +609,7 @@ UINT MSI_ViewModify( MSIQUERY *query, MSIMODIFY mode, MSIRECORD *rec )
if ( !view || !view->ops->modify) if ( !view || !view->ops->modify)
return ERROR_FUNCTION_FAILED; return ERROR_FUNCTION_FAILED;
if ( mode == MSIMODIFY_UPDATE && MSI_RecordGetIntPtr( rec, 0 ) != (INT_PTR)query ) if ( mode == MSIMODIFY_UPDATE && rec->query != query )
return ERROR_FUNCTION_FAILED; return ERROR_FUNCTION_FAILED;
r = view->ops->modify( view, mode, rec, query->row ); r = view->ops->modify( view, mode, rec, query->row );
......
...@@ -46,7 +46,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(msidb); ...@@ -46,7 +46,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(msidb);
#define MSIFIELD_INT 1 #define MSIFIELD_INT 1
#define MSIFIELD_WSTR 3 #define MSIFIELD_WSTR 3
#define MSIFIELD_STREAM 4 #define MSIFIELD_STREAM 4
#define MSIFIELD_INTPTR 5
static void MSI_FreeField( MSIFIELD *field ) static void MSI_FreeField( MSIFIELD *field )
{ {
...@@ -54,7 +53,6 @@ static void MSI_FreeField( MSIFIELD *field ) ...@@ -54,7 +53,6 @@ static void MSI_FreeField( MSIFIELD *field )
{ {
case MSIFIELD_NULL: case MSIFIELD_NULL:
case MSIFIELD_INT: case MSIFIELD_INT:
case MSIFIELD_INTPTR:
break; break;
case MSIFIELD_WSTR: case MSIFIELD_WSTR:
msi_free( field->u.szwVal); msi_free( field->u.szwVal);
...@@ -190,9 +188,6 @@ UINT MSI_RecordCopyField( MSIRECORD *in_rec, UINT in_n, ...@@ -190,9 +188,6 @@ UINT MSI_RecordCopyField( MSIRECORD *in_rec, UINT in_n,
case MSIFIELD_INT: case MSIFIELD_INT:
out->u.iVal = in->u.iVal; out->u.iVal = in->u.iVal;
break; break;
case MSIFIELD_INTPTR:
out->u.pVal = in->u.pVal;
break;
case MSIFIELD_WSTR: case MSIFIELD_WSTR:
if ((str = msi_strdupW( in->u.szwVal, in->len ))) if ((str = msi_strdupW( in->u.szwVal, in->len )))
{ {
...@@ -216,32 +211,6 @@ UINT MSI_RecordCopyField( MSIRECORD *in_rec, UINT in_n, ...@@ -216,32 +211,6 @@ UINT MSI_RecordCopyField( MSIRECORD *in_rec, UINT in_n,
return r; return r;
} }
INT_PTR MSI_RecordGetIntPtr( MSIRECORD *rec, UINT iField )
{
int ret;
TRACE( "%p %d\n", rec, iField );
if( iField > rec->count )
return MININT_PTR;
switch( rec->fields[iField].type )
{
case MSIFIELD_INT:
return rec->fields[iField].u.iVal;
case MSIFIELD_INTPTR:
return rec->fields[iField].u.pVal;
case MSIFIELD_WSTR:
if( string2intW( rec->fields[iField].u.szwVal, &ret ) )
return ret;
return MININT_PTR;
default:
break;
}
return MININT_PTR;
}
int MSI_RecordGetInteger( MSIRECORD *rec, UINT iField) int MSI_RecordGetInteger( MSIRECORD *rec, UINT iField)
{ {
int ret = 0; int ret = 0;
...@@ -255,8 +224,6 @@ int MSI_RecordGetInteger( MSIRECORD *rec, UINT iField) ...@@ -255,8 +224,6 @@ int MSI_RecordGetInteger( MSIRECORD *rec, UINT iField)
{ {
case MSIFIELD_INT: case MSIFIELD_INT:
return rec->fields[iField].u.iVal; return rec->fields[iField].u.iVal;
case MSIFIELD_INTPTR:
return rec->fields[iField].u.pVal;
case MSIFIELD_WSTR: case MSIFIELD_WSTR:
if( string2intW( rec->fields[iField].u.szwVal, &ret ) ) if( string2intW( rec->fields[iField].u.szwVal, &ret ) )
return ret; return ret;
...@@ -311,20 +278,6 @@ UINT WINAPI MsiRecordClearData( MSIHANDLE handle ) ...@@ -311,20 +278,6 @@ UINT WINAPI MsiRecordClearData( MSIHANDLE handle )
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
UINT MSI_RecordSetIntPtr( MSIRECORD *rec, UINT iField, INT_PTR pVal )
{
TRACE("%p %u %ld\n", rec, iField, pVal);
if( iField > rec->count )
return ERROR_INVALID_PARAMETER;
MSI_FreeField( &rec->fields[iField] );
rec->fields[iField].type = MSIFIELD_INTPTR;
rec->fields[iField].u.pVal = pVal;
return ERROR_SUCCESS;
}
UINT MSI_RecordSetInteger( MSIRECORD *rec, UINT iField, int iVal ) UINT MSI_RecordSetInteger( MSIRECORD *rec, UINT iField, int iVal )
{ {
TRACE("%p %u %d\n", rec, iField, iVal); TRACE("%p %u %d\n", rec, iField, iVal);
...@@ -1095,7 +1048,6 @@ void dump_record(MSIRECORD *rec) ...@@ -1095,7 +1048,6 @@ void dump_record(MSIRECORD *rec)
case MSIFIELD_NULL: TRACE("(null)"); break; case MSIFIELD_NULL: TRACE("(null)"); break;
case MSIFIELD_INT: TRACE("%d", rec->fields[i].u.iVal); break; case MSIFIELD_INT: TRACE("%d", rec->fields[i].u.iVal); break;
case MSIFIELD_WSTR: TRACE("%s", debugstr_w(rec->fields[i].u.szwVal)); break; case MSIFIELD_WSTR: TRACE("%s", debugstr_w(rec->fields[i].u.szwVal)); break;
case MSIFIELD_INTPTR: TRACE("%ld", rec->fields[i].u.pVal); break;
case MSIFIELD_STREAM: TRACE("%p", rec->fields[i].u.stream); break; case MSIFIELD_STREAM: TRACE("%p", rec->fields[i].u.stream); break;
} }
if (i < rec->count) TRACE(", "); if (i < rec->count) TRACE(", ");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment