Пример #1
0
        public static Point GetListViewItemPoint(IntPtr handle, int index)
        {
            uint   dwProcessId;
            int    windowThreadProcessId = (int)Vip72Handle.GetWindowThreadProcessId(handle, out dwProcessId);
            IntPtr num1 = Vip72Handle.OpenProcess(56U, false, dwProcessId);
            IntPtr num2 = Vip72Handle.VirtualAllocEx(num1, IntPtr.Zero, 4096U, 12288U, 4U);

            try
            {
                Point[] arr = new Point[1];
                uint    vNumberOfBytesRead = 0;
                Vip72Handle.WriteProcessMemory(num1, num2, Marshal.UnsafeAddrOfPinnedArrayElement <Point>(arr, 0), Marshal.SizeOf(typeof(Vip72Handle.LVITEM)), ref vNumberOfBytesRead);
                Vip72Handle.SendMessage(handle, 4112U, index, num2.ToInt32());
                Vip72Handle.ReadProcessMemory(num1, num2, Marshal.UnsafeAddrOfPinnedArrayElement <Point>(arr, 0), Marshal.SizeOf(typeof(Point)), ref vNumberOfBytesRead);
                return(arr[0]);
            }
            catch (Exception ex)
            {
                Console.WriteLine((object)ex);
            }
            finally
            {
                Vip72Handle.VirtualFreeEx(num1, num2, 0U, 32768U);
                Vip72Handle.CloseHandle(num1);
            }
            return(Vip72Handle.InvalidPoint);
        }
Пример #2
0
        public static List <List <string> > GetListViewItems(IntPtr handle)
        {
            int itemCount = Vip72Handle.ListView_GetItemCount(handle);
            int num1      = Vip72Handle.ListViewColumnCount(handle);
            List <List <string> > stringListList = new List <List <string> >();
            uint   dwProcessId;
            int    windowThreadProcessId = (int)Vip72Handle.GetWindowThreadProcessId(handle, out dwProcessId);
            IntPtr num2 = Vip72Handle.OpenProcess(56U, false, dwProcessId);
            IntPtr num3 = Vip72Handle.VirtualAllocEx(num2, IntPtr.Zero, 16384U, 12288U, 4U);

            try
            {
                for (int index1 = 0; index1 < itemCount; ++index1)
                {
                    List <string> stringList = new List <string>();
                    for (int index2 = 0; index2 < num1; ++index2)
                    {
                        try
                        {
                            byte[] arr1 = new byte[256];
                            Vip72Handle.LVITEM[] arr2 = new Vip72Handle.LVITEM[1];
                            arr2[0].mask       = 1;
                            arr2[0].iItem      = index1;
                            arr2[0].iSubItem   = index2;
                            arr2[0].cchTextMax = arr1.Length;
                            arr2[0].pszText    = (IntPtr)((int)num3 + Marshal.SizeOf(typeof(Vip72Handle.LVITEM)));
                            uint vNumberOfBytesRead = 0;
                            Vip72Handle.WriteProcessMemory(num2, num3, Marshal.UnsafeAddrOfPinnedArrayElement <Vip72Handle.LVITEM>(arr2, 0), Marshal.SizeOf(typeof(Vip72Handle.LVITEM)), ref vNumberOfBytesRead);
                            Vip72Handle.SendMessage(handle, 4171U, 0, num3.ToInt32());
                            Vip72Handle.ReadProcessMemory(num2, (IntPtr)((int)num3 + Marshal.SizeOf(typeof(Vip72Handle.LVITEM))), Marshal.UnsafeAddrOfPinnedArrayElement <byte>(arr1, 0), arr1.Length, ref vNumberOfBytesRead);
                            string stringUni = Marshal.PtrToStringUni(Marshal.UnsafeAddrOfPinnedArrayElement <byte>(arr1, 0));
                            stringList.Add(stringUni);
                        }
                        catch (Exception ex)
                        {
                            stringList.Add("");
                            Console.WriteLine((object)ex);
                        }
                    }
                    stringListList.Add(stringList);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine((object)ex);
            }
            finally
            {
                Vip72Handle.VirtualFreeEx(num2, num3, 0U, 32768U);
                Vip72Handle.CloseHandle(num2);
            }
            return(stringListList);
        }