Foro de elhacker.net

Programación => Programación Visual Basic => Mensaje iniciado por: Progmasterbr en 11 Junio 2017, 15:18 pm



Título: Can't find DLL entry point RtlGetNtVersionNumber in ntdll.dll
Publicado por: Progmasterbr en 11 Junio 2017, 15:18 pm
Hello,

i have th following declaration of RtlGetNtVersionNumber:

Código:
Public Declare Sub RtlGetNtVersionNumber Lib "ntdll.dll" (ByRef MajorVersion As Long, ByRef MinorVersion As Long, ByRef BuildNumber As Integer)

and using like this:

Código
  1.  
  2. Dim OsBuild As Integer
  3. Dim MaN As Long, MiN As Long
  4. Dim FilePath As String
  5.  
  6. Call RtlGetNtVersionNumber(MaN, MiN, OsBuild)
  7. Select Case OsBuild
  8.    Case 2600
  9.        FilePath = "\WinXPSssdt.txt"
  10.    Case 3750
  11.        FilePath = "\Win2k3x86Sssdt.txt"
  12.    Case 6000
  13.        FilePath = "\VistaX86Sssdt.txt"
  14.    Case 7600
  15.        FilePath = "\Win7x86Sssdt.txt"
  16.    Case 9200
  17.        FilePath = "\Win8x86Sssdt.txt"
  18.    Case 9600
  19.        FilePath = "\Win81x86Sssdt.txt"
  20.    Case 10240
  21.        FilePath = "\Win10Th1x86Sssdt.txt"
  22.    Case 10586
  23.        FilePath = "\Win10Th2x86Sssdt.txt"
  24.    Case Else
  25.        MsgBox "Current System is not supported", vbExclamation, "Error": End
  26. End Select
  27.  

but i'm getting this error saying:

"Can't find DLL entry point RtlGetNtVersionNumber in ntdll.dll"

some idea how solve?

thank you by any suggestion.




Título: Re: Can't find DLL entry point RtlGetNtVersionNumber in ntdll.dll
Publicado por: Eleкtro en 11 Junio 2017, 16:30 pm
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:
  • GetVersion function | MSDN (https://msdn.microsoft.com/en-us/library/windows/desktop/ms724439(v=vs.85).aspx)
  • GetVersionEx function | MSDN (https://msdn.microsoft.com/en-us/library/windows/desktop/ms724451(v=vs.85).aspx)
  • OSVERSIONINFO structure | MSDN (https://msdn.microsoft.com/en-us/library/windows/desktop/ms724834(v=vs.85).aspx)

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:
  • List of Microsoft Windows versions | Wikipedia (https://en.wikipedia.org/wiki/List_of_Microsoft_Windows_versions)

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:
  • Version Helper functions | MSDN (https://msdn.microsoft.com/es-es/library/windows/desktop/dn424972(v=vs.85).aspx)
...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.


Título: Re: Can't find DLL entry point RtlGetNtVersionNumber in ntdll.dll
Publicado por: Progmasterbr en 11 Junio 2017, 17:12 pm
Elektro, thank you very much.