From e1ae23e094a56657ece00b737aefafb75cc69b83 Mon Sep 17 00:00:00 2001 From: Lionel Ulmer Date: Wed, 24 Jul 2002 01:58:01 +0000 Subject: [PATCH] Properly check that the font resource is not already there. --- objects/font.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/objects/font.c b/objects/font.c index fd062078484..3fa2146b486 100644 --- a/objects/font.c +++ b/objects/font.c @@ -1964,6 +1964,8 @@ BOOL WINAPI CreateScalableFontResourceA( DWORD fHidden, LPCSTR lpszFontFile, LPCSTR lpszCurrentPath ) { + HANDLE f; + /* fHidden=1 - only visible for the calling app, read-only, not * enumbered with EnumFonts/EnumFontFamilies * lpszCurrentPath can be NULL @@ -1971,6 +1973,13 @@ BOOL WINAPI CreateScalableFontResourceA( DWORD fHidden, FIXME("(%ld,%s,%s,%s): stub\n", fHidden, debugstr_a(lpszResourceFile), debugstr_a(lpszFontFile), debugstr_a(lpszCurrentPath) ); + + /* If the output file already exists, return the ERROR_FILE_EXISTS error as specified in MSDN */ + if ((f = CreateFileA(lpszResourceFile, 0, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0)) != INVALID_HANDLE_VALUE) { + CloseHandle(f); + SetLastError(ERROR_FILE_EXISTS); + return FALSE; + } return FALSE; /* create failed */ } -- 2.11.4.GIT