summaryrefslogtreecommitdiffstats
path: root/include/iprt/win
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--include/iprt/win/Makefile.kup0
-rw-r--r--include/iprt/win/audioclient.h59
-rw-r--r--include/iprt/win/commctrl.h61
-rw-r--r--include/iprt/win/context-amd64.mac118
-rw-r--r--include/iprt/win/context-x86.mac101
-rw-r--r--include/iprt/win/credentialprovider.h58
-rw-r--r--include/iprt/win/d3d8.h60
-rw-r--r--include/iprt/win/d3d9.h68
-rw-r--r--include/iprt/win/d3dkmthk.h61
-rw-r--r--include/iprt/win/dbghelp.h61
-rw-r--r--include/iprt/win/dshow.h56
-rw-r--r--include/iprt/win/endpointvolume.h58
-rw-r--r--include/iprt/win/imagehlp.h61
-rw-r--r--include/iprt/win/intsafe.h77
-rw-r--r--include/iprt/win/iphlpapi.h50
-rw-r--r--include/iprt/win/ks.h54
-rw-r--r--include/iprt/win/lazy-dbghelp.h151
-rw-r--r--include/iprt/win/mmreg.h53
-rw-r--r--include/iprt/win/netioapi.h46
-rw-r--r--include/iprt/win/ntdddisk.h50
-rw-r--r--include/iprt/win/ntddndis.h50
-rw-r--r--include/iprt/win/ntverp.h50
-rw-r--r--include/iprt/win/objbase.h69
-rw-r--r--include/iprt/win/objidl.h63
-rw-r--r--include/iprt/win/rpcproxy.h75
-rw-r--r--include/iprt/win/setupapi.h59
-rw-r--r--include/iprt/win/shlobj.h67
-rw-r--r--include/iprt/win/shlwapi.h53
-rw-r--r--include/iprt/win/windef.h65
-rw-r--r--include/iprt/win/windows.h110
-rw-r--r--include/iprt/win/winsock.h64
-rw-r--r--include/iprt/win/winsock2.h74
-rw-r--r--include/iprt/win/ws2tcpip.h67
33 files changed, 2169 insertions, 0 deletions
diff --git a/include/iprt/win/Makefile.kup b/include/iprt/win/Makefile.kup
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/include/iprt/win/Makefile.kup
diff --git a/include/iprt/win/audioclient.h b/include/iprt/win/audioclient.h
new file mode 100644
index 00000000..4fb3fed1
--- /dev/null
+++ b/include/iprt/win/audioclient.h
@@ -0,0 +1,59 @@
+/** @file
+ * Safe way to include audioclient.h.
+ */
+
+/*
+ * Copyright (C) 2021-2022 Oracle and/or its affiliates.
+ *
+ * This file is part of VirtualBox base platform packages, as
+ * available from https://www.virtualbox.org.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, in version 3 of the
+ * License.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <https://www.gnu.org/licenses>.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
+ * in the VirtualBox distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ *
+ * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
+ */
+
+#ifndef IPRT_INCLUDED_win_audioclient_h
+#define IPRT_INCLUDED_win_audioclient_h
+#ifndef RT_WITHOUT_PRAGMA_ONCE
+# pragma once
+#endif
+
+#ifdef _MSC_VER
+# pragma warning(push)
+# pragma warning(disable:4668) /* ks.h(1978): warning C4668: '_WIN64' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif' [SDK 7.1] */
+# if _MSC_VER >= 1900 /*RT_MSC_VER_VC140*/
+# ifdef __cplusplus
+# pragma warning(disable:4091) /* ksmedia.h(4356): warning C4091: 'typedef ': ignored on left of '<unnamed-enum-KSEVENT_DYNAMIC_FORMAT_CHANGE>' when no variable is declared [SDK 7.1] */
+# endif
+# endif
+#endif
+
+#include <audioclient.h>
+
+#ifdef _MSC_VER
+# pragma warning(pop)
+#endif
+
+#endif /* !IPRT_INCLUDED_win_audioclient_h */
+
diff --git a/include/iprt/win/commctrl.h b/include/iprt/win/commctrl.h
new file mode 100644
index 00000000..349bac97
--- /dev/null
+++ b/include/iprt/win/commctrl.h
@@ -0,0 +1,61 @@
+/** @file
+ * Safe way to include commctrl.h.
+ */
+
+/*
+ * Copyright (C) 2016-2022 Oracle and/or its affiliates.
+ *
+ * This file is part of VirtualBox base platform packages, as
+ * available from https://www.virtualbox.org.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, in version 3 of the
+ * License.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <https://www.gnu.org/licenses>.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
+ * in the VirtualBox distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ *
+ * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
+ */
+
+#ifndef IPRT_INCLUDED_win_commctrl_h
+#define IPRT_INCLUDED_win_commctrl_h
+#ifndef RT_WITHOUT_PRAGMA_ONCE
+# pragma once
+#endif
+
+#ifdef _MSC_VER
+# pragma warning(push)
+# if _MSC_VER >= 1900 /*RT_MSC_VER_VC140*/
+# ifdef __cplusplus
+# pragma warning(disable:5039) /* commctrl.h(8323): warning C5039: 'DSA_DestroyCallback': pointer or reference to potentially throwing function passed to 'extern "C"' function under -EHc. Undefined behavior may occur if this function throws an exception. */
+# endif
+# ifdef __cplusplus
+# pragma warning(disable:4668) /* um\prsht.h(130): warning C4668: 'ISOLATION_AWARE_ENABLED' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif' */
+# endif
+# endif
+#endif
+
+#include <commctrl.h>
+
+#ifdef _MSC_VER
+# pragma warning(pop)
+#endif
+
+#endif /* !IPRT_INCLUDED_win_commctrl_h */
+
diff --git a/include/iprt/win/context-amd64.mac b/include/iprt/win/context-amd64.mac
new file mode 100644
index 00000000..5a1ec649
--- /dev/null
+++ b/include/iprt/win/context-amd64.mac
@@ -0,0 +1,118 @@
+;; @file
+; IPRT - Windows - AMD64 CPU Context Record for NASM/YASM.
+;
+
+;
+; Copyright (C) 2022 Oracle and/or its affiliates.
+;
+; This file is part of VirtualBox base platform packages, as
+; available from https://www.virtualbox.org.
+;
+; This program is free software; you can redistribute it and/or
+; modify it under the terms of the GNU General Public License
+; as published by the Free Software Foundation, in version 3 of the
+; License.
+;
+; This program is distributed in the hope that it will be useful, but
+; WITHOUT ANY WARRANTY; without even the implied warranty of
+; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+; General Public License for more details.
+;
+; You should have received a copy of the GNU General Public License
+; along with this program; if not, see <https://www.gnu.org/licenses>.
+;
+; The contents of this file may alternatively be used under the terms
+; of the Common Development and Distribution License Version 1.0
+; (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
+; in the VirtualBox distribution, in which case the provisions of the
+; CDDL are applicable instead of those of the GPL.
+;
+; You may elect to license modified versions of this file under the
+; terms and conditions of either the GPL or the CDDL or both.
+;
+; SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
+;
+
+%ifndef ___iprt_win_context_amd64_mac
+%define ___iprt_win_context_amd64_mac
+
+%include "iprt/asmdefs.mac"
+
+struc CONTEXT
+ .P1Home resq 1
+ .P2Home resq 1
+ .P3Home resq 1
+ .P4Home resq 1
+ .P5Home resq 1
+ .P6Home resq 1
+
+ .ContextFlags resd 1
+ .MxCsr resd 1
+
+ .SegCs resw 1 ; CONTEXT_CONTROL
+ .SegDs resw 1
+ .SegEs resw 1
+ .SegFs resw 1
+ .SegGs resw 1
+ .SegSs resw 1 ; CONTEXT_CONTROL
+ .EFlags resd 1 ; CONTEXT_CONTROL
+
+ .Dr0 resq 1 ; CONTEXT_DEBUG_REGISTERS
+ .Dr1 resq 1 ; CONTEXT_DEBUG_REGISTERS
+ .Dr2 resq 1 ; CONTEXT_DEBUG_REGISTERS
+ .Dr3 resq 1 ; CONTEXT_DEBUG_REGISTERS
+ .Dr6 resq 1 ; CONTEXT_DEBUG_REGISTERS
+ .Dr7 resq 1 ; CONTEXT_DEBUG_REGISTERS
+
+ .Rax resq 1 ; CONTEXT_INTEGER
+ .Rcx resq 1 ; CONTEXT_INTEGER
+ .Rdx resq 1 ; CONTEXT_INTEGER
+ .Rbx resq 1 ; CONTEXT_INTEGER
+ .Rsp resq 1 ; CONTEXT_CONTROL
+ .Rbp resq 1 ; CONTEXT_INTEGER
+ .Rsi resq 1 ; CONTEXT_INTEGER
+ .Rdi resq 1 ; CONTEXT_INTEGER
+ .R8 resq 1 ; CONTEXT_INTEGER
+ .R9 resq 1 ; CONTEXT_INTEGER
+ .R10 resq 1 ; CONTEXT_INTEGER
+ .R11 resq 1 ; CONTEXT_INTEGER
+ .R12 resq 1 ; CONTEXT_INTEGER
+ .R13 resq 1 ; CONTEXT_INTEGER
+ .R14 resq 1 ; CONTEXT_INTEGER
+ .R15 resq 1 ; CONTEXT_INTEGER
+
+ .Rip resq 1 ; CONTEXT_CONTROL
+
+ .FltSave resb 512 ; X86FXSTATE - CONTEXT_FLOATING_POINT = Xmm0-Xmm15
+
+ .VectorRegisters resb (26 * 16)
+ .VectorControl resq 1
+
+ .DebugControl resq 1
+ .LastBranchToRip resq 1
+ .LastBranchFromRip resq 1
+ .LastExceptionToRip resq 1
+ .LastExceptionFromRip resq 1
+endstruc
+%define CONTEXT_SIZE (0x4d0)
+AssertCompileSize(CONTEXT, CONTEXT_SIZE)
+
+%define CONTEXT_AMD64 (0x00100000)
+%define CONTEXT_CONTROL (0x00000001 | CONTEXT_AMD64)
+%define CONTEXT_INTEGER (0x00000002 | CONTEXT_AMD64)
+%define CONTEXT_SEGMENTS (0x00000004 | CONTEXT_AMD64)
+%define CONTEXT_FLOATING_POINT (0x00000008 | CONTEXT_AMD64)
+%define CONTEXT_DEBUG_REGISTERS (0x00000010 | CONTEXT_AMD64)
+%define CONTEXT_FULL (0x0000000b | CONTEXT_AMD64)
+%define CONTEXT_ALL (0x0000001f | CONTEXT_AMD64)
+
+%define CONTEXT_XSTATE (0x00000040 | CONTEXT_AMD64)
+%define CONTEXT_KERNEL_CET (0x00000080 | CONTEXT_AMD64)
+%define CONTEXT_EXCEPTION_ACTIVE (0x08000000)
+%define CONTEXT_SERVICE_ACTIVE (0x10000000)
+%define CONTEXT_UNWOUND_TO_CALL (0x20000000)
+%define CONTEXT_EXCEPTION_REQUEST (0x40000000)
+%define CONTEXT_EXCEPTION_REPORTING (0x80000000)
+
+%endif
+
diff --git a/include/iprt/win/context-x86.mac b/include/iprt/win/context-x86.mac
new file mode 100644
index 00000000..1f126295
--- /dev/null
+++ b/include/iprt/win/context-x86.mac
@@ -0,0 +1,101 @@
+;; @file
+; IPRT - Windows - X86 CPU Context Record for NASM/YASM.
+;
+
+;
+; Copyright (C) 2022 Oracle and/or its affiliates.
+;
+; This file is part of VirtualBox base platform packages, as
+; available from https://www.virtualbox.org.
+;
+; This program is free software; you can redistribute it and/or
+; modify it under the terms of the GNU General Public License
+; as published by the Free Software Foundation, in version 3 of the
+; License.
+;
+; This program is distributed in the hope that it will be useful, but
+; WITHOUT ANY WARRANTY; without even the implied warranty of
+; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+; General Public License for more details.
+;
+; You should have received a copy of the GNU General Public License
+; along with this program; if not, see <https://www.gnu.org/licenses>.
+;
+; The contents of this file may alternatively be used under the terms
+; of the Common Development and Distribution License Version 1.0
+; (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
+; in the VirtualBox distribution, in which case the provisions of the
+; CDDL are applicable instead of those of the GPL.
+;
+; You may elect to license modified versions of this file under the
+; terms and conditions of either the GPL or the CDDL or both.
+;
+; SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
+;
+
+%ifndef ___iprt_win_context_x86_mac
+%define ___iprt_win_context_x86_mac
+
+%include "iprt/asmdefs.mac"
+
+struc CONTEXT
+ .ContextFlags resd 1
+
+ ; CONTEXT_DEBUG_REGISTERS:
+ .Dr0 resd 1
+ .Dr1 resd 1
+ .Dr2 resd 1
+ .Dr3 resd 1
+ .Dr6 resd 1
+ .Dr7 resd 1
+
+ ; CONTEXT_FLOATING_POINT:
+ .FloatSave resb 112 ; X86FPUSTATE + 4 bytes
+
+ ; CONTEXT_SEGMENTS:
+ .SegGs resd 1
+ .SegFs resd 1
+ .SegEs resd 1
+ .SegDs resd 1
+
+ ; CONTEXT_INTEGER:
+ .Edi resd 1
+ .Esi resd 1
+ .Ebx resd 1
+ .Edx resd 1
+ .Ecx resd 1
+ .Eax resd 1
+
+ ; CONTEXT_CONTROL:
+ .Ebp resd 1
+ .Eip resd 1
+ .SegCs resd 1
+ .EFlags resd 1
+ .Esp resd 1
+ .SegSs resd 1
+
+ ; CONTEXT_EXTENDED_REGISTERS:
+ .ExtendedRegisters resb 512
+endstruc
+%define CONTEXT_SIZE (0x2cc)
+AssertCompileSize(CONTEXT, CONTEXT_SIZE)
+
+%define CONTEXT_i386 (0x00010000)
+%define CONTEXT_CONTROL (0x00000001 | CONTEXT_i386)
+%define CONTEXT_INTEGER (0x00000002 | CONTEXT_i386)
+%define CONTEXT_SEGMENTS (0x00000004 | CONTEXT_i386)
+%define CONTEXT_FLOATING_POINT (0x00000008 | CONTEXT_i386)
+%define CONTEXT_DEBUG_REGISTERS (0x00000010 | CONTEXT_i386)
+%define CONTEXT_EXTENDED_REGISTERS (0x00000020 | CONTEXT_i386)
+%define CONTEXT_FULL (0x00000007 | CONTEXT_i386)
+%define CONTEXT_ALL (0x0000003f | CONTEXT_i386)
+
+%define CONTEXT_XSTATE (0x00000040 | CONTEXT_i386)
+%define CONTEXT_EXCEPTION_ACTIVE (0x08000000)
+%define CONTEXT_SERVICE_ACTIVE (0x10000000)
+; 0x20000000 = CONTEXT_UNWOUND_TO_CALL ?
+%define CONTEXT_EXCEPTION_REQUEST (0x40000000)
+%define CONTEXT_EXCEPTION_REPORTING (0x80000000)
+
+%endif
+
diff --git a/include/iprt/win/credentialprovider.h b/include/iprt/win/credentialprovider.h
new file mode 100644
index 00000000..2d71cb6f
--- /dev/null
+++ b/include/iprt/win/credentialprovider.h
@@ -0,0 +1,58 @@
+/** @file
+ * Safe way to include credentialprovider.h.
+ */
+
+/*
+ * Copyright (C) 2016-2022 Oracle and/or its affiliates.
+ *
+ * This file is part of VirtualBox base platform packages, as
+ * available from https://www.virtualbox.org.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, in version 3 of the
+ * License.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <https://www.gnu.org/licenses>.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
+ * in the VirtualBox distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ *
+ * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
+ */
+
+#ifndef IPRT_INCLUDED_win_credentialprovider_h
+#define IPRT_INCLUDED_win_credentialprovider_h
+#ifndef RT_WITHOUT_PRAGMA_ONCE
+# pragma once
+#endif
+
+#ifdef _MSC_VER
+# pragma warning(push)
+# if _MSC_VER >= 1900 /*RT_MSC_VER_VC140*/
+# ifdef __cplusplus
+# pragma warning(disable:5039) /* commctrl.h(8323): warning C5039: 'DSA_DestroyCallback': pointer or reference to potentially throwing function passed to 'extern "C"' function under -EHc. Undefined behavior may occur if this function throws an exception. */
+# endif
+# endif
+#endif
+
+#include <credentialprovider.h>
+
+#ifdef _MSC_VER
+# pragma warning(pop)
+#endif
+
+#endif /* !IPRT_INCLUDED_win_credentialprovider_h */
+
diff --git a/include/iprt/win/d3d8.h b/include/iprt/win/d3d8.h
new file mode 100644
index 00000000..14f1c4ed
--- /dev/null
+++ b/include/iprt/win/d3d8.h
@@ -0,0 +1,60 @@
+/** @file
+ * Safe way to include d3d8.h.
+ */
+
+/*
+ * Copyright (C) 2016-2022 Oracle and/or its affiliates.
+ *
+ * This file is part of VirtualBox base platform packages, as
+ * available from https://www.virtualbox.org.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, in version 3 of the
+ * License.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <https://www.gnu.org/licenses>.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
+ * in the VirtualBox distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ *
+ * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
+ */
+
+#ifndef IPRT_INCLUDED_win_d3d8_h
+#define IPRT_INCLUDED_win_d3d8_h
+#ifndef RT_WITHOUT_PRAGMA_ONCE
+# pragma once
+#endif
+
+#ifdef _MSC_VER
+# pragma warning(push)
+/*# pragma warning(disable:4163)*/
+# pragma warning(disable:4668) /* warning C4668: 'WHEA_DOWNLEVEL_TYPE_NAMES' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif' */
+# pragma warning(disable:4255) /* warning C4255: 'ObGetFilterVersion' : no function prototype given: converting '()' to '(void)' */
+# if _MSC_VER >= 1800 /*RT_MSC_VER_VC120*/
+# pragma warning(disable:4005) /* sdk/v7.1/include/sal_supp.h(57) : warning C4005: '__useHeader' : macro redefinition */
+# endif
+#endif
+
+#include <d3d8.h>
+
+#ifdef _MSC_VER
+# pragma warning(pop)
+#endif
+
+
+#endif /* !IPRT_INCLUDED_win_d3d8_h */
+
diff --git a/include/iprt/win/d3d9.h b/include/iprt/win/d3d9.h
new file mode 100644
index 00000000..52c02c53
--- /dev/null
+++ b/include/iprt/win/d3d9.h
@@ -0,0 +1,68 @@
+/** @file
+ * Safe way to include d3d9.h.
+ */
+
+/*
+ * Copyright (C) 2016-2022 Oracle and/or its affiliates.
+ *
+ * This file is part of VirtualBox base platform packages, as
+ * available from https://www.virtualbox.org.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, in version 3 of the
+ * License.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <https://www.gnu.org/licenses>.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
+ * in the VirtualBox distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ *
+ * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
+ */
+
+#ifndef IPRT_INCLUDED_win_d3d9_h
+#define IPRT_INCLUDED_win_d3d9_h
+#ifndef RT_WITHOUT_PRAGMA_ONCE
+# pragma once
+#endif
+
+/* d3d9.h includes windows.h (via objbase.h -> rpc.h), so do it up front using
+ our wrappers to avoid needing to duplicate warning workarounds for it. */
+#include <iprt/win/windows.h>
+
+#ifdef _MSC_VER
+# pragma warning(push)
+/*# pragma warning(disable:4163)*/
+# pragma warning(disable:4668) /* warning C4668: 'WHEA_DOWNLEVEL_TYPE_NAMES' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif' */
+# pragma warning(disable:4255) /* warning C4255: 'ObGetFilterVersion' : no function prototype given: converting '()' to '(void)' */
+# if _MSC_VER >= 1800 /*RT_MSC_VER_VC120*/
+# pragma warning(disable:4005) /* sdk/v7.1/include/sal_supp.h(57) : warning C4005: '__useHeader' : macro redefinition */
+# endif
+# ifdef __cplusplus
+# if _MSC_VER >= 1900 /*RT_MSC_VER_VC140*/
+# pragma warning(disable:5039) /* winbase.h(13179): warning C5039: 'TpSetCallbackCleanupGroup': pointer or reference to potentially throwing function passed to 'extern "C"' function under -EHc. Undefined behavior may occur if this function throws an exception. */
+# endif
+# endif
+#endif
+
+#include <d3d9.h>
+
+#ifdef _MSC_VER
+# pragma warning(pop)
+#endif
+
+#endif /* !IPRT_INCLUDED_win_d3d9_h */
+
diff --git a/include/iprt/win/d3dkmthk.h b/include/iprt/win/d3dkmthk.h
new file mode 100644
index 00000000..af8fa34f
--- /dev/null
+++ b/include/iprt/win/d3dkmthk.h
@@ -0,0 +1,61 @@
+/** @file
+ * Safe way to include d3dkmthk.h.
+ */
+
+/*
+ * Copyright (C) 2016-2022 Oracle and/or its affiliates.
+ *
+ * This file is part of VirtualBox base platform packages, as
+ * available from https://www.virtualbox.org.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, in version 3 of the
+ * License.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <https://www.gnu.org/licenses>.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
+ * in the VirtualBox distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ *
+ * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
+ */
+
+#ifndef IPRT_INCLUDED_win_d3dkmthk_h
+#define IPRT_INCLUDED_win_d3dkmthk_h
+#ifndef RT_WITHOUT_PRAGMA_ONCE
+# pragma once
+#endif
+
+#ifdef _MSC_VER
+# pragma warning(push)
+# if _MSC_VER >= 1900 /*RT_MSC_VER_VC140*/
+# pragma warning(disable:4255) /* d3dkmthk.h(2061): warning C4255: 'PFND3DKMT_CHECKEXCLUSIVEOWNERSHIP': no function prototype given: converting '()' to '(void)' */
+# endif
+#endif
+
+/* 10.0.22000.0 SDK: */
+#define DXGKDDI_INTERFACE_VERSION_WDDM_1_3 DXGKDDI_INTERFACE_VERSION_WDDM1_3
+#define DXGKDDI_INTERFACE_VERSION_WDDM_2_0 DXGKDDI_INTERFACE_VERSION_WDDM2_0
+#define DXGKDDI_INTERFACE_VERSION_WDDM1_3_M1 DXGKDDI_INTERFACE_VERSION_WDDM1_3
+
+#include <d3dkmthk.h>
+
+#ifdef _MSC_VER
+# pragma warning(pop)
+#endif
+
+#endif /* !IPRT_INCLUDED_win_d3dkmthk_h */
+
diff --git a/include/iprt/win/dbghelp.h b/include/iprt/win/dbghelp.h
new file mode 100644
index 00000000..00d50b32
--- /dev/null
+++ b/include/iprt/win/dbghelp.h
@@ -0,0 +1,61 @@
+/** @file
+ * Safe way to include Dbghelp.h.
+ */
+
+/*
+ * Copyright (C) 2020-2022 Oracle and/or its affiliates.
+ *
+ * This file is part of VirtualBox base platform packages, as
+ * available from https://www.virtualbox.org.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, in version 3 of the
+ * License.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <https://www.gnu.org/licenses>.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
+ * in the VirtualBox distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ *
+ * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
+ */
+
+#ifndef IPRT_INCLUDED_win_dbghelp_h
+#define IPRT_INCLUDED_win_dbghelp_h
+#ifndef RT_WITHOUT_PRAGMA_ONCE
+# pragma once
+#endif
+
+#ifdef _MSC_VER
+/*
+ * Unfortunately, the Windows.h file in SDK 7.1 is not clean wrt warning C4091 with VCC140+:
+ * Dbghelp.h(1540): warning C4091: 'typedef ': ignored on left of '<unnamed-enum-hdBase>' when no variable is declared
+ * Dbghelp.h(3056): warning C4091: 'typedef ': ignored on left of '<unnamed-enum-sfImage>' when no variable is declared
+ */
+# pragma warning(push)
+# if _MSC_VER >= 1900 /*RT_MSC_VER_VC140*/
+# pragma warning(disable:4091)
+# endif
+#endif
+
+#include <Dbghelp.h>
+
+#ifdef _MSC_VER
+# pragma warning(pop)
+#endif
+
+#endif /* !IPRT_INCLUDED_win_dbghelp_h */
+
diff --git a/include/iprt/win/dshow.h b/include/iprt/win/dshow.h
new file mode 100644
index 00000000..eab1fdce
--- /dev/null
+++ b/include/iprt/win/dshow.h
@@ -0,0 +1,56 @@
+/** @file
+ * Safe way to include dshow.h.
+ */
+
+/*
+ * Copyright (C) 2016-2022 Oracle and/or its affiliates.
+ *
+ * This file is part of VirtualBox base platform packages, as
+ * available from https://www.virtualbox.org.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, in version 3 of the
+ * License.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <https://www.gnu.org/licenses>.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
+ * in the VirtualBox distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ *
+ * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
+ */
+
+#ifndef IPRT_INCLUDED_win_dshow_h
+#define IPRT_INCLUDED_win_dshow_h
+#ifndef RT_WITHOUT_PRAGMA_ONCE
+# pragma once
+#endif
+
+#ifdef _MSC_VER
+# pragma warning(push)
+# if _MSC_VER >= 1920 /*RT_MSC_VER_VC142*/
+# pragma warning(disable:5204) /* strmif.h(16270): warning C5204: 'IAMFilterGraphCallback': class has virtual functions, but its trivial destructor is not virtual; instances of objects derived from this class may not be destructed correctly */
+# endif
+#endif
+
+#include <dshow.h>
+
+#ifdef _MSC_VER
+# pragma warning(pop)
+#endif
+
+#endif /* !IPRT_INCLUDED_win_dshow_h */
+
diff --git a/include/iprt/win/endpointvolume.h b/include/iprt/win/endpointvolume.h
new file mode 100644
index 00000000..ec9cced5
--- /dev/null
+++ b/include/iprt/win/endpointvolume.h
@@ -0,0 +1,58 @@
+/** @file
+ * Safe way to include endpointvolume.h.
+ */
+
+/*
+ * Copyright (C) 2016-2022 Oracle and/or its affiliates.
+ *
+ * This file is part of VirtualBox base platform packages, as
+ * available from https://www.virtualbox.org.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, in version 3 of the
+ * License.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <https://www.gnu.org/licenses>.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
+ * in the VirtualBox distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ *
+ * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
+ */
+
+#ifndef IPRT_INCLUDED_win_endpointvolume_h
+#define IPRT_INCLUDED_win_endpointvolume_h
+#ifndef RT_WITHOUT_PRAGMA_ONCE
+# pragma once
+#endif
+
+#ifdef _MSC_VER
+# pragma warning(push)
+# pragma warning(disable:4201)
+# pragma warning(disable:4668) /* ks.h(1978): warning C4668: '_WIN64' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif' [SDK 7.1] */
+# if _MSC_VER >= 1900 /*RT_MSC_VER_VC140*/
+# pragma warning(disable: 4091) /* v7.1\include\ksmedia.h(4356): warning C4091: 'typedef ': ignored on left of '<unnamed-enum-KSEVENT_DYNAMIC_FORMAT_CHANGE>' when no variable is declared */
+# endif
+#endif
+
+#include <endpointvolume.h>
+
+#ifdef _MSC_VER
+# pragma warning(pop)
+#endif
+
+#endif /* !IPRT_INCLUDED_win_endpointvolume_h */
+
diff --git a/include/iprt/win/imagehlp.h b/include/iprt/win/imagehlp.h
new file mode 100644
index 00000000..138bdd3b
--- /dev/null
+++ b/include/iprt/win/imagehlp.h
@@ -0,0 +1,61 @@
+/** @file
+ * Safe way to include ImageHlp.h.
+ */
+
+/*
+ * Copyright (C) 2020-2022 Oracle and/or its affiliates.
+ *
+ * This file is part of VirtualBox base platform packages, as
+ * available from https://www.virtualbox.org.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, in version 3 of the
+ * License.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <https://www.gnu.org/licenses>.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
+ * in the VirtualBox distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ *
+ * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
+ */
+
+#ifndef IPRT_INCLUDED_win_imagehlp_h
+#define IPRT_INCLUDED_win_imagehlp_h
+#ifndef RT_WITHOUT_PRAGMA_ONCE
+# pragma once
+#endif
+
+#ifdef _MSC_VER
+/*
+ * Unfortunately, the ImageHlp.h file in SDK 7.1 is not clean wrt warning C4091 with VCC141:
+ * ImageHlp.h(1869): warning C4091: 'typedef ': ignored on left of '<unnamed-enum-hdBase>' when no variable is declared
+ * ImageHlp.h(3385): warning C4091: 'typedef ': ignored on left of '<unnamed-enum-sfImage>' when no variable is declared
+ */
+# pragma warning(push)
+# if _MSC_VER >= 1900 /*RT_MSC_VER_VC140*/
+# pragma warning(disable:4091)
+# endif
+#endif
+
+#include <ImageHlp.h>
+
+#ifdef _MSC_VER
+# pragma warning(pop)
+#endif
+
+#endif /* !IPRT_INCLUDED_win_imagehlp_h */
+
diff --git a/include/iprt/win/intsafe.h b/include/iprt/win/intsafe.h
new file mode 100644
index 00000000..182b93de
--- /dev/null
+++ b/include/iprt/win/intsafe.h
@@ -0,0 +1,77 @@
+/** @file
+ * Safe way to include intsafe.h.
+ */
+
+/*
+ * Copyright (C) 2016-2022 Oracle and/or its affiliates.
+ *
+ * This file is part of VirtualBox base platform packages, as
+ * available from https://www.virtualbox.org.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, in version 3 of the
+ * License.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <https://www.gnu.org/licenses>.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
+ * in the VirtualBox distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ *
+ * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
+ */
+
+#ifndef IPRT_INCLUDED_win_intsafe_h
+#define IPRT_INCLUDED_win_intsafe_h
+#ifndef RT_WITHOUT_PRAGMA_ONCE
+# pragma once
+#endif
+
+/* There's a conflict between the Visual C++ 2010 stdint.h and wDK 7.1 intsafe.h
+ that we must to mediate here. Current approach is to use the stuff from
+ intsafe.h rather than the other. */
+#ifndef _INTSAFE_H_INCLUDED_
+# include <iprt/stdint.h>
+# undef INT8_MIN
+# undef INT16_MIN
+# undef INT32_MIN
+# undef INT8_MAX
+# undef INT16_MAX
+# undef INT32_MAX
+# undef UINT8_MAX
+# undef UINT16_MAX
+# undef UINT32_MAX
+# undef INT64_MIN
+# undef INT64_MAX
+# undef UINT64_MAX
+
+# ifdef _MSC_VER
+# pragma warning(push)
+# pragma warning(disable:4668) /* intsafe.h(55) : warning C4668: '__midl' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif' */
+# if _MSC_VER >= 1800 /*RT_MSC_VER_VC120*/
+# pragma warning(disable:4005) /* sdk/v7.1/include/sal_supp.h(57) : warning C4005: '__useHeader' : macro redefinition */
+# endif
+# endif
+
+# include <intsafe.h>
+
+# ifdef _MSC_VER
+# pragma warning(pop)
+# endif
+
+#endif /* !_INTSAFE_H_INCLUDED_ */
+
+#endif /* !IPRT_INCLUDED_win_intsafe_h */
+
diff --git a/include/iprt/win/iphlpapi.h b/include/iprt/win/iphlpapi.h
new file mode 100644
index 00000000..d823e1ac
--- /dev/null
+++ b/include/iprt/win/iphlpapi.h
@@ -0,0 +1,50 @@
+/** @file
+ * Safe way to include iphlpapi.h.
+ */
+
+/*
+ * Copyright (C) 2016-2022 Oracle and/or its affiliates.
+ *
+ * This file is part of VirtualBox base platform packages, as
+ * available from https://www.virtualbox.org.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, in version 3 of the
+ * License.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <https://www.gnu.org/licenses>.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
+ * in the VirtualBox distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ *
+ * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
+ */
+
+#ifndef IPRT_INCLUDED_win_iphlpapi_h
+#define IPRT_INCLUDED_win_iphlpapi_h
+#ifndef RT_WITHOUT_PRAGMA_ONCE
+# pragma once
+#endif
+
+#pragma warning(push)
+#pragma warning(disable:4668) /* 'NDIS_SUPPORT_NDIS6' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif' */
+
+#include <iphlpapi.h>
+
+#pragma warning(pop)
+
+#endif /* !IPRT_INCLUDED_win_iphlpapi_h */
+
diff --git a/include/iprt/win/ks.h b/include/iprt/win/ks.h
new file mode 100644
index 00000000..6febf26c
--- /dev/null
+++ b/include/iprt/win/ks.h
@@ -0,0 +1,54 @@
+/** @file
+ * Safe way to include ks.h.
+ */
+
+/*
+ * Copyright (C) 2016-2022 Oracle and/or its affiliates.
+ *
+ * This file is part of VirtualBox base platform packages, as
+ * available from https://www.virtualbox.org.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, in version 3 of the
+ * License.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <https://www.gnu.org/licenses>.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
+ * in the VirtualBox distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ *
+ * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
+ */
+
+#ifndef IPRT_INCLUDED_win_ks_h
+#define IPRT_INCLUDED_win_ks_h
+#ifndef RT_WITHOUT_PRAGMA_ONCE
+# pragma once
+#endif
+
+#ifdef _MSC_VER
+# pragma warning(push)
+# pragma warning(disable:4668) /* C4668: '_WIN64' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif' */
+#endif
+
+#include <ks.h>
+
+#ifdef _MSC_VER
+# pragma warning(pop)
+#endif
+
+#endif /* !IPRT_INCLUDED_win_ks_h */
+
diff --git a/include/iprt/win/lazy-dbghelp.h b/include/iprt/win/lazy-dbghelp.h
new file mode 100644
index 00000000..a6924bb1
--- /dev/null
+++ b/include/iprt/win/lazy-dbghelp.h
@@ -0,0 +1,151 @@
+/** @file
+ * Symbols from dbghelp.dll, allowing us to select which one to load.
+ */
+
+/*
+ * Copyright (C) 2013-2022 Oracle and/or its affiliates.
+ *
+ * This file is part of VirtualBox base platform packages, as
+ * available from https://www.virtualbox.org.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, in version 3 of the
+ * License.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <https://www.gnu.org/licenses>.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
+ * in the VirtualBox distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ *
+ * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
+ */
+
+#ifndef IPRT_INCLUDED_win_lazy_dbghelp_h
+#define IPRT_INCLUDED_win_lazy_dbghelp_h
+#ifndef RT_WITHOUT_PRAGMA_ONCE
+# pragma once
+#endif
+
+#include <iprt/ldrlazy.h>
+#include <iprt/path.h>
+#include <iprt/env.h>
+#include <iprt/errcore.h>
+
+
+/**
+ * Custom loader callback.
+ * @returns Module handle or NIL_RTLDRMOD.
+ */
+static int rtLdrLazyLoadDbgHelp(const char *pszFile, PRTLDRMOD phMod)
+{
+ static const struct
+ {
+ const char *pszEnv;
+ const char *pszSubDir;
+ } s_aLocations[] =
+ {
+#ifdef RT_ARCH_AMD64
+ { "ProgramFiles(x86)", "Windows Kits\\8.1\\Debuggers\\x64\\dbghelp.dll" },
+ { "ProgramFiles(x86)", "Windows Kits\\8.0\\Debuggers\\x64\\dbghelp.dll" },
+ { "ProgramFiles", "Debugging Tools for Windows (x64)\\dbghelp.dll" },
+#else
+ { "ProgramFiles", "Windows Kits\\8.1\\Debuggers\\x86\\dbghelp.dll" },
+ { "ProgramFiles", "Windows Kits\\8.0\\Debuggers\\x86\\dbghelp.dll" },
+ { "ProgramFiles", "Debugging Tools for Windows (x86)\\dbghelp.dll" },
+#endif /** @todo More places we should look? */
+ };
+ uint32_t i;
+ for (i = 0; i < RT_ELEMENTS(s_aLocations); i++)
+ {
+ char szPath[RTPATH_MAX];
+ size_t cchPath;
+ int rc = RTEnvGetEx(RTENV_DEFAULT, s_aLocations[i].pszEnv, szPath, sizeof(szPath), &cchPath);
+ if (RT_SUCCESS(rc))
+ {
+ rc = RTPathAppend(szPath, sizeof(szPath), s_aLocations[i].pszSubDir);
+ if (RT_SUCCESS(rc))
+ {
+ rc = RTLdrLoad(szPath, phMod);
+ if (RT_SUCCESS(rc))
+ return rc;
+ }
+ }
+ }
+
+ /* Fall back on the system one, if present. */
+ return RTLdrLoadSystem(pszFile, true /*fNoUnload*/, phMod);
+}
+
+RTLDRLAZY_MODULE_EX(dbghelp, "dbghelp.dll", rtLdrLazyLoadDbgHelp);
+
+RTLDRLAZY_FUNC(dbghelp, BOOL, WINAPI, SymInitialize, (HANDLE a1, PCWSTR a2, BOOL a3), (a1, a2, a3), FALSE);
+#undef SymInitialize
+#define SymInitialize RTLDRLAZY_FUNC_NAME(dbghelp, SymInitialize)
+
+RTLDRLAZY_FUNC(dbghelp, BOOL, WINAPI, SymCleanup, (HANDLE a1), (a1), FALSE);
+#undef SymCleanup
+#define SymCleanup RTLDRLAZY_FUNC_NAME(dbghelp, SymCleanup)
+
+RTLDRLAZY_FUNC(dbghelp, DWORD, WINAPI, SymGetOptions, (VOID), (), 0);
+#undef SymGetOptions
+#define SymGetOptions RTLDRLAZY_FUNC_NAME(dbghelp, SymGetOptions)
+
+RTLDRLAZY_FUNC(dbghelp, DWORD, WINAPI, SymSetOptions, (DWORD a1), (a1), 0);
+#undef SymSetOptions
+#define SymSetOptions RTLDRLAZY_FUNC_NAME(dbghelp, SymSetOptions)
+
+RTLDRLAZY_FUNC(dbghelp, BOOL, WINAPI, SymRegisterCallback64, (HANDLE a1, PSYMBOL_REGISTERED_CALLBACK64 a2, ULONG64 a3),
+ (a1, a2, a3), FALSE);
+#undef SymRegisterCallback64
+#define SymRegisterCallback64 RTLDRLAZY_FUNC_NAME(dbghelp, SymRegisterCallback64)
+
+RTLDRLAZY_FUNC(dbghelp, DWORD64, WINAPI, SymLoadModuleEx,
+ (HANDLE a1, HANDLE a2, PCSTR a3, PCSTR a4, DWORD64 a5, DWORD a6, PMODLOAD_DATA a7, DWORD a8),
+ (a1, a2, a3, a4, a5, a6, a7, a8), 0);
+#undef SymLoadModuleEx
+#define SymLoadModuleEx RTLDRLAZY_FUNC_NAME(dbghelp, SymLoadModuleEx)
+
+RTLDRLAZY_FUNC(dbghelp, DWORD64, WINAPI, SymLoadModuleExW,
+ (HANDLE a1, HANDLE a2, PCWSTR a3, PCWSTR a4, DWORD64 a5, DWORD a6, PMODLOAD_DATA a7, DWORD a8),
+ (a1, a2, a3, a4, a5, a6, a7, a8), 0);
+#undef SymLoadModuleExW
+#define SymLoadModuleExW RTLDRLAZY_FUNC_NAME(dbghelp, SymLoadModuleExW)
+
+RTLDRLAZY_FUNC(dbghelp, DWORD64, WINAPI, SymUnloadModule64, (HANDLE a1, DWORD64 a2), (a1, a2), 0);
+#undef SymUnloadModule64
+#define SymUnloadModule64 RTLDRLAZY_FUNC_NAME(dbghelp, SymUnloadModule64)
+
+RTLDRLAZY_FUNC(dbghelp, BOOL, WINAPI, SymEnumSymbols,
+ (HANDLE a1, ULONG64 a2, PCSTR a3, PSYM_ENUMERATESYMBOLS_CALLBACK a4, PVOID a5),
+ (a1, a2, a3, a4, a5), FALSE);
+#undef SymEnumSymbols
+#define SymEnumSymbols RTLDRLAZY_FUNC_NAME(dbghelp, SymEnumSymbols)
+
+RTLDRLAZY_FUNC(dbghelp, BOOL, WINAPI, SymEnumLinesW,
+ (HANDLE a1, ULONG64 a2, PCWSTR a3, PCWSTR a4, PSYM_ENUMLINES_CALLBACKW a5, PVOID a6),
+ (a1, a2, a3, a4, a5, a6), FALSE);
+#undef SymEnumLinesW
+#define SymEnumLinesW RTLDRLAZY_FUNC_NAME(dbghelp, SymEnumLinesW)
+
+RTLDRLAZY_FUNC(dbghelp, BOOL, WINAPI, SymGetModuleInfo64, (HANDLE a1, DWORD64 a2, PIMAGEHLP_MODULE64 a3), (a1, a2, a3), FALSE);
+#undef SymGetModuleInfo64
+#define SymGetModuleInfo64 RTLDRLAZY_FUNC_NAME(dbghelp, SymGetModuleInfo64)
+
+
+
+
+#endif /* !IPRT_INCLUDED_win_lazy_dbghelp_h */
+
diff --git a/include/iprt/win/mmreg.h b/include/iprt/win/mmreg.h
new file mode 100644
index 00000000..8be69c7c
--- /dev/null
+++ b/include/iprt/win/mmreg.h
@@ -0,0 +1,53 @@
+/** @file
+ * Safe way to include mmreg.h.
+ */
+
+/*
+ * Copyright (C) 2016-2022 Oracle and/or its affiliates.
+ *
+ * This file is part of VirtualBox base platform packages, as
+ * available from https://www.virtualbox.org.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, in version 3 of the
+ * License.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <https://www.gnu.org/licenses>.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
+ * in the VirtualBox distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ *
+ * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
+ */
+
+#ifndef IPRT_INCLUDED_win_mmreg_h
+#define IPRT_INCLUDED_win_mmreg_h
+#ifndef RT_WITHOUT_PRAGMA_ONCE
+# pragma once
+#endif
+
+#ifdef _MSC_VER
+# pragma warning(push) /* Looks like this header messes with warning config, at least in the 7.1 SDK. */
+#endif
+
+#include <mmreg.h>
+
+#ifdef _MSC_VER
+# pragma warning(pop)
+#endif
+
+#endif /* !IPRT_INCLUDED_win_mmreg_h */
+
diff --git a/include/iprt/win/netioapi.h b/include/iprt/win/netioapi.h
new file mode 100644
index 00000000..5abf1bac
--- /dev/null
+++ b/include/iprt/win/netioapi.h
@@ -0,0 +1,46 @@
+/** @file
+ * Safe way to include netioapi.h.
+ */
+
+/*
+ * Copyright (C) 2016-2022 Oracle and/or its affiliates.
+ *
+ * This file is part of VirtualBox base platform packages, as
+ * available from https://www.virtualbox.org.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, in version 3 of the
+ * License.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <https://www.gnu.org/licenses>.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
+ * in the VirtualBox distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ *
+ * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
+ */
+
+#ifndef IPRT_INCLUDED_win_netioapi_h
+#define IPRT_INCLUDED_win_netioapi_h
+#ifndef RT_WITHOUT_PRAGMA_ONCE
+# pragma once
+#endif
+
+#include <iprt/win/ntddndis.h> /* this one has problems with -Wall */
+#include <netioapi.h>
+
+#endif /* !IPRT_INCLUDED_win_netioapi_h */
+
diff --git a/include/iprt/win/ntdddisk.h b/include/iprt/win/ntdddisk.h
new file mode 100644
index 00000000..452a5ac5
--- /dev/null
+++ b/include/iprt/win/ntdddisk.h
@@ -0,0 +1,50 @@
+/** @file
+ * Safe way to include ntdddisk.h.
+ */
+
+/*
+ * Copyright (C) 2016-2022 Oracle and/or its affiliates.
+ *
+ * This file is part of VirtualBox base platform packages, as
+ * available from https://www.virtualbox.org.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, in version 3 of the
+ * License.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <https://www.gnu.org/licenses>.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
+ * in the VirtualBox distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ *
+ * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
+ */
+
+#ifndef IPRT_INCLUDED_win_ntdddisk_h
+#define IPRT_INCLUDED_win_ntdddisk_h
+#ifndef RT_WITHOUT_PRAGMA_ONCE
+# pragma once
+#endif
+
+#pragma warning(push)
+#pragma warning(disable:4668) /* ntdddisk.h(137) : warning C4668: 'NTDDI_WIN2003' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif' */
+
+#include <ntdddisk.h>
+
+#pragma warning(pop)
+
+#endif /* !IPRT_INCLUDED_win_ntdddisk_h */
+
diff --git a/include/iprt/win/ntddndis.h b/include/iprt/win/ntddndis.h
new file mode 100644
index 00000000..fc9b8520
--- /dev/null
+++ b/include/iprt/win/ntddndis.h
@@ -0,0 +1,50 @@
+/** @file
+ * Safe way to include ntddndis.h.
+ */
+
+/*
+ * Copyright (C) 2016-2022 Oracle and/or its affiliates.
+ *
+ * This file is part of VirtualBox base platform packages, as
+ * available from https://www.virtualbox.org.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, in version 3 of the
+ * License.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <https://www.gnu.org/licenses>.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
+ * in the VirtualBox distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ *
+ * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
+ */
+
+#ifndef IPRT_INCLUDED_win_ntddndis_h
+#define IPRT_INCLUDED_win_ntddndis_h
+#ifndef RT_WITHOUT_PRAGMA_ONCE
+# pragma once
+#endif
+
+#pragma warning(push)
+#pragma warning(disable:4668) /* 'NDIS_SUPPORT_NDIS6' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif' */
+
+#include <ntddndis.h>
+
+#pragma warning(pop)
+
+#endif /* !IPRT_INCLUDED_win_ntddndis_h */
+
diff --git a/include/iprt/win/ntverp.h b/include/iprt/win/ntverp.h
new file mode 100644
index 00000000..484d8152
--- /dev/null
+++ b/include/iprt/win/ntverp.h
@@ -0,0 +1,50 @@
+/** @file
+ * Safe way to include ntverp.h.
+ */
+
+/*
+ * Copyright (C) 2016-2022 Oracle and/or its affiliates.
+ *
+ * This file is part of VirtualBox base platform packages, as
+ * available from https://www.virtualbox.org.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, in version 3 of the
+ * License.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <https://www.gnu.org/licenses>.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
+ * in the VirtualBox distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ *
+ * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
+ */
+
+#ifndef IPRT_INCLUDED_win_ntverp_h
+#define IPRT_INCLUDED_win_ntverp_h
+#ifndef RT_WITHOUT_PRAGMA_ONCE
+# pragma once
+#endif
+
+#pragma warning(push)
+#pragma warning(disable:4668) /*ntverp.h(126) : warning C4668: 'OFFICIAL_BUILD' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif' */
+
+#include <ntverp.h>
+
+#pragma warning(pop)
+
+#endif /* !IPRT_INCLUDED_win_ntverp_h */
+
diff --git a/include/iprt/win/objbase.h b/include/iprt/win/objbase.h
new file mode 100644
index 00000000..8bcb5c00
--- /dev/null
+++ b/include/iprt/win/objbase.h
@@ -0,0 +1,69 @@
+/** @file
+ * Safe way to include objbase.h.
+ */
+
+/*
+ * Copyright (C) 2016-2022 Oracle and/or its affiliates.
+ *
+ * This file is part of VirtualBox base platform packages, as
+ * available from https://www.virtualbox.org.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, in version 3 of the
+ * License.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <https://www.gnu.org/licenses>.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
+ * in the VirtualBox distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ *
+ * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
+ */
+
+#ifndef IPRT_INCLUDED_win_objbase_h
+#define IPRT_INCLUDED_win_objbase_h
+#ifndef RT_WITHOUT_PRAGMA_ONCE
+# pragma once
+#endif
+
+/* objbase.h includes windows.h via rpc.h, so get ahead of it and include
+ it here via our cleanup wrapper. */
+#include <iprt/win/windows.h>
+
+#ifdef _MSC_VER
+# pragma warning(push)
+# pragma warning(disable:4668) /* '__midl' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif' */
+# if !defined(__cplusplus)
+# pragma warning(disable:4255) /* 'FARPROC' : no function prototype given: converting '()' to '(void)' */
+# endif
+# if _MSC_VER >= 1800 /*RT_MSC_VER_VC120*/
+# pragma warning(disable:4005) /* sdk/v7.1/include/sal_supp.h(57) : warning C4005: '__useHeader' : macro redefinition */
+# endif
+# ifdef __cplusplus
+# if _MSC_VER >= 1900 /*RT_MSC_VER_VC140*/
+# pragma warning(disable:5039) /* winbase.h(13179): warning C5039: 'TpSetCallbackCleanupGroup': pointer or reference to potentially throwing function passed to 'extern "C"' function under -EHc. Undefined behavior may occur if this function throws an exception. */
+# endif
+# endif
+#endif
+
+#include <objbase.h>
+
+#ifdef _MSC_VER
+# pragma warning(pop)
+#endif
+
+#endif /* !IPRT_INCLUDED_win_objbase_h */
+
diff --git a/include/iprt/win/objidl.h b/include/iprt/win/objidl.h
new file mode 100644
index 00000000..d12e8bd7
--- /dev/null
+++ b/include/iprt/win/objidl.h
@@ -0,0 +1,63 @@
+/** @file
+ * Safe way to include objidl.h.
+ */
+
+/*
+ * Copyright (C) 2016-2022 Oracle and/or its affiliates.
+ *
+ * This file is part of VirtualBox base platform packages, as
+ * available from https://www.virtualbox.org.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, in version 3 of the
+ * License.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <https://www.gnu.org/licenses>.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
+ * in the VirtualBox distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ *
+ * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
+ */
+
+#ifndef IPRT_INCLUDED_win_objidl_h
+#define IPRT_INCLUDED_win_objidl_h
+#ifndef RT_WITHOUT_PRAGMA_ONCE
+# pragma once
+#endif
+
+#ifdef _MSC_VER
+# pragma warning(push)
+# pragma warning(disable:4668) /* '__midl' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif' */
+# if _MSC_VER >= 1800 /*RT_MSC_VER_VC120*/
+# pragma warning(disable:4005) /* sdk/v7.1/include/sal_supp.h(57) : warning C4005: '__useHeader' : macro redefinition */
+# pragma warning(disable:4255) /* windef.h(227) : warning C4255: 'NEARPROC' : no function prototype given: converting '()' to '(void)' */
+# endif
+# ifdef __cplusplus
+# if _MSC_VER >= 1900 /*RT_MSC_VER_VC140*/
+# pragma warning(disable:5039) /* winbase.h(13179): warning C5039: 'TpSetCallbackCleanupGroup': pointer or reference to potentially throwing function passed to 'extern "C"' function under -EHc. Undefined behavior may occur if this function throws an exception. */
+# endif
+# endif
+#endif
+
+#include <objidl.h>
+
+#ifdef _MSC_VER
+# pragma warning(pop)
+#endif
+
+#endif /* !IPRT_INCLUDED_win_objidl_h */
+
diff --git a/include/iprt/win/rpcproxy.h b/include/iprt/win/rpcproxy.h
new file mode 100644
index 00000000..8d355bb2
--- /dev/null
+++ b/include/iprt/win/rpcproxy.h
@@ -0,0 +1,75 @@
+/** @file
+ * Safe way to include rpcproxy.h (not C++ clean).
+ */
+
+/*
+ * Copyright (C) 2016-2022 Oracle and/or its affiliates.
+ *
+ * This file is part of VirtualBox base platform packages, as
+ * available from https://www.virtualbox.org.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, in version 3 of the
+ * License.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <https://www.gnu.org/licenses>.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
+ * in the VirtualBox distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ *
+ * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
+ */
+
+#ifndef IPRT_INCLUDED_win_rpcproxy_h
+#define IPRT_INCLUDED_win_rpcproxy_h
+#ifndef RT_WITHOUT_PRAGMA_ONCE
+# pragma once
+#endif
+
+#include <objbase.h>
+
+#ifdef __cplusplus
+
+typedef struct IRpcStubBufferVtbl
+{
+ BEGIN_INTERFACE
+ HRESULT (STDMETHODCALLTYPE *QueryInterface)(IRpcStubBuffer *, REFIID, void **);
+ ULONG (STDMETHODCALLTYPE *AddRef)(IRpcStubBuffer *);
+ ULONG (STDMETHODCALLTYPE *Release)(IRpcStubBuffer *);
+ HRESULT (STDMETHODCALLTYPE *Connect)(IRpcStubBuffer *, IUnknown *);
+ void (STDMETHODCALLTYPE *Disconnect)(IRpcStubBuffer *);
+ HRESULT (STDMETHODCALLTYPE *Invoke)(IRpcStubBuffer *, RPCOLEMESSAGE *, IRpcChannelBuffer *);
+ IRpcStubBuffer * (STDMETHODCALLTYPE *IsIIDSupported)(IRpcStubBuffer *, REFIID);
+ ULONG (STDMETHODCALLTYPE *CountRefs)(IRpcStubBuffer *);
+ HRESULT (STDMETHODCALLTYPE *DebugServerQueryInterface)(IRpcStubBuffer *, void **);
+ void (STDMETHODCALLTYPE *DebugServerRelease)(IRpcStubBuffer *, void *);
+} IRpcStubBufferVtbl;
+
+typedef struct IPSFactoryBufferVtbl
+{
+ HRESULT (STDMETHODCALLTYPE *QueryInterface)(IPSFactoryBuffer *, REFIID, void **);
+ ULONG (STDMETHODCALLTYPE *AddRef)(IPSFactoryBuffer *);
+ ULONG (STDMETHODCALLTYPE *Release)(IPSFactoryBuffer *);
+ HRESULT (STDMETHODCALLTYPE *CreateProxy)(IPSFactoryBuffer *, IUnknown *, REFIID riid, IRpcProxyBuffer **, void **);
+ HRESULT (STDMETHODCALLTYPE *CreateStub)(IPSFactoryBuffer *, REFIID, IUnknown *, IRpcStubBuffer **);
+} IPSFactoryBufferVtbl;
+
+#endif /* __cplusplus */
+
+#include <rpcproxy.h>
+
+#endif /* !IPRT_INCLUDED_win_rpcproxy_h */
+
diff --git a/include/iprt/win/setupapi.h b/include/iprt/win/setupapi.h
new file mode 100644
index 00000000..704cedaf
--- /dev/null
+++ b/include/iprt/win/setupapi.h
@@ -0,0 +1,59 @@
+/** @file
+ * Safe way to include setupapi.h.
+ */
+
+/*
+ * Copyright (C) 2016-2022 Oracle and/or its affiliates.
+ *
+ * This file is part of VirtualBox base platform packages, as
+ * available from https://www.virtualbox.org.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, in version 3 of the
+ * License.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <https://www.gnu.org/licenses>.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
+ * in the VirtualBox distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ *
+ * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
+ */
+
+#ifndef IPRT_INCLUDED_win_setupapi_h
+#define IPRT_INCLUDED_win_setupapi_h
+#ifndef RT_WITHOUT_PRAGMA_ONCE
+# pragma once
+#endif
+
+#ifdef _MSC_VER
+# pragma warning(push)
+# pragma warning(disable:4668) /* warning C4668: 'USE_SP_ALTPLATFORM_INFO_V1' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif' */
+# ifdef __cplusplus
+# if _MSC_VER >= 1900 /*RT_MSC_VER_VC140*/
+# pragma warning(disable:5039) /* winbase.h(13179): warning C5039: 'TpSetCallbackCleanupGroup': pointer or reference to potentially throwing function passed to 'extern "C"' function under -EHc. Undefined behavior may occur if this function throws an exception. */
+# endif
+# endif
+#endif
+
+#include <setupapi.h>
+
+#ifdef _MSC_VER
+# pragma warning(pop)
+#endif
+
+#endif /* !IPRT_INCLUDED_win_setupapi_h */
+
diff --git a/include/iprt/win/shlobj.h b/include/iprt/win/shlobj.h
new file mode 100644
index 00000000..bcbfd343
--- /dev/null
+++ b/include/iprt/win/shlobj.h
@@ -0,0 +1,67 @@
+/** @file
+ * Safe way to include shlobj.h.
+ */
+
+/*
+ * Copyright (C) 2016-2022 Oracle and/or its affiliates.
+ *
+ * This file is part of VirtualBox base platform packages, as
+ * available from https://www.virtualbox.org.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, in version 3 of the
+ * License.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <https://www.gnu.org/licenses>.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
+ * in the VirtualBox distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ *
+ * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
+ */
+
+#ifndef IPRT_INCLUDED_win_shlobj_h
+#define IPRT_INCLUDED_win_shlobj_h
+#ifndef RT_WITHOUT_PRAGMA_ONCE
+# pragma once
+#endif
+
+#ifdef _MSC_VER
+# pragma warning(push)
+# pragma warning(disable:4668) /* warning C4668: 'USE_SP_ALTPLATFORM_INFO_V1' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif' */
+# if _MSC_VER >= 1800 /*RT_MSC_VER_VC120*/
+# pragma warning(disable:4005) /* sdk/v7.1/include/sal_supp.h(57) : warning C4005: '__useHeader' : macro redefinition */
+# pragma warning(disable:4255) /* windef.h(227) : warning C4255: 'NEARPROC' : no function prototype given: converting '()' to '(void)' */
+# endif
+# if _MSC_VER >= 1900 /*RT_MSC_VER_VC140*/
+# pragma warning(disable:4091) /* sdk/v7.1/include/shlobj.h(1151): warning C4091: 'typedef ': ignored on left of 'tagGPFIDL_FLAGS' when no variable is declared */
+# ifdef __cplusplus
+# pragma warning(disable:5039) /* commctrl.h(8323): warning C5039: 'DSA_DestroyCallback': pointer or reference to potentially throwing function passed to 'extern "C"' function under -EHc. Undefined behavior may occur if this function throws an exception. */
+# endif
+# endif
+# if _MSC_VER >= 1910 /*RT_MSC_VER_VC141*/
+# pragma warning(disable:4768) /* sdk/v7.1/include/shlobj.h(1065): warning C4768: __declspec attributes before linkage specification are ignored */
+# endif
+#endif
+
+#include <shlobj.h>
+
+#ifdef _MSC_VER
+# pragma warning(pop)
+#endif
+
+#endif /* !IPRT_INCLUDED_win_shlobj_h */
+
diff --git a/include/iprt/win/shlwapi.h b/include/iprt/win/shlwapi.h
new file mode 100644
index 00000000..f1b037d1
--- /dev/null
+++ b/include/iprt/win/shlwapi.h
@@ -0,0 +1,53 @@
+/** @file
+ * Safe way to include shlwapi.h.
+ */
+
+/*
+ * Copyright (C) 2016-2022 Oracle and/or its affiliates.
+ *
+ * This file is part of VirtualBox base platform packages, as
+ * available from https://www.virtualbox.org.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, in version 3 of the
+ * License.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <https://www.gnu.org/licenses>.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
+ * in the VirtualBox distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ *
+ * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
+ */
+
+#ifndef IPRT_INCLUDED_win_shlwapi_h
+#define IPRT_INCLUDED_win_shlwapi_h
+#ifndef RT_WITHOUT_PRAGMA_ONCE
+# pragma once
+#endif
+
+#pragma warning(push)
+#pragma warning(disable:4668) /* warning C4668: 'USE_SP_ALTPLATFORM_INFO_V1' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif' */
+#pragma warning(disable:4255) /* warning C4255: 'I_RpcMgmtEnableDedicatedThreadPool' : no function prototype given: converting '()' to '(void)' */
+#if _MSC_VER >= 1800 /*RT_MSC_VER_VC120*/
+# pragma warning(disable:4005) /* sdk/v7.1/include/sal_supp.h(57) : warning C4005: '__useHeader' : macro redefinition */
+#endif
+#include <shlwapi.h>
+
+#pragma warning(pop)
+
+#endif /* !IPRT_INCLUDED_win_shlwapi_h */
+
diff --git a/include/iprt/win/windef.h b/include/iprt/win/windef.h
new file mode 100644
index 00000000..44c6a6ee
--- /dev/null
+++ b/include/iprt/win/windef.h
@@ -0,0 +1,65 @@
+/** @file
+ * Safe way to include windef.h.
+ */
+
+/*
+ * Copyright (C) 2016-2022 Oracle and/or its affiliates.
+ *
+ * This file is part of VirtualBox base platform packages, as
+ * available from https://www.virtualbox.org.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, in version 3 of the
+ * License.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <https://www.gnu.org/licenses>.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
+ * in the VirtualBox distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ *
+ * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
+ */
+
+#ifndef IPRT_INCLUDED_win_windef_h
+#define IPRT_INCLUDED_win_windef_h
+#ifndef RT_WITHOUT_PRAGMA_ONCE
+# pragma once
+#endif
+
+#ifdef _MSC_VER
+/*
+ * Unfortunately, the windef.h file in SDK 7.1 is not clean wrt warning C4668:
+ * basetsd.h(114) : warning C4668: '__midl' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
+ * winnt.h(13017) : warning C4668: '_DBG_MEMCPY_INLINE_' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
+ */
+# pragma warning(push)
+# pragma warning(disable:4668)
+# ifndef __cplusplus
+# pragma warning(disable:4255) /* warning C4255: 'FARPROC' : no function prototype given: converting '()' to '(void)' */
+# endif
+# if _MSC_VER >= 1800 /*RT_MSC_VER_VC120*/
+# pragma warning(disable:4005) /* sdk/v7.1/include/sal_supp.h(57) : warning C4005: '__useHeader' : macro redefinition */
+# endif
+#endif
+
+#include <windef.h>
+
+#ifdef _MSC_VER
+# pragma warning(pop)
+#endif
+
+#endif /* !IPRT_INCLUDED_win_windef_h */
+
diff --git a/include/iprt/win/windows.h b/include/iprt/win/windows.h
new file mode 100644
index 00000000..b1612713
--- /dev/null
+++ b/include/iprt/win/windows.h
@@ -0,0 +1,110 @@
+/** @file
+ * Safe way to include Windows.h.
+ */
+
+/*
+ * Copyright (C) 2016-2022 Oracle and/or its affiliates.
+ *
+ * This file is part of VirtualBox base platform packages, as
+ * available from https://www.virtualbox.org.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, in version 3 of the
+ * License.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <https://www.gnu.org/licenses>.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
+ * in the VirtualBox distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ *
+ * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
+ */
+
+#ifndef IPRT_INCLUDED_win_windows_h
+#define IPRT_INCLUDED_win_windows_h
+#ifndef RT_WITHOUT_PRAGMA_ONCE
+# pragma once
+#endif
+
+
+/* winioctl.h in windows 10 SDKs up to 22000(?) has a warning(push/pop) bug in the
+ portion taken from ntddscm.h causing trouble when using _WIN32_WINNT or NTDDI_VERSION
+ older than NTDDI_WIN10_RS5. In 18362 winioctl.h also tests against _WIN32_WINNT_WIN10_TH2
+ and other sdkddkver.h defines which only exist in NTDDI variants, not in _WIN32_WINNT_XXX,
+ so we fake up those too to keep the precompiler warning free.
+
+ Work around this by blocking out the buggy section on winioctl.h for now if the
+ NTDDI_VERSION target is too small.
+
+ WDK_NTDDI_VERSION is not present in the W7 SDK, not sure when exactly it was added.
+ NTDDI_WIN10_RS5 is W10 1809. NTDDI_WIN10_CO is Windows 11? */
+#include <sdkddkver.h>
+#ifdef _WIN32_WINNT_WIN10
+# ifndef _WIN32_WINNT_WIN10_TH2
+# define _WIN32_WINNT_WIN10_TH2 _WIN32_WINNT_WIN10
+# endif
+# ifndef _WIN32_WINNT_WIN10_RS1
+# define _WIN32_WINNT_WIN10_RS1 _WIN32_WINNT_WIN10
+# endif
+# ifndef _WIN32_WINNT_WIN10_RS2
+# define _WIN32_WINNT_WIN10_RS2 _WIN32_WINNT_WIN10
+# endif
+# ifndef _WIN32_WINNT_WIN10_RS3
+# define _WIN32_WINNT_WIN10_RS3 _WIN32_WINNT_WIN10
+# endif
+# ifndef _WIN32_WINNT_WIN10_RS4
+# define _WIN32_WINNT_WIN10_RS4 _WIN32_WINNT_WIN10
+# endif
+# ifndef _WIN32_WINNT_WIN10_RS5
+# define _WIN32_WINNT_WIN10_RS5 _WIN32_WINNT_WIN10
+# endif
+#endif
+#if defined(NTDDI_WIN10_RS5) && !defined(NTDDI_WIN10_CO) && defined(WDK_NTDDI_VERSION)
+# if NTDDI_VERSION < NTDDI_WIN10_RS5
+# define _NTDDSCM_H_ buggy, hope nobody needs it.
+# endif
+#endif
+
+#ifdef _MSC_VER
+/*
+ * Unfortunately, the Windows.h file in SDK 7.1 is not clean wrt warning C4668:
+ * wincrypt.h(1848) : warning C4668: 'NTDDI_WINLH' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
+ */
+# pragma warning(push)
+# pragma warning(disable:4668)
+# pragma warning(disable:4480) /* W10/wincrypt.h(9193) : warning C4480: nonstandard extension used: specifying underlying type for enum 'CertKeyType' */
+# if _MSC_VER >= 1800 /*RT_MSC_VER_VC120*/
+# pragma warning(disable:4005) /* sdk/v7.1/include/sal_supp.h(57) : warning C4005: '__useHeader' : macro redefinition */
+# endif
+# ifdef __cplusplus
+# if _MSC_VER >= 1900 /*RT_MSC_VER_VC140*/
+# pragma warning(disable:5039) /* winbase.h(13179): warning C5039: 'TpSetCallbackCleanupGroup': pointer or reference to potentially throwing function passed to 'extern "C"' function under -EHc. Undefined behavior may occur if this function throws an exception. */
+# endif
+# else
+# pragma warning(disable:4255) /* warning C4255: 'FARPROC' : no function prototype given: converting '()' to '(void)' */
+# endif
+#endif
+
+#include <Windows.h>
+
+#ifdef _MSC_VER
+# pragma warning(pop)
+/* VS2010: Something causes this to be re-enabled above and triggering errors using RT_FLEXIBLE_ARRAY. */
+# pragma warning(disable:4200)
+#endif
+
+#endif /* !IPRT_INCLUDED_win_windows_h */
+
diff --git a/include/iprt/win/winsock.h b/include/iprt/win/winsock.h
new file mode 100644
index 00000000..aabc3372
--- /dev/null
+++ b/include/iprt/win/winsock.h
@@ -0,0 +1,64 @@
+/** @file
+ * Safe way to include winsock2.h.
+ */
+
+/*
+ * Copyright (C) 2016-2022 Oracle and/or its affiliates.
+ *
+ * This file is part of VirtualBox base platform packages, as
+ * available from https://www.virtualbox.org.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, in version 3 of the
+ * License.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <https://www.gnu.org/licenses>.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
+ * in the VirtualBox distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ *
+ * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
+ */
+
+#ifndef IPRT_INCLUDED_win_winsock_h
+#define IPRT_INCLUDED_win_winsock_h
+#ifndef RT_WITHOUT_PRAGMA_ONCE
+# pragma once
+#endif
+
+#ifdef _MSC_VER
+/*
+ * Unfortunately, the Windows.h file in SDK 7.1 is not clean wrt warning C4668:
+ * wincrypt.h(1848) : warning C4668: 'NTDDI_WINLH' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
+ */
+# pragma warning(push)
+# pragma warning(disable:4668)
+# ifndef __cplusplus
+# pragma warning(disable:4255) /* warning C4255: 'FARPROC' : no function prototype given: converting '()' to '(void)' */
+# endif
+# if _MSC_VER >= 1800 /*RT_MSC_VER_VC120*/
+# pragma warning(disable:4005) /* sdk/v7.1/include/sal_supp.h(57) : warning C4005: '__useHeader' : macro redefinition */
+# endif
+#endif
+
+#include <winsock.h>
+
+#ifdef _MSC_VER
+# pragma warning(pop)
+#endif
+
+#endif /* !IPRT_INCLUDED_win_winsock_h */
+
diff --git a/include/iprt/win/winsock2.h b/include/iprt/win/winsock2.h
new file mode 100644
index 00000000..4c834b9a
--- /dev/null
+++ b/include/iprt/win/winsock2.h
@@ -0,0 +1,74 @@
+/** @file
+ * Safe way to include winsock2.h.
+ */
+
+/*
+ * Copyright (C) 2016-2022 Oracle and/or its affiliates.
+ *
+ * This file is part of VirtualBox base platform packages, as
+ * available from https://www.virtualbox.org.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, in version 3 of the
+ * License.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <https://www.gnu.org/licenses>.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
+ * in the VirtualBox distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ *
+ * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
+ */
+
+#ifndef IPRT_INCLUDED_win_winsock2_h
+#define IPRT_INCLUDED_win_winsock2_h
+#ifndef RT_WITHOUT_PRAGMA_ONCE
+# pragma once
+#endif
+
+/* winsock2.h includes windows.h, but without winsock.h, so we need to do it
+ up front using our wrapper header to avoid repeating tricks here. */
+#define _WINSOCKAPI_ /* do not include winsock.h via windows.h */
+#include <iprt/win/windows.h>
+
+#ifdef _MSC_VER
+/*
+ * Unfortunately, the Windows.h file in SDK 7.1 is not clean wrt warning C4668:
+ * wincrypt.h(1848) : warning C4668: 'NTDDI_WINLH' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
+ */
+# pragma warning(push)
+# pragma warning(disable:4668)
+# ifndef __cplusplus
+# pragma warning(disable:4255) /* warning C4255: 'FARPROC' : no function prototype given: converting '()' to '(void)' */
+# endif
+# if _MSC_VER >= 1800 /*RT_MSC_VER_VC120*/
+# pragma warning(disable:4005) /* sdk/v7.1/include/sal_supp.h(57) : warning C4005: '__useHeader' : macro redefinition */
+# endif
+# if _MSC_VER >= 1900 /*RT_MSC_VER_VC140*/
+# ifdef __cplusplus
+# pragma warning(disable:5039) /* winbase.h(13179): warning C5039: 'TpSetCallbackCleanupGroup': pointer or reference to potentially throwing function passed to 'extern "C"' function under -EHc. Undefined behavior may occur if this function throws an exception. */
+# endif
+# endif
+#endif
+
+#include <winsock2.h>
+
+#ifdef _MSC_VER
+# pragma warning(pop)
+#endif
+
+#endif /* !IPRT_INCLUDED_win_winsock2_h */
+
diff --git a/include/iprt/win/ws2tcpip.h b/include/iprt/win/ws2tcpip.h
new file mode 100644
index 00000000..ea5e7f2a
--- /dev/null
+++ b/include/iprt/win/ws2tcpip.h
@@ -0,0 +1,67 @@
+/** @file
+ * Safe way to include ws2tcpip.h.
+ */
+
+/*
+ * Copyright (C) 2016-2022 Oracle and/or its affiliates.
+ *
+ * This file is part of VirtualBox base platform packages, as
+ * available from https://www.virtualbox.org.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, in version 3 of the
+ * License.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <https://www.gnu.org/licenses>.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
+ * in the VirtualBox distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ *
+ * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
+ */
+
+#ifndef IPRT_INCLUDED_win_ws2tcpip_h
+#define IPRT_INCLUDED_win_ws2tcpip_h
+#ifndef RT_WITHOUT_PRAGMA_ONCE
+# pragma once
+#endif
+
+/* ws2tcpip.h includes winsock2.h, so get ahead of it and include our cleanly
+ wrapped version first to avoid duplicating stuff here. */
+#include <iprt/win/winsock2.h>
+
+#ifdef _MSC_VER
+# pragma warning(push)
+# pragma warning(disable:4668) /* 'NDIS_SUPPORT_NDIS6' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif' */
+# if _MSC_VER >= 1800 /*RT_MSC_VER_VC120*/
+# pragma warning(disable:4005) /* sdk/v7.1/include/sal_supp.h(57) : warning C4005: '__useHeader' : macro redefinition */
+# pragma warning(disable:4255) /* windef.h(227) : warning C4255: 'NEARPROC' : no function prototype given: converting '()' to '(void)' */
+# endif
+# if _MSC_VER >= 1900 /*RT_MSC_VER_VC140*/
+# ifdef __cplusplus
+# pragma warning(disable:5039) /* ws2tcpip.h(874): warning C5039: 'WSAIoctl': pointer or reference to potentially throwing function passed to 'extern "C"' function under -EHc. Undefined behavior may occur if this function throws an exception. */
+# endif
+# endif
+#endif
+
+#include <ws2tcpip.h>
+
+#ifdef _MSC_VER
+# pragma warning(pop)
+#endif
+
+#endif /* !IPRT_INCLUDED_win_ws2tcpip_h */
+