Closed Bug 1338609 Opened 7 years ago Closed 7 years ago

mscom needs the ability to (de)serialize structs

Categories

(Core :: IPC, defect)

Unspecified
Windows
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla54
Tracking Status
firefox54 --- fixed

People

(Reporter: bugzilla, Assigned: bugzilla)

References

Details

Attachments

(1 file)

COM easily serializes interfaces via CoMarshalInterface, but we need to do it with structs. Microsoft RPC provides a way to do this provided that the struct is declared properly in the idl.

I've written a pair of classes that allow us to read and write to/from IStream objects, which then can be read from/written to a buffer.

This is required to be able to send payloads along with a COM interface during marshaling.
I keep forgetting to point out that the function pointers that are accepted by this code are generated by midl. There is a bunch of info in the remarks section of https://msdn.microsoft.com/en-us/library/windows/desktop/aa366812(v=vs.85).aspx that goes into more detail.
Comment on attachment 8836194 [details]
Bug 1338609: Add the ability to serialize and deserialize structs using Microsoft RPC to mscom;

https://reviewboard.mozilla.org/r/111648/#review116138

::: ipc/mscom/StructStream.h:104
(Diff revision 3)
> +    return mStatus == RPC_S_OK && !mEncodedLen;
> +  }
> +
> +  unsigned long GetSize() const
> +  {
> +    return sizeof(mEncodedLen) + mEncodedLen;

why add sizeof(mEncodedLen) here?
Attachment #8836194 - Flags: review?(jmathies) → review+
(In reply to Jim Mathies [:jimm] from comment #5)
> why add sizeof(mEncodedLen) here?

When writing to the buffer we write out mEncodedLen before we write the buffer contents.
Pushed by aklotz@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/6c4184cc1e21
Add the ability to serialize and deserialize structs using Microsoft RPC to mscom; r=jimm
https://hg.mozilla.org/mozilla-central/rev/6c4184cc1e21
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla54
You need to log in before you can comment on or make changes to this bug.