<commit_before>#pragma once

#define VERSIONHELPERAPI inline bool

#define _WIN32_WINNT_NT4            0x0400
#define _WIN32_WINNT_WIN2K          0x0500
#define _WIN32_WINNT_WINXP          0x0501
#define _WIN32_WINNT_WS03           0x0502
#define _WIN32_WINNT_WIN6           0x0600
#define _WIN32_WINNT_VISTA          0x0600
#define _WIN32_WINNT_WS08           0x0600
#define _WIN32_WINNT_LONGHORN       0x0600
#define _WIN32_WINNT_WIN7           0x0601
#define _WIN32_WINNT_WIN8           0x0602
#define _WIN32_WINNT_WINBLUE        0x0603
#define _WIN32_WINNT_WIN10          0x0A00        

typedef NTSTATUS( NTAPI* fnRtlGetVersion )(PRTL_OSVERSIONINFOEXW lpVersionInformation);

enum eVerShort
{
    WinUnsupported, // Unsupported OS 
    WinXP,          // Windows XP
    Win7,           // Windows 7
    Win8,           // Windows 8
    Win8Point1,     // Windows 8.1
    Win10,          // Windows 10
    Win10AU,        // Windows 10 Anniversary update
    Win10CU,        // Windows 10 Creators update
    Win10FC,        // Windows 10 Fall Creators update
};

struct WinVersion
{
    eVerShort ver = WinUnsupported;
    RTL_OSVERSIONINFOEXW native;
};

inline WinVersion& WinVer()
{
    static WinVersion g_WinVer;
    return g_WinVer;
}

inline void InitVersion()
{
    auto& g_WinVer = WinVer();
    g_WinVer.native.dwOSVersionInfoSize = sizeof( g_WinVer.native );
    auto RtlGetVersion = (fnRtlGetVersion)GetProcAddress( GetModuleHandleW( L"ntdll.dll" ), "RtlGetVersion" );
    if (RtlGetVersion)
        RtlGetVersion( &g_WinVer.native );

    if (g_WinVer.native.dwMajorVersion != 0)
    {
        auto fullver = (g_WinVer.native.dwMajorVersion << 8) | g_WinVer.native.dwMinorVersion;
        switch (fullver)
        {
        case _WIN32_WINNT_WIN10:
            if (g_WinVer.native.dwBuildNumber >= 16299)
                g_WinVer.ver = Win10CU;
            else if (g_WinVer.native.dwBuildNumber >= 15063)
                g_WinVer.ver = Win10CU;
            else if (g_WinVer.native.dwBuildNumber >= 14393)
                g_WinVer.ver = Win10AU;
            else if (g_WinVer.native.dwBuildNumber >= 10586)
                g_WinVer.ver = Win10;
            break;

        case _WIN32_WINNT_WINBLUE:
            g_WinVer.ver = Win8Point1;
            break;

        case _WIN32_WINNT_WIN8:
            g_WinVer.ver = Win8;
            break;
<commit_msg>version typo fix<commit_after>#pragma once

#define VERSIONHELPERAPI inline bool

#define _WIN32_WINNT_NT4            0x0400
#define _WIN32_WINNT_WIN2K          0x0500
#define _WIN32_WINNT_WINXP          0x0501
#define _WIN32_WINNT_WS03           0x0502
#define _WIN32_WINNT_WIN6           0x0600
#define _WIN32_WINNT_VISTA          0x0600
#define _WIN32_WINNT_WS08           0x0600
#define _WIN32_WINNT_LONGHORN       0x0600
#define _WIN32_WINNT_WIN7           0x0601
#define _WIN32_WINNT_WIN8           0x0602
#define _WIN32_WINNT_WINBLUE        0x0603
#define _WIN32_WINNT_WIN10          0x0A00        

typedef NTSTATUS( NTAPI* fnRtlGetVersion )(PRTL_OSVERSIONINFOEXW lpVersionInformation);

enum eVerShort
{
    WinUnsupported, // Unsupported OS 
    WinXP,          // Windows XP
    Win7,           // Windows 7
    Win8,           // Windows 8
    Win8Point1,     // Windows 8.1
    Win10,          // Windows 10
    Win10AU,        // Windows 10 Anniversary update
    Win10CU,        // Windows 10 Creators update
    Win10FC,        // Windows 10 Fall Creators update
};

struct WinVersion
{
    eVerShort ver = WinUnsupported;
    RTL_OSVERSIONINFOEXW native;
};

inline WinVersion& WinVer()
{
    static WinVersion g_WinVer;
    return g_WinVer;
}

inline void InitVersion()
{
    auto& g_WinVer = WinVer();
    g_WinVer.native.dwOSVersionInfoSize = sizeof( g_WinVer.native );
    auto RtlGetVersion = (fnRtlGetVersion)GetProcAddress( GetModuleHandleW( L"ntdll.dll" ), "RtlGetVersion" );
    if (RtlGetVersion)
        RtlGetVersion( &g_WinVer.native );

    if (g_WinVer.native.dwMajorVersion != 0)
    {
        auto fullver = (g_WinVer.native.dwMajorVersion << 8) | g_WinVer.native.dwMinorVersion;
        switch (fullver)
        {
        case _WIN32_WINNT_WIN10:
            if (g_WinVer.native.dwBuildNumber >= 16299)
                g_WinVer.ver = Win10FC;
            else if (g_WinVer.native.dwBuildNumber >= 15063)
                g_WinVer.ver = Win10CU;
            else if (g_WinVer.native.dwBuildNumber >= 14393)
                g_WinVer.ver = Win10AU;
            else if (g_WinVer.native.dwBuildNumber >= 10586)
                g_WinVer.ver = Win10;
            break;

        case _WIN32_WINNT_WINBLUE:
            g_WinVer.ver = Win8Point1;
            break;

        case _WIN32_WINNT_WIN8:
            g_WinVer.ver = Win8;
            break;

{'fraction_non_alphanumeric': 0.07240580930330456, 'fraction_numerical': 0.06735424121237635, 'mean_word_length': 2.187122736418511, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5866407', 'n_tokens_mistral': 1818, 'n_tokens_neox': 1629, 'n_words': 330}