Workaround new windows SDK not compiling on VS2015

This commit is contained in:
baldurk
2025-02-17 16:58:36 +00:00
parent f69ac73f1f
commit 1a6f62cecf
28 changed files with 109 additions and 71 deletions
@@ -60,6 +60,7 @@
<ImportGroup Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<Import Project="$(SolutionDir)\util\WindowsSDKFix.props" />
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<IntDir>$(SolutionDir)$(Platform)\$(Configuration)\obj\$(ProjectName)\</IntDir>
@@ -80,9 +81,6 @@
<PropertyGroup>
<LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\pymodules\</OutDir>
<LibraryPath>$(LibraryPath)</LibraryPath>
<ExecutablePath>$(ExecutablePath)</ExecutablePath>
<ExcludePath>$(ExcludePath)</ExcludePath>
<TargetName>renderdoc</TargetName>
<TargetExt>.pyd</TargetExt>
</PropertyGroup>
@@ -39,6 +39,7 @@
<ImportGroup Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<Import Project="$(SolutionDir)\util\WindowsSDKFix.props" />
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<IntDir>$(SolutionDir)$(Platform)\$(Configuration)\obj\$(ProjectName)\</IntDir>
@@ -46,9 +47,6 @@
<PropertyGroup>
<LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\pymodules\</OutDir>
<LibraryPath>$(LibraryPath)</LibraryPath>
<ExecutablePath>$(ExecutablePath)</ExecutablePath>
<ExcludePath>$(ExcludePath)</ExcludePath>
<TargetName>qrenderdoc</TargetName>
<TargetExt>.pyd</TargetExt>
</PropertyGroup>
+1
View File
@@ -78,6 +78,7 @@
<PreprocessorDefinitions>RELEASE;QT_MESSAGELOGCONTEXT;QT_NO_DEBUG;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemDefinitionGroup>
<Import Project="$(SolutionDir)\util\WindowsSDKFix.props" />
<PropertyGroup>
<!-- QtBaseDir would be used for everything, except in our local repository copy of Qt
we only have one include and split the bin/lib by platform. Since include doesn't
+1
View File
@@ -49,6 +49,7 @@
<ImportGroup>
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<Import Project="$(SolutionDir)\util\WindowsSDKFix.props" />
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<LinkIncremental>false</LinkIncremental>
@@ -47,6 +47,7 @@
<ImportGroup Label="PropertySheets">
<Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" />
</ImportGroup>
<Import Project="$(SolutionDir)\util\WindowsSDKFix.props" />
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<IntDir>$(SolutionDir)$(Platform)\$(Configuration)\obj\$(ProjectName)\</IntDir>
@@ -46,6 +46,7 @@
<ImportGroup Label="PropertySheets">
<Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" />
</ImportGroup>
<Import Project="$(SolutionDir)\util\WindowsSDKFix.props" />
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<IntDir>$(SolutionDir)$(Platform)\$(Configuration)\obj\$(ProjectName)\</IntDir>
@@ -46,6 +46,7 @@
<ImportGroup Label="PropertySheets">
<Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" />
</ImportGroup>
<Import Project="$(SolutionDir)\util\WindowsSDKFix.props" />
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<IntDir>$(SolutionDir)$(Platform)\$(Configuration)\obj\$(ProjectName)\</IntDir>
@@ -46,6 +46,7 @@
<ImportGroup Label="PropertySheets">
<Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" />
</ImportGroup>
<Import Project="$(SolutionDir)\util\WindowsSDKFix.props" />
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<IntDir>$(SolutionDir)$(Platform)\$(Configuration)\obj\$(ProjectName)\</IntDir>
@@ -39,12 +39,9 @@
<ImportGroup Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<Import Project="$(SolutionDir)\util\WindowsSDKFix.props" />
<PropertyGroup>
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<ExecutablePath>$(ExecutablePath)</ExecutablePath>
<IncludePath>$(SolutionDir)\breakpad;$(IncludePath)</IncludePath>
<LibraryPath>$(LibraryPath)</LibraryPath>
<ExcludePath>$(ExcludePath)</ExcludePath>
<TargetName>driver_$(ProjectName)</TargetName>
</PropertyGroup>
<PropertyGroup>
@@ -39,12 +39,9 @@
<ImportGroup Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<Import Project="$(SolutionDir)\util\WindowsSDKFix.props" />
<PropertyGroup>
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<ExecutablePath>$(ExecutablePath)</ExecutablePath>
<IncludePath>$(SolutionDir)\breakpad;$(IncludePath)</IncludePath>
<LibraryPath>$(LibraryPath)</LibraryPath>
<ExcludePath>$(ExcludePath)</ExcludePath>
<TargetName>driver_$(ProjectName)</TargetName>
</PropertyGroup>
<PropertyGroup>
+1 -4
View File
@@ -39,12 +39,9 @@
<ImportGroup Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<Import Project="$(SolutionDir)\util\WindowsSDKFix.props" />
<PropertyGroup>
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<ExecutablePath>$(ExecutablePath)</ExecutablePath>
<IncludePath>$(SolutionDir)\breakpad;$(IncludePath)</IncludePath>
<LibraryPath>$(LibraryPath)</LibraryPath>
<ExcludePath>$(ExcludePath)</ExcludePath>
<TargetName>driver_$(ProjectName)</TargetName>
</PropertyGroup>
<PropertyGroup>
+1 -4
View File
@@ -39,12 +39,9 @@
<ImportGroup Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<Import Project="$(SolutionDir)\util\WindowsSDKFix.props" />
<PropertyGroup>
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<ExecutablePath>$(ExecutablePath)</ExecutablePath>
<IncludePath>$(SolutionDir)\breakpad;$(IncludePath)</IncludePath>
<LibraryPath>$(LibraryPath)</LibraryPath>
<ExcludePath>$(ExcludePath)</ExcludePath>
<TargetName>driver_$(ProjectName)</TargetName>
</PropertyGroup>
<PropertyGroup>
+1 -4
View File
@@ -37,12 +37,9 @@
<ImportGroup Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<Import Project="$(SolutionDir)\util\WindowsSDKFix.props" />
<PropertyGroup>
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<ExecutablePath>$(ExecutablePath)</ExecutablePath>
<IncludePath>$(SolutionDir)\breakpad;$(IncludePath)</IncludePath>
<LibraryPath>$(LibraryPath)</LibraryPath>
<ExcludePath>$(ExcludePath)</ExcludePath>
<TargetName>driver_$(ProjectName)</TargetName>
</PropertyGroup>
<PropertyGroup>
+1 -4
View File
@@ -37,12 +37,9 @@
<ImportGroup Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<Import Project="$(SolutionDir)\util\WindowsSDKFix.props" />
<PropertyGroup>
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<ExecutablePath>$(ExecutablePath)</ExecutablePath>
<IncludePath>$(SolutionDir)\breakpad;$(IncludePath)</IncludePath>
<LibraryPath>$(LibraryPath)</LibraryPath>
<ExcludePath>$(ExcludePath)</ExcludePath>
<TargetName>driver_$(ProjectName)</TargetName>
</PropertyGroup>
<PropertyGroup>
+1 -4
View File
@@ -37,12 +37,9 @@
<ImportGroup Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<Import Project="$(SolutionDir)\util\WindowsSDKFix.props" />
<PropertyGroup>
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<ExecutablePath>$(ExecutablePath)</ExecutablePath>
<IncludePath>$(SolutionDir)\breakpad;$(IncludePath)</IncludePath>
<LibraryPath>$(LibraryPath)</LibraryPath>
<ExcludePath>$(ExcludePath)</ExcludePath>
<TargetName>driver_$(ProjectName)</TargetName>
</PropertyGroup>
<PropertyGroup>
+1 -4
View File
@@ -37,12 +37,9 @@
<ImportGroup Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<Import Project="$(SolutionDir)\util\WindowsSDKFix.props" />
<PropertyGroup>
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<ExecutablePath>$(ExecutablePath)</ExecutablePath>
<IncludePath>$(SolutionDir)\breakpad;$(IncludePath)</IncludePath>
<LibraryPath>$(LibraryPath)</LibraryPath>
<ExcludePath>$(ExcludePath)</ExcludePath>
<TargetName>driver_$(ProjectName)</TargetName>
</PropertyGroup>
<PropertyGroup>
+2 -5
View File
@@ -37,12 +37,9 @@
<ImportGroup Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<Import Project="$(SolutionDir)\util\WindowsSDKFix.props" />
<PropertyGroup>
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<ExecutablePath>$(ExecutablePath)</ExecutablePath>
<IncludePath>$(SolutionDir)\breakpad;$(IncludePath)</IncludePath>
<LibraryPath>$(LibraryPath)</LibraryPath>
<ExcludePath>$(ExcludePath)</ExcludePath>
<TargetName>driver_$(ProjectName)</TargetName>
</PropertyGroup>
<PropertyGroup>
@@ -60,7 +57,7 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>$(SolutionDir)renderdoc\;$(SolutionDir)renderdoc\3rdparty\;$(SolutionDir)renderdoc\driver\ihv\nv\official\PerfSDK\redist\include;$(SolutionDir)renderdoc\driver\ihv\nv\official\PerfSDK\redist\NvPerfUtility\include</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(SolutionDir)renderdoc\;$(SolutionDir)renderdoc\3rdparty\;$(SolutionDir)renderdoc\driver\dx\official;$(SolutionDir)renderdoc\driver\ihv\nv\official\PerfSDK\redist\include;$(SolutionDir)renderdoc\driver\ihv\nv\official\PerfSDK\redist\NvPerfUtility\include</AdditionalIncludeDirectories>
<PreprocessorDefinitions>RENDERDOC_EXPORTS;RENDERDOC_PLATFORM_WIN32;WIN32;NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<WarningLevel>Level4</WarningLevel>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
@@ -39,12 +39,9 @@
<ImportGroup Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<Import Project="$(SolutionDir)\util\WindowsSDKFix.props" />
<PropertyGroup>
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<ExecutablePath>$(ExecutablePath)</ExecutablePath>
<IncludePath>$(SolutionDir)\breakpad;$(IncludePath)</IncludePath>
<LibraryPath>$(LibraryPath)</LibraryPath>
<ExcludePath>$(ExcludePath)</ExcludePath>
<TargetName>driver_$(ProjectName)</TargetName>
</PropertyGroup>
<PropertyGroup>
@@ -39,12 +39,9 @@
<ImportGroup Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<Import Project="$(SolutionDir)\util\WindowsSDKFix.props" />
<PropertyGroup>
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<ExecutablePath>$(ExecutablePath)</ExecutablePath>
<IncludePath>$(SolutionDir)\breakpad;$(IncludePath)</IncludePath>
<LibraryPath>$(LibraryPath)</LibraryPath>
<ExcludePath>$(ExcludePath)</ExcludePath>
<TargetName>driver_$(ProjectName)</TargetName>
</PropertyGroup>
<PropertyGroup>
@@ -39,12 +39,9 @@
<ImportGroup Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<Import Project="$(SolutionDir)\util\WindowsSDKFix.props" />
<PropertyGroup>
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<ExecutablePath>$(ExecutablePath)</ExecutablePath>
<IncludePath>$(SolutionDir)\breakpad;$(IncludePath)</IncludePath>
<LibraryPath>$(LibraryPath)</LibraryPath>
<ExcludePath>$(ExcludePath)</ExcludePath>
<TargetName>driver_$(ProjectName)</TargetName>
</PropertyGroup>
<PropertyGroup>
@@ -39,12 +39,9 @@
<ImportGroup Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<Import Project="$(SolutionDir)\util\WindowsSDKFix.props" />
<PropertyGroup>
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<ExecutablePath>$(ExecutablePath)</ExecutablePath>
<IncludePath>$(SolutionDir)\breakpad;$(IncludePath)</IncludePath>
<LibraryPath>$(LibraryPath)</LibraryPath>
<ExcludePath>$(ExcludePath)</ExcludePath>
<TargetName>driver_$(ProjectName)</TargetName>
</PropertyGroup>
<PropertyGroup>
+7 -4
View File
@@ -687,10 +687,13 @@ HMODULE WINAPI Hooked_LoadLibraryExW(LPCWSTR lpLibFileName, HANDLE fileHandle, D
// always returned first regardless of the search order and so we can detect the DLL is already loaded
if(wcschr(lpLibFileName, L'\\') == 0 && wcschr(lpLibFileName, L'/') == 0)
{
flagsExcludingSearchOrders &=
~(LOAD_LIBRARY_SEARCH_APPLICATION_DIR | LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR |
LOAD_LIBRARY_SEARCH_SYSTEM32 | LOAD_LIBRARY_SEARCH_USER_DIRS |
LOAD_WITH_ALTERED_SEARCH_PATH | LOAD_LIBRARY_SAFE_CURRENT_DIRS);
flagsExcludingSearchOrders &= ~(LOAD_LIBRARY_SEARCH_APPLICATION_DIR |
LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR | LOAD_LIBRARY_SEARCH_SYSTEM32 |
LOAD_LIBRARY_SEARCH_USER_DIRS | LOAD_WITH_ALTERED_SEARCH_PATH);
#ifdef LOAD_LIBRARY_SAFE_CURRENT_DIRS
flagsExcludingSearchOrders &= ~LOAD_LIBRARY_SAFE_CURRENT_DIRS;
#endif
}
// if there are no flags (possibly with search path flags excluded) and we already have the
+1 -4
View File
@@ -41,12 +41,9 @@
<ImportGroup Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<Import Project="$(SolutionDir)\util\WindowsSDKFix.props" />
<PropertyGroup>
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<ExecutablePath>$(ExecutablePath)</ExecutablePath>
<IncludePath>$(SolutionDir)\breakpad;$(IncludePath)</IncludePath>
<LibraryPath>$(LibraryPath)</LibraryPath>
<ExcludePath>$(ExcludePath)</ExcludePath>
</PropertyGroup>
<PropertyGroup>
<IntDir>$(SolutionDir)$(Platform)\$(Configuration)\obj\$(ProjectName)\</IntDir>
+1 -4
View File
@@ -36,12 +36,9 @@
<ImportGroup Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<Import Project="$(SolutionDir)\util\WindowsSDKFix.props" />
<PropertyGroup>
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<ExecutablePath>$(ExecutablePath)</ExecutablePath>
<IncludePath>$(SolutionDir)\breakpad;$(IncludePath)</IncludePath>
<LibraryPath>$(LibraryPath)</LibraryPath>
<ExcludePath>$(ExcludePath)</ExcludePath>
</PropertyGroup>
<PropertyGroup>
<IntDir>$(SolutionDir)$(Platform)\$(Configuration)\obj\$(ProjectName)\</IntDir>
+1
View File
@@ -67,6 +67,7 @@
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<Import Project="$(SolutionDir)\util\WindowsSDKFix.props" />
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<IntDir>$(SolutionDir)$(Platform)\$(Configuration)\obj\$(ProjectName)\</IntDir>
+1
View File
@@ -66,6 +66,7 @@
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<Import Project="$(SolutionDir)\util\WindowsSDKFix.props" />
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<IntDir>$(SolutionDir)$(Platform)\$(Configuration)\obj\$(ProjectName)\</IntDir>
+8
View File
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<IncludePath>$(SolutionDir)\util\sdkfix;$(IncludePath)</IncludePath>
</PropertyGroup>
</Project>
+68
View File
@@ -0,0 +1,68 @@
/******************************************************************************
* The MIT License (MIT)
*
* Copyright (c) 2025 Baldur Karlsson
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
******************************************************************************/
#pragma once
// workaround for bug with latest windows SDK version. wchar.h requires intrinsic that's not
// available on VS2015 _mm_loadu_si64. We also just don't want to pull in build-time dependencies
// on AVX if we can help it
// include this header first (on older SDKs it might not include this but it's not a heavy header
#include <immintrin.h>
// if this isn't defined (by new compiler versions) then define it now. This may break in future if
// this becomes a real function instead of a define...
#ifndef _mm_loadu_si64
#define _mm_loadu_si64(p) _mm_loadl_epi64((__m128i const *)(p))
#endif
// include the real wchar.h. To avoid self-referential includes we assume it sits in a ucrt folder
#include <../ucrt/wchar.h>
// don't call normal functions to avoid warnings about pulling in avx instructions
#define wmemcmp wmemcmp_simple
inline int wmemcmp_simple(const wchar_t *a, const wchar_t *b, size_t n)
{
size_t i = 0;
for(; i < n; ++i)
{
if(a[i] != b[i])
return a[i] < b[i] ? -1 : 1;
}
return 0;
}
#define wmemchr wmemchr_simple
inline const wchar_t *wmemchr_simple(const wchar_t *s, wchar_t c, size_t n)
{
size_t i = 0;
for(; i < n; ++i)
{
if(s[i] == c)
return s + i;
}
return NULL;
}