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>
This commit is contained in:
Hans Leidekker 2018-10-12 16:44:03 +02:00 committed by Alexandre Julliard
parent 965ca1b4de
commit c494570d89
4 changed files with 11 additions and 8 deletions

View File

@ -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;

View File

@ -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 );

View File

@ -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)
{

View File

@ -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[];
};