Question

I'm tyring to convert a MSVC project from VS 2005 to VS 2008. It contains a IDL file that outputs a header and stubs used for RPC. The VS 2005 project uses MIDL.exe version 6.00.0366. The VS 2008 project uses MIDL.exe version 7.00.0500.

Here's the problem: MIDL v6 outputs the following prototype for me to implement in my server code:

HRESULT PRC_Function(UINT input);

MIDL v7 with the same command line outputs this prototype:

HRESULT RPC_Function(handle_t IDL_handle, UINT input);

I don't want to have to go through and add the handle_t parameter to all my existing implementations. (Plus I still need the implementations to compile with VS 2005 for a while longer.)

Question: How can I get MIDL.exe v7 to output the same RPC server prototypes as v6?

Was it helpful?

Solution

Looks like I can answer my own question...

MIDL v6 appears to automatically default the handle type to auto_handle for the server prototypes. MIDL v7 does not, so the solution is to use a Server.acl file with the auto_handle setting in it. This outputs a Server.h file with function prototypes that is the same between MIDL v6 and v7.

However, it also outputs a warning indicating that "auto_handle" has been depreciated. Instead I used implicit_handle(handle_t IDL_handle).

Too bad this site doesn't give me badges for answering my own questions. Nor can I flag my own answer as the correct answer.

OTHER TIPS

The handle_t IDL_handle is for the explicit RPC binding handle. On the server side, you can do cool stuff with it like pull the calling client's token for impersonation through the various RPC functions, but if you don't need to use it, it is fine to just set it as an unreferenced parameter (UNREFERENCED_PARAMETER(IDL_handle);). It seems like implicit binding handles are deprecated now.

On the client side, you use the binding handle you get when you bind to the RPC server for the IDL_handle parameter.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top