> >   len = MultiByteToWideChar(CP_ACP,0,astr,-1,NULL,0);
> I noticed every call with the len = 0 to get the real length of the string sets the 
>LastError to ERROR_INVALID_PARAMETER. We
should fix that.
> Don't know exactly how but I think when internally used MultiByteToWideChar should 
>not influence the value of the LastError.
>
> I think we have the same problem with some more functions.
I run the following program and LastError is not overwritten.
But, LastError is overwritten if any error is happened.
At least, calling lstrcpynAtoW and lstrcpynWtoA with
insufficient buffer seems to cause this problem and should be fixed.
---
int main()
{
 DWORD dwErr;
 INT  len;

 SetLastError(0);
 len = lstrlenAtoW( "foo" );
 dwErr = GetLastError();
 printf( "%d %08x\n", len, dwErr );
 return 0;
}

the output is:
3 00000000
-----
Hidenori Takeshima




Reply via email to