Jeremy White : gdi32: Revise CreateScalableFontResourceA to pass through CreateScalableFontResourceW .
Alexandre Julliard
julliard at winehq.org
Mon Mar 10 07:16:53 CDT 2008
Module: wine
Branch: master
Commit: 5e1dd9577d41cd6a397c3da1c8c4a537dc37403a
URL: http://source.winehq.org/git/wine.git/?a=commit;h=5e1dd9577d41cd6a397c3da1c8c4a537dc37403a
Author: Jeremy White <jwhite at winehq.org>
Date: Fri Mar 7 10:11:09 2008 -0600
gdi32: Revise CreateScalableFontResourceA to pass through CreateScalableFontResourceW.
---
dlls/gdi32/font.c | 64 +++++++++++++++++++++++++++++++++++++++-------------
1 files changed, 48 insertions(+), 16 deletions(-)
diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c
index 7f29936..de82e70 100644
--- a/dlls/gdi32/font.c
+++ b/dlls/gdi32/font.c
@@ -2367,23 +2367,41 @@ BOOL WINAPI CreateScalableFontResourceA( DWORD fHidden,
LPCSTR lpszFontFile,
LPCSTR lpszCurrentPath )
{
- HANDLE f;
+ LPWSTR lpszResourceFileW = NULL;
+ LPWSTR lpszFontFileW = NULL;
+ LPWSTR lpszCurrentPathW = NULL;
+ int len;
+ BOOL ret;
- /* fHidden=1 - only visible for the calling app, read-only, not
- * enumbered with EnumFonts/EnumFontFamilies
- * lpszCurrentPath can be NULL
- */
- FIXME("(%d,%s,%s,%s): stub\n",
- fHidden, debugstr_a(lpszResourceFile), debugstr_a(lpszFontFile),
- debugstr_a(lpszCurrentPath) );
+ if (lpszResourceFile)
+ {
+ len = MultiByteToWideChar(CP_ACP, 0, lpszResourceFile, -1, NULL, 0);
+ lpszResourceFileW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
+ MultiByteToWideChar(CP_ACP, 0, lpszResourceFile, -1, lpszResourceFileW, len);
+ }
- /* 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;
+ if (lpszFontFile)
+ {
+ len = MultiByteToWideChar(CP_ACP, 0, lpszFontFile, -1, NULL, 0);
+ lpszFontFileW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
+ MultiByteToWideChar(CP_ACP, 0, lpszFontFile, -1, lpszFontFileW, len);
}
- return FALSE; /* create failed */
+
+ if (lpszCurrentPath)
+ {
+ len = MultiByteToWideChar(CP_ACP, 0, lpszCurrentPath, -1, NULL, 0);
+ lpszCurrentPathW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
+ MultiByteToWideChar(CP_ACP, 0, lpszCurrentPath, -1, lpszCurrentPathW, len);
+ }
+
+ ret = CreateScalableFontResourceW(fHidden, lpszResourceFileW,
+ lpszFontFileW, lpszCurrentPathW);
+
+ HeapFree(GetProcessHeap(), 0, lpszResourceFileW);
+ HeapFree(GetProcessHeap(), 0, lpszFontFileW);
+ HeapFree(GetProcessHeap(), 0, lpszCurrentPathW);
+
+ return ret;
}
/***********************************************************************
@@ -2394,8 +2412,22 @@ BOOL WINAPI CreateScalableFontResourceW( DWORD fHidden,
LPCWSTR lpszFontFile,
LPCWSTR lpszCurrentPath )
{
- FIXME("(%d,%p,%p,%p): stub\n",
- fHidden, lpszResourceFile, lpszFontFile, lpszCurrentPath );
+ HANDLE f;
+ FIXME("(%d,%s,%s,%s): stub\n",
+ fHidden, debugstr_w(lpszResourceFile), debugstr_w(lpszFontFile),
+ debugstr_w(lpszCurrentPath) );
+
+ /* fHidden=1 - only visible for the calling app, read-only, not
+ * enumbered with EnumFonts/EnumFontFamilies
+ * lpszCurrentPath can be NULL
+ */
+
+ /* If the output file already exists, return the ERROR_FILE_EXISTS error as specified in MSDN */
+ if ((f = CreateFileW(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 */
}
More information about the wine-cvs
mailing list