[PATCH] ws2_32: Implement GetHostNameW() function

Vijay Kiran Kamuju infyquest at gmail.com
Mon Jun 1 07:46:47 CDT 2020


On Mon, Jun 1, 2020 at 2:25 PM Dmitry Timoshkov <dmitry at baikal.ru> wrote:
>
> Vijay Kiran Kamuju <infyquest at gmail.com> wrote:
>
> > +int WINAPI GetHostNameW(PWSTR name, int namelen)
> > +{
> > +    char *nameA = NULL;
>
> Initialization to NULL is redundant.
I am getting warnings if we use it without initialization.
>
> > +    int ret;
> > +
> > +    TRACE("name %p, len %d\n", name, namelen);
> > +
> > +    if (!name)
> > +    {
> > +        SetLastError(WSAEFAULT);
> > +        return SOCKET_ERROR;
> > +    }
> > +    if (name && (!(nameA = HeapAlloc(GetProcessHeap(), 0, namelen))))
>
> 'name' can't be NULL at this point. 'namelen' for a multibyte string
> could be longer than length for a unicode one.
Should the nameA be allocated the size of namelen*sizeof(WCHAR)?
>
> --
> Dmitry.



More information about the wine-devel mailing list