Remove direct includes of windows.h where possible

It should be included via e_os.h instead.

Reviewed-by: Milan Broz <mbroz@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Simo Sorce <simo@redhat.com>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
MergeDate: Sat Jun 20 11:00:42 2026
(Merged from https://github.com/openssl/openssl/pull/31587)
This commit is contained in:
Tomas Mraz 2026-06-18 15:51:58 +02:00 committed by Neil Horman
parent 695fef3ec3
commit 1eaf29ef6c
16 changed files with 14 additions and 38 deletions

View file

@ -36,8 +36,8 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <windows.h>
#include <tchar.h>
#include "internal/e_os.h"
#include "internal/numbers.h"
#ifndef LPDIR_H
#include "LPdir.h"

View file

@ -19,7 +19,7 @@
#endif
#include "internal/cryptlib.h"
#ifdef _WIN32
#include <windows.h>
#include "internal/e_os.h"
#else
#include <unistd.h>
#endif

View file

@ -12,7 +12,7 @@
#ifdef ASYNC_WIN
#include <windows.h>
#include "internal/e_os.h"
#include "internal/cryptlib.h"
int ASYNC_is_capable(void)

View file

@ -21,6 +21,7 @@
#include <openssl/crypto.h>
#include <openssl/e_os2.h>
#include <internal/e_os.h>
typedef struct async_ctx_st async_ctx;
typedef struct async_pool_st async_pool;
@ -29,7 +30,6 @@ typedef struct async_pool_st async_pool;
#define ASYNC_WIN
#define ASYNC_ARCH
#include <windows.h>
#include "internal/cryptlib.h"
typedef struct async_fibre_st {

View file

@ -13,6 +13,7 @@
#include <stdlib.h>
#include <string.h>
#include <openssl/objects.h>
#include "internal/e_os.h"
#include "internal/comp.h"
#include <openssl/err.h>
#include "crypto/cryptlib.h"
@ -46,10 +47,6 @@ static void brotli_free(void *opaque, void *address)
* work. Therefore, all BROTLI routines are loaded at run time
* and we do not link to a .LIB file when BROTLI_SHARED is set.
*/
#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32)
#include <windows.h>
#endif
#ifdef BROTLI_SHARED
#include "internal/dso.h"

View file

@ -11,6 +11,7 @@
#include <stdlib.h>
#include <string.h>
#include <openssl/objects.h>
#include "internal/e_os.h"
#include "internal/comp.h"
#include <openssl/err.h>
#include "crypto/cryptlib.h"
@ -64,10 +65,6 @@ static COMP_METHOD zlib_stateful_method = {
* work. Therefore, all ZLIB routines are loaded at run time
* and we do not link to a .LIB file when ZLIB_SHARED is set.
*/
#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32)
#include <windows.h>
#endif /* !(OPENSSL_SYS_WINDOWS || \
* OPENSSL_SYS_WIN32) */
#ifdef ZLIB_SHARED
#include "internal/dso.h"

View file

@ -16,6 +16,7 @@
#include <stdlib.h>
#include <string.h>
#include <openssl/objects.h>
#include "internal/e_os.h"
#include "internal/comp.h"
#include <openssl/err.h>
#include "crypto/cryptlib.h"
@ -62,16 +63,6 @@ static ZSTD_customMem zstd_mem_funcs = {
};
#endif
/*
* When OpenSSL is built on Windows, we do not want to require that
* the LIBZSTD.DLL be available in order for the OpenSSL DLLs to
* work. Therefore, all ZSTD routines are loaded at run time
* and we do not link to a .LIB file when ZSTD_SHARED is set.
*/
#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32)
#include <windows.h>
#endif
#ifdef ZSTD_SHARED
#include "internal/dso.h"

View file

@ -23,7 +23,6 @@
#ifndef OPENSSL_NO_SECURE_MEMORY
#if defined(_WIN32)
#include <windows.h>
#if defined(WINAPI_FAMILY_PARTITION)
#if !defined(WINAPI_PARTITION_SYSTEM)
#define WINAPI_PARTITION_SYSTEM 0

View file

@ -12,7 +12,6 @@
#include <openssl/rand.h>
#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32)
#include <windows.h>
#ifndef OPENSSL_NO_DEPRECATED_1_1_0
#define DEPRECATED_RAND_FUNCTIONS_DEFINED

View file

@ -36,7 +36,6 @@
#include <sys/stat.h>
#include <fcntl.h>
#if defined(_WIN32) && !defined(_WIN32_WCE)
#include <windows.h>
#include <io.h>
#define stat _stat
#define chmod _chmod

View file

@ -67,7 +67,6 @@ static void ossl_sleep_millis(uint64_t millis)
#endif
#elif defined(_WIN32) && !defined(OPENSSL_SYS_UEFI)
#include <windows.h>
static void ossl_sleep_millis(uint64_t millis)
{

View file

@ -7,11 +7,11 @@
* https://www.openssl.org/source/license.html
*/
#include <internal/thread_arch.h>
#include "internal/thread_arch.h"
#include "internal/e_os.h"
#if defined(OPENSSL_THREADS_WINNT)
#include <process.h>
#include <windows.h>
static unsigned __stdcall thread_start_thunk(LPVOID vthread)
{

View file

@ -7,14 +7,13 @@
* https://www.openssl.org/source/license.html
*/
#if defined(_WIN32)
#include <windows.h>
#include "internal/e_os.h"
#if defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x600
#define USE_RWLOCK
#endif
#endif
#include <assert.h>
#include <assert.h>
#include <openssl/crypto.h>
#include <crypto/cryptlib.h>
#include "internal/common.h"

View file

@ -60,7 +60,6 @@
#endif
#ifdef WIN_CONSOLE_BUG
#include <windows.h>
#ifndef OPENSSL_SYS_WINCE
#include <wincon.h>
#endif

View file

@ -11,12 +11,9 @@
#define OSSL_INTERNAL_THREAD_ARCH_H
#include <openssl/configuration.h>
#include <openssl/e_os2.h>
#include "internal/e_os.h"
#include "internal/time.h"
#if defined(_WIN32)
#include <windows.h>
#endif
#if defined(OPENSSL_THREADS) && defined(OPENSSL_SYS_UNIX)
#define OPENSSL_THREADS_POSIX
#elif defined(OPENSSL_THREADS) && defined(OPENSSL_SYS_VMS)

View file

@ -7,6 +7,7 @@
* https://www.openssl.org/source/license.html
*/
#include "internal/e_os.h" /* For windows.h */
#include "internal/cryptlib.h"
#include <openssl/rand.h>
#include "crypto/rand_pool.h"
@ -19,7 +20,6 @@
#error "Unsupported seeding method configured; must be os"
#endif
#include <windows.h>
/* On Windows Vista or higher use BCrypt instead of the legacy CryptoAPI */
#if defined(_MSC_VER) && _MSC_VER > 1500 /* 1500 = Visual Studio 2008 */ \
&& defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x0600