4

I was trying to look into the implementation of GetVersion function in kernel32.dll.

I was surprised to see that the GetVersion thunk is issuing a jump to API-MS-WIN-CORE-SYSINFO-L1-1-0.DLL::GetVersion, and in turn API-MS-WIN-CORE-SYSINFO-L1-1-0.DLL::GetVersion is pointing(forwarder) back to KERNEL32.DLL::GetVersion


Any idea why is it so? So where is the real implementation of GetVersion?

Kernel32.dll

kernel32.dll

API-MS-WIN-CORE-SYSINFO-L1-1-0.DLL

enter image description here

2
  • 1
    to make universal crt possible most implementation were shifted to other dlls and a version agnostic stub which knows where to redirect the backward compatible and present apis were introduced which is contained in a resource only dll file named APISETSCHEMEA.dll you may check here for some internals of that here
    – blabb
    Jan 14 at 3:12
  • What @blabb said! Plus, you may want to read this and this and this as well as the code in this and this. Enjoy. Oh and my answer on the Q&A blabb linked also offers details about this topic.
    – 0xC0000022L
    Jan 14 at 10:35

1 Answer 1

0

GetVersion() was deprecated in 8.1 - https://learn.microsoft.com/en-us/windows/win32/sysinfo/targeting-your-application-at-windows-8-1

So I would guess that they've left the function stub there to catch and redirect calls in code that hasn't been updated.

4
  • I did tried to create a dummy program to test out GetVersion and it's working fine. Jan 14 at 5:04
  • Besides that there are also some function that is not deprecated that has the same footprint. Jan 14 at 5:04
  • Deprecated means you shouldn't use it, not you can't. However, GetVersion() does anyway lie all the time unless your application happens to run with a manifest that proclaims full compatibility with the Windows release on which it runs. For the truth use RtlGetVersion or consult KUSER_SHARED_DATA. Either way, what you encountered is more about API sets than about whether GetVersion is deprecated.
    – 0xC0000022L
    Jan 14 at 10:29
  • @MegaTonnage: I think in this question it's more about the API Sets rather than about why it's deprecated or so.
    – 0xC0000022L
    Jan 14 at 10:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.