Simon Fell > Its just code > PocketPC
Following up on this & this, I got to the bottom of the SSL problems on Windows Mobile 5.0. The docs are delightfully short on details, all they say is call WSAIoctl with the SO_SSL_PERFORM_HANDSHAKE control code passing in the target server name. none of the docs I could find actually explain the details of how you pass this server name in, (neither do the CE 4.2 docs, when this server name passing was introduced), back when CE4.2 came out, i changed PocketHTTP to do
This appeared to work, the call suceeded, the SSL connection gets established correctly, all is good and well. It turns out that on WM5.0, you need to pass in the length of the server name including the terminating NULL, either this is a change, or it seems more likely to me, the serverName stuff was added to the CE 4.2 docs, but was never implemented, now its implemented in WM5.0 it barfs. I never would of found the include the NULL in the length, its not mentioned in any MSDN docs I could fine, but I took a hint from this post on using the new SET_PEER_NAME option. So PocketHTTP, now does this
WSAIoctl( t->socket, SO_SSL_PERFORM_HANDSHAKE, (void *)(serverName), strlen(serverName), 0, 0, NULL, NULL, NULL )
and all is well, this works fine on WM5.0, and despite all the signs that you need to use VS.NET 2005 to do WM5.0 builds, the latest PocketHTTP build is still done with eVC3, and it works fine on my WM5.0 device. PocketHTTP v.1.3.0 is out and has this fix in it.
WSAIoctl( t->socket, SO_SSL_PERFORM_HANDSHAKE, (void *)(serverName), strlen(serverName)+1, 0, 0, NULL, NULL, NULL )
eVC3 (PocketPC, PocketPC2002) & eVC4 (PocketPC2003) were both free, but unless I'm miss reading this, to do WM5.0 dev work, you need to buy VS 2005 ? WTF
Update : Brad & I both figured the WM SDK would work with the free VS.NET Express C++ edition, but alas no cigar. Seems the cheapest way into WM 5.0 development is with the VS.NET Standard edition at $299. I guess the folks in Redmond figure they need to be making money from dev tools these days.
I hope the Redmond folks finally got around to shipping a usable SOAP stack, 'cause I doubt I'll shell out for it just to do PocketSOAP stuff on WM5.
Following on from my earlier SSlValidate problems, I found a blog post that details some of the SSL related changes for WM5.0. It looks like there's an extra WSAIoctl you need to do to have it pass the correct flag in dwFlags to your validation hook. It sucks that they "improved" this feature in such a backwards imcompatible way. (old code won't be making the additional call, so the hook will always get the wrong flags). But, hell, the screwed SSL on every previous release, why was I really expecting WM5.0 to be any better?
I've had numerous reports that the SSL support in PocketHTTP/SOAP always returns an error on Windows Mobile 5.0 devices, I've been digging through it and have tracked it down to what appears to be a bug in WM5.0. As per the docs I register a SslValidate hook, however the dwFlags parameter is always SSL_CERT_FLAG_ISSUER_UNKNOWN, regardless of the status of the root certificate. Previous versions of PocketPC (2003 & 2002) got this right. sigh.
I got my hands on a Windows Mobile 5 based PDA today, so far I'm completely underwhelmed, the first peice of software I installed decided it needed to reboot the device to finish the install (never seen this on older devices), so they've made WM5 better by making it more like XP :(. I fired up my eVB based test app, as expected it takes me to the web to install the eVB runtime (because golly, why on earth would you want the runtime for the development tools MSFT spent years telling you were the bee knees). However it seems the regular Microsoft.com URL shuffler has struck, and it takes you to a non existent page. First impressions are, wow, it really does suck as badly as the earlier incarnations. And everyone wonders why the crackberrys are insanely popular.