mirror of
git://source.winehq.org/git/wine.git
synced 2024-11-05 18:01:34 +00:00
43 lines
991 B
C
43 lines
991 B
C
/*
|
|
* Win32 heap definitions
|
|
*
|
|
* Copyright 1996 Alexandre Julliard
|
|
*/
|
|
|
|
#ifndef __WINE_HEAP_H
|
|
#define __WINE_HEAP_H
|
|
|
|
#include <string.h>
|
|
|
|
#include "winbase.h"
|
|
#include "winnls.h"
|
|
#include "wine/unicode.h"
|
|
|
|
/* strdup macros */
|
|
/* DO NOT USE THEM!! they will go away soon */
|
|
|
|
inline static LPWSTR HEAP_strdupAtoW( HANDLE heap, DWORD flags, LPCSTR str )
|
|
{
|
|
LPWSTR ret;
|
|
INT len;
|
|
|
|
if (!str) return NULL;
|
|
len = MultiByteToWideChar( CP_ACP, 0, str, -1, NULL, 0 );
|
|
ret = HeapAlloc( heap, flags, len * sizeof(WCHAR) );
|
|
if (ret) MultiByteToWideChar( CP_ACP, 0, str, -1, ret, len );
|
|
return ret;
|
|
}
|
|
|
|
inline static LPSTR HEAP_strdupWtoA( HANDLE heap, DWORD flags, LPCWSTR str )
|
|
{
|
|
LPSTR ret;
|
|
INT len;
|
|
|
|
if (!str) return NULL;
|
|
len = WideCharToMultiByte( CP_ACP, 0, str, -1, NULL, 0, NULL, NULL );
|
|
ret = HeapAlloc( heap, flags, len );
|
|
if(ret) WideCharToMultiByte( CP_ACP, 0, str, -1, ret, len, NULL, NULL );
|
|
return ret;
|
|
}
|
|
|
|
#endif /* __WINE_HEAP_H */
|