Index: Include/api_gdi.sbp
===================================================================
--- Include/api_gdi.sbp	(revision 137)
+++ Include/api_gdi.sbp	(revision 141)
@@ -6,7 +6,35 @@
 
 #ifdef UNICODE
+Const _FuncName_CopyEnhMetaFile = "CopyEnhMetaFileW"
+Const _FuncName_CopyMetaFile = "CopyMetaFileW"
+Const _FuncName_CreateDC = "CreateDCW"
+Const _FuncName_CreateEnhMetaFile = "CreateEnhMetaFileW"
+Const _FuncName_CreateMetaFile = "CreateMetaFileW"
+Const _FuncName_CreateFont = "CreateFontW"
 Const _FuncName_CreateFontIndirect = "CreateFontIndirectW"
+Const _FuncName_GetEnhMetaFile = "GetEnhMetaFileW"
+Const _FuncName_GetEnhMetaFileDescription = "GetEnhMetaFileDescriptionW"
+Const _FuncName_GetObject = "GetObjectW"
+Const _FuncName_GetTextMetrics = "GetTextMetricsW"
+Const _FuncName_ResetDC = "ResetDCW"
+Const _FuncName_StartDoc = "StartDocW"
+Const _FuncName_wglUseFontBitmaps = "wglUseFontBitmapsW"
+Const _FuncName_wglUseFontOutlines = "wglUseFontOutlinesW"
 #else
+Const _FuncName_CopyEnhMetaFile = "CopyEnhMetaFileA"
+Const _FuncName_CopyMetaFile = "CopyMetaFileA"
+Const _FuncName_CreateDC = "CreateDCA"
+Const _FuncName_CreateEnhMetaFile = "CreateEnhMetaFileA"
+Const _FuncName_CreateMetaFile = "CreateMetaFileA"
+Const _FuncName_CreateFont = "CreateFontA"
 Const _FuncName_CreateFontIndirect = "CreateFontIndirectA"
+Const _FuncName_GetEnhMetaFile = "GetEnhMetaFileA"
+Const _FuncName_GetEnhMetaFileDescription = "GetEnhMetaFileDescriptionA"
+Const _FuncName_GetObject = "GetObjectA"
+Const _FuncName_GetTextMetrics = "GetTextMetricsA"
+Const _FuncName_ResetDC = "ResetDCA"
+Const _FuncName_StartDoc = "StartDocA"
+Const _FuncName_wglUseFontBitmaps = "wglUseFontBitmapsA"
+Const _FuncName_wglUseFontOutlines = "wglUseFontOutlinesA"
 #endif
 
@@ -402,6 +430,6 @@
 Const CCHDEVICENAME = 32
 Const CCHFORMNAME = 32
-Type _devicemodeA
-	dmDeviceName[ELM(CCHDEVICENAME)] As Byte
+Type DEVMODEW
+	dmDeviceName[ELM(CCHDEVICENAME)] As WCHAR
 	dmSpecVersion As Word
 	dmDriverVersion As Word
@@ -422,5 +450,5 @@
 	dmTTOption As Integer
 	dmCollate As Integer
-	dmFormName[ELM(CCHFORMNAME)] As Byte
+	dmFormName[ELM(CCHFORMNAME)] As WCHAR
 	dmLogPixels As Word
 	dmBitsPerPel As DWord
@@ -438,7 +466,45 @@
 	dmPanningHeight As DWord
 End Type
