19 Mar
2015
19 Mar
'15
3:45 p.m.
On Thu, Mar 19, 2015 at 06:29:50PM +0300, Nikolay Sivov wrote:
This doesn't look right. Proper way would be:
- call GetFinalPathNameByHandleW() with NULL buffer to get required length; - allocated WCHAR buffer and get a path in it; - call WideCharToMultiByte() with NULL output buffer to get required length for CP_ACP string; - do what you need to do if A buffer length is too small.
Right now you're assuming that WCHAR representation has same number of characters as CP_ACP one, I don't think it's always a case.
Yeah, good point. I'll fix and resubmit. Thanks! Andrew