Index: /Include/Classes/System/IO/Stream.ab
===================================================================
--- /Include/Classes/System/IO/Stream.ab	(revision 118)
+++ /Include/Classes/System/IO/Stream.ab	(revision 119)
@@ -1,18 +1,40 @@
+
+#require <Classes/System/misc.ab>
 
 Class Stream
-Public
+Public 'Protected
 	Sub Stream():	End Sub
 Public
-	Virtual Function CanRead() As Boolean:	End Function
-	Virtual Function CanSeek() As Boolean:	End Function
-	Virtual Function CanTimeout() As Boolean:	End Function
-	Virtual Function CanWrite() As Boolean:	End Function
-	Virtual Function Length() As Int64:	End Function
-	Virtual Sub Position(value As Int64):	End Sub
-	Virtual Function Position() As Int64:	End Function
-	Virtual Sub ReadTimeout(value As Long):	End Sub
-	Virtual Function ReadTimeout() As Long:	End Function
-	Virtual Sub WriteTimeout(value As Long):	End Sub
-	Virtual Function WriteTimeout() As Long:	End Function
+	Virtual Sub ~Stream()
+		Close()
+	End Sub
+Public
+	Abstract Function CanRead() As Boolean
+	Abstract Function CanSeek() As Boolean
+
+	Virtual Function CanTimeout() As Boolean
+		Return True
+	End Function
+
+	Abstract Function CanWrite() As Boolean
+	Abstract Function Length() As Int64
+	Abstract Sub Position(value As Int64)
+	Abstract Function Position() As Int64
+
+	Virtual Sub ReadTimeout(value As Long)
+		' Throw InvalidOperationException
+	End Sub
+
+	Virtual Function ReadTimeout() As Long
+		' Throw InvalidOperationException
+	End Function
+
+	Virtual Sub WriteTimeout(value As Long)
+		' Throw InvalidOperationException
+	End Sub
+
+	Virtual Function WriteTimeout() As Long
+		' Throw InvalidOperationException
+	End Function
 
 Public
@@ -22,12 +44,24 @@
 	Virtual Function EndRead(ByRef asyncResult As IAsyncResult) As Long:	End Function
 	Virtual Sub EndWrite(ByRef asyncResult As IAsyncResult):	End Sub
-	Virtual Sub Flush():	End Sub
-	Virtual Function Read(ByRef buffer[] As Byte, offset As Long, count As Long) As Long:	End Function
-	Virtual Function ReadByte() As Long:	End Function
-	Virtual Function Seek(offset As Int64, origin As SeekOrigin) As Long:	End Function
-	Virtual Sub SetLength(value As Int64):	End Sub
-	Virtual Sub Write (ByRef buffer[] As Byte, offset As Long, count As Long):	End Sub
-	Virtual Sub WriteByte(value As Byte):	End Sub
+	Abstract Sub Flush()
+	Abstract Function Read(ByRef buffer[] As Byte, offset As Long, count As Long) As Long
 
+	Virtual Function ReadByte() As Long
+		Dim b As Byte
+		Dim ret = Read(VarPtr(b), 0, 1)
+		If ret <> 0 Then
+			Return b
+		Else
+			Return -1
+		End If
+	End Function
+
+	Abstract Function Seek(offset As Int64, origin As SeekOrigin) As Long
+	Abstract Sub SetLength(value As Int64):	End Sub
+	Abstract Sub Write(ByRef buffer[] As Byte, offset As Long, count As Long)
+
+	Virtual Sub WriteByte(b As Byte)
+		Write(VarPtr(b), 0, 1)
+	End Sub
 Protected
 	Virtual Function CreateWaitHandle() As WaitHandle:	End Function
Index: /Include/Classes/System/String.ab
===================================================================
--- /Include/Classes/System/String.ab	(revision 118)
+++ /Include/Classes/System/String.ab	(revision 119)
@@ -2,5 +2,5 @@
 	m_Length As Long
 Public
-	Chars As LPSTR
+	Chars As *Char
 
 	Sub String()
@@ -9,5 +9,5 @@
 	End Sub
 
-	Sub String(initStr As LPSTR)
+	Sub String(initStr As *Char)
 		String()
 		Assign(initStr)
@@ -24,5 +24,5 @@
 	End Sub
 */
-	Sub String(initChar As Byte, length As Long)
+	Sub String(initChar As Char, length As Long)
 		ReSize(length, initChar)
 	End Sub
@@ -40,5 +40,5 @@
 	End Function
 
-	Function Operator() As LPSTR
+	Function Operator() As *Char
 		Return Chars
 	End Function
@@ -48,17 +48,17 @@
 	End Sub
 
-	Sub Operator = (text As LPSTR)
+	Sub Operator = (text As *Char)
 		Assign(text)
 	End Sub
 
-	Function Operator[] (n As Long) As Byte
+	Function Operator[] (n As Long) As Char
 		Return Chars[n]
 	End Function
 
-	Sub Operator[]= (n As Long, c As Byte)
+	Sub Operator[]= (n As Long, c As Char)
 		Chars[n] = c
 	End Sub
 
-	Function Operator+ (lpszText As LPSTR) As String
+	Function Operator+ (lpszText As *Char) As String
 		Return Concat(lpszText, lstrlen(lpszText))
 	End Function
@@ -68,5 +68,5 @@
 	End Function
 
-	Function Operator& (lpszText As LPSTR) As String
+	Function Operator& (lpszText As *Char) As String
 		Dim tempString As String
 		tempString=This+lpszText