-TypeDef DEVMODEA = _devicemodeA
+Type DEVMODEA
+	dmDeviceName[ELM(CCHDEVICENAME)] As SByte
+	dmSpecVersion As Word
+	dmDriverVersion As Word
+	dmSize As Word
+	dmDriverExtra As Word
+	dmFields As DWord
+	dmOrientation As Integer
+	dmPaperSize As Integer
+	dmPaperLength As Integer
+	dmPaperWidth As Integer
+	dmScale As Integer
+	dmCopies As Integer
+	dmDefaultSource As Integer
+	dmPrintQuality As Integer
+	dmColor As Integer
+	dmDuplex As Integer
+	dmYResolution As Integer
+	dmTTOption As Integer
+	dmCollate As Integer
+	dmFormName[ELM(CCHFORMNAME)] As SByte
+	dmLogPixels As Word
+	dmBitsPerPel As DWord
+	dmPelsWidth As DWord
+	dmPelsHeight As DWord
+	dmDisplayFlags As DWord
+	dmDisplayFrequency As DWord
+	dmICMMethod As DWord
+	dmICMIntent As DWord
+	dmMediaType As DWord
+	dmDitherType As DWord
+	dmReserved1 As DWord
+	dmReserved2 As DWord
+	dmPanningWidth As DWord
+	dmPanningHeight As DWord
+End Type
+#ifdef UNICODE
+TypeDef DEVMODE = DEVMODEW
+#else
 TypeDef DEVMODE = DEVMODEA
-
+#endif
 
 ' Binary raster ops
@@ -480,5 +546,12 @@
 End Type
 
-Type DOCINFO
+Type DOCINFOW
+	cbSize As Long
+	lpszDocName As LPCWSTR
+	lpszOutput As LPCWSTR
+	lpszDatatype As LPCWSTR
+	fwType As DWord
+End Type
+Type DOCINFOA
 	cbSize As Long
 	lpszDocName As LPCSTR
@@ -487,4 +560,9 @@
 	fwType As DWord
 End Type
+#ifdef UNICODE
+TypeDef DOCINFO = DOCINFOW
+#else
+TypeDef DOCINFO = DOCINFOA
+#endif
 
 '-------------------
@@ -508,8 +586,8 @@
 Const RGN_COPY = 5
 Declare Function CombineRgn Lib "gdi32" (hrgnDest As HRGN, hrgnSrc1 As HRGN, hrgnSrc2 As HRGN, fnCombineMode As Long) As Long
-Declare Function CopyEnhMetaFile Lib "gdi32" Alias "CopyEnhMetaFileA" (hemfSrc As HENHMETAFILE, pszFile As PCSTR) As HENHMETAFILE
-Declare Function CopyMetaFile Lib "gdi32" Alias "CopyMetaFileA" (hmfSrc As HMETAFILE, pszFile As PCSTR) As HMETAFILE
+Declare Function CopyEnhMetaFile Lib "gdi32" Alias _FuncName_CopyEnhMetaFile (hemfSrc As HENHMETAFILE, pszFile As PCTSTR) As HENHMETAFILE
+Declare Function CopyMetaFile Lib "gdi32" Alias _FuncName_CopyMetaFile (hmfSrc As HMETAFILE, pszFile As PCTSTR) As HMETAFILE
 Declare Function CreateBitmap Lib "gdi32" (nWidth As Long, nHeight As Long, cPlanes As Long, cBitsPerPel As Long, lpvBits As VoidPtr) As HBITMAP
-Declare Function CreateBitmapIndirect Lib "gdi32" (ByRef lpbm As BITMAP) As HBITMAP
+Declare Function CreateBitmapIndirect Lib "gdi32" (ByRef bm As BITMAP) As HBITMAP
 
 Const BS_SOLID =          0
@@ -541,8 +619,8 @@
 Declare Function CreateCompatibleBitmap Lib "gdi32" (hdc As HDC, nWidth As Long, nHeight As Long) As HBITMAP
 Declare Function CreateCompatibleDC Lib "gdi32" (hdc As HDC) As HDC
-Declare Function CreateDC Lib "gdi32" Alias "CreateDCA" (lpszDriver As PCSTR, lpszDevice As PCSTR, lpszOutput As PCSTR, ByRef lpInitData As DEVMODE) As HDC
+Declare Function CreateDC Lib "gdi32" Alias _FuncName_CreateDC (pszDriver As PCTSTR, pszDevice As PCTSTR, pszOutput As PCTSTR, ByRef InitData As DEVMODE) As HDC
 
 Const CBM_INIT = &H04
