mirror of
https://github.com/reactos/wine.git
synced 2024-11-25 12:49:45 +00:00
43 lines
1.3 KiB
C
43 lines
1.3 KiB
C
/*
|
|
* DNS support
|
|
*
|
|
* Copyright 2006 Hans Leidekker
|
|
*
|
|
* This library is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
* License as published by the Free Software Foundation; either
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
*
|
|
* This library is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
* License along with this library; if not, write to the Free Software
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
*/
|
|
|
|
|
|
static inline void *dns_alloc( SIZE_T size )
|
|
{
|
|
return HeapAlloc( GetProcessHeap(), 0, size );
|
|
}
|
|
|
|
static inline void dns_free( LPVOID mem )
|
|
{
|
|
HeapFree( GetProcessHeap(), 0, mem );
|
|
}
|
|
|
|
static inline LPWSTR dns_strdup_aw( LPCSTR str )
|
|
{
|
|
LPWSTR ret = NULL;
|
|
if (str)
|
|
{
|
|
DWORD len = MultiByteToWideChar( CP_ACP, 0, str, -1, NULL, 0 );
|
|
if ((ret = dns_alloc( len * sizeof(WCHAR) )))
|
|
MultiByteToWideChar( CP_ACP, 0, str, -1, ret, len );
|
|
}
|
|
return ret;
|
|
}
|