@@ -88,5 +88,5 @@
 	End Function
 
-	Function Operator== (lpszText As LPSTR) As Long
+	Function Operator== (lpszText As *Char) As Long
 		If lstrcmp(This, lpszText) = 0 Then
 			Return _System_TRUE
@@ -100,5 +100,5 @@
 	End Function
 
-	Function Operator<> (lpszText As LPSTR) As Long
+	Function Operator<> (lpszText As *Char) As Long
 		Return lstrcmp(This, lpszText)
 	End Function
@@ -112,5 +112,5 @@
 	End Function
 
-	Function Operator< (lpszText As LPSTR) As Long
+	Function Operator< (lpszText As *Char) As Long
 		If lstrcmp(This, lpszText) < 0 Then
 			Return _System_TRUE
@@ -128,5 +128,5 @@
 	End Function
 
-	Function Operator> (lpszText As LPSTR) As Long
+	Function Operator> (lpszText As *Char) As Long
 		If lstrcmp(This, lpszText) > 0 Then
 			Return _System_TRUE
@@ -144,5 +144,5 @@
 	End Function
 
-	Function Operator<= (lpszText As LPSTR) As Long
+	Function Operator<= (lpszText As *Char) As Long
 		If lstrcmp(This, lpszText) <= 0 Then
 			Return _System_TRUE
@@ -160,5 +160,5 @@
 	End Function
 
-	Function Operator>= (lpszText As LPSTR) As Long
+	Function Operator>= (lpszText As *Char) As Long
 		If lstrcmp(This, lpszText) => 0 Then
 			Return _System_TRUE
@@ -168,5 +168,5 @@
 	End Function
 
-	Function StrPtr() As LPSTR
+	Function StrPtr() As *Char
 		Return Chars
 	End Function
@@ -186,5 +186,5 @@
 	End Sub
 
-	Sub ReSize(allocLength As Long, c As Byte)
+	Sub ReSize(allocLength As Long, c As Char)
 		If allocLength < 0 Then
 			Exit Sub
@@ -201,5 +201,5 @@
 	End Sub
 
-	Sub Assign(lpszText As LPSTR, textLength As Long)
+	Sub Assign(lpszText As *Char, textLength As Long)
 		If lpszText = Chars Then Exit Sub
 		If AllocStringBuffer(textLength) <> 0 Then
@@ -213,5 +213,5 @@
 	End Sub
 
-	Sub Assign(lpszText As LPSTR)
+	Sub Assign(lpszText As *Char)
 		If lpszText Then
 			Assign(lpszText, lstrlen(lpszText))
@@ -223,5 +223,5 @@
 	End Sub
 
-	Sub Append(lpszText As LPSTR, textLength As Long)
+	Sub Append(lpszText As *Char, textLength As Long)
 		Dim prevLen As Long
 		prevLen = m_Length
@@ -232,5 +232,5 @@
 	End Sub
 
-	Sub Append(text As LPSTR)
+	Sub Append(text As *Char)
 		Append(text, lstrlen(text))
 	End Sub
@@ -240,5 +240,5 @@
 	End Sub
 
-	Function Concat(lpszText As LPSTR, textLength As Long) As String
+	Function Concat(lpszText As *Char, textLength As Long) As String
 		Dim tempString As String
 		With tempString
@@ -259,5 +259,5 @@
 	End Function
 
-	Function Contains(lpszText As LPSTR) As BOOL
+	Function Contains(lpszText As *Char) As BOOL
 		If IndexOf(lpszText, 0, m_Length) >= 0 Then
 			Return _System_TRUE
@@ -267,13 +267,13 @@
 	End Function
 
-	Function IndexOf(lpszText As LPSTR) As Long
+	Function IndexOf(lpszText As *Char) As Long
 		Return IndexOf(lpszText, 0, m_Length)
 	End Function
 
-	Function IndexOf(lpszText As LPSTR, startIndex As Long) As Long
+	Function IndexOf(lpszText As *Char, startIndex As Long) As Long
 		Return IndexOf(lpszText, startIndex, m_Length - startIndex)
 	End Function
 
-	Function IndexOf(lpszText As LPSTR, startIndex As Long, count As Long) As Long
+	Function IndexOf(lpszText As *Char, startIndex As Long, count As Long) As Long
 		Dim length As Long
 		length = lstrlen(lpszText)
@@ -298,13 +298,13 @@
 	End Function
 
-	Function LastIndexOf(lpszText As LPSTR) As Long
+	Function LastIndexOf(lpszText As *Char) As Long
 		Return LastIndexOf(lpszText, m_Length - 1, m_Length)
 	End Function
 
-	Function LastIndexOf(lpszText As LPSTR, startIndex As Long) As Long
-		Return LastIndexOf(lpszText As LPSTR, startIndex, startIndex + 1)
-	End Function
-
-	Function LastIndexOf(lpszText As LPSTR, startIndex As Long, count As Long) As Long
+	Function LastIndexOf(lpszText As *Char, startIndex As Long) As Long
+		Return LastIndexOf(lpszText As *Char, startIndex, startIndex + 1)
+	End Function
+
+	Function LastIndexOf(lpszText As *Char, startIndex As Long, count As Long) As Long
 		Dim length As Long
 		length = lstrlen(lpszText)
@@ -329,5 +329,5 @@
 	End Function
 