-Declare Function CreateDIBitmap Lib "gdi32" (hdc As HDC, ByRef lpbmih As BITMAPINFOHEADER, fdwInit As Long, lpbInit As VoidPtr, ByRef lpbmi As BITMAPINFO, fuUsage As Long) As HBITMAP
+Declare Function CreateDIBitmap Lib "gdi32" (hdc As HDC, ByRef bmih As BITMAPINFOHEADER, fdwInit As Long, lpbInit As VoidPtr, ByRef bmi As BITMAPINFO, fuUsage As Long) As HBITMAP
 
 Declare Function CreateDIBPatternBrushPt Lib "gdi32" (lpPackedDIB As VoidPtr, iUsage As Long) As HBRUSH
@@ -550,6 +628,6 @@
 Declare Function CreateEllipticRgn Lib "gdi32" (nLeftRect As Long, nTopRect As Long, nRightRect As Long, nBottomRect As Long) As HRGN
 Declare Function CreateEllipticRgnIndirect Lib "gdi32" (ByRef lpRect As RECT) As HRGN
-Declare Function CreateEnhMetaFile Lib "gdi32" Alias "CreateEnhMetaFileA" (hdcRef As HDC, pFileName As PCTSTR, ByRef Rect As RECT, pDescription As PCTSTR) As HDC 
-Declare Function CreateMetaFile Lib "gdi32" Alias "CreateMetaFileA" (pFileName As PCTSTR) As HDC 
+Declare Function CreateEnhMetaFile Lib "gdi32" Alias _FuncName_CreateEnhMetaFile (hdcRef As HDC, pFileName As PCTSTR, ByRef Rect As RECT, pDescription As PCTSTR) As HDC
+Declare Function CreateMetaFile Lib "gdi32" Alias _FuncName_CreateMetaFile (pFileName As PCTSTR) As HDC
 
 Const FW_DONTCARE =       0
@@ -625,5 +703,5 @@
 Const FF_SCRIPT =         &H00040000
 Const FF_DECORATIVE =     &H00050000
-Declare Function CreateFont Lib "gdi32" Alias "CreateFontA" (nHeight As Long, nWidth As Long, nEscapement As Long, nOrientation As Long, fnWeight As Long, fdwItalic As DWord, fdwUnderline As DWord, fdwStrikeOut As DWord, fdwCharSet As DWord, fdwOutputPrecision As DWord, fdwClipPrecision As DWord, fdwQuality As DWord, fdwPitchAndFamily As DWord, lpszFace As PCSTR) As HFONT
+Declare Function CreateFont Lib "gdi32" Alias _FuncName_CreateFont (nHeight As Long, nWidth As Long, nEscapement As Long, nOrientation As Long, fnWeight As Long, fdwItalic As DWord, fdwUnderline As DWord, fdwStrikeOut As DWord, fdwCharSet As DWord, fdwOutputPrecision As DWord, fdwClipPrecision As DWord, fdwQuality As DWord, fdwPitchAndFamily As DWord, lpszFace As PCTSTR) As HFONT
 
 Const LF_FACESIZE = 32
@@ -642,5 +720,5 @@
 	lfQuality As Byte
 	lfPitchAndFamily As Byte
-	lfFaceName[ELM(LF_FACESIZE)] As Byte
+	lfFaceName[ELM(LF_FACESIZE)] As SByte
 End Type
 Type LOGFONTW
@@ -726,7 +804,7 @@
 Declare Function ExtTextOutW Lib "gdi32" (hdc As HDC, x As Long, y As Long, fuOptions As DWord, ByRef rc As RECT, lpString As PCWSTR, cbCount As Long, pDx As *Long) As Long
 #ifdef UNICODE
-Declare Function ExtTextOut Lib "gdi32" Alias "ExtTextOutW" (hdc As HDC, x As Long, y As Long, fuOptions As DWord, ByRef rc As RECT, lpString As PCTSTR, cbCount As Long, pDx As *Long) As Long
+Declare Function ExtTextOut Lib "gdi32" Alias "ExtTextOutW" (hdc As HDC, x As Long, y As Long, fuOptions As DWord, ByRef rc As RECT, pString As PCWSTR, cbCount As Long, pDx As *Long) As Long
 #else
