---- libgcrypt/random/rndw32.c.orig	2016-05-09 16:48:42.495200068 +0200
-+++ libgcrypt/random/rndw32.c	2016-05-09 16:55:07.423179353 +0200
-@@ -337,6 +337,7 @@
+--- libgcrypt/random/rndw32.c	2015-09-08 08:17:06.000000000 +0200
++++ libgcrypt/random/rndw32.c.winrt	2016-05-24 14:07:35.202767500 +0200
+@@ -96,8 +96,13 @@
+    value in a newer release. So we use a far larger value. */
+ #define SIZEOF_DISK_PERFORMANCE_STRUCT 256
+ 
++#include <winapifamily.h>
++#if (WINAPI_FAMILY == WINAPI_FAMILY_PC_APP || WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP)
++#include <wincrypt.h>
++#else
+ /* We don't include wincrypt.h so define it here.  */
+ #define HCRYPTPROV  HANDLE
++#endif
+ 
+ 
+ /* When we query the performance counters, we allocate an initial buffer and
+@@ -234,7 +239,9 @@ static NTQUERYSYSTEMINFORMATION  pNtQuer
+ static NTQUERYINFORMATIONPROCESS pNtQueryInformationProcess;
+ static NTPOWERINFORMATION        pNtPowerInformation;
+ 
++#if (WINAPI_FAMILY != WINAPI_FAMILY_PC_APP && WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP)
+ static HANDLE hAdvAPI32;
++#endif
+ static CRYPTACQUIRECONTEXT pCryptAcquireContext;
+ static CRYPTGENRANDOM      pCryptGenRandom;
+ static CRYPTRELEASECONTEXT pCryptReleaseContext;
+@@ -259,6 +266,12 @@ init_system_rng (void)
+   system_rng_available = 0;
+   hRNGProv = NULL;
+ 
++#if (WINAPI_FAMILY == WINAPI_FAMILY_PC_APP || WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP)
++    pCryptAcquireContext = CryptAcquireContext;
++    pCryptGenRandom      = CryptGenRandom;
++    pCryptReleaseContext = CryptReleaseContext;
++    pRtlGenRandom        = CryptGenRandom;
++#else
+   hAdvAPI32 = GetModuleHandle ("AdvAPI32.dll");
+   if (!hAdvAPI32)
+     return;
+@@ -274,6 +287,7 @@ init_system_rng (void)
+      This isn't exported by name, so we have to get it by ordinal.  */
+   pRtlGenRandom = (RTLGENRANDOM)
+     GetProcAddress (hAdvAPI32, "SystemFunction036");
++#endif
+ 
+   /* Try and connect to the PIII RNG CSP.  The AMD 768 southbridge (from
+      the 760 MP chipset) also has a hardware RNG, but there doesn't appear
+@@ -286,7 +300,9 @@ init_system_rng (void)
+                                   PROV_INTEL_SEC, 0) )
+        && !pRtlGenRandom)
+     {
++#if (WINAPI_FAMILY != WINAPI_FAMILY_PC_APP && WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP)
+       hAdvAPI32 = NULL;
++#endif
+     }
+   else
+     system_rng_available = 1;
+@@ -312,11 +328,13 @@ read_system_rng (void (*add)(const void*
+       if (pCryptGenRandom (hRNGProv, SYSTEMRNG_BYTES, buffer))
+         quality = 80;
+     }
++#if (WINAPI_FAMILY != WINAPI_FAMILY_PC_APP && WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP)
+   else if (pRtlGenRandom)
+     {
+       if ( pRtlGenRandom (buffer, SYSTEMRNG_BYTES))
+         quality = 50;
+     }
++#endif
+   if (quality > 0)
+     {
+       if (debug_me)
+@@ -337,6 +355,7 @@ read_mbm_data (void (*add)(const void*,
    HANDLE hMBMData;
    SharedData *mbmDataPtr;
  

 }
 
 
@@ -594,6 +596,7 @@
       }
   }
 

 
   /* The performance of QPC varies depending on the architecture it's
      running on and on the OS, the MS documentation is vague about the
