From ed022d17fda03b04be0aac91f3a101486c165797 Mon Sep 17 00:00:00 2001 From: Magnus Olsen Date: Fri, 15 Sep 2006 10:36:50 +0000 Subject: [PATCH] arcoding winetest CreateEnhMetaFileA all param can be NULL and we fail on this. But this is only one bugfix, We need bugfix win32k now. To completed the bugfix svn path=/trunk/; revision=24130 --- reactos/dll/win32/gdi32/objects/metafile.c | 42 +++++++++++++--------- 1 file changed, 26 insertions(+), 16 deletions(-) diff --git a/reactos/dll/win32/gdi32/objects/metafile.c b/reactos/dll/win32/gdi32/objects/metafile.c index c428a0750cf..9ca1f02c93b 100644 --- a/reactos/dll/win32/gdi32/objects/metafile.c +++ b/reactos/dll/win32/gdi32/objects/metafile.c @@ -194,23 +194,33 @@ CreateEnhMetaFileA( LPWSTR lpFileNameW, lpDescriptionW; HDC rc = 0; - Status = HEAP_strdupA2W ( &lpFileNameW, lpFileName ); - if (!NT_SUCCESS (Status)) - SetLastError (RtlNtStatusToDosError(Status)); - else - { - Status = HEAP_strdupA2W ( &lpDescriptionW, lpDescription ); - if (!NT_SUCCESS (Status)) - SetLastError (RtlNtStatusToDosError(Status)); - else - { - rc = NtGdiCreateEnhMetaFile ( - hdcRef, lpFileNameW, (CONST LPRECT)lpRect, lpDescriptionW ); + lpFileNameW = NULL; + if (lpFileName != NULL) + { + Status = HEAP_strdupA2W ( &lpFileNameW, lpFileName ); + if (!NT_SUCCESS (Status)) + SetLastError (RtlNtStatusToDosError(Status)); - HEAP_free ( lpDescriptionW ); - } - HEAP_free ( lpFileNameW ); - } + return rc; + } + + lpDescriptionW = NULL; + if (lpDescription != NULL) + { + Status = HEAP_strdupA2W ( &lpDescriptionW, lpDescription ); + if (!NT_SUCCESS (Status)) + SetLastError (RtlNtStatusToDosError(Status)); + + return rc; + } + + rc = NtGdiCreateEnhMetaFile (hdcRef, lpFileNameW, (CONST LPRECT)lpRect, lpDescriptionW ); + + if (lpDescriptionW != NULL) + HEAP_free ( lpDescriptionW ); + + if (lpFileNameW != NULL) + HEAP_free ( lpFileNameW ); return rc; }