-Declare Function ExtTextOut Lib "gdi32" Alias "ExtTextOutA" (hdc As HDC, x As Long, y As Long, fuOptions As DWord, ByRef rc As RECT, lpString As PCTSTR, cbCount As Long, pDx As *Long) As Long
+Declare Function ExtTextOut Lib "gdi32" Alias "ExtTextOutA" (hdc As HDC, x As Long, y As Long, fuOptions As DWord, ByRef rc As RECT, pString As PCSTR, cbCount As Long, pDx As *Long) As Long
 #endif
 Declare Function FillPath Lib "gdi32" (hdc As HDC) As Long
@@ -738,9 +816,10 @@
 Declare Function GetBkMode Lib "gdi32" (hdc As HDC) As Long
 Declare Function GetBrushOrgEx Lib "gdi32" (hdc As HDC, ByRef lppt As POINTAPI) As Long
-Declare Function GetCharWidth32 Lib "gdi32" Alias "GetCharWidth32A" (hdc As HDC, iFirstChar As Long, iLastChar As Long, lpBuffer As DWordPtr) As Long
+' only WinNT
+'Declare Function GetCharWidth32 Lib "gdi32" Alias "GetCharWidth32A" (hdc As HDC, iFirstChar As DWord, iLastChar As DWord, pBuffer As *DWord) As Long
 Declare Function GetClipBox Lib "gdi32" (hdc As HDC, ByRef lpRect As RECT) As Long
 Declare Function GetClipRgn Lib "gdi32" (hdc As HDC, hRgn As HRGN) As Long
 Declare Function GetCurrentObject Lib "gdi32" (hdc As HDC, dwObjectType As DWord) As HANDLE
-Declare Function GetCurrentPositionEx Lib "gdi32" (hdc As HDC, ByRef lpPoint As POINTAPI) As Long
+Declare Function GetCurrentPositionEx Lib "gdi32" (hdc As HDC, ByRef Point As POINTAPI) As Long
 
 Const DRIVERVERSION =   0
@@ -864,7 +943,7 @@
 
 Declare Function GetDIBits Lib "gdi32" (hdc As HDC, hbmp As HBITMAP, uStartScan As DWord, cScanLines As DWord, lpvBits As VoidPtr, ByRef lpbi As BITMAPINFO, uUsage As DWord) As Long
-Declare Function GetEnhMetaFile Lib "gdi32" Alias "GetEnhMetaFileA" (pszMetaFile As PCSTR) As HENHMETAFILE
+Declare Function GetEnhMetaFile Lib "gdi32" Alias _FuncName_GetEnhMetaFile (pszMetaFile As PCTSTR) As HENHMETAFILE
 Declare Function GetEnhMetaFileBits Lib "gdi32" (hemf As HENHMETAFILE, cbBuffer As DWord, pbBuffer As *Byte) As DWord
-Declare Function GetEnhMetaFileDescription Lib "gdi32" Alias "GetEnhMetaFileDescriptionA" (hemf As HENHMETAFILE, cbBuffer As DWord, pszDescription As PTSTR) As DWord
+Declare Function GetEnhMetaFileDescription Lib "gdi32" Alias _FuncName_GetEnhMetaFileDescription (hemf As HENHMETAFILE, cbBuffer As DWord, pszDescription As PTSTR) As DWord
 Declare Function GetEnhMetaFileHeader Lib "gdi32" (hemf As HENHMETAFILE, cbBuffer As DWord, ByRef emh As ENHMETAHEADER) As DWord
 Declare Function GetEnhMetaFilePaletteEntries Lib "gdi32" (hemf As HENHMETAFILE, cEntries As DWord, ByRef pe As PALETTEENTRY) As DWord
@@ -881,5 +960,5 @@
 Declare Function GetMetaFileBitsEx Lib "gdi32" (hmf As HMETAFILE, nSize As DWord, pvData As VoidPtr) As DWord
 Declare Function GetMiterLimit Lib "gdi32" (hdc As HDC, peLimit As SinglePtr) As Long
-Declare Function GetObject Lib "gdi32" Alias "GetObjectA" (hgdiobj As HANDLE, cbBuffer As Long, ByRef lpvObject As Any) As Long
+Declare Function GetObject Lib "gdi32" Alias _FuncName_GetObject (hgdiobj As HANDLE, cbBuffer As Long, ByRef pvObject As Any) As Long
 Declare Function GetObjectType Lib "gdi32" (hObject As HANDLE) As Long
 