-	Function StartsWith(lpszText As LPSTR) As BOOL
+	Function StartsWith(lpszText As *Char) As BOOL
 		If IndexOf(lpszText) = 0 Then
 			Return _System_TRUE
@@ -337,5 +337,5 @@
 	End Function
 
-	Function EndsWith(lpszText As LPSTR) As BOOL
+	Function EndsWith(lpszText As *Char) As BOOL
 		If LastIndexOf(lpszText) = m_Length - lstrlen(lpszText) Then
 			Return _System_TRUE
@@ -345,5 +345,5 @@
 	End Function
 
-	Function Insert(startIndex As Long, lpszText As LPSTR) As Long
+	Function Insert(startIndex As Long, lpszText As *Char) As Long
 		Dim length As Long
 		length = lstrlen(lpszText)
@@ -351,5 +351,5 @@
 		If startIndex < 0 Or startIndex > m_Length Then Return -1
 
-		Dim newChars As LPSTR
+		Dim newChars As *Char
 		newChars = _System_malloc(length + m_Length + 1)
 		If newChars = 0 Then Return -1
@@ -391,5 +391,5 @@
 		If startIndex + count > m_Length Then Return -1
 
-		Dim newChars As LPSTR
+		Dim newChars As *Char
 		newChars = _System_malloc(m_Length - count + 1)
 		If newChars = 0 Then Return -1
@@ -413,5 +413,6 @@
 	End Function
 
-	Sub Replace(oldChar As Byte, newChar As Byte)
+
+	Sub Replace(oldChar As Char, newChar As Char)
 		Dim i As Long
 		For i = 0 To ELM(m_Length)
@@ -468,7 +469,11 @@
 	End Sub
 
+	Override Function ToString() As String
+		Return This
+	End Function
+
 Private
 	' メモリ確保に失敗すると元の文字列は失われない。（例外安全でいう強い保障）
-	Function AllocStringBuffer(textLength As Long) As LPSTR
+	Function AllocStringBuffer(textLength As Long) As *Char
 		If textLength < 0 Then
 			Return 0
Index: /Include/Classes/System/Threading/WaitHandle.ab
===================================================================
--- /Include/Classes/System/Threading/WaitHandle.ab	(revision 118)
+++ /Include/Classes/System/Threading/WaitHandle.ab	(revision 119)
@@ -21,5 +21,5 @@
 
 	Virtual Sub ~WaitHandle()
-		Close()
+		CloseHandle(h)
 	End Sub
 
@@ -70,5 +70,5 @@
 			ExitThread(0)
 		End If
-		Return AfterWait(pSignalAndWait(toSignal.Handle, toWaitOn.Handle, millisecondsTimeout As DWord), 1)
+		Return WaitHandle.AfterWait(pSignalAndWait(toSignal.Handle, toWaitOn.Handle, millisecondsTimeout As DWord), 1)
 	End Function
 
Index: /Include/GdiPlus.ab
===================================================================
--- /Include/GdiPlus.ab	(revision 118)
+++ /Include/GdiPlus.ab	(revision 119)
@@ -3,6 +3,4 @@
 #ifndef GDIPLUS_AB
 #define GDIPLUS_AB
-
-TypeDef PDirectDrawSurface7 = VoidPtr '*IDirectDrawSurface7
 
 Declare Function GdipAlloc Lib "Gdiplus.dll" (size As SIZE_T) As VoidPtr
Index: /Include/GdiPlusFlat.ab
===================================================================
--- /Include/GdiPlusFlat.ab	(revision 118)
+++ /Include/GdiPlusFlat.ab	(revision 119)
@@ -3,4 +3,13 @@
 #ifndef __GDIPLUS_FLATAPI_AB__
 #define __GDIPLUS_FLATAPI_AB__
+
+#require <GdiPlusEnums.ab>
+#require <GdiPlusGpStubs.ab>
+#require <Classes/System/Drawing/misc.ab>
+#require <Classes/System/Drawing/Imaging/misc.ab>
+#require <Classes/System/Drawing/Text/misc.ab>
+#require <Classes/System/Drawing/Imaging/MetafileHeader.ab>
+
+TypeDef PDirectDrawSurface7 = VoidPtr '*IDirectDrawSurface7
 
 ' GraphicsPath APIs
Index: /Include/GdiPlusGpStubs.ab
===================================================================
--- /Include/GdiPlusGpStubs.ab	(revision 118)
+++ /Include/GdiPlusGpStubs.ab	(revision 119)
@@ -4,5 +4,8 @@
 #define __GDIPLUSGPSTUBS_AB__
 
-#include <Classes/System/Drawing/Drawing2D/Matrix.ab>
+#require <GdiPlusTypes.ab>
+#require <GdiPlusEnums.ab>
+#require <Classes/System/Drawing/Drawing2D/misc.ab>
+#require <Classes/System/Drawing/Drawing2D/Matrix.ab>
 
 Class GpGraphics
@@ -75,5 +78,5 @@
 TypeDef GpFillMode = FillMode
 TypeDef GpWrapMode = WrapMode
-TypeDef GpUnit = Unit
+TypeDef GpUnit = GraphicsUnit
 TypeDef GpCoordinateSpace = CoordinateSpace
 TypeDef GpPointF = PointF
Index: /Include/api_console.sbp
===================================================================
--- /Include/api_console.sbp	(revision 118)
+++ /Include/api_console.sbp	(revision 119)
@@ -14,9 +14,14 @@
 Const BACKGROUND_INTENSITY = &H0080
 
