RCF for Windows without sockets

RCF support and general discussion.
Post Reply
okg
Posts: 10
Joined: Mon May 27, 2013 2:14 pm

RCF for Windows without sockets

Post by okg »

Hi,

I’m trying to implement an RCF client in Metro/Windows Store application.
The related application certification process prohibits the use of windows sockets, so I may not link ws2_32.lib and mswsock.lib at least.

...................personal environmental explanations, can be skipped..............
I had to implement my own transport and use (one of the) approved by Metro (IXMLHTTPRequest2) interface instead of TcpClientTransport/BsdClientTransport.
So my RCF regular/desktop server operates via HttpEndpoint, but the RCF client transfers all the data via my (say so) MetroHttpEndpoint without the use of HttpFrameFilter.cpp as all the required http related client wrapping is made by the native Metro API.
After a week it started working finally, but the question is
..............end of the explanations........................

How to build RCF without ws2_32.lib/mswsock.lib linkage?
In other words, how to get rid of any WSA…/socket calls in the entire text. As any of the calls requires prohibited (by Windows Store) ws2_32.lib/mswsock.lib linkage.
I believe, in the source there is a couple of #define-s that I could use. Otherwise I would need to find and "comment out" all the WSA/socket calls manually.
I see the question is extraordinary enough....
Any ideas would be very helpful.

Thank you,
Konstantin

PS By the way, initially I thought the process would take a lot of time, but due to the perfect RCF class hierarchy the process went relatively smoothly. Great product!

jarl
Posts: 238
Joined: Mon Oct 03, 2011 4:53 am
Contact:

Re: RCF for Windows without sockets

Post by jarl »

Hi Konstantin,

Thanks for the explanation. I didn't realize that Metro apps were this restrictive with the Windows API.

I've had a look through the code and there is currently no easy way to prevent linking to Winsock (ws2_32.lib). There are Winsock usages throughout RCF source code, and also in Boost.Asio which we use for networking.

I think the easiest way to proceed, is to obtain a list of the functions that are being imported from ws2_32.lib, and then stub them out yourself. For example, getsockopt() turns up as a missing symbol if you build without linking to ws2_32.lib . You can look up the getsockopt() definition in the Windows headers, and then copy it pretty much verbatim into your own program and give it a trivial definition:

Code: Select all

	int
	WSAAPI
	getsockopt(
	_In_ SOCKET s,
	_In_ int level,
	_In_ int optname,
	_Out_writes_bytes_(*optlen) char FAR * optval,
	_Inout_ int FAR * optlen
	)
{
	RCF_ASSERT(0 && "Should never be calling getsockopt().");
}
I get a compiler warning (4273: inconsistent dll linkage) when I do this, but that should be harmless and the warning can be disabled. If you do this for all the symbols that are missing, you should then have a build that doesn't need ws2_32.lib.
Kind Regards

Jarl Lindrud
Delta V Software
http://www.deltavsoft.com

okg
Posts: 10
Joined: Mon May 27, 2013 2:14 pm

Re: RCF for Windows without sockets

Post by okg »

Hi Jarl,

>I didn't realize that Metro apps were this restrictive with the Windows API.
Actually extremely restrictive, most of the kernel32.dll calls are disallowed, all the others are to be used via new metro API. Such calls are provided by so called run time broker (the integral part of metro sandbox/application contained) that adds some (as advertised by Microsoft) benefits.

Actually I suspected I would need to create stubs/gags for all the socket related functions for successful linkage without ws2_32.
Thank you for helping me to choose the simplest way, I will do that.
If you are interested in my Metro realated source code, I would be happy to share the code with you.

Thank you very much,
Konstantin

jarl
Posts: 238
Joined: Mon Oct 03, 2011 4:53 am
Contact:

Re: RCF for Windows without sockets

Post by jarl »

Thanks for the offer Konstantin. It would be great to have a working RCF build on Metro, so if you want to send me your changes I'm more than happy to see if we can integrate it with the rest of the codebase.
Kind Regards

Jarl Lindrud
Delta V Software
http://www.deltavsoft.com

okg
Posts: 10
Joined: Mon May 27, 2013 2:14 pm

Re: RCF for Windows without sockets

Post by okg »

Jarl,

I'll be back. I just need to finish the process and pass through the certification kit.
By the way, named pipes are not allowed for Metro apps as well.

Yours,
Konstantin.

Post Reply