@@ -931,7 +1010,7 @@
 Declare Function GetTextExtentPoint32W Lib "gdi32" (hdc As HDC, pString As PCWSTR, cbString As Long, ByRef Size As SIZE) As Long
 #ifdef UNICODE
-Declare Function GetTextExtentPoint32 Lib "gdi32" Alias "GetTextExtentPoint32W" (hdc As HDC, pString As PCTSTR, cbString As Long, ByRef Size As SIZE) As Long
+Declare Function GetTextExtentPoint32 Lib "gdi32" Alias "GetTextExtentPoint32W" (hdc As HDC, pString As PCWSTR, cbString As Long, ByRef Size As SIZE) As Long
 #else
-Declare Function GetTextExtentPoint32 Lib "gdi32" Alias "GetTextExtentPoint32A" (hdc As HDC, pString As PCTSTR, cbString As Long, ByRef Size As SIZE) As Long
+Declare Function GetTextExtentPoint32 Lib "gdi32" Alias "GetTextExtentPoint32A" (hdc As HDC, pString As PCSTR, cbString As Long, ByRef Size As SIZE) As Long
 #endif
 
@@ -940,5 +1019,5 @@
 Const TMPF_DEVICE =      &H08
 Const TMPF_TRUETYPE =    &H04
-Type TEXTMETRIC
+Type TEXTMETRICW
 	tmHeight As Long
 	tmAscent As Long
@@ -952,8 +1031,8 @@
 	tmDigitizedAspectX As Long
 	tmDigitizedAspectY As Long
-	tmFirstChar As Byte
-	tmLastChar As Byte
-	tmDefaultChar As Byte
-	tmBreakChar As Byte
+	tmFirstChar As WCHAR
+	tmLastChar As WCHAR
+	tmDefaultChar As WCHAR
+	tmBreakChar As WCHAR
 	tmItalic As Byte
 	tmUnderlined As Byte
@@ -962,5 +1041,32 @@
 	tmCharSet As Byte
 End Type
-Declare Function GetTextMetrics Lib "gdi32" Alias "GetTextMetricsA" (hdc As HDC, ByRef lptm As TEXTMETRIC) As Long
+Type TEXTMETRICA
+	tmHeight As Long
+	tmAscent As Long
+	tmDescent As Long
+	tmInternalLeading As Long
+	tmExternalLeading As Long
+	tmAveCharWidth As Long
+	tmMaxCharWidth As Long
+	tmWeight As Long
+	tmOverhang As Long
+	tmDigitizedAspectX As Long
+	tmDigitizedAspectY As Long
+	tmFirstChar As SByte
+	tmLastChar As SByte
+	tmDefaultChar As SByte
+	tmBreakChar As SByte
+	tmItalic As Byte
+	tmUnderlined As Byte
+	tmStruckOut As Byte
+	tmPitchAndFamily As Byte
+	tmCharSet As Byte
+End Type
+#ifdef UNICODE
+TypeDef TEXTMETRIC = TEXTMETRICW
+#else
+TypeDef TEXTMETRIC = TEXTMETRICA
+#endif
+Declare Function GetTextMetrics Lib "gdi32" Alias _FuncName_GetTextMetrics (hdc As HDC, ByRef tm As TEXTMETRIC) As Long
 
 Declare Function GetViewportExtEx Lib "gdi32" (hdc As HDC, ByRef lpSize As SIZE) As Long
@@ -998,5 +1104,5 @@
 Declare Function RectInRegion Lib "gdi32" (hRgn As HRGN, ByRef lpRect As RECT) As Long
 Declare Function RectVisible Lib "gdi32" (hdc As HDC, ByRef lpRect As RECT) As Long