+Type COORD
+	X As Integer
+	Y As Integer
+End Type
 
-Declare Function AllocConsole Lib "kernel32" () As Long
-Declare Function FreeConsole Lib "kernel32" () As Long
 
-Declare Function SetConsoleCursorPosition Lib "kernel32" (hConsoleOutput As HANDLE, dwCursorPosition As DWord) As Long
+Declare Function AllocConsole Lib "kernel32" () As BOOL
+Declare Function FreeConsole Lib "kernel32" () As BOOL
+
+Declare Function SetConsoleCursorPosition Lib "kernel32" (hConsoleOutput As HANDLE, dwCursorPosition As DWord) As BOOL
 
 Declare Function ReadConsole Lib "kernel32" Alias "ReadConsoleA" (hConsoleInput As HANDLE, pBuffer As VoidPtr, nNumberOfCharsToRead As DWord, ByRef NumberOfCharsRead As DWord, pReserved As VoidPtr) As BOOL
Index: /Include/api_gdi.sbp
===================================================================
--- /Include/api_gdi.sbp	(revision 118)
+++ /Include/api_gdi.sbp	(revision 119)
@@ -484,5 +484,9 @@
 	lfFaceName[ELM(LF_FACESIZE)] As WCHAR
 End Type
+#ifdef UNICODE
+TypeDef LOGFONT = LOGFONTW
+#else
 TypeDef LOGFONT = LOGFONTA
+#endif
 Declare Function CreateFontIndirect Lib "gdi32" Alias "CreateFontIndirectA" (ByRef lplf As LOGFONT) As HFONT
 
@@ -730,5 +734,11 @@
 
 Declare Function GetTextColor Lib "gdi32" (hdc As HDC) As DWord
-Declare Function GetTextExtentPoint32 Lib "gdi32" Alias "GetTextExtentPoint32A" (hdc As HDC, lpString As BytePtr, cbString As Long, ByRef lpSize As SIZE) As Long
+Declare Function GetTextExtentPoint32A Lib "gdi32" (hdc As HDC, pString As PCSTR, cbString As Long, ByRef Size As SIZE) As Long
+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
+#else
+Declare Function GetTextExtentPoint32 Lib "gdi32" Alias "GetTextExtentPoint32A" (hdc As HDC, pString As PCTSTR, cbString As Long, ByRef Size As SIZE) As Long
+#endif
 
 Const TMPF_FIXED_PITCH = &H01
@@ -836,6 +846,11 @@
 Declare Function StrokeAndFillPath Lib "gdi32" (hdc As HDC) As Long
 Declare Function StrokePath Lib "gdi32" (DC As DWord) As Long
-Declare Function TextOut Lib "gdi32" Alias "TextOutA" (hdc As HDC, nXStart As Long, nYStart As Long, lpString As BytePtr, cbString As Long) As Long
-
+Declare Function TextOutA Lib "gdi32" (hdc As HDC, nXStart As Long, nYStart As Long, pString As PCSTR, cbString As Long) As Long
+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
+#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
+#endif
 
 /* Pixel Format */
Index: /Include/api_imm.sbp
===================================================================
--- /Include/api_imm.sbp	(revision 118)
+++ /Include/api_imm.sbp	(revision 119)
@@ -20,16 +20,28 @@
 
 Declare Function ImmDisableIME Lib "imm32" (idThread As DWord) As BOOL
-
+#ifdef UNICODE
 Declare Function ImmGetCompositionString Lib "imm32" Alias "ImmGetCompositionStringA" (hIMC As HIMC, dwIndex As DWord, pBuf As VoidPtr, dwBufLen As DWord) As Long
+#else
+Declare Function ImmGetCompositionString Lib "imm32" Alias "ImmGetCompositionStringA" (hIMC As HIMC, dwIndex As DWord, pBuf As VoidPtr, dwBufLen As DWord) As Long
+#endif
 Declare Function ImmGetCompositionStringA Lib "imm32" (hIMC As HIMC, dwIndex As DWord, pBuf As VoidPtr, dwBufLen As DWord) As Long
 Declare Function ImmGetCompositionStringW Lib "imm32" (hIMC As HIMC, dwIndex As DWord, pBuf As VoidPtr, dwBufLen As DWord) As Long
+
+#ifdef UNICODE
+Declare Function ImmGetCompositionFont Lib "imm32" Alias "ImmSetCompositionFontW" (hIMC As HIMC, ByRef lf As LOGFONT) As BOOL
+#else
 Declare Function ImmGetCompositionFont Lib "imm32" Alias "ImmSetCompositionFontA" (hIMC As HIMC, ByRef lf As LOGFONT) As BOOL
-Declare Function ImmGetCompositionFontA Lib "imm32" (hIMC As HIMC, ByRef lf As LOGFONT) As BOOL
-Declare Function ImmGetCompositionFontW Lib "imm32" (hIMC As HIMC, ByRef lf As LOGFONT) As BOOL
+#endif
+Declare Function ImmGetCompositionFontA Lib "imm32" (hIMC As HIMC, ByRef lf As LOGFONTA) As BOOL
+Declare Function ImmGetCompositionFontW Lib "imm32" (hIMC As HIMC, ByRef lf As LOGFONTW) As BOOL
 Declare Function ImmGetCompositionWindow Lib "imm32" (hIMC As HIMC, ByRef CompForm As COMPOSITIONFORM) As BOOL
 
