2022-01-26 04:47:32 +00:00
|
|
|
/***
|
|
|
|
Copyright (C) 2022 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
|
|
|
|
2022-11-17 07:46:07 +00:00
|
|
|
File: AuVersionHelpers.cpp
|
2022-01-26 04:47:32 +00:00
|
|
|
Date: 2022-1-25
|
|
|
|
Author: Reece
|
|
|
|
***/
|
|
|
|
#include <Source/RuntimeInternal.hpp>
|
2022-11-17 07:46:07 +00:00
|
|
|
#include "AuSWInfo.hpp"
|
2022-01-26 04:47:32 +00:00
|
|
|
// NO HEADER (note -> .hpp wouldn't clash with windows' sdk)
|
|
|
|
|
|
|
|
namespace Aurora::SWInfo
|
|
|
|
{
|
|
|
|
static AuUInt16 kWinVerNT4 = 0x0400;
|
|
|
|
static AuUInt16 kWinVerWin2K = 0x0500;
|
|
|
|
static AuUInt16 kWinVerWinXP = 0x0501;
|
|
|
|
static AuUInt16 kWinVerWS03 = 0x0502;
|
|
|
|
static AuUInt16 kWinVerWin6 = 0x0600;
|
|
|
|
static AuUInt16 kWinVerVista = 0x0600;
|
|
|
|
static AuUInt16 kWinVerWS08 = 0x0600;
|
|
|
|
static AuUInt16 kWinVerWin7 = 0x0601;
|
|
|
|
static AuUInt16 kWinVerWin8 = 0x0602;
|
|
|
|
static AuUInt16 kWinVerWinBlue = 0x0603;
|
|
|
|
static AuUInt16 kWinVerWin10 = 0x0A00;
|
[*/+/-] MEGA COMMIT. ~2 weeks compressed.
The intention is to quickly improve and add util apis, enhance functionality given current demands, go back to the build pipeline, finish that, publish runtime tests, and then use what we have to go back to to linux support with a more stable api.
[+] AuMakeSharedArray
[+] Technet ArgvQuote
[+] Grug subsystem (UNIX signal thread async safe ipc + telemetry flusher + log flusher.)
[+] auEndianness -> Endian swap utils
[+] AuGet<N>(...)
[*] AUE_DEFINE conversion for
ECompresionType, EAnsiColor, EHashType, EStreamError, EHexDump
[+] ConsoleMessage ByteBuffer serialization
[+] CmdLine subsystem for parsing command line arguments and simple switch/flag checks
[*] Split logger from console subsystem
[+] StartupParameters -> A part of a clean up effort under Process
[*] Refactor SysErrors header + get caller hack
[+] Atomic APIs
[+] popcnt
[+] Ring Buffer sink
[+] Added more standard errors
Catch,
Submission,
LockError,
NoAccess,
ResourceMissing,
ResourceLocked,
MalformedData,
InSandboxContext,
ParseError
[+] Added ErrorCategorySet, ErrorCategoryClear, GetStackTrace
[+] IExitSubscriber, ETriggerLevel
[*] Write bias the high performance RWLockImpl read-lock operation operation
[+] ExitHandlerAdd/ExitHandlerRemove (exit subsystem)
[*] Updated API style
Digests
[+] CpuId::CpuBitCount
[+] GetUserProgramsFolder
[+] GetPackagePath
[*] Split IStreamReader with an inl file
[*] BlobWriter/BlobReader/BlobArbitraryReader can now take shared pointers to bytebuffers. default constructor allocates a new scalable bytebuffer
[+] ICharacterProvider
[+] ICharacterProviderEx
[+] IBufferedCharacterConsumer
[+] ProviderFromSharedString
[+] ProviderFromString
[+] BufferConsumerFromProvider
[*] Parse Subsystem uses character io bufferer
[*] Rewritten NT's high perf semaphore to use userland SRW/ConVars [like mutex, based on generic semaphore]
[+] ByteBuffer::ResetReadPointer
[*] Bug fix bytebuffer base not reset on free and some scaling issues
[+] ProcessMap -> Added kSectionNameStack, kSectionNameFile, kSectionNameHeap for Section
[*] ProcessMap -> Refactor Segment to Section. I was stupid for keeping a type conflict hack API facing
[+] Added 64 *byte* fast RNG seeds
[+] File Advisorys/File Lock Awareness
[+] Added extended IAuroraThread from OS identifier caches for debug purposes
[*] Tweaked how memory is reported on Windows. Better consistency of what values mean across functions.
[*] Broke AuroraUtils/Typedefs out into a separate library
[*] Update build script
[+] Put some more effort into adding detail to the readme before rewriting it, plus, added some media
[*] Improved public API documentation
[*] Bug fix `SetConsoleCtrlHandler`
[+] Locale TimeDateToFileNameISO8601
[+] Console config stdOutShortTime
[*] Begin using internal UTF8/16 decoders when platform support isnt available (instead of stl)
[*] Bug fixes in decoders
[*] Major bug fix, AuMax
[+] RateLimiter
[+] Binary file sink
[+] Log directory sink
[*] Data header usability (more operators)
[+] AuRemoveRange
[+] AuRemove
[+] AuTryRemove
[+] AuTryRemoveRange
[+] auCastUtils
[+] Finish NewLSWin32Source
[+] AuTryFindByTupleN, AuTryRemoveByTupleN
[+] Separated AuRead/Write types, now in auTypeUtils
[+] Added GetPosition/SetPosition to FileWriter
[*] Fix stupid AuMin in place of AuMax in SpawnThread.Unix.Cpp
[*] Refactored Arbitrary readers to SeekingReaders (as in, they could be atomic and/or parallelized, and accept an arbitrary position as a work parameter -> not Seekable, as in, you can simply set the position)
[*] Hack back in the sched deinit
[+] File AIO loop source interop
[+] Begin to prototype a LoopQueue object I had in mind for NT, untested btw
[+] Stub code for networking
[+] Compression BaseStream/IngestableStreamBase
[*] Major: read/write locks now support write-entrant read routines.
[*] Compression subsystem now uses the MemoryView concept
[*] Rewrite the base stream compressions, made them less broken
[*] Update hashing api
[*] WriterTryGoForward and ReaderTryGoForward now revert to the previous relative index instead of panicing
[+] Added new AuByteBuffer apis
Trim, Pad, WriteFrom, WriteString, [TODO: ReadString]
[+] Added ByteBufferPushReadState
[+] Added ByteBufferPushWriteState
[*] Move from USC-16 to full UTF-16. Win32 can handle full UTF-16.
[*] ELogLevel is now an Aurora enum
[+] Raised arbitrary limit in header to 255, the max filter buffer
[+] Explicit GZip support
[+] Explicit Zip support
[+] Added [some] compressors
et al
2022-02-17 00:11:40 +00:00
|
|
|
static AuUInt16 kKernPatchWin11 = 22000;
|
2022-01-26 04:47:32 +00:00
|
|
|
|
2022-01-27 05:24:08 +00:00
|
|
|
static bool IsWindowsVersionOrGreater(AuUInt8 major, AuUInt8 minor, AuUInt16 sp)
|
2022-01-26 04:47:32 +00:00
|
|
|
{
|
|
|
|
auto &info = GetPlatformInfo();
|
2022-05-28 16:21:57 +00:00
|
|
|
return info.ePlatform == Build::EPlatform::ePlatformWin32 &&
|
|
|
|
(info.uKernelMajor > major || (info.uKernelMajor == major && info.uKernelMinor >= minor)) &&
|
|
|
|
((info.uKernelMajor == major && info.uKernelMinor == minor) ? info.uUserlandMinor >= sp : true);
|
2022-01-26 04:47:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
AUKN_SYM bool IsWindowsXPOrGreater()
|
|
|
|
{
|
2022-01-27 05:24:08 +00:00
|
|
|
return IsWindowsVersionOrGreater(AuBitsToHigher(kWinVerWinXP), AuBitsToLower(kWinVerWinXP), 0);
|
2022-01-26 04:47:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
AUKN_SYM bool IsWindowsXPSP1OrGreater()
|
|
|
|
{
|
2022-01-27 05:24:08 +00:00
|
|
|
return IsWindowsVersionOrGreater(AuBitsToHigher(kWinVerWinXP), AuBitsToLower(kWinVerWinXP), 1);
|
2022-01-26 04:47:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
AUKN_SYM bool IsWindowsXPSP2OrGreater()
|
|
|
|
{
|
2022-01-27 05:24:08 +00:00
|
|
|
return IsWindowsVersionOrGreater(AuBitsToHigher(kWinVerWinXP), AuBitsToLower(kWinVerWinXP), 2);
|
2022-01-26 04:47:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
AUKN_SYM bool IsWindowsXPSP3OrGreater()
|
|
|
|
{
|
2022-01-27 05:24:08 +00:00
|
|
|
return IsWindowsVersionOrGreater(AuBitsToHigher(kWinVerWinXP), AuBitsToLower(kWinVerWinXP), 3);
|
2022-01-26 04:47:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
AUKN_SYM bool IsWindowsVistaOrGreater()
|
|
|
|
{
|
2022-01-27 05:24:08 +00:00
|
|
|
return IsWindowsVersionOrGreater(AuBitsToHigher(kWinVerVista), AuBitsToLower(kWinVerVista), 0);
|
2022-01-26 04:47:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
AUKN_SYM bool IsWindowsVistaSP1OrGreater()
|
|
|
|
{
|
2022-01-27 05:24:08 +00:00
|
|
|
return IsWindowsVersionOrGreater(AuBitsToHigher(kWinVerVista), AuBitsToLower(kWinVerVista), 1);
|
2022-01-26 04:47:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
AUKN_SYM bool IsWindowsVistaSP2OrGreater()
|
|
|
|
{
|
2022-01-27 05:24:08 +00:00
|
|
|
return IsWindowsVersionOrGreater(AuBitsToHigher(kWinVerVista), AuBitsToLower(kWinVerVista), 2);
|
2022-01-26 04:47:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
AUKN_SYM bool IsWindows7OrGreater()
|
|
|
|
{
|
2022-01-27 05:24:08 +00:00
|
|
|
return IsWindowsVersionOrGreater(AuBitsToHigher(kWinVerWin7), AuBitsToLower(kWinVerWin7), 0);
|
2022-01-26 04:47:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
AUKN_SYM bool IsWindows7SP1OrGreater()
|
|
|
|
{
|
2022-01-27 05:24:08 +00:00
|
|
|
return IsWindowsVersionOrGreater(AuBitsToHigher(kWinVerWin7), AuBitsToLower(kWinVerWin7), 1);
|
2022-01-26 04:47:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
AUKN_SYM bool IsWindows8OrGreater()
|
|
|
|
{
|
2022-01-27 05:24:08 +00:00
|
|
|
return IsWindowsVersionOrGreater(AuBitsToHigher(kWinVerWin8), AuBitsToLower(kWinVerWin8), 0);
|
2022-01-26 04:47:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
AUKN_SYM bool IsWindows8Point1OrGreater()
|
|
|
|
{
|
2022-01-27 05:24:08 +00:00
|
|
|
return IsWindowsVersionOrGreater(AuBitsToHigher(kWinVerWinBlue), AuBitsToLower(kWinVerWinBlue), 0);
|
2022-01-26 04:47:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
AUKN_SYM bool IsWindows10OrGreater()
|
|
|
|
{
|
2022-01-27 05:24:08 +00:00
|
|
|
return IsWindowsVersionOrGreater(AuBitsToHigher(kWinVerWin10), AuBitsToLower(kWinVerWin10), 0);
|
2022-01-26 04:47:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
AUKN_SYM bool IsWindows11OrGreater()
|
|
|
|
{
|
[*/+/-] MEGA COMMIT. ~2 weeks compressed.
The intention is to quickly improve and add util apis, enhance functionality given current demands, go back to the build pipeline, finish that, publish runtime tests, and then use what we have to go back to to linux support with a more stable api.
[+] AuMakeSharedArray
[+] Technet ArgvQuote
[+] Grug subsystem (UNIX signal thread async safe ipc + telemetry flusher + log flusher.)
[+] auEndianness -> Endian swap utils
[+] AuGet<N>(...)
[*] AUE_DEFINE conversion for
ECompresionType, EAnsiColor, EHashType, EStreamError, EHexDump
[+] ConsoleMessage ByteBuffer serialization
[+] CmdLine subsystem for parsing command line arguments and simple switch/flag checks
[*] Split logger from console subsystem
[+] StartupParameters -> A part of a clean up effort under Process
[*] Refactor SysErrors header + get caller hack
[+] Atomic APIs
[+] popcnt
[+] Ring Buffer sink
[+] Added more standard errors
Catch,
Submission,
LockError,
NoAccess,
ResourceMissing,
ResourceLocked,
MalformedData,
InSandboxContext,
ParseError
[+] Added ErrorCategorySet, ErrorCategoryClear, GetStackTrace
[+] IExitSubscriber, ETriggerLevel
[*] Write bias the high performance RWLockImpl read-lock operation operation
[+] ExitHandlerAdd/ExitHandlerRemove (exit subsystem)
[*] Updated API style
Digests
[+] CpuId::CpuBitCount
[+] GetUserProgramsFolder
[+] GetPackagePath
[*] Split IStreamReader with an inl file
[*] BlobWriter/BlobReader/BlobArbitraryReader can now take shared pointers to bytebuffers. default constructor allocates a new scalable bytebuffer
[+] ICharacterProvider
[+] ICharacterProviderEx
[+] IBufferedCharacterConsumer
[+] ProviderFromSharedString
[+] ProviderFromString
[+] BufferConsumerFromProvider
[*] Parse Subsystem uses character io bufferer
[*] Rewritten NT's high perf semaphore to use userland SRW/ConVars [like mutex, based on generic semaphore]
[+] ByteBuffer::ResetReadPointer
[*] Bug fix bytebuffer base not reset on free and some scaling issues
[+] ProcessMap -> Added kSectionNameStack, kSectionNameFile, kSectionNameHeap for Section
[*] ProcessMap -> Refactor Segment to Section. I was stupid for keeping a type conflict hack API facing
[+] Added 64 *byte* fast RNG seeds
[+] File Advisorys/File Lock Awareness
[+] Added extended IAuroraThread from OS identifier caches for debug purposes
[*] Tweaked how memory is reported on Windows. Better consistency of what values mean across functions.
[*] Broke AuroraUtils/Typedefs out into a separate library
[*] Update build script
[+] Put some more effort into adding detail to the readme before rewriting it, plus, added some media
[*] Improved public API documentation
[*] Bug fix `SetConsoleCtrlHandler`
[+] Locale TimeDateToFileNameISO8601
[+] Console config stdOutShortTime
[*] Begin using internal UTF8/16 decoders when platform support isnt available (instead of stl)
[*] Bug fixes in decoders
[*] Major bug fix, AuMax
[+] RateLimiter
[+] Binary file sink
[+] Log directory sink
[*] Data header usability (more operators)
[+] AuRemoveRange
[+] AuRemove
[+] AuTryRemove
[+] AuTryRemoveRange
[+] auCastUtils
[+] Finish NewLSWin32Source
[+] AuTryFindByTupleN, AuTryRemoveByTupleN
[+] Separated AuRead/Write types, now in auTypeUtils
[+] Added GetPosition/SetPosition to FileWriter
[*] Fix stupid AuMin in place of AuMax in SpawnThread.Unix.Cpp
[*] Refactored Arbitrary readers to SeekingReaders (as in, they could be atomic and/or parallelized, and accept an arbitrary position as a work parameter -> not Seekable, as in, you can simply set the position)
[*] Hack back in the sched deinit
[+] File AIO loop source interop
[+] Begin to prototype a LoopQueue object I had in mind for NT, untested btw
[+] Stub code for networking
[+] Compression BaseStream/IngestableStreamBase
[*] Major: read/write locks now support write-entrant read routines.
[*] Compression subsystem now uses the MemoryView concept
[*] Rewrite the base stream compressions, made them less broken
[*] Update hashing api
[*] WriterTryGoForward and ReaderTryGoForward now revert to the previous relative index instead of panicing
[+] Added new AuByteBuffer apis
Trim, Pad, WriteFrom, WriteString, [TODO: ReadString]
[+] Added ByteBufferPushReadState
[+] Added ByteBufferPushWriteState
[*] Move from USC-16 to full UTF-16. Win32 can handle full UTF-16.
[*] ELogLevel is now an Aurora enum
[+] Raised arbitrary limit in header to 255, the max filter buffer
[+] Explicit GZip support
[+] Explicit Zip support
[+] Added [some] compressors
et al
2022-02-17 00:11:40 +00:00
|
|
|
return IsWindowsVersionOrGreater(AuBitsToHigher(kWinVerWin10), AuBitsToLower(kWinVerWin10), 0) && GetPlatformInfo().uKernelPatch >= kKernPatchWin11;
|
2022-01-26 04:47:32 +00:00
|
|
|
}
|
|
|
|
}
|