开发者

Sending UDT over RPC in Windows

开发者 https://www.devze.com 2023-02-23 12:07 出处:网络
I\'m getting to grips with RPC in Windows and I\'ve got a basic client/server model setup and working and I can pass a string over between the 2 OK but I now need to extend it to pass a binary structu

I'm getting to grips with RPC in Windows and I've got a basic client/server model setup and working and I can pass a string over between the 2 OK but I now need to extend it to pass a binary structure between the 2 and I can't figure out how to. Obviously trying to pass a void* will not work as the MIDL compiler would 开发者_运维百科have no idea of the structure size but I'm hoping there's a way to define a structure in IDL to make this work. My current IDL looks like this:

[uuid("1D51414D-150C-4F4C-8742-0C08AFBE409E"), version(1.0)]
interface RpcVendor
{
    void SendMessage([in] handle_t hBinding, [in, string] char *message);
}

And my structure looks like this:

struct {
    char *title;
    char *message;
    int type;
}

Is there any way to define that in IDL and pass it across?

Thanks, J


Your object has two string and an int. You can define such an object in the IDL source file and pass them around after the compiler spits out the necessary stubs.

Start here to do the reading.

0

精彩评论

暂无评论...
验证码 换一张
取 消