ReactOS 0.4.15-dev-7906-g1b85a5f
heap.c
Go to the documentation of this file.
1/*
2 *
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.
7 *
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.
12 *
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
16 */
17/*
18 * COPYRIGHT: See COPYING in the top level directory
19 * PROJECT: ReactOS GDI32
20 * PURPOSE:
21 * FILE: win32ss/gdi/gdi32/misc/heap.c
22 * PROGRAMER:
23 * REVISION HISTORY:
24 * NOTES:
25 */
26
27#include <precomp.h>
28#include <debug.h>
29
30// global variables in a dll are process-global
32
33
36{
37 /* make sure hProcessHeap gets initialized by GdiProcessSetup before we get here */
39 return RtlAllocateHeap ( hProcessHeap, 0, len );
40}
41
43HEAP_strdupA2W ( LPWSTR* ppszW, LPCSTR lpszA )
44{
45 ULONG len;
47
48 *ppszW = NULL;
49 if ( !lpszA )
50 return STATUS_SUCCESS;
51 len = lstrlenA(lpszA);
52
53 *ppszW = HEAP_alloc ( (len+1) * sizeof(WCHAR) );
54 if ( !*ppszW )
55 return STATUS_NO_MEMORY;
56 Status = RtlMultiByteToUnicodeN ( *ppszW, len*sizeof(WCHAR), NULL, (PCHAR)lpszA, len );
57 (*ppszW)[len] = L'\0';
58 return Status;
59}
60
61
62VOID
64{
65 /* make sure hProcessHeap gets initialized by GdiProcessSetup before we get here */
67
69}
LONG NTSTATUS
Definition: precomp.h:26
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:590
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:608
#define NULL
Definition: types.h:112
#define assert(x)
Definition: debug.h:53
unsigned long DWORD
Definition: ntddk_ex.h:95
Status
Definition: gdiplustypes.h:25
GLenum GLsizei len
Definition: glext.h:6722
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
static char memory[1024 *256]
Definition: process.c:116
_Use_decl_annotations_ NTSTATUS NTAPI RtlMultiByteToUnicodeN(_Out_ PWCH UnicodeString, _In_ ULONG UnicodeSize, _Out_opt_ PULONG ResultSize, _In_ PCCH MbString, _In_ ULONG MbSize)
Definition: nlsboot.c:62
#define STATUS_NO_MEMORY
Definition: ntstatus.h:260
#define L(x)
Definition: ntvdm.h:50
#define STATUS_SUCCESS
Definition: shellext.h:65
uint32_t ULONG
Definition: typedefs.h:59
char * PCHAR
Definition: typedefs.h:51
PVOID HEAP_alloc(DWORD len)
Definition: heap.c:35
NTSTATUS HEAP_strdupA2W(LPWSTR *ppszW, LPCSTR lpszA)
Definition: heap.c:43
VOID HEAP_free(LPVOID memory)
Definition: heap.c:63
HANDLE hProcessHeap
Definition: heap.c:31
const char * LPCSTR
Definition: xmlstorage.h:183
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184