+#ifdef UNICODE
+Declare Function ImmSetCompositionFont Lib "imm32" Alias "ImmSetCompositionFontW" (hIMC As HIMC, ByRef lplf As LOGFONT) As Long
+#else
 Declare Function ImmSetCompositionFont Lib "imm32" Alias "ImmSetCompositionFontA" (hIMC As HIMC, ByRef lplf As LOGFONT) As Long
-Declare Function ImmSetCompositionFontA Lib "imm32" (hIMC As HIMC, ByRef lplf As LOGFONT) As Long
-Declare Function ImmSetCompositionFontW Lib "imm32" (hIMC As HIMC, ByRef lplf As LOGFONT) As Long
+#endif
+Declare Function ImmSetCompositionFontA Lib "imm32" (hIMC As HIMC, ByRef lplf As LOGFONTA) As Long
+Declare Function ImmSetCompositionFontW Lib "imm32" (hIMC As HIMC, ByRef lplf As LOGFONTW) As Long
 Declare Function ImmSetCompositionWindow Lib "imm32" (hIMC As HIMC, ByRef CompForm As COMPOSITIONFORM) As BOOL
 
Index: /Include/api_system.sbp
===================================================================
--- /Include/api_system.sbp	(revision 118)
+++ /Include/api_system.sbp	(revision 119)
@@ -779,5 +779,11 @@
 Declare Function lstrcmpi Lib "kernel32" Alias "lstrcmpiA" (lpString1 As BytePtr, lpString2 As BytePtr) As Long
 Declare Function lstrcpy Lib "kernel32" Alias "lstrcpyA" (lpString1 As BytePtr, lpString2 As BytePtr) As BytePtr
-Declare Function lstrlen Lib "kernel32" Alias "lstrlenA" (lpString As BytePtr) As Long
+Declare Function lstrlenA Lib "kernel32" (lpString As LPSTR) As Long
+Declare Function lstrlenW Lib "kernel32" (lpString As LPWSTR) As Long
+#ifdef UNICODE
+Declare Function lstrlen Lib "kernel32" Alias "lstrlenA" (lpString As *Char) As Long
+#else
+Declare Function lstrlen Lib "kernel32" Alias "lstrlenA" (lpString As *Char) As Long
+#endif
 Declare Sub memcpy Lib "kernel32" Alias "RtlMoveMemory" (pDest As VoidPtr, pSrc As VoidPtr, length As SIZE_T)
 Declare Function MoveFile Lib "kernel32" Alias "MoveFileA" (lpExistingFileName As BytePtr, lpNewFileName As BytePtr) As BOOL
Index: /Include/api_window.sbp
===================================================================
--- /Include/api_window.sbp	(revision 118)
+++ /Include/api_window.sbp	(revision 119)
@@ -200,4 +200,59 @@
 Const CF_GDIOBJLAST =      &H03FF
 
+'-------------
+' Window API Function Names
+
+/*
+CreateWindowEx
+CallWindowProc
+DefWindowProc
+DispatchMessage
+DrawText
+DrawTextEx
+FindWindow
+FindWindowEx
+GetClassInfoEx
+GetClassLong
+GetClassLongPtr
+GetClassName
+GetClipboardFormatName
+GetDlgItemText
+GetMenuItemInfo
+GetMessage
+GetWindowLong
+GetWindowLongPtr
+GetWindowText
+GetWindowTextLength
+InsertMenuItem
+IsCharAlpha
+IsCharAlphaNumeric
+IsDialogMessage
+LoadBitmap
+LoadCursor
+LoadCursorFromFile
+LoadIcon
+LoadImage
+PeekMessage
+PostMessage
+PostThreadMessage
+RegisterClassEx
+RegisterClipboardFormat
+RegisterWindowMessage
+RemoveProp
+SendDlgItemMessage
+SendMessage
+SendNotifyMessage
+SetDlgItemText
+SetClassLong
+SetClassLong
+SetMenuItemInfo
+SetWindowLong
+SetWindowLongPtr
+SetWindowText
+SystemParametersInfo
+UnregisterClass
+wsprintf
+wvsprintf
+*/
 
 '-------------
@@ -761,6 +816,11 @@
 Const MB_RIGHT =                  &H00080000
 Const MB_RTLREADING =             &H00100000
-Declare Function MessageBox Lib "user32" Alias "MessageBoxA" (hWnd As HWND, lpText As PCSTR, lpCaption As PCSTR, uType As DWord) As Long
-
+#ifdef UNICODE
+Declare Function MessageBox Lib "user32" Alias "MessageBoxW" (hWnd As HWND, pText As PCWSTR, pCaption As PCWSTR, uType As DWord) As Long
+#else
+Declare Function MessageBox Lib "user32" Alias "MessageBoxA" (hWnd As HWND, pText As PCSTR, pCaption As PCSTR, uType As DWord) As Long
+#endif
+Declare Function MessageBoxW Lib "user32" (hWnd As HWND, pText As PCWSTR, pCaption As PCWSTR, uType As DWord) As Long
+Declare Function MessageBoxA Lib "user32" (hWnd As HWND, pText As PCSTR, pCaption As PCSTR, uType As DWord) As Long
 Const MOUSEEVENTF_MOVE =       &H0001
 Const MOUSEEVENTF_LEFTDOWN =   &H0002
Index: /Include/basic/command.sbp
===================================================================
--- /Include/basic/command.sbp	(revision 118)
+++ /Include/basic/command.sbp	(revision 119)
@@ -6,5 +6,5 @@
 
 
-Const _System_Type_Char = 1
+Const _System_Type_SByte = 1
 Const _System_Type_Byte = 2
 Const _System_Type_Integer = 3
