Пример #1
0
        public static void DoubleClickListView(IntPtr hwnd, uint processId, int item, int subitem)
        {
            IntPtr zero1 = IntPtr.Zero;

            IntPtr zero2 = IntPtr.Zero;
            NMHDR  lpBuffer1;

            lpBuffer1.hwndFrom = (int)hwnd;
            lpBuffer1.idFrom   = 7809;
            lpBuffer1.code     = 515;
            IntPtr zero3                  = IntPtr.Zero;
            IntPtr hProcess               = ListViewItem1.OpenProcess(Win32ProcessAccessType.AllAccess, false, processId);
            IntPtr lpBaseAddress1         = ListViewItem1.VirtualAllocEx(hProcess, IntPtr.Zero, 2048U, Win32AllocationTypes.MEM_COMMIT, Win32MemoryProtection.PAGE_READWRITE);
            IntPtr zero4                  = IntPtr.Zero;
            int    lpNumberOfBytesWritten = 0;

            ListViewItem1.WriteProcessMemory(hProcess, lpBaseAddress1, ref lpBuffer1, (uint)Marshal.SizeOf(typeof(NMHDR)), out lpNumberOfBytesWritten);
            POINT lpBuffer2;

            lpBuffer2.x = 31;
            lpBuffer2.y = 31;
            IntPtr lpBaseAddress2 = ListViewItem1.VirtualAllocEx(hProcess, IntPtr.Zero, 2048U, Win32AllocationTypes.MEM_COMMIT, Win32MemoryProtection.PAGE_READWRITE);

            ListViewItem1.WriteProcessMemory(hProcess, lpBaseAddress2, ref lpBuffer2, (uint)Marshal.SizeOf(typeof(POINT)), out lpNumberOfBytesWritten);
            NMITEMACTIVATE lpBuffer3 = new NMITEMACTIVATE();

            lpBuffer3.hdr       = lpBaseAddress1;
            lpBuffer3.iItem     = item;
            lpBuffer3.iSubItem  = subitem;
            lpBuffer3.uOldState = 2U;
            lpBuffer3.uNewState = 0U;
            lpBuffer3.ptAction  = lpBaseAddress2;
            IntPtr zero5 = IntPtr.Zero;
            IntPtr num   = ListViewItem1.VirtualAllocEx(hProcess, IntPtr.Zero, 2048U, Win32AllocationTypes.MEM_COMMIT, Win32MemoryProtection.PAGE_READWRITE);

            ListViewItem1.WriteProcessMemory(hProcess, num, ref lpBuffer3, (uint)Marshal.SizeOf(typeof(NMITEMACTIVATE)), out lpNumberOfBytesWritten);
            ListViewItem1.SendMessageTimeout(hwnd, 78, (IntPtr)116, num, 2, 5000, IntPtr.Zero);
        }
Пример #2
0
 internal static extern bool WriteProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, ref NMITEMACTIVATE lpBuffer, uint nSize, out int lpNumberOfBytesWritten);