[WINESYNC] msi: Fix the remote case for MsiViewModify(MSIMODIFY_UPDATE).

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45972
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>

wine commit id c494570d89f270c9240519c625c5c757a4e8ff23 by Hans Leidekker <hans@codeweavers.com>
This commit is contained in:
winesync 2022-03-13 00:08:18 +01:00 committed by Mark Jansen
parent 4b4baf5cb8
commit 14478462cc
No known key found for this signature in database
GPG key ID: B39240EE84BEAE8B
4 changed files with 11 additions and 8 deletions

View file

@ -141,8 +141,8 @@ 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 */
UINT64 cookie;
MSIFIELD fields[1]; /* nb. array size is count+1 */ MSIFIELD fields[1]; /* nb. array size is count+1 */
} MSIRECORD; } MSIRECORD;

View file

@ -379,7 +379,7 @@ UINT MSI_ViewFetch(MSIQUERY *query, MSIRECORD **prec)
if (r == ERROR_SUCCESS) if (r == ERROR_SUCCESS)
{ {
query->row ++; query->row ++;
(*prec)->query = query; (*prec)->cookie = (UINT64)(ULONG_PTR)query;
MSI_RecordSetInteger(*prec, 0, 1); MSI_RecordSetInteger(*prec, 0, 1);
} }
@ -693,7 +693,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 && rec->query != query ) if ( mode == MSIMODIFY_UPDATE && rec->cookie != (UINT64)(ULONG_PTR)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 );

View file

@ -1064,6 +1064,7 @@ UINT copy_remote_record(const struct wire_record *in, MSIHANDLE out)
if (!(rec = msihandle2msiinfo(out, MSIHANDLETYPE_RECORD))) if (!(rec = msihandle2msiinfo(out, MSIHANDLETYPE_RECORD)))
return ERROR_INVALID_HANDLE; return ERROR_INVALID_HANDLE;
rec->cookie = in->cookie;
for (i = 0; i <= in->count; i++) for (i = 0; i <= in->count; i++)
{ {
switch (in->fields[i].type) 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 *marshal_record(MSIHANDLE handle)
{ {
struct wire_record *ret; struct wire_record *ret;
unsigned int i, count; unsigned int i;
MSIRECORD *rec; MSIRECORD *rec;
if (!(rec = msihandle2msiinfo(handle, MSIHANDLETYPE_RECORD))) if (!(rec = msihandle2msiinfo(handle, MSIHANDLETYPE_RECORD)))
return NULL; return NULL;
count = MSI_RecordGetFieldCount(rec); ret = midl_user_allocate(sizeof(*ret) + rec->count * sizeof(ret->fields[0]));
ret = midl_user_allocate(sizeof(*ret) + count * sizeof(ret->fields[0])); ret->count = rec->count;
ret->count = count; ret->cookie = rec->cookie;
for (i = 0; i <= count; i++) for (i = 0; i <= rec->count; i++)
{ {
switch (rec->fields[i].type) switch (rec->fields[i].type)
{ {

View file

@ -51,8 +51,10 @@ struct wire_field {
int len; int len;
}; };
/* compatible with MSIRECORD minus header */
struct wire_record { struct wire_record {
unsigned int count; unsigned int count;
UINT64 cookie;
[size_is(count+1)] struct wire_field fields[]; [size_is(count+1)] struct wire_field fields[];
}; };