@@ -16,5 +16,7 @@
 Const _System_Type_Single =	9
 Const _System_Type_Double =	10
-Const _System_Type_String =	11
+Const _System_Type_Char =	11
+Const _System_Type_String =	13
+Const _System_Type_VoidPtr =	14
 Const _System_MAX_PARMSNUM = 32-1
 
Index: /Include/basic/function.sbp
===================================================================
--- /Include/basic/function.sbp	(revision 118)
+++ /Include/basic/function.sbp	(revision 119)
@@ -514,6 +514,6 @@
 	End If
 End Sub
-Function _ecvt(value As Double, count As Long, ByRef dec As Long, ByRef sign As Long) As BytePtr
-	Dim temp As BytePtr
+Function _ecvt(value As Double, count As Long, ByRef dec As Long, ByRef sign As Long) As *Char
+	Dim temp As *Char
 	Dim i As Long, i2 As Long
 
@@ -540,10 +540,10 @@
 	dec=1
 	While value<0.999999999999999  'value<1
-		value=value*10
-		dec=dec-1
+		value *= 10
+		dec--
 	Wend
 	While 9.99999999999999<=value  '10<=value
-		value=value/10
-		dec=dec+1
+		value /= 10
+		dec++
 	Wend
 
@@ -555,5 +555,5 @@
 	_System_ecvt_buffer[i]=0
 
-	i=i-1
+	i--
 	If value>=5 Then
 		'切り上げ処理
@@ -562,5 +562,5 @@
 
 	For i=0 To count-1
-		_System_ecvt_buffer[i]=_System_ecvt_buffer[i]+&H30
+		_System_ecvt_buffer[i] += &H30
 	Next
 	_System_ecvt_buffer[i]=0
@@ -713,8 +713,8 @@
 End Function
 
-Function Val(buf As BytePtr) As Double
+Function Val(buf As *Char) As Double
 	Dim i As Long, i2 As Long, i3 As Long, i4 As Long
 	Dim temporary As String
-	Dim TempPtr As BytePtr
+	Dim TempPtr As *Char
 	Dim dbl As Double
 	Dim i64data As Int64
@@ -1024,4 +1024,12 @@
 End Function
 
+Function _System_IsSurrogatePair(wcHigh As WCHAR, wcLow As WCHAR) As Boolean
+	If &hD800 <= wcHigh And wcHigh < &hDC00 Then
+		If &hDC00 <= wcLow And wcLow < &hE000 Then
+			Return True
+		End If
+	End If
+	Return False
+End Function
 
 #endif '_INC_FUNCTION
Index: /Include/basic/prompt.sbp
===================================================================
--- /Include/basic/prompt.sbp	(revision 118)
+++ /Include/basic/prompt.sbp	(revision 119)
@@ -99,7 +99,12 @@
 
 				temporary[0]=_PromptSys_Buffer[i][i2]
+#ifdef UNICODE
+				If _System_IsSurrogatePair(_PromptSys_Buffer[i][i2], _PromptSys_Buffer[i][i2+1]) Then
+#else
 				If IsDBCSLeadByte(temporary[0]) Then
+#endif
 					temporary[1]=_PromptSys_Buffer[i][i2+1]
 					temporary[2]=0
+					i2++
 				Else
 					temporary[1]=0
@@ -107,6 +112,4 @@
 				TextOut(hDC,i2*_PromptSys_FontSize.cx,i*_PromptSys_FontSize.cy,_
 					temporary,lstrlen(temporary))
-
-				If IsDBCSLeadByte(temporary[0]) Then i2++
 			Next
 		End If
@@ -172,5 +175,4 @@
 	Dim CompForm As COMPOSITIONFORM
 	Dim hGlobal As HGLOBAL
-	Dim pTemp As BytePtr
 
 	Select Case message
@@ -246,9 +248,13 @@
 					hGlobal=GetClipboardData(CF_TEXT)
 					If hGlobal=0 Then PromptProc=0:Exit Function
-					pTemp=GlobalLock(hGlobal) As *Byte
-
+					Dim pTemp=GlobalLock(hGlobal) As *Byte
+#ifdef UNICODE
+					Dim tempSizeW = MultiByteToWideChar(CP_ACP, 0, pTemp, -1, 0, 0) + 1
+					TempStr=ZeroString(tempSizeW)
+					MultiByteToWideChar(CP_ACP, 0, pTemp, -1, StrPtr(TempStr), tempSizeW)
+#else
 					TempStr=ZeroString(lstrlen(pTemp)+1)
 					lstrcpy(StrPtr(TempStr),pTemp)
-
+#endif
 					lstrcpy((VarPtr(_PromptSys_InputStr[0])+_PromptSys_InputLen) As *Byte,pTemp)
 					_PromptSys_InputLen=_PromptSys_InputLen+lstrlen(pTemp)
@@ -337,4 +343,5 @@
 	_PromptSys_hWnd=CreateWindowEx(WS_EX_CLIENTEDGE,"PROMPT","BASIC PROMPT",WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,0,0,GetModuleHandle(0),0)
 	ShowWindow(_PromptSys_hWnd,SW_SHOW)
+	UpdateWindow(_PromptSys_hWnd)
 
 	Dim msg As MSG, iResult As Long
