there
edit: something I'm only realizing now XD, this method might have issues because it is SIZE_T that is being used which is an equivalent to NativeInt in Delphi.
NativeInt in x86 is actually a 32-bit integer, however this can be fixed by merging this code to the same idea I shared earlier about the same info being available on registry
here