-
April 11th, 2013, 03:42 AM
#31
Re: getting RpcExceptionCode 5 with RPC code
just before the line What is this RPC anyway? there is a link to download the code near the top of the page.
this is an old example and nobody has written to it since 2008 and there is no way to contact the author
this was the easiest example of RPC i could find. there isn't many tutorials
-
April 11th, 2013, 04:26 AM
#32
Re: getting RpcExceptionCode 5 with RPC code
Well, I tested it and got the same error on my XP SP3. But it was not the NdrSendReceive that caused this error but NdrFreeBuffer
Perhaps, you will try some MSDN samples instead? like this one:
http://msdn.microsoft.com/en-us/libr...(v=VS.60).aspx
Victor Nijegorodov
-
April 11th, 2013, 04:39 AM
#33
Re: getting RpcExceptionCode 5 with RPC code
i saw that example before but i don't understand it. it talks about the files being used but there is no link to these files...
-
April 11th, 2013, 04:55 AM
#34
Re: getting RpcExceptionCode 5 with RPC code
Victor Nijegorodov
-
April 11th, 2013, 05:06 AM
#35
Re: getting RpcExceptionCode 5 with RPC code
ok i followed that tutorial and i got this error in the server program:
error C2664: 'RpcServerUseProtseqEpW' : cannot convert parameter 1 from 'unsigned char *' to 'RPC_WSTR'
so i changed this code:
Code:
status = RpcServerUseProtseqEp(
reinterpret_cast<unsigned char*>("ncacn_ip_tcp"),
RPC_C_PROTSEQ_MAX_REQS_DEFAULT,
reinterpret_cast<unsigned char*>("4747"),
NULL);
to this:
Code:
status = RpcServerUseProtseqEp(
L"ncacn_ip_tcp",
RPC_C_PROTSEQ_MAX_REQS_DEFAULT,
L"4747",
NULL);
but now i am getting this error:
error C2664: 'RpcServerUseProtseqEpW' : cannot convert parameter 1 from 'const wchar_t [13]' to 'RPC_WSTR'
-
April 14th, 2013, 06:38 PM
#36
Re: getting RpcExceptionCode 5 with RPC code
Originally Posted by beginner91
ok i followed that tutorial and i got this error in the server program:
error C2664: 'RpcServerUseProtseqEpW' : cannot convert parameter 1 from 'unsigned char *' to 'RPC_WSTR'
That is because you are building your program as Unicode, not MBCS. You should be using the _T() macro or _TEXT() macro when creating string literals.
so i changed this code:
[code] status = RpcServerUseProtseqEp(
reinterpret_cast<unsigned char*>("ncacn_ip_tcp"),
No. Do not do this. The function is expecting 16-bit char strings, and casting one string type to another doesn't do any conversion.
Code:
RpcServerUseProtseqEp(_T("ncacn_ip_tcp"), RPC_C_PROTSEQ_MAX_REQS_DEFAULT, _T("4747"), NULL);
The above code now will compile, regardless if your code is compiled as Unicode or ANSI/MBCS.
Regards,
Paul McKenzie
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|