3 * This library is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU Lesser General Public
5 * License as published by the Free Software Foundation; either
6 * version 2.1 of the License, or (at your option) any later version.
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
13 * You should have received a copy of the GNU Lesser General Public
14 * License along with this library; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 * COPYRIGHT: See COPYING in the top level directory
20 * PROJECT: ReactOS GDI32
22 * FILE: lib/gdi32/misc/heap.c
31 // global variables in a dll are process-global
32 HANDLE hProcessHeap
= NULL
;
36 HEAP_alloc ( DWORD len
)
38 /* make sure hProcessHeap gets initialized by GdiProcessSetup before we get here */
40 return RtlAllocateHeap ( hProcessHeap
, 0, len
);
44 HEAP_strdupA2W ( LPWSTR
* ppszW
, LPCSTR lpszA
)
51 return STATUS_SUCCESS
;
52 len
= lstrlenA(lpszA
);
54 *ppszW
= HEAP_alloc ( (len
+1) * sizeof(WCHAR
) );
56 return STATUS_NO_MEMORY
;
57 Status
= RtlMultiByteToUnicodeN ( *ppszW
, len
*sizeof(WCHAR
), NULL
, (PCHAR
)lpszA
, len
);
58 (*ppszW
)[len
] = L
'\0';
64 HEAP_free ( LPVOID memory
)
66 /* make sure hProcessHeap gets initialized by GdiProcessSetup before we get here */
69 RtlFreeHeap ( hProcessHeap
, 0, memory
);