> Dmitry Timoshkov wrote:
>>> "Tony Lambregts" <tony_lambregts at telusplanet.net> wrote:
>> Yeah I actually had it that way at one point due to my familairity
>> with drive.c and well... I ran into some compiler errors (in
>> RegSaveKeyW) that ended up making the problem worse. Perhaps it was
>> something I simple I missed. I can take another look at it if it will
>> save some CPU cycles.
>>when I change the code to the following
> LONG WINAPI RegSaveKeyA( HKEY hkey, LPCSTR file, LPSECURITY_ATTRIBUTES sa )
{
WCHAR fileW[MAX_PATH];
- LONG ret, len;
+ LONG ret;
- len = WideCharToMultiByte(CP_ACP, 0, fileW, -1, file, 0, NULL, NULL);
- WideCharToMultiByte(CP_ACP, 0, fileW, -1, file, len, NULL, NULL);
+ MultiByteToWideChar(CP_ACP, 0, file, -1, fileW, MAX_PATH);
- ret = RegSaveKeyW( hkey, fileW.Buffer, sa );
+ ret = RegSaveKeyW( hkey, fileW, sa );
return ret;
}
>I get the following warning
>>warning: passing arg 5 of `WideCharToMultiByte' discards qualifiers from
>pointer target type
Well you should get a lot more warnings and even errors IMO. Look above as
to what I think the code should really look like.
Rolf Kalbermatter