oleaut32: Fix differences between the size returned in sizing the
buffer for interfaces and the buffer actually used.
This commit is contained in:
parent
a963fd6285
commit
50a9c208c6
|
@ -287,14 +287,14 @@ static unsigned char* interface_variant_marshal(unsigned long *pFlags, unsigned
|
||||||
|
|
||||||
working_memlocked = GlobalLock(working_mem);
|
working_memlocked = GlobalLock(working_mem);
|
||||||
memcpy(Buffer, &size, sizeof(ULONG)); /* copy the buffersize */
|
memcpy(Buffer, &size, sizeof(ULONG)); /* copy the buffersize */
|
||||||
Buffer += sizeof(ULONG);
|
memcpy(Buffer + sizeof(ULONG), working_memlocked, size);
|
||||||
memcpy(Buffer, working_memlocked, size);
|
|
||||||
GlobalUnlock(working_mem);
|
GlobalUnlock(working_mem);
|
||||||
|
|
||||||
IStream_Release(working);
|
IStream_Release(working);
|
||||||
|
|
||||||
TRACE("done, size=%ld\n", sizeof(ULONG) + size);
|
/* size includes the ULONG for the size written above */
|
||||||
return Buffer + sizeof(ULONG) + size;
|
TRACE("done, size=%ld\n", size);
|
||||||
|
return Buffer + size;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* helper: called for VT_DISPATCH / VT_UNKNOWN variants to unmarshal the buffer. returns Buffer on failure, new position otherwise */
|
/* helper: called for VT_DISPATCH / VT_UNKNOWN variants to unmarshal the buffer. returns Buffer on failure, new position otherwise */
|
||||||
|
@ -314,8 +314,7 @@ static unsigned char *interface_variant_unmarshal(unsigned long *pFlags, unsigne
|
||||||
/* get the buffersize */
|
/* get the buffersize */
|
||||||
memcpy(&size, Buffer, sizeof(ULONG));
|
memcpy(&size, Buffer, sizeof(ULONG));
|
||||||
TRACE("buffersize=%ld\n", size);
|
TRACE("buffersize=%ld\n", size);
|
||||||
Buffer += sizeof(ULONG);
|
|
||||||
|
|
||||||
working_mem = GlobalAlloc(0, size);
|
working_mem = GlobalAlloc(0, size);
|
||||||
if (!working_mem) return oldpos;
|
if (!working_mem) return oldpos;
|
||||||
|
|
||||||
|
@ -328,7 +327,7 @@ static unsigned char *interface_variant_unmarshal(unsigned long *pFlags, unsigne
|
||||||
working_memlocked = GlobalLock(working_mem);
|
working_memlocked = GlobalLock(working_mem);
|
||||||
|
|
||||||
/* now we copy the contents of the marshalling buffer to working_memlocked, unlock it, and demarshal the stream */
|
/* now we copy the contents of the marshalling buffer to working_memlocked, unlock it, and demarshal the stream */
|
||||||
memcpy(working_memlocked, Buffer, size);
|
memcpy(working_memlocked, Buffer + sizeof(ULONG), size);
|
||||||
GlobalUnlock(working_mem);
|
GlobalUnlock(working_mem);
|
||||||
|
|
||||||
hr = CoUnmarshalInterface(working, riid, (void**)&V_UNKNOWN(pvar));
|
hr = CoUnmarshalInterface(working, riid, (void**)&V_UNKNOWN(pvar));
|
||||||
|
@ -339,8 +338,9 @@ static unsigned char *interface_variant_unmarshal(unsigned long *pFlags, unsigne
|
||||||
|
|
||||||
IStream_Release(working); /* this also frees the underlying hglobal */
|
IStream_Release(working); /* this also frees the underlying hglobal */
|
||||||
|
|
||||||
TRACE("done, processed=%ld bytes\n", sizeof(ULONG) + size);
|
/* size includes the ULONG for the size written above */
|
||||||
return Buffer + sizeof(ULONG) + size;
|
TRACE("done, processed=%ld bytes\n", size);
|
||||||
|
return Buffer + size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue