Module: wine
Branch: master
Commit: 826e937a81ffe7169759b49f456a2836b2ae56fc
URL: http://source.winehq.org/git/wine.git/?a=commit;h=826e937a81ffe7169759b49f4…
Author: Dmitry Timoshkov <dmitry(a)codeweavers.com>
Date: Mon Mar 26 17:03:51 2007 +0900
gdi32: Implement GdiGetCodePage.
---
dlls/gdi32/font.c | 37 ++++++++++++++++++++++++-------------
dlls/gdi32/gdi32.spec | 4 ++--
include/wingdi.h | 1 +
3 files changed, 27 insertions(+), 15 deletions(-)
diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c
index e8b96c4..ea2e66c 100644
--- a/dlls/gdi32/font.c
+++ b/dlls/gdi32/font.c
@@ -347,22 +347,11 @@ static void FONT_NewTextMetricExWToA(const NEWTEXTMETRICEXW *ptmW, NEWTEXTMETRIC
/***********************************************************************
- * FONT_mbtowc
- *
- * Returns a Unicode translation of str using the charset of the
- * currently selected font in hdc. If count is -1 then str is assumed
- * to be '\0' terminated, otherwise it contains the number of bytes to
- * convert. If plenW is non-NULL, on return it will point to the
- * number of WCHARs that have been written. If pCP is non-NULL, on
- * return it will point to the codepage used in the conversion. The
- * caller should free the returned LPWSTR from the process heap
- * itself.
+ * GdiGetCodePage (GDI32.@)
*/
-static LPWSTR FONT_mbtowc(HDC hdc, LPCSTR str, INT count, INT *plenW, UINT *pCP)
+DWORD WINAPI GdiGetCodePage( HDC hdc )
{
UINT cp = CP_ACP;
- INT lenW;
- LPWSTR strW;
CHARSETINFO csi;
int charset = GetTextCharset(hdc);
@@ -402,6 +391,28 @@ static LPWSTR FONT_mbtowc(HDC hdc, LPCSTR str, INT count, INT *plenW, UINT *pCP)
}
TRACE("charset %d => cp %d\n", charset, cp);
+ return cp;
+}
+
+/***********************************************************************
+ * FONT_mbtowc
+ *
+ * Returns a Unicode translation of str using the charset of the
+ * currently selected font in hdc. If count is -1 then str is assumed
+ * to be '\0' terminated, otherwise it contains the number of bytes to
+ * convert. If plenW is non-NULL, on return it will point to the
+ * number of WCHARs that have been written. If pCP is non-NULL, on
+ * return it will point to the codepage used in the conversion. The
+ * caller should free the returned LPWSTR from the process heap
+ * itself.
+ */
+static LPWSTR FONT_mbtowc(HDC hdc, LPCSTR str, INT count, INT *plenW, UINT *pCP)
+{
+ UINT cp;
+ INT lenW;
+ LPWSTR strW;
+
+ cp = GdiGetCodePage( hdc );
if(count == -1) count = strlen(str);
lenW = MultiByteToWideChar(cp, 0, str, count, NULL, 0);
diff --git a/dlls/gdi32/gdi32.spec b/dlls/gdi32/gdi32.spec
index 10ec996..6f1c71b 100644
--- a/dlls/gdi32/gdi32.spec
+++ b/dlls/gdi32/gdi32.spec
@@ -178,8 +178,8 @@
@ stdcall GdiFlush()
# @ stub GdiFullscreenControl
@ stdcall GdiGetBatchLimit()
-@ stdcall GdiGetCharDimensions(ptr ptr ptr)
-# @ stub GdiGetCodePage
+@ stdcall GdiGetCharDimensions(long ptr ptr)
+@ stdcall GdiGetCodePage(long)
# @ stub GdiGetDC
# @ stub GdiGetDevmodeForPage
@ stub GdiGetLocalBitmap
diff --git a/include/wingdi.h b/include/wingdi.h
index a357c77..ca72f33 100644
--- a/include/wingdi.h
+++ b/include/wingdi.h
@@ -3396,6 +3396,7 @@ BOOL WINAPI GdiComment(HDC,UINT,const BYTE *);
DEVMODEW * WINAPI GdiConvertToDevmodeW(const DEVMODEA *);
BOOL WINAPI GdiFlush(void);
LONG WINAPI GdiGetCharDimensions(HDC, LPTEXTMETRICW, LONG *);
+DWORD WINAPI GdiGetCodePage(HDC);
BOOL WINAPI GdiGradientFill(HDC,PTRIVERTEX,ULONG,PVOID,ULONG,ULONG);
BOOL WINAPI GdiIsMetaFileDC(HDC);
BOOL WINAPI GdiIsMetaPrintDC(HDC);