ReactOS  0.4.15-dev-448-gd6c4411
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 
34 PVOID
36 {
37  /* make sure hProcessHeap gets initialized by GdiProcessSetup before we get here */
39  return RtlAllocateHeap ( hProcessHeap, 0, len );
40 }
41 
43 HEAP_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 
62 VOID
64 {
65  /* make sure hProcessHeap gets initialized by GdiProcessSetup before we get here */
67 
69 }
signed char * PCHAR
Definition: retypes.h:7
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:606
#define assert(x)
Definition: debug.h:53
HANDLE hProcessHeap
Definition: heap.c:31
static char memory[1024 *256]
Definition: process.c:116
PVOID HEAP_alloc(DWORD len)
Definition: heap.c:35
smooth NULL
Definition: ftsmooth.c:416
const char * LPCSTR
Definition: xmlstorage.h:183
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:588
NTSYSAPI NTSTATUS WINAPI RtlMultiByteToUnicodeN(LPWSTR, DWORD, LPDWORD, LPCSTR, DWORD)
__wchar_t WCHAR
Definition: xmlstorage.h:180
VOID HEAP_free(LPVOID memory)
Definition: heap.c:63
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR L[]
Definition: oid.c:1250
GLenum GLsizei len
Definition: glext.h:6722
Status
Definition: gdiplustypes.h:24
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
#define STATUS_NO_MEMORY
Definition: ntstatus.h:246
unsigned int ULONG
Definition: retypes.h:1
WCHAR * LPWSTR
Definition: xmlstorage.h:184
return STATUS_SUCCESS
Definition: btrfs.c:3014
NTSTATUS HEAP_strdupA2W(LPWSTR *ppszW, LPCSTR lpszA)
Definition: heap.c:43