There's no need to pre-malloc the number of handles. Instead call LocateHandles twice, once to get the size, and once to get the data.
There's no need to pre-malloc the number of handles. Instead call LocateHandles twice, once to get the size, and once to get the data.