-Declare Function ResetDC Lib "gdi32" Alias "ResetDCA" (hdc As HDC, ByRef lpInitData As DEVMODE) As HDC
+Declare Function ResetDC Lib "gdi32" Alias _FuncName_ResetDC (hdc As HDC, ByRef InitData As DEVMODE) As HDC
 Declare Function RestoreDC Lib "gdi32" (hdc As HDC, nSavedDC As Long) As Long
 Declare Function RoundRect Lib "gdi32" (hdc As HDC, nLeftRect As Long, nTopRect As Long, nRightRect As Long, nBottomRect As Long, nWidth As Long, nHeight As Long) As Long
@@ -1042,5 +1148,5 @@
 Declare Function SetWindowOrgEx Lib "gdi32" (hdc As HDC, x As Long, y As Long, ByRef lpPoint As POINTAPI) As Long
 Declare Function SetWinMetaFileBits Lib "gdi32" (cbBuffer As DWord, pbBuffer As *Byte, hdcRef As HDC, ByRef mfp As METAFILEPICT) As HENHMETAFILE
-Declare Function StartDoc Lib "gdi32" Alias "StartDocA" (hdc As HDC, ByRef ref_di As DOCINFO) As Long
+Declare Function StartDoc Lib "gdi32" Alias _FuncName_StartDoc (hdc As HDC, ByRef di As DOCINFO) As Long
 Declare Function StartPage Lib "gdi32" (hdc As HDC) As Long
 Declare Function StretchBlt Lib "gdi32" (hdcDest As HDC, nXOriginDest As Long, nYOriginDest As Long, nWidthDest As Long, nHeightDest As Long, hdcSrc As HDC, nXOriginSrc As Long, nYOriginSrc As Long, nWidthSrc As Long, nHeightSrc As Long, dwRop As DWord) As Long
@@ -1051,7 +1157,7 @@
 Declare Function TextOutW Lib "gdi32" (hdc As HDC, nXStart As Long, nYStart As Long, pString As PCWSTR, cbString As Long) As Long
 #ifdef UNICODE
-Declare Function TextOut Lib "gdi32" Alias "TextOutW" (hdc As HDC, nXStart As Long, nYStart As Long, pString As PCTSTR, cbString As Long) As Long
+Declare Function TextOut Lib "gdi32" Alias "TextOutW" (hdc As HDC, nXStart As Long, nYStart As Long, pString As PCWSTR, cbString As Long) As Long
 #else
-Declare Function TextOut Lib "gdi32" Alias "TextOutA" (hdc As HDC, nXStart As Long, nYStart As Long, pString As PCTSTR, cbString As Long) As Long
+Declare Function TextOut Lib "gdi32" Alias "TextOutA" (hdc As HDC, nXStart As Long, nYStart As Long, pString As PCSTR, cbString As Long) As Long
 #endif
 
@@ -1133,5 +1239,5 @@
 Declare Function wglMakeCurrent Lib "opengl32" (hdc As HDC, hglrc As HGLRC) As BOOL
 Declare Function wglShareLists Lib "opengl32" (hglrc1 As HGLRC, hglrc2 As HGLRC) As BOOL
-Declare Function wglUseFontBitmaps Lib "opengl32" Alias "wglUseFontBitmapsA" (hdc As HDC, first As DWord, count As DWord, listbase As DWord) As BOOL
+Declare Function wglUseFontBitmaps Lib "opengl32" Alias _FuncName_wglUseFontBitmaps (hdc As HDC, first As DWord, count As DWord, listbase As DWord) As BOOL
 Declare Function SwapBuffers Lib "gdi32" (hdc As HDC) As BOOL
 
@@ -1155,5 +1261,5 @@
 Const WGL_FONT_POLYGONS = 1
 
-Declare Function wglUseFontOutlines Lib "opengl32" Alias "wglUseFontOutlinesA" (hdc As HDC, first As DWord, count As DWord, listbase As DWord, deviation As Single, extrusion As Single, format As Long, ByRef lpgmf As GLYPHMETRICSFLOAT) As BOOL
+Declare Function wglUseFontOutlines Lib "opengl32" Alias _FuncName_wglUseFontOutlines (hdc As HDC, first As DWord, count As DWord, listbase As DWord, deviation As Single, extrusion As Single, format As Long, ByRef lpgmf As GLYPHMETRICSFLOAT) As BOOL
 
 Type LAYERPLANEDESCRIPTOR
