Fix UWP builds by defining VirtualLock
authorCharles Milette <charles.milette@gmail.com>
Sat, 14 May 2022 01:42:29 +0000 (21:42 -0400)
committerHugo Landau <hlandau@openssl.org>
Tue, 26 Jul 2022 11:35:40 +0000 (12:35 +0100)
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18311)

crypto/mem_sec.c

index 53acd22c04ba16d1a03ed6cd2b1ac373268ae82d..60559a930ed4b8e7bae598478c7a8347868443f5 100644 (file)
 #ifndef OPENSSL_NO_SECURE_MEMORY
 # if defined(_WIN32)
 #  include <windows.h>
+#  if defined(WINAPI_FAMILY_PARTITION) \
+     && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_SYSTEM)
+/*
+ * While VirtualLock is available under the app partition (e.g. UWP),
+ * the headers do not define the API. Define it ourselves instead.
+ */
+WINBASEAPI
+BOOL
+WINAPI
+VirtualLock(
+    _In_ LPVOID lpAddress,
+    _In_ SIZE_T dwSize
+    );
+#  endif
 # endif
 # include <stdlib.h>
 # include <assert.h>