ReactOS 0.4.16-dev-1049-g378a335
heap.c File Reference
#include <precomp.h>
#include <debug.h>
Include dependency graph for heap.c:

Go to the source code of this file.

Functions

NTSTATUS FASTCALL HEAP_strdupA2W (_Outptr_ PWSTR *ppszW, _In_ PCSTR lpszA)
 
PWSTR FASTCALL HEAP_strdupA2W_buf (_In_ PCSTR lpszA, _In_ PWSTR pszStaticBuff, _In_ SIZE_T cchStaticBuff)
 

Variables

HANDLE hProcessHeap = NULL
 

Function Documentation

◆ HEAP_strdupA2W()

NTSTATUS FASTCALL HEAP_strdupA2W ( _Outptr_ PWSTR ppszW,
_In_ PCSTR  lpszA 
)

Definition at line 34 of file heap.c.

35{
36 ULONG len;
38
39 *ppszW = NULL;
40 if ( !lpszA )
41 return STATUS_SUCCESS;
42 len = lstrlenA(lpszA);
43
44 *ppszW = HEAP_alloc ( (len+1) * sizeof(WCHAR) );
45 if ( !*ppszW )
46 return STATUS_NO_MEMORY;
47 Status = RtlMultiByteToUnicodeN ( *ppszW, len*sizeof(WCHAR), NULL, (PCHAR)lpszA, len );
48 (*ppszW)[len] = UNICODE_NULL;
49 return Status;
50}
LONG NTSTATUS
Definition: precomp.h:26
#define STATUS_NO_MEMORY
Definition: d3dkmdt.h:51
#define NULL
Definition: types.h:112
Status
Definition: gdiplustypes.h:25
GLenum GLsizei len
Definition: glext.h:6722
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
_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 UNICODE_NULL
#define STATUS_SUCCESS
Definition: shellext.h:65
uint32_t ULONG
Definition: typedefs.h:59
char * PCHAR
Definition: typedefs.h:51
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by CreateICA(), EnumFontsA(), GetStringBitmapA(), and GetTextExtentExPointA().

◆ HEAP_strdupA2W_buf()

PWSTR FASTCALL HEAP_strdupA2W_buf ( _In_ PCSTR  lpszA,
_In_ PWSTR  pszStaticBuff,
_In_ SIZE_T  cchStaticBuff 
)

Definition at line 53 of file heap.c.

57{
58 if (!lpszA)
59 return NULL;
60
61 SIZE_T size = strlen(lpszA) + 1;
62 PWSTR pszW = (size < cchStaticBuff) ? pszStaticBuff : HEAP_alloc(size * sizeof(WCHAR));
63 if (!pszW)
64 return NULL;
65
66 RtlMultiByteToUnicodeN(pszW, size * sizeof(WCHAR), NULL, lpszA, size);
67 return pszW;
68}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
GLsizeiptr size
Definition: glext.h:5919
uint16_t * PWSTR
Definition: typedefs.h:56
ULONG_PTR SIZE_T
Definition: typedefs.h:80

Referenced by AddFontResourceExA(), and RemoveFontResourceExA().

Variable Documentation

◆ hProcessHeap

HANDLE hProcessHeap = NULL

Definition at line 31 of file heap.c.