(4th) Janitorial dlls/advapi32/registry.c W->A cleanup

Alexandre Julliard julliard at winehq.com
Fri Mar 7 17:09:04 CST 2003


Tony Lambregts <tony_lambregts at telusplanet.net> writes:

> +    len = WideCharToMultiByte(CP_ACP, 0, nameW, -1, NULL, 0, NULL, NULL);
> +    nameA = HeapAlloc(GetProcessHeap(), 0, len);
> +    WideCharToMultiByte(CP_ACP, 0, nameW, -1, nameA, len, NULL, NULL);
> +    
>      for (;;)
>      {
> -        sprintf( name, "reg%04x.tmp", count++ );
> -        handle = CreateFileA( buffer, GENERIC_WRITE, 0, NULL,
> +        sprintf( nameA, "reg%04x.tmp", count++ );
> +        handle = CreateFileW( buffer, GENERIC_WRITE, 0, NULL,

This can't work, the sprintf is supposed to modify the buffer, not a
copy of it.

Also note that registry functions are not supposed to set last error,
so you probably don't want to use Dmitry's wrapper here.

-- 
Alexandre Julliard
julliard at winehq.com



More information about the wine-devel mailing list