Tony Lambregts tony_lambregts@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.