From 9f6198579488e17718f0c518b69dc40fb75c3652 Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Mon, 17 Feb 2003 16:27:31 +0000 Subject: [PATCH] Replaced kernel32 heap functions by ntdll heap functions. svn path=/trunk/; revision=4163 --- reactos/lib/kernel32/makefile | 4 +- reactos/lib/kernel32/misc/errormsg.c | 60 ++++++++++++++-------------- 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/reactos/lib/kernel32/makefile b/reactos/lib/kernel32/makefile index ef90ebfa38e..a8ddff08b48 100644 --- a/reactos/lib/kernel32/makefile +++ b/reactos/lib/kernel32/makefile @@ -1,4 +1,4 @@ -# $Id: makefile,v 1.60 2003/02/16 18:47:41 hbirr Exp $ +# $Id: makefile,v 1.61 2003/02/17 16:27:31 ekohl Exp $ PATH_TO_TOP = ../.. @@ -10,7 +10,7 @@ TARGET_BASE = 0x77f00000 TARGET_LFLAGS = -nostartfiles -nostdlib -TARGET_SDKLIBS = ntdll.a kernel32.a +TARGET_SDKLIBS = ntdll.a TARGET_GCCLIBS = gcc diff --git a/reactos/lib/kernel32/misc/errormsg.c b/reactos/lib/kernel32/misc/errormsg.c index 7a1ac55500f..1bf908c38ca 100644 --- a/reactos/lib/kernel32/misc/errormsg.c +++ b/reactos/lib/kernel32/misc/errormsg.c @@ -1,4 +1,4 @@ -/* $Id: errormsg.c,v 1.3 2003/01/07 17:29:08 robd Exp $ +/* $Id: errormsg.c,v 1.4 2003/02/17 16:27:08 ekohl Exp $ * * reactos/lib/kernel32/misc/errormsg.c * @@ -250,7 +250,7 @@ DWORD WINAPI FormatMessageA( from = NULL; if (dwFlags & FORMAT_MESSAGE_FROM_STRING) { - from = HeapAlloc( GetProcessHeap(), 0, strlen((LPSTR)lpSource)+1 ); + from = RtlAllocateHeap(RtlGetProcessHeap(), 0, strlen((LPSTR)lpSource)+1 ); strcpy( from, (LPSTR)lpSource ); } else { @@ -295,17 +295,17 @@ DWORD WINAPI FormatMessageA( return 0; } - from = HeapAlloc( GetProcessHeap(), 0, bufsize + 1 ); + from = RtlAllocateHeap(RtlGetProcessHeap(), 0, bufsize + 1 ); load_messageA(hmodule,dwMessageId,dwLanguageId,from,bufsize+1); } - target = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, 100); + target = RtlAllocateHeap(RtlGetProcessHeap(), HEAP_ZERO_MEMORY, 100); t = target; talloced= 100; #define ADD_TO_T(c) do { \ *t++=c;\ if (t-target == talloced) {\ - target = (char*)HeapReAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,target,talloced*2);\ + target = (char*)RtlReAllocateHeap(RtlGetProcessHeap(),HEAP_ZERO_MEMORY,target,talloced*2);\ t = target+talloced;\ talloced*=2;\ }\ @@ -351,17 +351,17 @@ DWORD WINAPI FormatMessageA( f++; if (NULL!=(x=strchr(f,'!'))) { *x='\0'; - fmtstr=HeapAlloc(GetProcessHeap(),0,strlen(f)+2); + fmtstr=RtlAllocateHeap(RtlGetProcessHeap(),0,strlen(f)+2); sprintf(fmtstr,"%%%s",f); f=x+1; } else { - fmtstr=HeapAlloc(GetProcessHeap(),0,strlen(f)+2); + fmtstr=RtlAllocateHeap(RtlGetProcessHeap(),0,strlen(f)+2); sprintf(fmtstr,"%%%s",f); f+=strlen(f); /*at \0*/ } } else { if(!args) break; - fmtstr = HeapAlloc(GetProcessHeap(),0,3); + fmtstr = RtlAllocateHeap(RtlGetProcessHeap(),0,3); strcpy( fmtstr, "%s" ); } if (args) { @@ -376,17 +376,17 @@ DWORD WINAPI FormatMessageA( /* FIXME: precision and width components are not handled correctly */ if ( (strcmp(fmtstr, "%ls") == 0) || (strcmp(fmtstr,"%S") == 0) ) { sz = WideCharToMultiByte( CP_ACP, 0, *(WCHAR**)argliststart, -1, NULL, 0, NULL, NULL); - b = HeapAlloc(GetProcessHeap(), 0, sz); + b = RtlAllocateHeap(RtlGetProcessHeap(), 0, sz); WideCharToMultiByte( CP_ACP, 0, *(WCHAR**)argliststart, -1, b, sz, NULL, NULL); } else { - b = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sz = 1000); + b = RtlAllocateHeap(RtlGetProcessHeap(), HEAP_ZERO_MEMORY, sz = 1000); /* CMF - This makes a BIG assumption about va_list */ TRACE("A BIG assumption\n"); //vsnprintf(b, sz, fmtstr, (va_list) argliststart); } for (x=b; *x; x++) ADD_TO_T(*x); - HeapFree(GetProcessHeap(),0,b); + RtlFreeHeap(RtlGetProcessHeap(),0,b); } else { /* NULL args - copy formatstr * (probably wrong) @@ -395,7 +395,7 @@ DWORD WINAPI FormatMessageA( ADD_TO_T(*lastf++); } } - HeapFree(GetProcessHeap(),0,fmtstr); + RtlFreeHeap(GetProcessHeap(),0,fmtstr); break; case 'n': ADD_TO_T('\r'); @@ -444,7 +444,7 @@ DWORD WINAPI FormatMessageA( } talloced = strlen(target)+1; if (nSize && talloced 0 && !MultiByteToWideChar( CP_ACP, 0, target, -1, lpBuffer, nSize )) lpBuffer[nSize-1] = 0; } - HeapFree(GetProcessHeap(),0,target); - if (from) HeapFree(GetProcessHeap(),0,from); + RtlFreeHeap(RtlGetProcessHeap(),0,target); + if (from) RtlFreeHeap(RtlGetProcessHeap(),0,from); return (dwFlags & FORMAT_MESSAGE_ALLOCATE_BUFFER) ? strlenW(*(LPWSTR*)lpBuffer): strlenW(lpBuffer);