Faction Test 100.4.0.0

This commit is contained in:
Markus Isberg
2022-11-14 18:28:28 +02:00
parent 87426b68b2
commit c772b61fc1
412 changed files with 16984 additions and 5530 deletions
+149
View File
@@ -0,0 +1,149 @@
using System;
using System.Text;
using System.Runtime.InteropServices;
namespace ImeSharp.Native
{
public partial class NativeMethods
{
#region Constants
public const int S_OK = 0x00000000;
public const int S_FALSE = 0x00000001;
public const int E_FAIL = unchecked((int)0x80004005);
public const int E_INVALIDARG = unchecked((int)0x80070057);
public const int E_NOTIMPL = unchecked((int)0x80004001);
public const int WM_KEYFIRST = 0x0100;
public const int WM_KEYDOWN = 0x0100;
public const int WM_KEYUP = 0x0101;
public const int WM_CHAR = 0x0102;
public const int WM_DEADCHAR = 0x0103;
public const int WM_SYSKEYDOWN = 0x0104;
public const int WM_SYSKEYUP = 0x0105;
public const int WM_SYSCHAR = 0x0106;
public const int WM_SYSDEADCHAR = 0x0107;
public const int WM_UNICHAR = 0x0109;
public const int WM_KEYLAST = 0x0109;
public const int UNICODE_NOCHAR = 0xFFFF;
public const int WM_NOTIFY = 0x004E;
public const int WM_INPUTLANGCHANGEREQUEST = 0x0050;
public const int WM_INPUTLANGCHANGE = 0x0051;
public const int WM_TCARD = 0x0052;
public const int WM_HELP = 0x0053;
public const int WM_USERCHANGED = 0x0054;
public const int WM_NOTIFYFORMAT = 0x0055;
public const int GWL_WNDPROC = -4;
public const int WM_ACTIVATE = 0x0006;
// WM_ACTIVATE state values
public const int WA_INACTIVE = 0;
public const int WA_ACTIVE = 1;
public const int WA_CLICKACTIVE = 2;
public const int WM_SETFOCUS = 0x0007;
public const int WM_KILLFOCUS = 0x0008;
public const int WM_DESTROY = 0x0002;
public const int WM_NULL = 0x0000;
public const int WM_QUIT = 0x0012;
public const int CLSCTX_INPROC_SERVER = 0x1;
public const int PM_NOREMOVE = 0x0000;
public const int PM_REMOVE = 0x0001;
public const int PM_NOYIELD = 0x0002;
#endregion Constants
#region Structs
[StructLayout(LayoutKind.Sequential)]
public struct NativeMessage
{
public IntPtr handle;
public uint msg;
public IntPtr wParam;
public IntPtr lParam;
public uint time;
public int ptX;
public int ptY;
}
#endregion
[DllImport("user32.dll")]
public static extern int GetSystemMetrics(SM nIndex);
// We have this wrapper because casting IntPtr to int may
// generate OverflowException when one of high 32 bits is set.
public static int IntPtrToInt32(IntPtr intPtr)
{
return unchecked((int)intPtr.ToInt64());
}
[DllImport("user32.dll", ExactSpelling = true, CharSet = CharSet.Unicode)]
public static extern IntPtr GetKeyboardLayout(int dwLayout);
public delegate IntPtr WndProcDelegate(IntPtr hWnd, uint msg, IntPtr wParam, IntPtr lParam);
[DllImport("user32.dll")]
public static extern IntPtr CallWindowProc(IntPtr lpPrevWndFunc, IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam);
// This static method is required because legacy OSes do not support
public static IntPtr SetWindowLongPtr(IntPtr hWnd, int nIndex, IntPtr dwNewLong)
{
if (IntPtr.Size == 8)
return SetWindowLongPtr64(hWnd, nIndex, dwNewLong);
else
return new IntPtr(SetWindowLong32(hWnd, nIndex, dwNewLong.ToInt32()));
}
[DllImport("user32.dll", EntryPoint = "SetWindowLong", CharSet = CharSet.Unicode)]
private static extern int SetWindowLong32(IntPtr hWnd, int nIndex, int dwNewLong);
[DllImport("user32.dll", EntryPoint = "SetWindowLongPtr", CharSet = CharSet.Unicode)]
private static extern IntPtr SetWindowLongPtr64(IntPtr hWnd, int nIndex, IntPtr dwNewLong);
[DllImport("user32.dll", SetLastError = true)]
public static extern bool GetWindowRect(IntPtr hwnd, out TsfSharp.Rect lpRect);
[DllImport("user32", ExactSpelling = true, SetLastError = true)]
public static extern int MapWindowPoints(IntPtr hWndFrom, IntPtr hWndTo, ref TsfSharp.Rect rect, [MarshalAs(UnmanagedType.U4)] int cPoints);
[DllImport("user32.dll", CharSet = CharSet.Unicode)]
public static extern IntPtr SendMessage(IntPtr hWnd, int Msg, IntPtr wParam, StringBuilder lParam);
[DllImport("user32.dll", CharSet = CharSet.Unicode)]
public static extern IntPtr SendMessage(IntPtr hWnd, int Msg, IntPtr wParam, [MarshalAs(UnmanagedType.LPWStr)] string lParam);
[DllImport("user32.dll", CharSet = CharSet.Unicode)]
public static extern IntPtr SendMessage(IntPtr hWnd, int Msg, int wParam, [MarshalAs(UnmanagedType.LPWStr)] string lParam);
[DllImport("user32.dll", CharSet = CharSet.Unicode)]
public static extern IntPtr SendMessage(IntPtr hWnd, int Msg, int wParam, ref IntPtr lParam);
[DllImport("user32.dll", CharSet = CharSet.Unicode)]
public static extern IntPtr SendMessage(IntPtr hWnd, int Msg, int wParam, IntPtr lParam);
[DllImport("user32.dll", CharSet = CharSet.Unicode)]
public static extern bool PostMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam);
[DllImport("user32.dll")]
public static extern bool TranslateMessage(ref NativeMessage lpMsg);
[DllImport("user32.dll")]
public static extern IntPtr DispatchMessage(ref NativeMessage lpmsg);
[DllImport("User32.dll", CharSet = CharSet.Unicode)]
public static extern bool PeekMessage(out NativeMessage msg, IntPtr hWnd, uint messageFilterMin, uint messageFilterMax, uint flags);
[DllImport("ole32.dll", ExactSpelling = true, EntryPoint = "CoCreateInstance", PreserveSig = true)]
public static extern int CoCreateInstance([In, MarshalAs(UnmanagedType.LPStruct)] Guid rclsid, IntPtr pUnkOuter, int dwClsContext, [In, MarshalAs(UnmanagedType.LPStruct)] Guid riid, out IntPtr ppv);
}
}
@@ -0,0 +1,156 @@
using System;
using System.Runtime.InteropServices;
namespace ImeSharp.Native
{
public partial class NativeMethods
{
#region Constants
public const int WM_IME_SETCONTEXT = 0x0281;
public const int WM_IME_NOTIFY = 0x0282;
public const int WM_IME_CONTROL = 0x0283;
public const int WM_IME_COMPOSITIONFULL = 0x0284;
public const int WM_IME_SELECT = 0x0285;
public const int WM_IME_CHAR = 0x0286;
public const int WM_IME_REQUEST = 0x0288;
public const int WM_IME_KEYDOWN = 0x0290;
public const int WM_IME_KEYUP = 0x0291;
public const int WM_IME_STARTCOMPOSITION = 0x010D;
public const int WM_IME_ENDCOMPOSITION = 0x010E;
public const int WM_IME_COMPOSITION = 0x010F;
public const int WM_IME_KEYLAST = 0x010F;
// wParam of report message WM_IME_NOTIFY
public const int IMN_CLOSESTATUSWINDOW = 0x0001;
public const int IMN_OPENSTATUSWINDOW = 0x0002;
public const int IMN_CHANGECANDIDATE = 0x0003;
public const int IMN_CLOSECANDIDATE = 0x0004;
public const int IMN_OPENCANDIDATE = 0x0005;
public const int IMN_SETCONVERSIONMODE = 0x0006;
public const int IMN_SETSENTENCEMODE = 0x0007;
public const int IMN_SETOPENSTATUS = 0x0008;
public const int IMN_SETCANDIDATEPOS = 0x0009;
public const int IMN_SETCOMPOSITIONFONT = 0x000A;
public const int IMN_SETCOMPOSITIONWINDOW = 0x000B;
public const int IMN_SETSTATUSWINDOWPOS = 0x000C;
public const int IMN_GUIDELINE = 0x000D;
public const int IMN_PRIVATE = 0x000E;
// wParam of report message WM_IME_REQUEST
public const int IMR_COMPOSITIONWINDOW = 0x0001;
public const int IMR_CANDIDATEWINDOW = 0x0002;
public const int IMR_COMPOSITIONFONT = 0x0003;
public const int IMR_RECONVERTSTRING = 0x0004;
public const int IMR_CONFIRMRECONVERTSTRING = 0x0005;
public const int IMR_QUERYCHARPOSITION = 0x0006;
public const int IMR_DOCUMENTFEED = 0x0007;
// parameter of ImmGetCompositionString
public const int GCS_COMPREADSTR = 0x0001;
public const int GCS_COMPREADATTR = 0x0002;
public const int GCS_COMPREADCLAUSE = 0x0004;
public const int GCS_COMPSTR = 0x0008;
public const int GCS_COMPATTR = 0x0010;
public const int GCS_COMPCLAUSE = 0x0020;
public const int GCS_CURSORPOS = 0x0080;
public const int GCS_DELTASTART = 0x0100;
public const int GCS_RESULTREADSTR = 0x0200;
public const int GCS_RESULTREADCLAUSE = 0x0400;
public const int GCS_RESULTSTR = 0x0800;
public const int GCS_RESULTCLAUSE = 0x1000;
public const int GCS_COMP = (GCS_COMPSTR | GCS_COMPATTR | GCS_COMPCLAUSE);
public const int GCS_COMPREAD = (GCS_COMPREADSTR | GCS_COMPREADATTR | GCS_COMPREADCLAUSE);
public const int GCS_RESULT = (GCS_RESULTSTR | GCS_RESULTCLAUSE);
public const int GCS_RESULTREAD = (GCS_RESULTREADSTR | GCS_RESULTREADCLAUSE);
public const int CFS_CANDIDATEPOS = 0x0040;
public const int CFS_POINT = 0x0002;
public const int CFS_EXCLUDE = 0x0080;
// lParam for WM_IME_SETCONTEXT
public const long ISC_SHOWUICANDIDATEWINDOW = 0x00000001;
public const long ISC_SHOWUICOMPOSITIONWINDOW = 0x80000000;
public const long ISC_SHOWUIGUIDELINE = 0x40000000;
public const long ISC_SHOWUIALLCANDIDATEWINDOW = 0x0000000F;
public const long ISC_SHOWUIALL = 0xC000000F;
#endregion Constants
[StructLayout(LayoutKind.Sequential)]
public unsafe struct CANDIDATELIST
{
public uint dwSize;
public uint dwStyle;
public uint dwCount;
public uint dwSelection;
public uint dwPageStart;
public uint dwPageSize;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1, ArraySubType = UnmanagedType.U4)]
public fixed uint dwOffset[1];
}
// CANDIDATEFORM structures
[StructLayout(LayoutKind.Sequential)]
public struct CANDIDATEFORM
{
public int dwIndex;
public int dwStyle;
public TsfSharp.Point ptCurrentPos;
public TsfSharp.Rect rcArea;
}
// COMPOSITIONFORM structures
[StructLayout(LayoutKind.Sequential)]
public struct COMPOSITIONFORM
{
public int dwStyle;
public TsfSharp.Point ptCurrentPos;
public TsfSharp.Rect rcArea;
}
[DllImport("imm32.dll", SetLastError = true)]
public static extern IntPtr ImmCreateContext();
[DllImport("imm32.dll", SetLastError = true)]
public static extern bool ImmDestroyContext(IntPtr hIMC);
[DllImport("imm32.dll", SetLastError = true)]
public static extern IntPtr ImmAssociateContext(IntPtr hWnd, IntPtr hIMC);
[DllImport("imm32.dll", SetLastError = true)]
public static extern IntPtr ImmReleaseContext(IntPtr hWnd, IntPtr hIMC);
[DllImport("imm32.dll", CharSet = CharSet.Unicode)]
public static extern uint ImmGetCandidateList(IntPtr hIMC, uint deIndex, IntPtr candidateList, uint dwBufLen);
[DllImport("imm32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
public static extern int ImmGetCompositionString(IntPtr hIMC, int CompositionStringFlag, IntPtr buffer, int bufferLength);
[DllImport("imm32.dll", SetLastError = true)]
public static extern IntPtr ImmGetContext(IntPtr hWnd);
[DllImport("Imm32.dll", SetLastError = true)]
public static extern bool ImmGetOpenStatus(IntPtr hIMC);
[DllImport("Imm32.dll", SetLastError = true)]
public static extern bool ImmSetOpenStatus(IntPtr hIMC, bool open);
[DllImport("imm32.dll", SetLastError = true)]
public static extern bool ImmSetCandidateWindow(IntPtr hIMC, ref CANDIDATEFORM candidateForm);
[DllImport("imm32.dll", SetLastError = true)]
public static extern int ImmSetCompositionWindow(IntPtr hIMC, ref COMPOSITIONFORM compForm);
[DllImport("user32.dll", SetLastError = true)]
public static extern bool CreateCaret(IntPtr hWnd, IntPtr hBitmap, int nWidth, int nHeight);
[DllImport("user32.dll", SetLastError = true)]
public static extern bool DestroyCaret();
[DllImport("user32.dll", SetLastError = true)]
public static extern bool SetCaretPos(int x, int y);
}
}
+95
View File
@@ -0,0 +1,95 @@
using System;
namespace ImeSharp.Native
{
/// <summary>
/// SystemMetrics. SM_*
/// </summary>
public enum SM
{
CXSCREEN = 0,
CYSCREEN = 1,
CXVSCROLL = 2,
CYHSCROLL = 3,
CYCAPTION = 4,
CXBORDER = 5,
CYBORDER = 6,
CXFIXEDFRAME = 7,
CYFIXEDFRAME = 8,
CYVTHUMB = 9,
CXHTHUMB = 10,
CXICON = 11,
CYICON = 12,
CXCURSOR = 13,
CYCURSOR = 14,
CYMENU = 15,
CXFULLSCREEN = 16,
CYFULLSCREEN = 17,
CYKANJIWINDOW = 18,
MOUSEPRESENT = 19,
CYVSCROLL = 20,
CXHSCROLL = 21,
DEBUG = 22,
SWAPBUTTON = 23,
CXMIN = 28,
CYMIN = 29,
CXSIZE = 30,
CYSIZE = 31,
CXFRAME = 32,
CXSIZEFRAME = CXFRAME,
CYFRAME = 33,
CYSIZEFRAME = CYFRAME,
CXMINTRACK = 34,
CYMINTRACK = 35,
CXDOUBLECLK = 36,
CYDOUBLECLK = 37,
CXICONSPACING = 38,
CYICONSPACING = 39,
MENUDROPALIGNMENT = 40,
PENWINDOWS = 41,
DBCSENABLED = 42,
CMOUSEBUTTONS = 43,
SECURE = 44,
CXEDGE = 45,
CYEDGE = 46,
CXMINSPACING = 47,
CYMINSPACING = 48,
CXSMICON = 49,
CYSMICON = 50,
CYSMCAPTION = 51,
CXSMSIZE = 52,
CYSMSIZE = 53,
CXMENUSIZE = 54,
CYMENUSIZE = 55,
ARRANGE = 56,
CXMINIMIZED = 57,
CYMINIMIZED = 58,
CXMAXTRACK = 59,
CYMAXTRACK = 60,
CXMAXIMIZED = 61,
CYMAXIMIZED = 62,
NETWORK = 63,
CLEANBOOT = 67,
CXDRAG = 68,
CYDRAG = 69,
SHOWSOUNDS = 70,
CXMENUCHECK = 71,
CYMENUCHECK = 72,
SLOWMACHINE = 73,
MIDEASTENABLED = 74,
MOUSEWHEELPRESENT = 75,
XVIRTUALSCREEN = 76,
YVIRTUALSCREEN = 77,
CXVIRTUALSCREEN = 78,
CYVIRTUALSCREEN = 79,
CMONITORS = 80,
SAMEDISPLAYFORMAT = 81,
IMMENABLED = 82,
CXFOCUSBORDER = 83,
CYFOCUSBORDER = 84,
TABLETPC = 86,
MEDIACENTER = 87,
REMOTESESSION = 0x1000,
REMOTECONTROL = 0x2001,
}
}