On 02.08.2016 15:17, Pierre Schweitzer wrote:
Le 02/08/2016 à 14:13, Nikolay Sivov a écrit :
On 02.08.2016 14:31, Pierre Schweitzer wrote:
- len = WideCharToMultiByte(CP_ACP, 0, provider->lpProvider, -1, NULL, 0, NULL, NULL);
- provider_name = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
- if (provider_name)
memcpy(provider_name, provider->lpProvider, len * sizeof(WCHAR));
- HeapFree(GetProcessHeap(), 0, provider);
- return provider_name;
This is confusing. WNetGetResourceInformationW return W string, you convert it to A, and use A length to allocate another W buffer? What's going on?
I'm just getting string length for a local recopy, as it is done in other places. Should I use something else? Like some strdupW if it exists?
If you already have W string, strlenW will give you length. What are the other places where it's done like that?