So it's been a loooooong time since I've properly done any Win32 API stuff. Years ago, samples like these (& my code too) were commonplace: http://allapi.mentalis.org/apilist/EnumPrinters.shtml# or http://word.mvps.org/faqs/macrosvba/...lePrinters.htm.
In essence:
[LIST][1]Try an API call once, passing a dummy value for one of the byref buffer-length related parameters
[2]Check the return value - if it didn't work, use the retrieved buffer length (now known) & just call the same API call again[/ LIST]
Um, so wouldn't this cause one of those nasty buffer overflow security leak errors I've heard so much about in the news, causing potentially full remote control? What's the 2016 preferred way of coding & calling APIs with buffer length parameters please?
In essence:
[LIST][1]Try an API call once, passing a dummy value for one of the byref buffer-length related parameters
[2]Check the return value - if it didn't work, use the retrieved buffer length (now known) & just call the same API call again[/ LIST]
Um, so wouldn't this cause one of those nasty buffer overflow security leak errors I've heard so much about in the news, causing potentially full remote control? What's the 2016 preferred way of coding & calling APIs with buffer length parameters please?