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

Tony Lambregts tony_lambregts at telusplanet.net
Fri Mar 7 17:35:14 CST 2003


Alexandre Julliard wrote:

>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.
>
It didn't feel right to me. I had a problem with this in the first place 
since I could not use swprintf (at least not without including msvcrt.h) 
My poor brain needs more advice.

>
>Also note that registry functions are not supposed to set last error,
>so you probably don't want to use Dmitry's wrapper here.
>
>  
>
OK I can do this without the wrapper thats not a problem. I still need 
help with the sprintf problem though.

-- 

Tony Lambregts






More information about the wine-devel mailing list