Windows RPC call fails with error 87 (0x57) ERROR_INVALID_PARAMETER

285 views Asked by At

I'm upgrading a huge suite of programs from C++ Builder 6 and MSVC 6 to C++ Builder 11 and Visual Studio 2022.

The suite of programs use C++ Builder for the UI and MSVC for non-visual utilities and services. The C++ Builder UI communicates with the services using RPC. MSVC generates rpc client and server stubs using the MIDL compiler. C++ Builder 6 happily accepts and compiles the .c and .h client side stubs.

I've converted the MSVC projects to V2022 and I've set the Platform Toolset to Visual Studio 2015 - Windows XP (v140_xp). I'm doing the MSVC conversion first as it's much easier, Very few code changes were needed - mainly removing throw() specifications and using unique_ptr, etc.

The MIDL compiler produces slightly different stubs to MSVC V6 - now it produces separate .C files for the server and client stubs, whereas the V6 put them both in one .C file. C++ Builder 6 is happy to compile the new .C client side stubs.

However, the C++ Builder V6 programs receive error code 87 (0x57) whenever it tries to call any RPC function using the NdrClientCall2(...) functions in the client stubs... The target service is running. I set up Visual Studio to debug the service (by attaching to the process) and set a breakpoint to the function that should respond to the call - the breakpoint is never hit, which I think means the RPC call is not getting that far.

If I replace the service with the one compiled with MSVC 6, everything works as expected.

I'm not sure how to proceed - I'm wondering if there is some incompatibility between the new MSVC 2022 code and the old C++ Builder V6 code, but they both are targeting the same Windows version... And I don't have any experience in debugging RPC itself. Sadly, the codebase is huge, so I can't post a simple example.

I'm just looking for any pointers about how to figure out what the problem is...

Andy

0

There are 0 answers