+ULONG
+WINAPI
+GetFontObjectA(HGDIOBJ hfont, ULONG cbSize, LPVOID lpBuffer)
+{
+ ENUMLOGFONTEXDVW elfedvW;
+ ENUMLOGFONTEXDVA elfedvA;
+ ULONG cbResult;
+
+ /* Check if size only is requested */
+ if (!lpBuffer) return sizeof(LOGFONTA);
+
+ /* Check for size 0 */
+ if (cbSize == 0)
+ {
+ /* Windows does not SetLastError() */
+ return 0;
+ }
+
+ /* Windows does this ... */
+ if (cbSize == sizeof(LOGFONTW)) cbSize = sizeof(LOGFONTA);
+
+ /* Call win32k to get the logfont (widechar) */
+ cbResult = NtGdiExtGetObjectW(hfont, sizeof(ENUMLOGFONTEXDVW), &elfedvW);
+ if (cbResult == 0)
+ {
+ return 0;
+ }
+
+ /* Convert the logfont from widechar to ansi */
+ EnumLogFontExW2A(&elfedvA.elfEnumLogfontEx, &elfedvW.elfEnumLogfontEx);
+ elfedvA.elfDesignVector = elfedvW.elfDesignVector;
+
+ /* Don't copy more than maximum */
+ if (cbSize > sizeof(ENUMLOGFONTEXDVA)) cbSize = sizeof(ENUMLOGFONTEXDVA);
+
+ /* Copy the number of bytes requested */
+ memcpy(lpBuffer, &elfedvA, cbSize);
+
+ /* Return the number of bytes copied */
+ return cbSize;
+}