October 13, 2014 3:22 pm

WinSock and more Open Source for your Windows Store apps

By / Corporate Vice President, Windows Developer Platform

Back at the //Build conference in April, I outlined our goals for the Windows 8.1 developer platform and summarized them in a post about Extending platform commonality through universal Windows apps. Those goals were as follows:

  1. Reach customers across phones, tablets, and PCs
  2. Deliver innovation that supports developer investments
  3. Make cross-platform technology easier and more capable

Today I want to follow up with some exciting news about the availability of WinSock and several associated open source libraries that help deliver on the cross-platform technology promise.

We have heard from many of you about the desire to reuse existing cross-platform native open source libraries and infrastructure in your Windows Store and Phone apps. A few weeks ago, we announced Windows Store and Phone support for CMake (and so did Kitware), and have also been investigating other popular libraries. As we started working on these libraries, we saw that many of them require native socket programming support for Windows Store apps. Previously, apps using WinSock APIs were blocked at certification by the Windows Store.

We’re happy to announce that starting with the release of Visual Studio 2013 Update 3 (download) in August, the Windows App Certification Kit (WACK) allows use of WinSock APIs in your Windows Store apps. And since WinSock was already allowed to pass certification on Windows Phone, this work completes the story. Now WinSock is available universally across Windows 8.1, Windows Phone 8.1, and universal apps.

This enables several great WinSock-dependent libraries for Windows Store:

Libwebsockets is a lightweight pure C library built to use minimal CPU and memory resources and provide fast throughput in both directions. NuGet packages for Windows Phone are available here. MS Open Tech will release libwebsockets packages for Windows Store apps as well.

libcURL is a free, open source client to get documents/files from servers using a variety of supported protocols. NuGet packages for Windows Phone are available here. MS Open Tech will release libcURL packages for Windows Store apps as well.

OpenSSL is a popular toolkit implementing the Secure Sockets Layer (SSL v2/v3) and Transport Layer Security (TLS v1) protocols as well as a full-strength general purpose cryptography library. We have made contributions to OpenSSL library to make it work for Windows Phone and Windows Store apps. You can find our fork of OpenSSL that supports Windows Phone and Store apps here. Please note that we are working with OpenSSL Foundation team to get our pull request reviewed and accepted to the OpenSSL repository.

While OpenSSL enables you to re-use your existing cross-platform code, you can also use the Windows Security and Cryptography APIs (namespace: Windows.Security.Cryptography*) which provide secured communication features natively in WinRT, when you decide to rewrite your code or build new Windows apps.

We hope you find this new support useful as you’re building your apps.

Are there other libraries or functionality that you need? Let us know in the comments.

Updated May 8, 2018 12:47 pm

Join the conversation

  1. Great news Kevin. Will this allow ICMP packets or are we still locked out of that functionality for Windows Store apps? I have several IT admin app ideas that could be built but cannot because of these API limitations.

  2. OpenAL – I wrote an xaudio2 system for our game to run on WinRT (on the plane to Hawaii which makes a great office). The issue isn’t the openal core, it’s that it references things like getenv() and the registry. Also just a pain to figure out how to configure.

    Facebook – WebAuthenticationBroker only returns short-lived tokens. SilentMode is broken as it appears to open the ‘already authz’ed’ webpage in the background then proceeds to timeout waiting for ‘okay’ to be clicked.

    Lots of basic threading & os-level c & win32 functions. Things like Shawn’s library is a start (http://blogs.msdn.com/b/shawnhar/archive/2012/03/12/createthread-for-windows-8-metro.aspx) but there’s just a looong list of functions that aren’t defined when compiling for WinRT that could often be defined in some manner, albeit sometimes non-optimal. Each API excluded makes sense but the overall result is a lot of work for every developer trying to port or support xplat apps. There should have been attempt to create a mock/shim for each API removed. I have a lot of things like this in our win32/osx/ios/android/winrt/winphone/linux codebase:
    #define CreateSemaphore(attributes, count, maxCount, name) \
    CreateSemaphoreEx(attributes, count, maxCount, name, 0, SEMAPHORE_ALL_ACCESS)
    #define getenv(env) \
    (NULL);(env)

    (In case you want to learn more, I’m Seattle local & ex-MSFT. Khouzam knows how to contact me from our discussions on cmakems.)

    • Based on new compilation errors it looks like Update 4 added quite a bit of this. I see nothing in Release Notes or anywhere else. But I’ve got a lot the following, which I welcome:
      2> C:\Program Files (x86)\Windows Kits\8.1\Include\um\processthreadsapi.h(209) : see declaration of ‘CreateThread’
      2> C:\Program Files (x86)\Windows Kits\8.1\Include\um\processthreadsapi.h(408) : see declaration of ‘TlsAlloc’

  3. Hello,

    I would like to integrate some libraries I developed with libcURL into windows 8.1 for store apps.
    Is libcURL supported in windows 8.1 for store apps?.

    Thanks in advance.

  4. Will you release the libcurl libraries for WinRT as well (as stated in the text above)?