mirror of
https://github.com/reactos/reactos.git
synced 2024-09-03 09:09:19 +00:00
fixed 2 bugs in HEAP_strdupA2W, moved the HEAP_ functions to their own file, and caching the results of RtlGetProcessHeap() for improved performance.
svn path=/trunk/; revision=5401
This commit is contained in:
parent
bd3999379b
commit
330f6dce4f
17
reactos/lib/gdi32/include/internal/heap.h
Normal file
17
reactos/lib/gdi32/include/internal/heap.h
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
// heap.h
|
||||||
|
|
||||||
|
#ifndef GDI32_INTERNAL_HEAP_H
|
||||||
|
#define GDI32_INTERNAL_HEAP_H
|
||||||
|
|
||||||
|
extern HANDLE hProcessHeap;
|
||||||
|
|
||||||
|
PVOID
|
||||||
|
HEAP_alloc ( DWORD len );
|
||||||
|
|
||||||
|
NTSTATUS
|
||||||
|
HEAP_strdupA2W ( LPWSTR* ppszW, LPCSTR lpszA );
|
||||||
|
|
||||||
|
VOID
|
||||||
|
HEAP_free ( LPVOID memory );
|
||||||
|
|
||||||
|
#endif//GDI32_INTERNAL_HEAP_H
|
|
@ -1,14 +1,15 @@
|
||||||
/*
|
/*
|
||||||
* dllmain.c
|
* dllmain.c
|
||||||
*
|
*
|
||||||
* $Revision: 1.7 $
|
* $Revision: 1.8 $
|
||||||
* $Author: chorns $
|
* $Author: royce $
|
||||||
* $Date: 2003/07/10 15:35:49 $
|
* $Date: 2003/08/04 00:28:44 $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <win32k/win32k.h>
|
#include <win32k/win32k.h>
|
||||||
|
#include <internal/heap.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* GDI32.DLL doesn't have an entry point. The initialization is done by a call
|
* GDI32.DLL doesn't have an entry point. The initialization is done by a call
|
||||||
|
@ -64,7 +65,7 @@ VOID
|
||||||
WINAPI
|
WINAPI
|
||||||
GdiProcessSetup (VOID)
|
GdiProcessSetup (VOID)
|
||||||
{
|
{
|
||||||
|
hProcessHeap = RtlGetProcessHeap();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# $Id: makefile,v 1.30 2003/07/21 03:56:27 royce Exp $
|
# $Id: makefile,v 1.31 2003/08/04 00:28:44 royce Exp $
|
||||||
|
|
||||||
PATH_TO_TOP = ../..
|
PATH_TO_TOP = ../..
|
||||||
|
|
||||||
|
@ -21,7 +21,12 @@ TARGET_LFLAGS = -nostartfiles -nostdlib
|
||||||
|
|
||||||
MAIN_OBJECTS = main/dllmain.o
|
MAIN_OBJECTS = main/dllmain.o
|
||||||
|
|
||||||
MISC_OBJECTS = misc/stubs.o misc/stubsa.o misc/stubsw.o misc/win32k.o
|
MISC_OBJECTS = \
|
||||||
|
misc/heap.o \
|
||||||
|
misc/stubs.o \
|
||||||
|
misc/stubsa.o \
|
||||||
|
misc/stubsw.o \
|
||||||
|
misc/win32k.o
|
||||||
|
|
||||||
OBJECTS_OBJECTS = \
|
OBJECTS_OBJECTS = \
|
||||||
objects/bitblt.o \
|
objects/bitblt.o \
|
||||||
|
|
46
reactos/lib/gdi32/misc/heap.c
Normal file
46
reactos/lib/gdi32/misc/heap.c
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
// heap.c
|
||||||
|
|
||||||
|
#undef WIN32_LEAN_AND_MEAN
|
||||||
|
#include <windows.h>
|
||||||
|
#include <ddk/ntddk.h>
|
||||||
|
#include <debug.h>
|
||||||
|
|
||||||
|
// global variables in a dll are process-global
|
||||||
|
HANDLE hProcessHeap = NULL;
|
||||||
|
|
||||||
|
PVOID
|
||||||
|
HEAP_alloc ( DWORD len )
|
||||||
|
{
|
||||||
|
/* make sure hProcessHeap gets initialized by GdiProcessSetup before we get here */
|
||||||
|
assert(hProcessHeap);
|
||||||
|
return RtlAllocateHeap ( hProcessHeap, 0, len );
|
||||||
|
}
|
||||||
|
|
||||||
|
NTSTATUS
|
||||||
|
HEAP_strdupA2W ( LPWSTR* ppszW, LPCSTR lpszA )
|
||||||
|
{
|
||||||
|
ULONG len;
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
*ppszW = NULL;
|
||||||
|
if ( !lpszA )
|
||||||
|
return STATUS_SUCCESS;
|
||||||
|
len = lstrlenA(lpszA);
|
||||||
|
|
||||||
|
*ppszW = HEAP_alloc ( (len+1) * sizeof(WCHAR) );
|
||||||
|
if ( !*ppszW )
|
||||||
|
return STATUS_NO_MEMORY;
|
||||||
|
Status = RtlMultiByteToUnicodeN ( *ppszW, len*sizeof(WCHAR), NULL, (PCHAR)lpszA, len );
|
||||||
|
(*ppszW)[len] = L'\0';
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
VOID
|
||||||
|
HEAP_free ( LPVOID memory )
|
||||||
|
{
|
||||||
|
/* make sure hProcessHeap gets initialized by GdiProcessSetup before we get here */
|
||||||
|
assert(hProcessHeap);
|
||||||
|
|
||||||
|
RtlFreeHeap ( hProcessHeap, 0, memory );
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: stubsa.c,v 1.20 2003/07/29 16:44:48 royce Exp $
|
/* $Id: stubsa.c,v 1.21 2003/08/04 00:28:44 royce Exp $
|
||||||
*
|
*
|
||||||
* reactos/lib/gdi32/misc/stubs.c
|
* reactos/lib/gdi32/misc/stubs.c
|
||||||
*
|
*
|
||||||
|
@ -20,29 +20,7 @@
|
||||||
#include <win32k/dc.h>
|
#include <win32k/dc.h>
|
||||||
#include <rosrtl/devmode.h>
|
#include <rosrtl/devmode.h>
|
||||||
#include <rosrtl/logfont.h>
|
#include <rosrtl/logfont.h>
|
||||||
|
#include <internal/heap.h>
|
||||||
NTSTATUS
|
|
||||||
STATIC
|
|
||||||
HEAP_strdupA2W ( HANDLE hHeap, LPWSTR* ppszW, LPCSTR lpszA )
|
|
||||||
{
|
|
||||||
ULONG len;
|
|
||||||
*ppszW = NULL;
|
|
||||||
if ( !lpszA )
|
|
||||||
return STATUS_SUCCESS;
|
|
||||||
len = lstrlenA(lpszA);
|
|
||||||
*ppszW = RtlAllocateHeap ( hHeap, 0, (len+1) * sizeof(WCHAR) );
|
|
||||||
if ( !*ppszW )
|
|
||||||
return STATUS_NO_MEMORY;
|
|
||||||
return RtlMultiByteToUnicodeN ( *ppszW, len, NULL, (PCHAR)lpszA, len );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
VOID
|
|
||||||
STATIC HEAP_free ( HANDLE hHeap, LPVOID memory )
|
|
||||||
{
|
|
||||||
RtlFreeHeap ( hHeap, 0, memory );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @implemented
|
||||||
|
@ -52,18 +30,17 @@ STDCALL
|
||||||
AddFontResourceExA ( LPCSTR lpszFilename, DWORD fl, PVOID pvReserved )
|
AddFontResourceExA ( LPCSTR lpszFilename, DWORD fl, PVOID pvReserved )
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
HANDLE hHeap = RtlGetProcessHeap();
|
|
||||||
PWSTR FilenameW;
|
PWSTR FilenameW;
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
|
||||||
Status = HEAP_strdupA2W ( hHeap, &FilenameW, lpszFilename );
|
Status = HEAP_strdupA2W ( &FilenameW, lpszFilename );
|
||||||
if ( !NT_SUCCESS (Status) )
|
if ( !NT_SUCCESS (Status) )
|
||||||
SetLastError (RtlNtStatusToDosError(Status));
|
SetLastError (RtlNtStatusToDosError(Status));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
rc = AddFontResourceExW ( FilenameW, fl, pvReserved );
|
rc = AddFontResourceExW ( FilenameW, fl, pvReserved );
|
||||||
|
|
||||||
HEAP_free ( hHeap, &FilenameW );
|
HEAP_free ( &FilenameW );
|
||||||
}
|
}
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
@ -90,18 +67,17 @@ CopyMetaFileA(
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
HANDLE hHeap = RtlGetProcessHeap();
|
|
||||||
PWSTR lpszFileW;
|
PWSTR lpszFileW;
|
||||||
HMETAFILE rc = 0;
|
HMETAFILE rc = 0;
|
||||||
|
|
||||||
Status = HEAP_strdupA2W ( hHeap, &lpszFileW, lpszFile );
|
Status = HEAP_strdupA2W ( &lpszFileW, lpszFile );
|
||||||
if (!NT_SUCCESS (Status))
|
if (!NT_SUCCESS (Status))
|
||||||
SetLastError (RtlNtStatusToDosError(Status));
|
SetLastError (RtlNtStatusToDosError(Status));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
rc = W32kCopyMetaFile ( Src, lpszFileW );
|
rc = W32kCopyMetaFile ( Src, lpszFileW );
|
||||||
|
|
||||||
HEAP_free ( hHeap, lpszFileW );
|
HEAP_free ( lpszFileW );
|
||||||
}
|
}
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
|
@ -121,22 +97,21 @@ CreateICA(
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
HANDLE hHeap = RtlGetProcessHeap();
|
|
||||||
LPWSTR lpszDriverW, lpszDeviceW, lpszOutputW;
|
LPWSTR lpszDriverW, lpszDeviceW, lpszOutputW;
|
||||||
DEVMODEW dvmInitW;
|
DEVMODEW dvmInitW;
|
||||||
HDC rc = 0;
|
HDC rc = 0;
|
||||||
|
|
||||||
Status = HEAP_strdupA2W ( hHeap, &lpszDriverW, lpszDriver );
|
Status = HEAP_strdupA2W ( &lpszDriverW, lpszDriver );
|
||||||
if (!NT_SUCCESS (Status))
|
if (!NT_SUCCESS (Status))
|
||||||
SetLastError (RtlNtStatusToDosError(Status));
|
SetLastError (RtlNtStatusToDosError(Status));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Status = HEAP_strdupA2W ( hHeap, &lpszDeviceW, lpszDevice );
|
Status = HEAP_strdupA2W ( &lpszDeviceW, lpszDevice );
|
||||||
if (!NT_SUCCESS (Status))
|
if (!NT_SUCCESS (Status))
|
||||||
SetLastError (RtlNtStatusToDosError(Status));
|
SetLastError (RtlNtStatusToDosError(Status));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Status = HEAP_strdupA2W ( hHeap, &lpszOutputW, lpszOutput );
|
Status = HEAP_strdupA2W ( &lpszOutputW, lpszOutput );
|
||||||
if (!NT_SUCCESS (Status))
|
if (!NT_SUCCESS (Status))
|
||||||
SetLastError (RtlNtStatusToDosError(Status));
|
SetLastError (RtlNtStatusToDosError(Status));
|
||||||
else
|
else
|
||||||
|
@ -149,11 +124,11 @@ CreateICA(
|
||||||
lpszOutputW,
|
lpszOutputW,
|
||||||
lpdvmInit ? &dvmInitW : NULL );
|
lpdvmInit ? &dvmInitW : NULL );
|
||||||
|
|
||||||
HEAP_free ( hHeap, lpszOutputW );
|
HEAP_free ( lpszOutputW );
|
||||||
}
|
}
|
||||||
HEAP_free ( hHeap, lpszDeviceW );
|
HEAP_free ( lpszDeviceW );
|
||||||
}
|
}
|
||||||
HEAP_free ( hHeap, lpszDriverW );
|
HEAP_free ( lpszDriverW );
|
||||||
}
|
}
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
@ -169,18 +144,17 @@ CreateMetaFileA(
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
HANDLE hHeap = RtlGetProcessHeap();
|
|
||||||
PWSTR lpszFileW;
|
PWSTR lpszFileW;
|
||||||
HDC rc = 0;
|
HDC rc = 0;
|
||||||
|
|
||||||
Status = HEAP_strdupA2W ( hHeap, &lpszFileW, lpszFile );
|
Status = HEAP_strdupA2W ( &lpszFileW, lpszFile );
|
||||||
if (!NT_SUCCESS (Status))
|
if (!NT_SUCCESS (Status))
|
||||||
SetLastError (RtlNtStatusToDosError(Status));
|
SetLastError (RtlNtStatusToDosError(Status));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
rc = W32kCreateMetaFile ( lpszFileW );
|
rc = W32kCreateMetaFile ( lpszFileW );
|
||||||
|
|
||||||
HEAP_free ( hHeap, lpszFileW );
|
HEAP_free ( lpszFileW );
|
||||||
}
|
}
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
@ -199,21 +173,20 @@ CreateScalableFontResourceA(
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
HANDLE hHeap = RtlGetProcessHeap();
|
|
||||||
LPWSTR lpszFontResW, lpszFontFileW, lpszCurrentPathW;
|
LPWSTR lpszFontResW, lpszFontFileW, lpszCurrentPathW;
|
||||||
BOOL rc = FALSE;
|
BOOL rc = FALSE;
|
||||||
|
|
||||||
Status = HEAP_strdupA2W ( hHeap, &lpszFontResW, lpszFontRes );
|
Status = HEAP_strdupA2W ( &lpszFontResW, lpszFontRes );
|
||||||
if (!NT_SUCCESS (Status))
|
if (!NT_SUCCESS (Status))
|
||||||
SetLastError (RtlNtStatusToDosError(Status));
|
SetLastError (RtlNtStatusToDosError(Status));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Status = HEAP_strdupA2W ( hHeap, &lpszFontFileW, lpszFontFile );
|
Status = HEAP_strdupA2W ( &lpszFontFileW, lpszFontFile );
|
||||||
if (!NT_SUCCESS (Status))
|
if (!NT_SUCCESS (Status))
|
||||||
SetLastError (RtlNtStatusToDosError(Status));
|
SetLastError (RtlNtStatusToDosError(Status));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Status = HEAP_strdupA2W ( hHeap, &lpszCurrentPathW, lpszCurrentPath );
|
Status = HEAP_strdupA2W ( &lpszCurrentPathW, lpszCurrentPath );
|
||||||
if (!NT_SUCCESS (Status))
|
if (!NT_SUCCESS (Status))
|
||||||
SetLastError (RtlNtStatusToDosError(Status));
|
SetLastError (RtlNtStatusToDosError(Status));
|
||||||
else
|
else
|
||||||
|
@ -223,13 +196,13 @@ CreateScalableFontResourceA(
|
||||||
lpszFontFileW,
|
lpszFontFileW,
|
||||||
lpszCurrentPathW );
|
lpszCurrentPathW );
|
||||||
|
|
||||||
HEAP_free ( hHeap, lpszCurrentPathW );
|
HEAP_free ( lpszCurrentPathW );
|
||||||
}
|
}
|
||||||
|
|
||||||
HEAP_free ( hHeap, lpszFontFileW );
|
HEAP_free ( lpszFontFileW );
|
||||||
}
|
}
|
||||||
|
|
||||||
HEAP_free ( hHeap, lpszFontResW );
|
HEAP_free ( lpszFontResW );
|
||||||
}
|
}
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
@ -288,18 +261,17 @@ EnumFontFamiliesA(
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
HANDLE hHeap = RtlGetProcessHeap();
|
|
||||||
LPWSTR lpszFamilyW;
|
LPWSTR lpszFamilyW;
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
|
||||||
Status = HEAP_strdupA2W ( hHeap, &lpszFamilyW, lpszFamily );
|
Status = HEAP_strdupA2W ( &lpszFamilyW, lpszFamily );
|
||||||
if (!NT_SUCCESS (Status))
|
if (!NT_SUCCESS (Status))
|
||||||
SetLastError (RtlNtStatusToDosError(Status));
|
SetLastError (RtlNtStatusToDosError(Status));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
rc = W32kEnumFontFamilies ( hdc, lpszFamilyW, lpEnumFontFamProc, lParam );
|
rc = W32kEnumFontFamilies ( hdc, lpszFamilyW, lpEnumFontFamProc, lParam );
|
||||||
|
|
||||||
HEAP_free ( hHeap, lpszFamilyW );
|
HEAP_free ( lpszFamilyW );
|
||||||
}
|
}
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
|
@ -319,18 +291,17 @@ EnumFontsA (
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
HANDLE hHeap = RtlGetProcessHeap();
|
|
||||||
LPWSTR lpFaceNameW;
|
LPWSTR lpFaceNameW;
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
|
||||||
Status = HEAP_strdupA2W ( hHeap, &lpFaceNameW, lpFaceName );
|
Status = HEAP_strdupA2W ( &lpFaceNameW, lpFaceName );
|
||||||
if (!NT_SUCCESS (Status))
|
if (!NT_SUCCESS (Status))
|
||||||
SetLastError (RtlNtStatusToDosError(Status));
|
SetLastError (RtlNtStatusToDosError(Status));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
rc = W32kEnumFonts ( hDC, lpFaceNameW, FontFunc, lParam );
|
rc = W32kEnumFonts ( hDC, lpFaceNameW, FontFunc, lParam );
|
||||||
|
|
||||||
HEAP_free ( hHeap, lpFaceNameW );
|
HEAP_free ( lpFaceNameW );
|
||||||
}
|
}
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
@ -450,18 +421,17 @@ GetMetaFileA(
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
HANDLE hHeap = RtlGetProcessHeap();
|
|
||||||
LPWSTR lpszMetaFileW;
|
LPWSTR lpszMetaFileW;
|
||||||
HMETAFILE rc = 0;
|
HMETAFILE rc = 0;
|
||||||
|
|
||||||
Status = HEAP_strdupA2W ( hHeap, &lpszMetaFileW, lpszMetaFile );
|
Status = HEAP_strdupA2W ( &lpszMetaFileW, lpszMetaFile );
|
||||||
if (!NT_SUCCESS (Status))
|
if (!NT_SUCCESS (Status))
|
||||||
SetLastError (RtlNtStatusToDosError(Status));
|
SetLastError (RtlNtStatusToDosError(Status));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
rc = W32kGetMetaFile ( lpszMetaFileW );
|
rc = W32kGetMetaFile ( lpszMetaFileW );
|
||||||
|
|
||||||
HEAP_free ( hHeap, lpszMetaFileW );
|
HEAP_free ( lpszMetaFileW );
|
||||||
}
|
}
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
|
@ -500,11 +470,10 @@ GetTextExtentExPointA(
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
HANDLE hHeap = RtlGetProcessHeap();
|
|
||||||
LPWSTR lpszStrW;
|
LPWSTR lpszStrW;
|
||||||
BOOL rc = 0;
|
BOOL rc = 0;
|
||||||
|
|
||||||
Status = HEAP_strdupA2W ( hHeap, &lpszStrW, lpszStr );
|
Status = HEAP_strdupA2W ( &lpszStrW, lpszStr );
|
||||||
if (!NT_SUCCESS (Status))
|
if (!NT_SUCCESS (Status))
|
||||||
SetLastError (RtlNtStatusToDosError(Status));
|
SetLastError (RtlNtStatusToDosError(Status));
|
||||||
else
|
else
|
||||||
|
@ -512,7 +481,7 @@ GetTextExtentExPointA(
|
||||||
rc = W32kGetTextExtentExPoint (
|
rc = W32kGetTextExtentExPoint (
|
||||||
hdc, lpszStrW, cchString, nMaxExtent, lpnFit, alpDx, lpSize );
|
hdc, lpszStrW, cchString, nMaxExtent, lpnFit, alpDx, lpSize );
|
||||||
|
|
||||||
HEAP_free ( hHeap, lpszStrW );
|
HEAP_free ( lpszStrW );
|
||||||
}
|
}
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
|
@ -566,18 +535,17 @@ RemoveFontResourceA(
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
HANDLE hHeap = RtlGetProcessHeap();
|
|
||||||
LPWSTR lpFileNameW;
|
LPWSTR lpFileNameW;
|
||||||
BOOL rc = 0;
|
BOOL rc = 0;
|
||||||
|
|
||||||
Status = HEAP_strdupA2W ( hHeap, &lpFileNameW, lpFileName );
|
Status = HEAP_strdupA2W ( &lpFileNameW, lpFileName );
|
||||||
if (!NT_SUCCESS (Status))
|
if (!NT_SUCCESS (Status))
|
||||||
SetLastError (RtlNtStatusToDosError(Status));
|
SetLastError (RtlNtStatusToDosError(Status));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
rc = W32kRemoveFontResource ( lpFileNameW );
|
rc = W32kRemoveFontResource ( lpFileNameW );
|
||||||
|
|
||||||
HEAP_free ( hHeap, lpFileNameW );
|
HEAP_free ( lpFileNameW );
|
||||||
}
|
}
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
|
@ -595,18 +563,17 @@ CopyEnhMetaFileA(
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
HANDLE hHeap = RtlGetProcessHeap();
|
|
||||||
LPWSTR lpszFileW;
|
LPWSTR lpszFileW;
|
||||||
HENHMETAFILE rc = 0;
|
HENHMETAFILE rc = 0;
|
||||||
|
|
||||||
Status = HEAP_strdupA2W ( hHeap, &lpszFileW, lpszFile );
|
Status = HEAP_strdupA2W ( &lpszFileW, lpszFile );
|
||||||
if (!NT_SUCCESS (Status))
|
if (!NT_SUCCESS (Status))
|
||||||
SetLastError (RtlNtStatusToDosError(Status));
|
SetLastError (RtlNtStatusToDosError(Status));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
rc = W32kCopyEnhMetaFile ( hemfSrc, lpszFileW );
|
rc = W32kCopyEnhMetaFile ( hemfSrc, lpszFileW );
|
||||||
|
|
||||||
HEAP_free ( hHeap, lpszFileW );
|
HEAP_free ( lpszFileW );
|
||||||
}
|
}
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
@ -625,16 +592,15 @@ CreateEnhMetaFileA(
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
HANDLE hHeap = RtlGetProcessHeap();
|
|
||||||
LPWSTR lpFileNameW, lpDescriptionW;
|
LPWSTR lpFileNameW, lpDescriptionW;
|
||||||
HDC rc = 0;
|
HDC rc = 0;
|
||||||
|
|
||||||
Status = HEAP_strdupA2W ( hHeap, &lpFileNameW, lpFileName );
|
Status = HEAP_strdupA2W ( &lpFileNameW, lpFileName );
|
||||||
if (!NT_SUCCESS (Status))
|
if (!NT_SUCCESS (Status))
|
||||||
SetLastError (RtlNtStatusToDosError(Status));
|
SetLastError (RtlNtStatusToDosError(Status));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Status = HEAP_strdupA2W ( hHeap, &lpDescriptionW, lpDescription );
|
Status = HEAP_strdupA2W ( &lpDescriptionW, lpDescription );
|
||||||
if (!NT_SUCCESS (Status))
|
if (!NT_SUCCESS (Status))
|
||||||
SetLastError (RtlNtStatusToDosError(Status));
|
SetLastError (RtlNtStatusToDosError(Status));
|
||||||
else
|
else
|
||||||
|
@ -642,9 +608,9 @@ CreateEnhMetaFileA(
|
||||||
rc = W32kCreateEnhMetaFile (
|
rc = W32kCreateEnhMetaFile (
|
||||||
hdc, lpFileNameW, (CONST LPRECT)lpRect, lpDescriptionW );
|
hdc, lpFileNameW, (CONST LPRECT)lpRect, lpDescriptionW );
|
||||||
|
|
||||||
HEAP_free ( hHeap, lpDescriptionW );
|
HEAP_free ( lpDescriptionW );
|
||||||
}
|
}
|
||||||
HEAP_free ( hHeap, lpFileNameW );
|
HEAP_free ( lpFileNameW );
|
||||||
}
|
}
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
|
@ -661,18 +627,17 @@ GetEnhMetaFileA(
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
HANDLE hHeap = RtlGetProcessHeap();
|
|
||||||
LPWSTR lpszMetaFileW;
|
LPWSTR lpszMetaFileW;
|
||||||
HENHMETAFILE rc = 0;
|
HENHMETAFILE rc = 0;
|
||||||
|
|
||||||
Status = HEAP_strdupA2W ( hHeap, &lpszMetaFileW, lpszMetaFile );
|
Status = HEAP_strdupA2W ( &lpszMetaFileW, lpszMetaFile );
|
||||||
if (!NT_SUCCESS (Status))
|
if (!NT_SUCCESS (Status))
|
||||||
SetLastError (RtlNtStatusToDosError(Status));
|
SetLastError (RtlNtStatusToDosError(Status));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
rc = W32kGetEnhMetaFile ( lpszMetaFileW );
|
rc = W32kGetEnhMetaFile ( lpszMetaFileW );
|
||||||
|
|
||||||
HEAP_free ( hHeap, lpszMetaFileW );
|
HEAP_free ( lpszMetaFileW );
|
||||||
}
|
}
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
|
@ -690,15 +655,13 @@ GetEnhMetaFileDescriptionA(
|
||||||
LPSTR lpszDescription
|
LPSTR lpszDescription
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
HANDLE hHeap;
|
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
LPWSTR lpszDescriptionW;
|
LPWSTR lpszDescriptionW;
|
||||||
UINT rc;
|
UINT rc;
|
||||||
|
|
||||||
if ( lpszDescription && cchBuffer )
|
if ( lpszDescription && cchBuffer )
|
||||||
{
|
{
|
||||||
hHeap = RtlGetProcessHeap();
|
lpszDescriptionW = (LPWSTR)HEAP_alloc ( cchBuffer*sizeof(WCHAR) );
|
||||||
lpszDescriptionW = (LPWSTR)RtlAllocateHeap ( hHeap, 0, cchBuffer*sizeof(WCHAR) );
|
|
||||||
if ( !lpszDescriptionW )
|
if ( !lpszDescriptionW )
|
||||||
{
|
{
|
||||||
SetLastError (RtlNtStatusToDosError(STATUS_NO_MEMORY));
|
SetLastError (RtlNtStatusToDosError(STATUS_NO_MEMORY));
|
||||||
|
@ -717,7 +680,7 @@ GetEnhMetaFileDescriptionA(
|
||||||
NULL,
|
NULL,
|
||||||
lpszDescriptionW,
|
lpszDescriptionW,
|
||||||
cchBuffer );
|
cchBuffer );
|
||||||
RtlFreeHeap ( hHeap, 0, lpszDescriptionW );
|
HEAP_free ( lpszDescriptionW );
|
||||||
if ( !NT_SUCCESS(Status) )
|
if ( !NT_SUCCESS(Status) )
|
||||||
{
|
{
|
||||||
SetLastError (RtlNtStatusToDosError(Status));
|
SetLastError (RtlNtStatusToDosError(Status));
|
||||||
|
|
Loading…
Reference in a new issue