From ce107e041500ed5cbd0df60ef860049e0d60f1c9 Mon Sep 17 00:00:00 2001 From: Royce Mitchell III Date: Mon, 21 Jul 2003 04:56:32 +0000 Subject: [PATCH] fixed declaration for W32kEnumFontFamiliesEx. Added RosRtlLogFontA2W and RosRtlLogFontW2A to lib/rosrtl more destubbing in gdi32/misc/stubsa/w.c svn path=/trunk/; revision=5205 --- reactos/include/rosrtl/logfont.h | 19 ++++ reactos/include/win32k/text.h | 2 +- reactos/lib/gdi32/misc/stubsa.c | 152 ++++++++++++++++++++++++------ reactos/lib/gdi32/misc/stubsw.c | 76 ++++++++------- reactos/lib/rosrtl/makefile | 3 +- reactos/lib/rosrtl/misc/devmode.c | 1 + reactos/lib/rosrtl/misc/logfont.c | 53 +++++++++++ 7 files changed, 243 insertions(+), 63 deletions(-) create mode 100644 reactos/include/rosrtl/logfont.h create mode 100644 reactos/lib/rosrtl/misc/logfont.c diff --git a/reactos/include/rosrtl/logfont.h b/reactos/include/rosrtl/logfont.h new file mode 100644 index 00000000000..820e798d2be --- /dev/null +++ b/reactos/include/rosrtl/logfont.h @@ -0,0 +1,19 @@ +/* logfont.h + */ + +#ifdef __cplusplus +extern "C" +{ +#endif + +void +RosRtlLogFontA2W ( LPLOGFONTW pW, const LPLOGFONTA pA ); + +void +RosRtlLogFontW2A ( LPLOGFONTA pA, const LPLOGFONTW pW ); + +#ifdef __cplusplus +} +#endif + +/* EOF */ diff --git a/reactos/include/win32k/text.h b/reactos/include/win32k/text.h index 9147044a85b..492c8fad03d 100644 --- a/reactos/include/win32k/text.h +++ b/reactos/include/win32k/text.h @@ -63,7 +63,7 @@ int STDCALL W32kEnumFontFamiliesEx(HDC hDC, LPLOGFONTW Logfont, - FONTENUMPROC EnumFontFamExProc, + FONTENUMEXPROC EnumFontFamExProc, LPARAM lParam, DWORD Flags); diff --git a/reactos/lib/gdi32/misc/stubsa.c b/reactos/lib/gdi32/misc/stubsa.c index ad87e68878f..e978535c142 100644 --- a/reactos/lib/gdi32/misc/stubsa.c +++ b/reactos/lib/gdi32/misc/stubsa.c @@ -1,4 +1,4 @@ -/* $Id: stubsa.c,v 1.13 2003/07/21 02:36:00 royce Exp $ +/* $Id: stubsa.c,v 1.14 2003/07/21 04:56:31 royce Exp $ * * reactos/lib/gdi32/misc/stubs.c * @@ -145,16 +145,31 @@ CreateICA( /* - * @unimplemented + * @implemented */ HDC STDCALL CreateMetaFileA( - LPCSTR a0 + LPCSTR lpszFile ) { - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return 0; + HDC rc; + NTSTATUS Status; + UNICODE_STRING File; + + Status = RtlCreateUnicodeStringFromAsciiz ( &File, + (PCSZ)lpszFile ); + if (!NT_SUCCESS (Status)) + { + SetLastError (RtlNtStatusToDosError(Status)); + return 0; + } + + rc = W32kCreateMetaFile ( File.Buffer ); + + RtlFreeUnicodeString ( &File ); + + return rc; } @@ -164,14 +179,50 @@ CreateMetaFileA( BOOL STDCALL CreateScalableFontResourceA( - DWORD a0, - LPCSTR a1, - LPCSTR a2, - LPCSTR a3 + DWORD fdwHidden, + LPCSTR lpszFontRes, + LPCSTR lpszFontFile, + LPCSTR lpszCurrentPath ) { - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return FALSE; + NTSTATUS Status; + UNICODE_STRING FontRes, FontFile, CurrentPath; + BOOL rc; + + Status = RtlCreateUnicodeStringFromAsciiz ( &FontRes, + (PCSZ)lpszFontRes ); + if (!NT_SUCCESS (Status)) + { + SetLastError (RtlNtStatusToDosError(Status)); + return 0; + } + + Status = RtlCreateUnicodeStringFromAsciiz ( &FontFile, + (PCSZ)lpszFontFile ); + if (!NT_SUCCESS (Status)) + { + SetLastError (RtlNtStatusToDosError(Status)); + return 0; + } + + Status = RtlCreateUnicodeStringFromAsciiz ( &CurrentPath, + (PCSZ)lpszCurrentPath ); + if (!NT_SUCCESS (Status)) + { + SetLastError (RtlNtStatusToDosError(Status)); + return 0; + } + + return W32kCreateScalableFontResource ( fdwHidden, + FontRes.Buffer, + FontFile.Buffer, + CurrentPath.Buffer ); + + RtlFreeUnicodeString ( &FontRes ); + RtlFreeUnicodeString ( &FontFile ); + RtlFreeUnicodeString ( &CurrentPath ); + + return rc; } @@ -181,15 +232,62 @@ CreateScalableFontResourceA( int STDCALL DeviceCapabilitiesExA( - LPCSTR a0, - LPCSTR a1, - WORD a2, - LPSTR a3, - CONST DEVMODEA *a4 + LPCSTR pDevice, + LPCSTR pPort, + WORD fwCapability, + LPSTR pOutput, + CONST DEVMODEA *pDevMode ) { - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return 0; +#if 0 + NTSTATUS Status; + UNICODE_STRING Device, Port, Output; + DEVMODEW DevModeW; + int rc; + + Status = RtlCreateUnicodeStringFromAsciiz ( &Device, + (PCSZ)pDevice ); + if (!NT_SUCCESS (Status)) + { + SetLastError (RtlNtStatusToDosError(Status)); + return 0; + } + + Status = RtlCreateUnicodeStringFromAsciiz ( &Port, + (PCSZ)pPort ); + if (!NT_SUCCESS (Status)) + { + SetLastError (RtlNtStatusToDosError(Status)); + return 0; + } + + Status = RtlCreateUnicodeStringFromAsciiz ( &Output, + (PCSZ)pOutput ); + if (!NT_SUCCESS (Status)) + { + SetLastError (RtlNtStatusToDosError(Status)); + return 0; + } + + if ( pDevMode ) + RosRtlDevModeA2W ( &DevModeW, (const LPDEVMODEA)pDevMode ); + + /* FIXME no W32kDeviceCapabilities???? */ + rc = W32kDeviceCapabilities ( Device.Buffer, + Port.Buffer, + fwCapability + Output.Buffer, + pDevMode ? &DevModeW : NULL ); + + RtlFreeUnicodeString ( &Device ); + RtlFreeUnicodeString ( &Port ); + RtlFreeUnicodeString ( &Output ); + + return rc; +#else + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return 0; +#endif } @@ -199,11 +297,11 @@ DeviceCapabilitiesExA( int STDCALL EnumFontFamiliesExA( - HDC a0, - LPLOGFONT a1, - FONTENUMEXPROC a2, - LPARAM a3, - DWORD a4 + HDC hdc, + LPLOGFONT lpLogFont, + FONTENUMEXPROC lpEnumFontFamProc, + LPARAM lParam, + DWORD dwFlags ) { SetLastError(ERROR_CALL_NOT_IMPLEMENTED); @@ -217,10 +315,10 @@ EnumFontFamiliesExA( int STDCALL EnumFontFamiliesA( - HDC a0, - LPCSTR a1, - FONTENUMPROC a2, - LPARAM a3 + HDC hdc, + LPCSTR lpszFamily, + FONTENUMPROC lpEnumFontFamProc, + LPARAM lParam ) { SetLastError(ERROR_CALL_NOT_IMPLEMENTED); diff --git a/reactos/lib/gdi32/misc/stubsw.c b/reactos/lib/gdi32/misc/stubsw.c index 72eb3460a8c..43712063135 100644 --- a/reactos/lib/gdi32/misc/stubsw.c +++ b/reactos/lib/gdi32/misc/stubsw.c @@ -1,4 +1,4 @@ -/* $Id: stubsw.c,v 1.13 2003/07/21 04:10:41 royce Exp $ +/* $Id: stubsw.c,v 1.14 2003/07/21 04:56:32 royce Exp $ * * reactos/lib/gdi32/misc/stubs.c * @@ -70,33 +70,34 @@ CreateICW( /* - * @unimplemented + * @implemented */ HDC STDCALL CreateMetaFileW( - LPCWSTR a0 + LPCWSTR lpszFile ) { - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return 0; + return W32kCreateMetaFile ( lpszFile ); } /* - * @unimplemented + * @implemented */ BOOL STDCALL CreateScalableFontResourceW( - DWORD a0, - LPCWSTR a1, - LPCWSTR a2, - LPCWSTR a3 + DWORD fdwHidden, + LPCWSTR lpszFontRes, + LPCWSTR lpszFontFile, + LPCWSTR lpszCurrentPath ) { - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return FALSE; + return W32kCreateScalableFontResource ( fdwHidden, + lpszFontRes, + lpszFontFile, + lpszCurrentPath ); } @@ -106,50 +107,57 @@ CreateScalableFontResourceW( int STDCALL DeviceCapabilitiesExW( - LPCWSTR a0, - LPCWSTR a1, - WORD a2, - LPWSTR a3, - CONST DEVMODEW *a4 + LPCWSTR pDevice, + LPCWSTR pPort, + WORD fwCapability, + LPWSTR pOutput, + CONST DEVMODEW *pDevMode ) { - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return 0; +#if 0 + /* FIXME no W32kDeviceCapabilities???? */ + return W32kDeviceCapabilities ( pDevice, + pPort, + fwCapability, + pOutput, + pDevMode ); +#else + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return 0; +#endif } /* - * @unimplemented + * @implemented */ int STDCALL EnumFontFamiliesExW( - HDC a0, - LPLOGFONT a1, - FONTENUMEXPROC a2, - LPARAM a3, - DWORD a4 + HDC hdc, + LPLOGFONT lpLogFont, + FONTENUMEXPROC lpEnumFontFamProc, + LPARAM lParam, + DWORD dwFlags ) { - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return 0; + return W32kEnumFontFamiliesEx ( hdc, lpLogFont, lpEnumFontFamProc, lParam, dwFlags ); } /* - * @unimplemented + * @implemented */ int STDCALL EnumFontFamiliesW( - HDC a0, - LPCWSTR a1, - FONTENUMPROC a2, - LPARAM a3 + HDC hdc, + LPCWSTR lpszFamily, + FONTENUMPROC lpEnumFontFamProc, + LPARAM lParam ) { - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return 0; + return W32kEnumFontFamilies ( hdc, lpszFamily, lpEnumFontFamProc, lParam ); } diff --git a/reactos/lib/rosrtl/makefile b/reactos/lib/rosrtl/makefile index ea58084a7e1..54f9e97d36c 100644 --- a/reactos/lib/rosrtl/makefile +++ b/reactos/lib/rosrtl/makefile @@ -1,4 +1,4 @@ -# $Id: makefile,v 1.6 2003/07/21 03:56:27 royce Exp $ +# $Id: makefile,v 1.7 2003/07/21 04:56:32 royce Exp $ PATH_TO_TOP = ../.. @@ -17,6 +17,7 @@ THREAD_OBJECTS = \ MISC_OBJECTS = \ misc/devmode.o \ + misc/logfont.o \ misc/qsort.o TARGET_OBJECTS = $(THREAD_OBJECTS) $(MISC_OBJECTS) diff --git a/reactos/lib/rosrtl/misc/devmode.c b/reactos/lib/rosrtl/misc/devmode.c index 2bd3011f12f..70c51b5f604 100644 --- a/reactos/lib/rosrtl/misc/devmode.c +++ b/reactos/lib/rosrtl/misc/devmode.c @@ -1,5 +1,6 @@ #include #include +#include void RosRtlDevModeA2W ( LPDEVMODEW pW, const LPDEVMODEA pA ) diff --git a/reactos/lib/rosrtl/misc/logfont.c b/reactos/lib/rosrtl/misc/logfont.c new file mode 100644 index 00000000000..1838ba14960 --- /dev/null +++ b/reactos/lib/rosrtl/misc/logfont.c @@ -0,0 +1,53 @@ +#include +#include +#include + +void +RosRtlLogFontA2W ( LPLOGFONTW pW, const LPLOGFONTA pA ) +{ +#define COPYS(f,len) MultiByteToWideChar ( CP_THREAD_ACP, 0, pA->f, len, pW->f, len ) +#define COPYN(f) pW->f = pA->f + + COPYN(lfHeight); + COPYN(lfWidth); + COPYN(lfEscapement); + COPYN(lfOrientation); + COPYN(lfWeight); + COPYN(lfItalic); + COPYN(lfUnderline); + COPYN(lfStrikeOut); + COPYN(lfCharSet); + COPYN(lfOutPrecision); + COPYN(lfClipPrecision); + COPYN(lfQuality); + COPYN(lfPitchAndFamily); + COPYS(lfFaceName,LF_FACESIZE); + +#undef COPYN +#undef COPYS +} + +void +RosRtlLogFontW2A ( LPLOGFONTA pA, const LPLOGFONTW pW ) +{ +#define COPYS(f,len) WideCharToMultiByte ( CP_THREAD_ACP, 0, pW->f, len, pA->f, len, NULL, NULL ) +#define COPYN(f) pA->f = pW->f + + COPYN(lfHeight); + COPYN(lfWidth); + COPYN(lfEscapement); + COPYN(lfOrientation); + COPYN(lfWeight); + COPYN(lfItalic); + COPYN(lfUnderline); + COPYN(lfStrikeOut); + COPYN(lfCharSet); + COPYN(lfOutPrecision); + COPYN(lfClipPrecision); + COPYN(lfQuality); + COPYN(lfPitchAndFamily); + COPYS(lfFaceName,LF_FACESIZE); + +#undef COPYN +#undef COPYS +}