@@ -455,8 +462,14 @@
 			Case _System_Type_Integer,_System_Type_Word
 				SetWord(_System_InputDataPtr[i],Val(buf))
-			Case _System_Type_Char,_System_Type_Byte
+			Case _System_Type_SByte,_System_Type_Byte
 				SetByte(_System_InputDataPtr[i],Val(buf))
-
+			Case _System_Type_Char
+#ifdef UNICODE
+				SetWord(_System_InputDataPtr[i], buf[0])
+#else
+				SetByte(_System_InputDataPtr[i], buf[0])
+#endif
 			Case _System_Type_String
+			*INPUT_FromPrompt_Type_String
 				Dim pTempStr As *String
 				pTempStr=_System_InputDataPtr[i] As *String
@@ -464,4 +477,6 @@
 				memcpy(pTempStr->Chars, buf.Chars, pTempStr->Length)
 				pTempStr->Chars[pTempStr->Length] = 0
+			Case 13
+				Goto *INPUT_FromPrompt_Type_String
 		End Select
 
Index: /Include/crt.sbp
===================================================================
--- /Include/crt.sbp	(revision 118)
+++ /Include/crt.sbp	(revision 119)
@@ -4,6 +4,10 @@
 #define _INC_CRT
 
-Declare Function _beginthread cdecl Lib "msvcrt" (start_address As VoidPtr, stack_size As DWord, arglist As VoidPtr) As HANDLE
-Declare Function _beginthreadex cdecl Lib "msvcrt" (
+#ifndef _DEFINE_CRTDLL_NAME
+Const _CrtDllName = "msvcrt"
+#endif
+
+Declare Function _beginthread cdecl Lib _CrtDllName (start_address As VoidPtr, stack_size As DWord, arglist As VoidPtr) As HANDLE
+Declare Function _beginthreadex cdecl Lib _CrtDllName (
 	security As *SECURITY_ATTRIBUTES,
 	stack_size As DWord,
@@ -12,22 +16,44 @@
 	initflag As DWord,
 	ByRef thrdaddr As DWord) As HANDLE
-Declare Sub _endthread cdecl Lib "msvcrt" ()
-Declare Sub _endthreadex cdecl Lib "msvcrt" (retval As DWord)
+Declare Sub _endthread cdecl Lib _CrtDllName ()
+Declare Sub _endthreadex cdecl Lib _CrtDllName (retval As DWord)
 
-Declare Function strstr cdecl Lib "msvcrt" (s1 As LPSTR, s2 As LPSTR) As LPSTR
-Declare Function memmove cdecl Lib "msvcrt" (dest As VoidPtr, src As VoidPtr, count As SIZE_T) As VoidPtr
-Declare Function _mbsstr cdecl Lib "msvcrt" (s1 As LPSTR, s2 As LPSTR) As LPSTR
+Declare Function strstr cdecl Lib _CrtDllName (s1 As LPSTR, s2 As LPSTR) As LPSTR
+Declare Function memmove cdecl Lib _CrtDllName (dest As VoidPtr, src As VoidPtr, count As SIZE_T) As VoidPtr
+Declare Function _mbsstr cdecl Lib _CrtDllName (s1 As LPSTR, s2 As LPSTR) As LPSTR
 
-Declare Function memcmp CDecl Lib "msvcrt" (buf1 As VoidPtr, buf2 As VoidPtr, c As SIZE_T) As Long
-Declare Function memicmp CDecl Lib "msvcrt" Alias "_memicmp" (buf1 As VoidPtr, buf2 As VoidPtr, c As SIZE_T) As Long
+Declare Function memcmp CDecl Lib _CrtDllName (buf1 As VoidPtr, buf2 As VoidPtr, c As SIZE_T) As Long
+Declare Function memicmp CDecl Lib _CrtDllName Alias "_memicmp" (buf1 As VoidPtr, buf2 As VoidPtr, c As SIZE_T) As Long
 
 TypeDef va_list = VoidPtr
 
-Declare Function sprintf CDecl Lib "msvcrt" (buffer As PSTR, format As PCSTR, ...) As Long
-Declare Function _snprintf CDecl Lib "msvcrt" (buffer As PSTR, count As SIZE_T, format As PCSTR, ...) As Long
-Declare Function _scprintf CDecl Lib "msvcrt" (format As PCSTR, ...) As Long
-Declare Function vsprintf CDecl Lib "msvcrt" (buffer As PSTR, format As PCSTR, argptr As va_list) As Long
-Declare Function _vsnprintf CDecl Lib "msvcrt" (buffer As PSTR, count As SIZE_T, format As PCSTR, argptr As va_list) As Long
-Declare Function _vscprintf CDecl Lib "msvcrt" (format As PCSTR, argptr As va_list) As Long
+Declare Function sprintf CDecl Lib _CrtDllName (buffer As PSTR, format As PCSTR, ...) As Long
+Declare Function _snprintf CDecl Lib _CrtDllName (buffer As PSTR, count As SIZE_T, format As PCSTR, ...) As Long
+Declare Function _scprintf CDecl Lib _CrtDllName (format As PCSTR, ...) As Long
+Declare Function vsprintf CDecl Lib _CrtDllName (buffer As PSTR, format As PCSTR, argptr As va_list) As Long
+Declare Function _vsnprintf CDecl Lib _CrtDllName (buffer As PSTR, count As SIZE_T, format As PCSTR, argptr As va_list) As Long
+Declare Function _vscprintf CDecl Lib _CrtDllName (format As PCSTR, argptr As va_list) As Long
+
+Declare Function swprintf CDecl Lib _CrtDllName (buffer As PWSTR, format As PCWSTR, ...) As Long
+Declare Function _snwprintf CDecl Lib _CrtDllName (buffer As PWSTR, count As SIZE_T, format As PCWSTR, ...) As Long
+Declare Function _scwprintf CDecl Lib _CrtDllName (format As PCWSTR, ...) As Long
+Declare Function vswprintf CDecl Lib _CrtDllName (buffer As PWSTR, format As PCWSTR, argptr As va_list) As Long
+Declare Function _vsnwprintf CDecl Lib _CrtDllName (buffer As PWSTR, count As SIZE_T, format As PCWSTR, argptr As va_list) As Long
+Declare Function _vscwprintf CDecl Lib _CrtDllName (format As PCWSTR, argptr As va_list) As Long
+#ifdef UNICODE
+Declare Function _stprintf CDecl Lib _CrtDllName Alias "swprintf" (buffer As PWSTR, format As PCWSTR, ...) As Long
+Declare Function _sntprintf CDecl Lib _CrtDllName Alias "_snwprintf" (buffer As PWSTR, count As SIZE_T, format As PCWSTR, ...) As Long
+Declare Function _sctprintf CDecl Lib _CrtDllName Alias "_scwprintf" (format As PCWSTR, ...) As Long
+Declare Function _vstprintf CDecl Lib _CrtDllName Alias "vswprintf" (buffer As PWSTR, format As PCWSTR, argptr As va_list) As Long
+Declare Function _vsntprintf CDecl Lib _CrtDllName Alias "_vsnwprintf" (buffer As PWSTR, count As SIZE_T, format As PCWSTR, argptr As va_list) As Long
+Declare Function _vsctprintf CDecl Lib _CrtDllName Alias "_vscwprintf" (format As PCWSTR, argptr As va_list) As Long
+#else
+Declare Function _stprintf CDecl Lib _CrtDllName Alias "sprintf" (buffer As PSTR, format As PCSTR, ...) As Long
+Declare Function _sntprintf CDecl Lib _CrtDllName Alias "_snprintf" (buffer As PSTR, count As SIZE_T, format As PCSTR, ...) As Long
+Declare Function _sctprintf CDecl Lib _CrtDllName Alias "_scprintf" (format As PCSTR, ...) As Long
+Declare Function _vstprintf CDecl Lib _CrtDllName Alias "vsprintf" (buffer As PSTR, format As PCSTR, argptr As va_list) As Long
+Declare Function _vsntprintf CDecl Lib _CrtDllName Alias "_vsnprintf" (buffer As PSTR, count As SIZE_T, format As PCSTR, argptr As va_list) As Long
+Declare Function _vsctprintf CDecl Lib _CrtDllName Alias "_vscprintf" (format As PCSTR, argptr As va_list) As Long
+#endif
 
 #endif '_INC_CRT
Index: /Include/system/string.sbp
===================================================================
--- /Include/system/string.sbp	(revision 118)
+++ /Include/system/string.sbp	(revision 119)
@@ -5,5 +5,5 @@
 #define _INC_BASIC_STRING
 
-Function StrPtr(buf As *Byte) As *Byte
+Function StrPtr(buf As *Char) As *Char
 	StrPtr = buf
 End Function
@@ -15,5 +15,5 @@
 End Function
 
-Function MakeStr(pBuf As *Byte) As String
+Function MakeStr(pBuf As *Char) As String
 	Dim temp As String(pBuf)
 	Return temp
Index: /Include/windows.sbp
===================================================================
--- /Include/windows.sbp	(revision 118)
+++ /Include/windows.sbp	(revision 119)
@@ -62,14 +62,38 @@
 TypeDef LPARAM = LONG_PTR
 
+TypeDef TCHAR = Char
 
-TypeDef PSTR = *Byte
-TypeDef PCSTR = *Byte
+#ifdef UNICODE
+TypeDef TBYTE = Char
+
+TypeDef PSTR = *SByte
+TypeDef PCSTR = *SByte
+
+TypeDef PWSTR = *Char
+TypeDef PCWSTR = *Char
+
+TypeDef PTSTR = PWSTR
+TypeDef PCTSTR = PCWSTR
+#else
+TypeDef TBYTE = Byte
+
+TypeDef PSTR = *Char
+TypeDef PCSTR = *Char
+
+TypeDef PWSTR = *WCHAR
+TypeDef PCWSTR = *WCHAR
+
+TypeDef PTSTR = PSTR
+TypeDef PCTSTR = PCSTR
+#endif
+
 TypeDef LPSTR = PSTR
 TypeDef LPCSTR = PCSTR
 
-TypeDef PWSTR = *WCHAR
-TypeDef PCWSTR = *WCHAR
 TypeDef LPWSTR = PWSTR
 TypeDef LPCWSTR = PCWSTR
+
+TypeDef LPTSTR = PTSTR
+TypeDef LPCTSTR = PCTSTR
 
 TypeDef OLECHAR = WCHAR
@@ -78,4 +102,10 @@
 
 TypeDef BSTR = LPOLESTR
+
+TypeDef UCSCHAR = DWord
+
+Const UCSCHAR_INVALID_CHARACTER = &hffffffff As UCSCHAR
+Const MIN_UCSCHAR = 0 As UCSCHAR
+Const MAX_UCSCHAR = &h0010ffff As UCSCHAR
 
 TypeDef LANGID = Word
