Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45972 Signed-off-by: Hans Leidekker hans@codeweavers.com --- dlls/msi/msipriv.h | 2 +- dlls/msi/msiquery.c | 4 ++-- dlls/msi/record.c | 11 ++++++----- dlls/msi/winemsi.idl | 2 ++ 4 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/dlls/msi/msipriv.h b/dlls/msi/msipriv.h index 76f532f34c..4e61fdb929 100644 --- a/dlls/msi/msipriv.h +++ b/dlls/msi/msipriv.h @@ -141,8 +141,8 @@ typedef struct tagMSIFIELD typedef struct tagMSIRECORD { MSIOBJECTHDR hdr; - MSIQUERY *query; UINT count; /* as passed to MsiCreateRecord */ + UINT64 cookie; MSIFIELD fields[1]; /* nb. array size is count+1 */ } MSIRECORD;
diff --git a/dlls/msi/msiquery.c b/dlls/msi/msiquery.c index 544bfc9e9a..701a347a8c 100644 --- a/dlls/msi/msiquery.c +++ b/dlls/msi/msiquery.c @@ -379,7 +379,7 @@ UINT MSI_ViewFetch(MSIQUERY *query, MSIRECORD **prec) if (r == ERROR_SUCCESS) { query->row ++; - (*prec)->query = query; + (*prec)->cookie = (UINT64)(ULONG_PTR)query; MSI_RecordSetInteger(*prec, 0, 1); }
@@ -693,7 +693,7 @@ UINT MSI_ViewModify( MSIQUERY *query, MSIMODIFY mode, MSIRECORD *rec ) if ( !view || !view->ops->modify) return ERROR_FUNCTION_FAILED;
- if ( mode == MSIMODIFY_UPDATE && rec->query != query ) + if ( mode == MSIMODIFY_UPDATE && rec->cookie != (UINT64)(ULONG_PTR)query ) return ERROR_FUNCTION_FAILED;
r = view->ops->modify( view, mode, rec, query->row ); diff --git a/dlls/msi/record.c b/dlls/msi/record.c index a7d55888a9..cca63083d1 100644 --- a/dlls/msi/record.c +++ b/dlls/msi/record.c @@ -1064,6 +1064,7 @@ UINT copy_remote_record(const struct wire_record *in, MSIHANDLE out) if (!(rec = msihandle2msiinfo(out, MSIHANDLETYPE_RECORD))) return ERROR_INVALID_HANDLE;
+ rec->cookie = in->cookie; for (i = 0; i <= in->count; i++) { switch (in->fields[i].type) @@ -1114,17 +1115,17 @@ UINT unmarshal_record(const struct wire_record *in, MSIHANDLE *out) struct wire_record *marshal_record(MSIHANDLE handle) { struct wire_record *ret; - unsigned int i, count; + unsigned int i; MSIRECORD *rec;
if (!(rec = msihandle2msiinfo(handle, MSIHANDLETYPE_RECORD))) return NULL;
- count = MSI_RecordGetFieldCount(rec); - ret = midl_user_allocate(sizeof(*ret) + count * sizeof(ret->fields[0])); - ret->count = count; + ret = midl_user_allocate(sizeof(*ret) + rec->count * sizeof(ret->fields[0])); + ret->count = rec->count; + ret->cookie = rec->cookie;
- for (i = 0; i <= count; i++) + for (i = 0; i <= rec->count; i++) { switch (rec->fields[i].type) { diff --git a/dlls/msi/winemsi.idl b/dlls/msi/winemsi.idl index ebbca82a16..1658603694 100644 --- a/dlls/msi/winemsi.idl +++ b/dlls/msi/winemsi.idl @@ -51,8 +51,10 @@ struct wire_field { int len; };
+/* compatible with MSIRECORD minus header */ struct wire_record { unsigned int count; + UINT64 cookie; [size_is(count+1)] struct wire_field fields[]; };