i'm getting this error saying:
"Can't find DLL entry point RtlGetNtVersionNumber in ntdll.dll"
some idea how solve?
Hi.
The error message its self-explanatory, it doesn't exists any exported function with the name "
RtlGetNtVersionNumber" in the dll that you are trying to import, in other words: that function name doesn't exists (at least as an export) inside of your specific version of the
ntdll.dll file.
Anyways the Windows API function names that starts with "
Rtl*" are system reserved (and may be unavailable in newer versions of the operating system), mostly not documented because those functions are not intended to be used by the end-user.
To retrieve the build number of the current O.S you could use
GetVersion function instead, or
GetVersionEx function +
OSVERSIONINFO structure:
Once said this, be aware that if your purpose is to determine which is the current release (NT) version of Windows, then your code is wrong because you are just checking the build number, then it will not determine a Windows NT version properly, instead it just will accept the build numbers that you are handling and it will fail producing the error messagebox that you have specified in your code for any other build number that is not handled. That is not the way to do it, you must evaluate only the major and minor version numbers (wich both in conjunction defines the value to determine Windows version), not the build/compilation number.
For a reference of the Windows NT versioning, read this:
Also take into account that you could simplify the job by replacing all your Select Case for a Select case that evaluates the value returned by the operating system's version helper (boolean) functions:
...from recent Windows version to least recent.
PS: Finally, ensure to don't miss in the MSDN articles the Windows 10 version checking warnings when using
GetVersionEx/
GetVersion or
IsWindows10OrGreater functions if you want to prevent false positives.
Regards.