WLDAP32: implement ldap_err2string

Dmitry Timoshkov dmitry at baikal.ru
Fri Jul 29 08:55:50 CDT 2005


"Hans Leidekker" <hans at it.vu.nl> wrote:

> But according MSDN:
> 
>> The return value is a static pointer to the character string.
>> Do not free this string. 
> 
> How would you handle this using LoadString?

Something like this:

PCHAR ldap_err2stringA( ULONG err )
{
    static char buf[256];

    if (!LoadStringA(wldap_hinst, err, buf, 256))
        LoadStringA(wldap_hinst, IDS_DEFAULT_ERROR, buf, 256);

    return buf;
}

PWCHAR ldap_err2stringW( ULONG err )
{
    static WCHAR buf[256];

    if (!LoadStringW(wldap_hinst, err, buf, 256))
        LoadStringW(wldap_hinst, IDS_DEFAULT_ERROR, buf, 256);

    return buf;
}

-- 
Dmitry.




More information about the wine-devel mailing list