SimpleDirect2DApplication fails to compile - identifier FILE_INFO_BY_HANDLE_CLASS is undefined
rnikander opened this issue · 2 comments
I downloaded Visual Studio and have been trying some of these samples. This application did not compile.
The error is pointing to line 1065 of fileapi.h
.
WINBASEAPI
BOOL
WINAPI
SetFileInformationByHandle(
_In_ HANDLE hFile,
_In_ FILE_INFO_BY_HANDLE_CLASS FileInformationClass, // Error here
_In_reads_bytes_(dwBufferSize) LPVOID lpFileInformation,
_In_ DWORD dwBufferSize
);
I'm running on Windows 11 Home.
Same error with "SimplePathAnimationSample".
Ran int the same problem when trying to run SimpleDirect2dApplication
. The problem is that the current sdkddkver.h
is bugged. Let's review.
FILE_INFO_BY_HANDLE_CLASS
is only defined when:
// minwinbase.h
#if (NTDDI_VERSION >= NTDDI_LONGHORN)
typedef enum _FILE_INFO_BY_HANDLE_CLASS {
...
} FILE_INFO_BY_HANDLE_CLASS, *PFILE_INFO_BY_HANDLE_CLASS;
#endif
NTDDI_VERSION
is defined in sdkddkver.h
, and here's the problematic code:
// sdkddkver.h
#ifndef NTDDI_VERSION
#ifdef _WIN32_WINNT
#if (_WIN32_WINNT <= _WIN32_WINNT_WINBLUE)
#define NTDDI_VERSION NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT)
#elif (_WIN32_WINNT >= _WIN32_WINNT_WIN10)
#define NTDDI_VERSION WDK_NTDDI_VERSION
#endif
#else
#define NTDDI_VERSION 0x0A00000C
#endif
#endif
If _WIN32_WINNT_WINBLUE
< _WIN32_WINNT
< _WIN32_WINNT_WIN10
, then NTDDI_VERSION
remains undefined, leading to the original error. This will occur if you run the app as is, with 0x0603 < 0x0700 < 0x0A00.
A temporary fix is to place one of these directives at the beginning of your app header:
//#define NTDDI_VERSION 0x07000000
//#define _WIN32_WINNT 0x0A00