Skip to content

Commit 5864794

Browse files
authored
Build for a Windows 8.1 minimum (#564)
1 parent 42357da commit 5864794

30 files changed

+152
-319
lines changed

.github/workflows/main.yml

+6
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,12 @@ jobs:
6060
- os: windows-2022
6161
build_type: arm64ec-Release
6262
arch: amd64_arm64
63+
- os: windows-2022
64+
build_type: x64-Debug-Win8
65+
arch: amd64
66+
- os: windows-2022
67+
build_type: x64-Release-Win8
68+
arch: amd64
6369
- os: windows-2022
6470
build_type: x64-Debug-Clang
6571
arch: amd64

Auxiliary/DirectXTexEXR.cpp

-25
Original file line numberDiff line numberDiff line change
@@ -240,19 +240,10 @@ HRESULT DirectX::GetMetadataFromEXRFile(const wchar_t* szFile, TexMetadata& meta
240240
}
241241
}
242242

243-
#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8)
244243
ScopedHandle hFile(safe_handle(CreateFile2(
245244
szFile,
246245
GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING,
247246
nullptr)));
248-
#else
249-
ScopedHandle hFile(safe_handle(CreateFileW(
250-
szFile,
251-
GENERIC_READ, FILE_SHARE_READ,
252-
nullptr,
253-
OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN,
254-
nullptr)));
255-
#endif
256247
if (!hFile)
257248
{
258249
return HRESULT_FROM_WIN32(GetLastError());
@@ -358,19 +349,10 @@ HRESULT DirectX::LoadFromEXRFile(const wchar_t* szFile, TexMetadata* metadata, S
358349
}
359350
}
360351

361-
#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8)
362352
ScopedHandle hFile(safe_handle(CreateFile2(
363353
szFile,
364354
GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING,
365355
nullptr)));
366-
#else
367-
ScopedHandle hFile(safe_handle(CreateFileW(
368-
szFile,
369-
GENERIC_READ, FILE_SHARE_READ,
370-
nullptr,
371-
OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN,
372-
nullptr)));
373-
#endif
374356
if (!hFile)
375357
{
376358
return HRESULT_FROM_WIN32(GetLastError());
@@ -508,19 +490,12 @@ HRESULT DirectX::SaveToEXRFile(const Image& image, const wchar_t* szFile)
508490
}
509491

