Tony Lambregts <[EMAIL PROTECTED]> writes: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.
+ 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.
OK I can do this without the wrapper thats not a problem. I still need help with the sprintf problem though.
Also note that registry functions are not supposed to set last error, so you probably don't want to use Dmitry's wrapper here.
--
Tony Lambregts