VariantToStringArray() and VariantToStringArrayAlloc(): What is the allocation method?

  • Thread starter Thread starter [MSFT] Stratcat
  • Start date Start date
M

[MSFT] Stratcat

Guest
These two functions take a VARIANT that holds a safearray and returns an allocated array of strings.

In the Alloc() API the array and elements appear to be alloc'd. The non-Alloc() API appears to still alloc the individual string elements. At first I thought they might be merely referencing the BSTRs in the safearray I'm converting from however the converted string addresses are different and obviously changing a character in the safearray does not change it in the converted array. So, it seems clear that these API do indeed alloc new arrays and/or elements and that's great.

The big problem is that they still can't be used without knowing how to delete the memory!

In order to use these we need to know how to free the memory allocated by the API. MSDN is no help here and Googling pulls up nothing from anyone who has ever used them. Can someone ping the win32prg DL and find out how these things are allocated so we can pair them with the appropriate delete/free please?

Thanks,
Stratcat

Continue reading...
 
Back
Top