510492
// Create file and write header
511-
#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8)
512-
ScopedHandle hFile(safe_handle(CreateFile2(
513-
szFile,
514-
GENERIC_WRITE, 0, CREATE_ALWAYS,
515-
nullptr)));
516-
#else
517493
ScopedHandle hFile(safe_handle(CreateFileW(
518494
szFile,
519495
GENERIC_WRITE, 0,
520496
nullptr,
521497
CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL,
522498
nullptr)));
523-
#endif
524499
if (!hFile)
525500
{
526501
return HRESULT_FROM_WIN32(GetLastError());

Auxiliary/DirectXTexXboxDDS.cpp

+12-20
Original file line numberDiff line numberDiff line change
@@ -439,12 +439,10 @@ HRESULT Xbox::GetMetadataFromDDSFileEx(
439439

440440
isXbox = false;
441441

442-
#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8)
443-
ScopedHandle hFile(safe_handle(CreateFile2(szFile, GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING, nullptr)));
444-
#else
445-
ScopedHandle hFile(safe_handle(CreateFileW(szFile, GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING,
446-
FILE_FLAG_SEQUENTIAL_SCAN, nullptr)));
447-
#endif
442+
ScopedHandle hFile(safe_handle(CreateFile2(
443+
szFile,
444+
GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING,
445+
nullptr)));
448446
if (!hFile)
449447
{
450448
return HRESULT_FROM_WIN32(GetLastError());
@@ -591,13 +589,10 @@ HRESULT Xbox::LoadFromDDSFileEx(
591589

592590
xbox.Release();
593591

594-
#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8)
595-
ScopedHandle hFile(safe_handle(CreateFile2(szFile, GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING, nullptr)));
596-
#else
597-
ScopedHandle hFile(safe_handle(CreateFileW(szFile, GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING,
598-
FILE_FLAG_SEQUENTIAL_SCAN, nullptr)));
599-
#endif
600-
592+
ScopedHandle hFile(safe_handle(CreateFile2(
593+
szFile,
594+
GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING,
595+
nullptr)));
601596
if (!hFile)
602597
{
603598
return HRESULT_FROM_WIN32(GetLastError());
@@ -742,13 +737,10 @@ HRESULT Xbox::SaveToDDSFile(const XboxImage& xbox, const wchar_t* szFile)
742737
return hr;
743738

744739
// Create file and write header
745-
#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8)
746-
ScopedHandle hFile(safe_handle(CreateFile2(szFile,
747-
GENERIC_WRITE, 0, CREATE_ALWAYS, nullptr)));
748-
#else
749-
ScopedHandle hFile(safe_handle(CreateFileW(szFile,
750-
GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr)));
751-
#endif
740+
ScopedHandle hFile(safe_handle(CreateFile2(
741+
szFile,
742+
GENERIC_WRITE, 0, CREATE_ALWAYS,
743+
nullptr)));
752744
if (!hFile)
753745
{
754746
return HRESULT_FROM_WIN32(GetLastError());

CMakeLists.txt

+2-3
Original file line numberDiff line numberDiff line change
@@ -632,9 +632,8 @@ if(WIN32)
632632
elseif(${DIRECTX_ARCH} MATCHES "^arm")
633633
set(WINVER 0x0602)
634634
else()
635-
message(STATUS "Building with Windows 7 compatibility")
636-
set(WINVER 0x0601)
637-
target_compile_definitions(${PROJECT_NAME} PRIVATE _WIN7_PLATFORM_UPDATE)
635+
message(STATUS "Building with Windows 8.1 compatibility")
636+
set(WINVER 0x0603)
638637
endif()
639638

640639
foreach(t IN LISTS TOOL_EXES ITEMS ${PROJECT_NAME})

CMakePresets.json

+9-9
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@
118118
},
119119

120120
{
121-
"name": "Win7",
121+
"name": "Win8",
122122
"cacheVariables": {
123123
"BUILD_DX12": false
124124
},
@@ -294,10 +294,10 @@
294294
{ "name": "arm64-Debug-UWP" , "description": "MSVC for ARM64 (Debug) for UWP", "inherits": [ "base", "ARM64", "Debug", "MSVC", "UWP" ] },
295295
{ "name": "arm64-Release-UWP", "description": "MSVC for ARM64 (Release) for UWP", "inherits": [ "base", "ARM64", "Release", "MSVC", "UWP" ] },
296296

297-
{ "name": "x64-Debug-Win7" , "description": "MSVC for x64 (Debug) for Windows 7", "inherits": [ "base", "x64", "Debug", "MSVC", "Win7" ] },
298-
{ "name": "x64-Release-Win7" , "description": "MSVC for x64 (Release) for Windows 7", "inherits": [ "base", "x64", "Release", "MSVC", "Win7" ] },
299-
{ "name": "x86-Debug-Win7" , "description": "MSVC for x86 (Debug) for Windows 7", "inherits": [ "base", "x86", "Debug", "MSVC", "Win7" ] },
300-
{ "name": "x86-Release-Win7" , "description": "MSVC for x86 (Release) for Windows 7", "inherits": [ "base", "x86", "Release", "MSVC", "Win7" ] },
297+
{ "name": "x64-Debug-Win8" , "description": "MSVC for x64 (Debug) for Windows 8.1", "inherits": [ "base", "x64", "Debug", "MSVC", "Win8" ] },
298+
{ "name": "x64-Release-Win8" , "description": "MSVC for x64 (Release) for Windows 8.1", "inherits": [ "base", "x64", "Release", "MSVC", "Win8" ] },
299+
{ "name": "x86-Debug-Win8" , "description": "MSVC for x86 (Debug) for Windows 8.1", "inherits": [ "base", "x86", "Debug", "MSVC", "Win8" ] },
300+
{ "name": "x86-Release-Win8" , "description": "MSVC for x86 (Release) for Windows 8.1", "inherits": [ "base", "x86", "Release", "MSVC", "Win8" ] },
301301

302302
{ "name": "x64-Debug-Scarlett" , "description": "MSVC for x64 (Debug) for Xbox Series X|S", "inherits": [ "base", "x64", "Debug", "MSVC", "Scarlett" ] },
303303
{ "name": "x64-Release-Scarlett" , "description": "MSVC for x64 (Release) for Xbox Series X|S", "inherits": [ "base", "x64", "Release", "MSVC", "Scarlett" ] },
@@ -337,10 +337,10 @@
337337
{ "name": "arm64-Debug-UWP-Clang" , "description": "Clang/LLVM for AArch64 (Debug) for UWP", "inherits": [ "base", "ARM64", "Debug", "Clang", "Clang-AArch64", "UWP" ] },
338338
{ "name": "arm64-Release-UWP-Clang", "description": "Clang/LLVM for AArch64 (Release) for UWP", "inherits": [ "base", "ARM64", "Release", "Clang", "Clang-AArch64", "UWP" ] },
339339

340-
{ "name": "x64-Debug-Win7-Clang" , "description": "Clang/LLVM for x64 (Debug) for Windows 7", "inherits": [ "base", "x64", "Debug", "Clang", "Win7" ] },
341-
{ "name": "x64-Release-Win7-Clang", "description": "Clang/LLVM for x64 (Release) for Windows 7", "inherits": [ "base", "x64", "Release", "Clang", "Win7" ] },
342-
{ "name": "x86-Debug-Win7-Clang" , "description": "Clang/LLVM for x86 (Debug) for Windows 7", "inherits": [ "base", "x86", "Debug", "Clang", "Clang-X86", "Win7" ] },
343-
{ "name": "x86-Release-Win7-Clang", "description": "Clang/LLVM for x86 (Release) for Windows 7", "inherits": [ "base", "x86", "Release", "Clang", "Clang-X86", "Win7" ] },
340+
{ "name": "x64-Debug-Win8-Clang" , "description": "Clang/LLVM for x64 (Debug) for Windows 8.1", "inherits": [ "base", "x64", "Debug", "Clang", "Win8" ] },
341+
{ "name": "x64-Release-Win8-Clang", "description": "Clang/LLVM for x64 (Release) for Windows 8.1", "inherits": [ "base", "x64", "Release", "Clang", "Win8" ] },
342+
{ "name": "x86-Debug-Win8-Clang" , "description": "Clang/LLVM for x86 (Debug) for Windows 8.1", "inherits": [ "base", "x86", "Debug", "Clang", "Clang-X86", "Win8" ] },
343+
{ "name": "x86-Release-Win8-Clang", "description": "Clang/LLVM for x86 (Release) for Windows 8.1", "inherits": [ "base", "x86", "Release", "Clang", "Clang-X86", "Win8" ] },
344344

345345
{ "name": "x64-Debug-Clang-VCPKG" , "description": "Clang/LLVM for x64 (Debug) using VCPKG/OpenEXR", "inherits": [ "base", "x64", "Debug", "Clang", "VCPKG" ] },
346346
{ "name": "x64-Release-Clang-VCPKG" , "description": "Clang/LLVM for x64 (Release) using VCPKG/OpenEXR", "inherits": [ "base", "x64", "Release", "Clang", "VCPKG" ] },

DDSTextureLoader/DDSTextureLoader11.cpp

-10
Original file line numberDiff line numberDiff line change
@@ -239,20 +239,10 @@ namespace
239239
*bitSize = 0;
240240

241241
// open the file
242-
#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8)
243242
ScopedHandle hFile(safe_handle(CreateFile2(
244243
fileName,
245244
GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING,
246245
nullptr)));
247-
#else
248-
ScopedHandle hFile(safe_handle(CreateFileW(
249-
fileName,
250-
GENERIC_READ, FILE_SHARE_READ,
251-
nullptr,
252-
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,
253-
nullptr)));
254-
#endif
255-
256246
if (!hFile)
257247
{
258248
return HRESULT_FROM_WIN32(GetLastError());

DDSTextureLoader/DDSTextureLoader9.cpp

+3-15
Original file line numberDiff line numberDiff line change
@@ -204,22 +204,10 @@ namespace
204204
*bitSize = 0;
205205

206206
// open the file
207-
#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8)
208-
ScopedHandle hFile(safe_handle(CreateFile2(fileName,
209-
GENERIC_READ,
210-
FILE_SHARE_READ,
211-
OPEN_EXISTING,
207+
ScopedHandle hFile(safe_handle(CreateFile2(
208+
fileName,
209+
GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING,
212210
nullptr)));
213-
#else
214-
ScopedHandle hFile(safe_handle(CreateFileW(fileName,
215-
GENERIC_READ,
216-
FILE_SHARE_READ,
217-
nullptr,
218-
OPEN_EXISTING,
219-
FILE_ATTRIBUTE_NORMAL,
220-
nullptr)));
221-
#endif
222-
223211
if (!hFile)
224212
{
225213
return HRESULT_FROM_WIN32(GetLastError());

DDSView/DDSView_Desktop_2019.vcxproj

+6-6
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@
135135
<FloatingPointModel>Fast</FloatingPointModel>
136136
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
137137
<AdditionalIncludeDirectories>..\DirectXTex;$(ProjectDir)Shaders;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
138-
<PreprocessorDefinitions>WIN32;_DEBUG;DEBUG;PROFILE;_WINDOWS;_WIN32_WINNT=0x0601;%(PreprocessorDefinitions)</PreprocessorDefinitions>
138+
<PreprocessorDefinitions>WIN32;_DEBUG;DEBUG;PROFILE;_WINDOWS;_WIN32_WINNT=0x0603;%(PreprocessorDefinitions)</PreprocessorDefinitions>
139139
<ConformanceMode>true</ConformanceMode>
140140
<SDLCheck>true</SDLCheck>
141141
<AdditionalOptions>/Zc:__cplusplus /ZH:SHA_256 %(AdditionalOptions)</AdditionalOptions>
@@ -159,7 +159,7 @@
159159
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
160160
<FloatingPointModel>Fast</FloatingPointModel>
161161
<AdditionalIncludeDirectories>..\DirectXTex;$(ProjectDir)Shaders;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
162-
<PreprocessorDefinitions>WIN32;_DEBUG;DEBUG;PROFILE;_WINDOWS;_WIN32_WINNT=0x0601;%(PreprocessorDefinitions)</PreprocessorDefinitions>
162+
<PreprocessorDefinitions>WIN32;_DEBUG;DEBUG;PROFILE;_WINDOWS;_WIN32_WINNT=0x0603;%(PreprocessorDefinitions)</PreprocessorDefinitions>
163163
<ConformanceMode>true</ConformanceMode>
164164
<SDLCheck>true</SDLCheck>
165165
<AdditionalOptions>/Zc:__cplusplus /ZH:SHA_256 %(AdditionalOptions)</AdditionalOptions>
@@ -182,7 +182,7 @@
182182
<FloatingPointModel>Fast</FloatingPointModel>
183183
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
184184
<AdditionalIncludeDirectories>..\DirectXTex;$(ProjectDir)Shaders;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
185-
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_WIN32_WINNT=0x0601;%(PreprocessorDefinitions)</PreprocessorDefinitions>
185+
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_WIN32_WINNT=0x0603;%(PreprocessorDefinitions)</PreprocessorDefinitions>
186186
<ControlFlowGuard>Guard</ControlFlowGuard>
187187
<ConformanceMode>true</ConformanceMode>
188188
<SDLCheck>true</SDLCheck>
@@ -208,7 +208,7 @@
208208
<Optimization>MaxSpeed</Optimization>
209209
<FloatingPointModel>Fast</FloatingPointModel>
210210
<AdditionalIncludeDirectories>..\DirectXTex;$(ProjectDir)Shaders;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
211-
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_WIN32_WINNT=0x0601;%(PreprocessorDefinitions)</PreprocessorDefinitions>
211+
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_WIN32_WINNT=0x0603;%(PreprocessorDefinitions)</PreprocessorDefinitions>
212212
<ControlFlowGuard>Guard</ControlFlowGuard>
213213
<ConformanceMode>true</ConformanceMode>
214214
<SDLCheck>true</SDLCheck>
@@ -234,7 +234,7 @@
234234
<FloatingPointModel>Fast</FloatingPointModel>
235235
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
236236
<AdditionalIncludeDirectories>..\DirectXTex;$(ProjectDir)Shaders;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
237-
<PreprocessorDefinitions>WIN32;NDEBUG;PROFILE;_WINDOWS;_WIN32_WINNT=0x0601;%(PreprocessorDefinitions)</PreprocessorDefinitions>
237+
<PreprocessorDefinitions>WIN32;NDEBUG;PROFILE;_WINDOWS;_WIN32_WINNT=0x0603;%(PreprocessorDefinitions)</PreprocessorDefinitions>
238238
<ControlFlowGuard>Guard</ControlFlowGuard>
239239
<ConformanceMode>true</ConformanceMode>
240240
<SDLCheck>true</SDLCheck>
@@ -260,7 +260,7 @@
260260
<Optimization>MaxSpeed</Optimization>
261261
<FloatingPointModel>Fast</FloatingPointModel>
262262
<AdditionalIncludeDirectories>..\DirectXTex;$(ProjectDir)Shaders;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
263-
<PreprocessorDefinitions>WIN32;NDEBUG;PROFILE;_WINDOWS;_WIN32_WINNT=0x0601;%(PreprocessorDefinitions)</PreprocessorDefinitions>
263+
<PreprocessorDefinitions>WIN32;NDEBUG;PROFILE;_WINDOWS;_WIN32_WINNT=0x0603;%(PreprocessorDefinitions)</PreprocessorDefinitions>
264264
<ControlFlowGuard>Guard</ControlFlowGuard>
265265
<ConformanceMode>true</ConformanceMode>
266266
<SDLCheck>true</SDLCheck>

DDSView/DDSView_Desktop_2022.vcxproj

+6-6
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@
135135
<FloatingPointModel>Fast</FloatingPointModel>
136136
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
137137
<AdditionalIncludeDirectories>..\DirectXTex;$(ProjectDir)Shaders;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
138-
<PreprocessorDefinitions>WIN32;_DEBUG;DEBUG;PROFILE;_WINDOWS;_WIN32_WINNT=0x0601;%(PreprocessorDefinitions)</PreprocessorDefinitions>
138+
<PreprocessorDefinitions>WIN32;_DEBUG;DEBUG;PROFILE;_WINDOWS;_WIN32_WINNT=0x0603;%(PreprocessorDefinitions)</PreprocessorDefinitions>
139139
<ConformanceMode>true</ConformanceMode>
140140
<SDLCheck>true</SDLCheck>
141141
<AdditionalOptions>/Zc:__cplusplus %(AdditionalOptions)</AdditionalOptions>
@@ -159,7 +159,7 @@
159159
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
160160
<FloatingPointModel>Fast</FloatingPointModel>
161161
<AdditionalIncludeDirectories>..\DirectXTex;$(ProjectDir)Shaders;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
162-
<PreprocessorDefinitions>WIN32;_DEBUG;DEBUG;PROFILE;_WINDOWS;_WIN32_WINNT=0x0601;%(PreprocessorDefinitions)</PreprocessorDefinitions>
162+
<PreprocessorDefinitions>WIN32;_DEBUG;DEBUG;PROFILE;_WINDOWS;_WIN32_WINNT=0x0603;%(PreprocessorDefinitions)</PreprocessorDefinitions>
163163
<ConformanceMode>true</ConformanceMode>
164164
<SDLCheck>true</SDLCheck>
165165
<AdditionalOptions>/Zc:__cplusplus %(AdditionalOptions)</AdditionalOptions>
@@ -182,7 +182,7 @@
182182
<FloatingPointModel>Fast</FloatingPointModel>
183183
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
184184
<AdditionalIncludeDirectories>..\DirectXTex;$(ProjectDir)Shaders;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
185-
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_WIN32_WINNT=0x0601;%(PreprocessorDefinitions)</PreprocessorDefinitions>
185+
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_WIN32_WINNT=0x0603;%(PreprocessorDefinitions)</PreprocessorDefinitions>
186186
<ControlFlowGuard>Guard</ControlFlowGuard>
187187
<ConformanceMode>true</ConformanceMode>
188188
<SDLCheck>true</SDLCheck>
@@ -208,7 +208,7 @@
208208
<Optimization>MaxSpeed</Optimization>
209209
<FloatingPointModel>Fast</FloatingPointModel>
210210
<AdditionalIncludeDirectories>..\DirectXTex;$(ProjectDir)Shaders;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
211-
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_WIN32_WINNT=0x0601;%(PreprocessorDefinitions)</PreprocessorDefinitions>
211+
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_WIN32_WINNT=0x0603;%(PreprocessorDefinitions)</PreprocessorDefinitions>
212212
<ControlFlowGuard>Guard</ControlFlowGuard>
213213
<ConformanceMode>true</ConformanceMode>
214214
<SDLCheck>true</SDLCheck>
@@ -234,7 +234,7 @@
234234
<FloatingPointModel>Fast</FloatingPointModel>
235235
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
236236
<AdditionalIncludeDirectories>..\DirectXTex;$(ProjectDir)Shaders;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
237-
<PreprocessorDefinitions>WIN32;NDEBUG;PROFILE;_WINDOWS;_WIN32_WINNT=0x0601;%(PreprocessorDefinitions)</PreprocessorDefinitions>
237+
<PreprocessorDefinitions>WIN32;NDEBUG;PROFILE;_WINDOWS;_WIN32_WINNT=0x0603;%(PreprocessorDefinitions)</PreprocessorDefinitions>
238238
<ControlFlowGuard>Guard</ControlFlowGuard>
239239
<ConformanceMode>true</ConformanceMode>
240240
<SDLCheck>true</SDLCheck>
@@ -260,7 +260,7 @@
260260
<Optimization>MaxSpeed</Optimization>
261261
<FloatingPointModel>Fast</FloatingPointModel>
262262
<AdditionalIncludeDirectories>..\DirectXTex;$(ProjectDir)Shaders;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
263-
<PreprocessorDefinitions>WIN32;NDEBUG;PROFILE;_WINDOWS;_WIN32_WINNT=0x0601;%(PreprocessorDefinitions)</PreprocessorDefinitions>
263+
<PreprocessorDefinitions>WIN32;NDEBUG;PROFILE;_WINDOWS;_WIN32_WINNT=0x0603;%(PreprocessorDefinitions)</PreprocessorDefinitions>
264264
<ControlFlowGuard>Guard</ControlFlowGuard>
265265
<ConformanceMode>true</ConformanceMode>
266266
<SDLCheck>true</SDLCheck>

DirectXTex/DirectXTexDDS.cpp

+10-18
Original file line numberDiff line numberDiff line change
@@ -1878,12 +1878,10 @@ HRESULT DirectX::GetMetadataFromDDSFileEx(
18781878
return E_INVALIDARG;
18791879

18801880
#ifdef _WIN32
1881-
#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8)
1882-
ScopedHandle hFile(safe_handle(CreateFile2(szFile, GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING, nullptr)));
1883-
#else
1884-
ScopedHandle hFile(safe_handle(CreateFileW(szFile, GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING,
1885-
FILE_FLAG_SEQUENTIAL_SCAN, nullptr)));
1886-
#endif
1881+
ScopedHandle hFile(safe_handle(CreateFile2(
1882+
szFile,
1883+
GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING,
1884+
nullptr)));
18871885
if (!hFile)
18881886
{
18891887
return HRESULT_FROM_WIN32(GetLastError());
@@ -2064,12 +2062,10 @@ HRESULT DirectX::LoadFromDDSFileEx(
20642062
image.Release();
20652063

20662064
#ifdef _WIN32
2067-
#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8)
2068-
ScopedHandle hFile(safe_handle(CreateFile2(szFile, GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING, nullptr)));
2069-
#else
2070-
ScopedHandle hFile(safe_handle(CreateFileW(szFile, GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING,
2071-
FILE_FLAG_SEQUENTIAL_SCAN, nullptr)));
2072-
#endif
2065+
ScopedHandle hFile(safe_handle(CreateFile2(
2066+
szFile,
2067+
GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING,
2068+
nullptr)));
20732069
if (!hFile)
20742070
{
20752071
return HRESULT_FROM_WIN32(GetLastError());
@@ -2548,13 +2544,9 @@ HRESULT DirectX::SaveToDDSFile(
25482544

25492545
// Create file and write header
25502546
#ifdef _WIN32
2551-
#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8)
2552-
ScopedHandle hFile(safe_handle(CreateFile2(szFile,
2547+
ScopedHandle hFile(safe_handle(CreateFile2(
2548+
szFile,
25532549
GENERIC_WRITE | DELETE, 0, CREATE_ALWAYS, nullptr)));
2554-
#else
2555-
ScopedHandle hFile(safe_handle(CreateFileW(szFile,
2556-
GENERIC_WRITE | DELETE, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr)));
2557-
#endif
25582550
if (!hFile)
25592551
{
25602552
return HRESULT_FROM_WIN32(GetLastError());

0 commit comments

Comments
 (0)