Author: dchapyshev Date: Sat Aug 15 11:56:22 2009 New Revision: 42687
URL: http://svn.reactos.org/svn/reactos?rev=42687&view=rev Log: - Implement EnumObjects (untested) - Implement PolyTextOutA/W (from Wine) - Implement GetICMProfileA (from Wine) - Stub-implement CreateScalableFontResourceW (from Wine)
Modified: trunk/reactos/dll/win32/gdi32/misc/stubs.c trunk/reactos/dll/win32/gdi32/misc/stubsa.c trunk/reactos/dll/win32/gdi32/misc/stubsw.c
Modified: trunk/reactos/dll/win32/gdi32/misc/stubs.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/misc/stubs.... ============================================================================== --- trunk/reactos/dll/win32/gdi32/misc/stubs.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/gdi32/misc/stubs.c [iso-8859-1] Sat Aug 15 11:56:22 2009 @@ -138,7 +138,7 @@
/* - * @unimplemented + * @implemented */ int WINAPI @@ -147,10 +147,20 @@ GOBJENUMPROC lpObjectFunc, LPARAM lParam) { + ULONG ObjectsCount; + ULONG Size; + PVOID Buffer = NULL; + DWORD_PTR EndOfBuffer; + int Result = 0; + switch (nObjectType) { case OBJ_BRUSH: + Size = sizeof(LOGBRUSH); + break; + case OBJ_PEN: + Size = sizeof(LOGPEN); break;
default: @@ -158,9 +168,32 @@ return 0; }
- UNIMPLEMENTED; - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return 0; + ObjectsCount = NtGdiEnumObjects(hdc, nObjectType, 0, NULL); + if (!ObjectsCount) return 0; + + Buffer = HeapAlloc(GetProcessHeap(), 0, ObjectsCount * Size); + if (!Buffer) + { + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return 0; + } + + if (!NtGdiEnumObjects(hdc, nObjectType, ObjectsCount * Size, Buffer)) + { + HeapFree(GetProcessHeap(), 0, Buffer); + return 0; + } + + EndOfBuffer = (DWORD_PTR)Buffer + (ObjectsCount * Size); + while ((DWORD_PTR)Buffer < EndOfBuffer) + { + Result = lpObjectFunc(Buffer, lParam); + if (!Result) break; + Buffer = (PVOID)((DWORD_PTR)Buffer + Size); + } + + HeapFree(GetProcessHeap(), 0, Buffer); + return Result; }
Modified: trunk/reactos/dll/win32/gdi32/misc/stubsa.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/misc/stubsa... ============================================================================== --- trunk/reactos/dll/win32/gdi32/misc/stubsa.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/gdi32/misc/stubsa.c [iso-8859-1] Sat Aug 15 11:56:22 2009 @@ -40,15 +40,12 @@ */ BOOL WINAPI -PolyTextOutA( - HDC hdc, - CONST POLYTEXTA *a1, - int a2 - ) -{ - UNIMPLEMENTED; - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return FALSE; +PolyTextOutA( HDC hdc, const POLYTEXTA *pptxt, INT cStrings ) +{ + for (; cStrings>0; cStrings--, pptxt++) + if (!ExtTextOutA( hdc, pptxt->x, pptxt->y, pptxt->uiFlags, &pptxt->rcl, pptxt->lpstr, pptxt->n, pptxt->pdx )) + return FALSE; + return TRUE; }
/* @@ -79,9 +76,25 @@ LPSTR pszFilename ) { - UNIMPLEMENTED; - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return FALSE; + WCHAR filenameW[MAX_PATH]; + DWORD buflen = MAX_PATH; + BOOL ret = FALSE; + + if (!hdc || !pBufSize || !pszFilename) return FALSE; + + if (GetICMProfileW(hdc, &buflen, filenameW)) + { + int len = WideCharToMultiByte(CP_ACP, 0, filenameW, -1, NULL, 0, NULL, NULL); + if (*pBufSize >= len) + { + WideCharToMultiByte(CP_ACP, 0, filenameW, -1, pszFilename, *pBufSize, NULL, NULL); + ret = TRUE; + } + else SetLastError(ERROR_INSUFFICIENT_BUFFER); + *pBufSize = len; + } + + return ret; }
Modified: trunk/reactos/dll/win32/gdi32/misc/stubsw.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/misc/stubsw... ============================================================================== --- trunk/reactos/dll/win32/gdi32/misc/stubsw.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/gdi32/misc/stubsw.c [iso-8859-1] Sat Aug 15 11:56:22 2009 @@ -21,15 +21,12 @@ */ BOOL WINAPI -PolyTextOutW( - HDC hdc, - CONST POLYTEXTW *a1, - int a2 - ) -{ - UNIMPLEMENTED; - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return FALSE; +PolyTextOutW( HDC hdc, const POLYTEXTW *pptxt, INT cStrings ) +{ + for (; cStrings>0; cStrings--, pptxt++) + if (!ExtTextOutW( hdc, pptxt->x, pptxt->y, pptxt->uiFlags, &pptxt->rcl, pptxt->lpstr, pptxt->n, pptxt->pdx )) + return FALSE; + return TRUE; }
/* @@ -55,11 +52,13 @@ BOOL WINAPI GetICMProfileW( - HDC a0, - LPDWORD a1, - LPWSTR a2 - ) -{ + HDC hdc, + LPDWORD size, + LPWSTR filename + ) +{ + if (!hdc || !size || !filename) return FALSE; + UNIMPLEMENTED; SetLastError(ERROR_CALL_NOT_IMPLEMENTED); return FALSE; @@ -288,9 +287,22 @@ LPCWSTR lpszCurrentPath ) { - UNIMPLEMENTED; - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return FALSE; + HANDLE f; + + UNIMPLEMENTED; + + /* fHidden=1 - only visible for the calling app, read-only, not + * enumerated 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(lpszFontRes, 0, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0)) != INVALID_HANDLE_VALUE) { + CloseHandle(f); + SetLastError(ERROR_FILE_EXISTS); + return FALSE; + } + return FALSE; /* create failed */ }