That's classic "Microsoft style" and I've always hated APIs like that because they add unnecessary complexity to the code of all their callers.
https://docs.microsoft.com/en-us/windows/win32/seccrypto/exa...
They managed to mix both patterns into a ghastly 9 function call!
The example above speaks for itself but I kind of see the "we provide you with memory you need to call 'FreeX' on" and the "call the function twice, once to find out how much memory you need to allocate" patterns to be equally annoying to use.
Callers allocate the right size no matter what OS version, and can only see the fields exposed on the version they were built for.