Time:10-21
WriteProcessMemory (hProcess, pHeaderItem, & amp; HeaderItem, sizeof (HDITEM), NULL); : : SendMessage (pHeaderCtrl - & gt; GetSafeHwnd (), LVM_GETITEMTEXT, 0, (LPARAM) pHeaderItem); ReadProcessMemory (hProcess, pItem ItemBuf, 512, NULL);
CodePudding user response:
you look under the Debug debugging, data are allocated space? Call the above ReadxxxMemory data correct?
pHeaderItem=(HDITEM *) VirtualAllocEx (hProcess, NULL, sizeof (HDITEM), MEM_COMMIT, PAGE_READWRITE); PItem=(char *) VirtualAllocEx (hProcess, NULL, 512, MEM_COMMIT, PAGE_READWRITE); if ((! PHeaderItem) | | (! PItem)) {: : MessageBox (NULL, "unable to allocate memory!" , "wrong!" , NULL); } for (i=0; i{HeaderItem. CchTextMax=512; HeaderItem. PszText=pItem; WriteProcessMemory (hProcess, pHeaderItem, & amp; HeaderItem, sizeof (HDITEM), NULL); : : SendMessage (pHeaderCtrl - & gt; GetSafeHwnd (), LVM_GETITEMTEXT, 0, (LPARAM) pHeaderItem); ReadProcessMemory (hProcess, pItem ItemBuf, 512, NULL); } //release the memory The CloseHandle (hProcess); VirtualFreeEx (hProcess, pHeaderItem, 0, MEM_RELEASE); VirtualFreeEx (hProcess, pItem, 0, MEM_RELEASE);
BOOL the GetItem (int nPos, HDITEM * pHeaderItem) const;
HeaderItem. Mask=HDI_TEXT; HeaderItem. CchTextMax=512; HeaderItem. PszText=pItem; for (i=0; i{WriteProcessMemory (hProcess, pHeaderItem, & amp; HeaderItem, sizeof (HDITEM), NULL); : : SendMessage (pHeaderCtrl - & gt; GetSafeHwnd (), HDM_GETITEM, 0, (LPARAM) pHeaderItem); ReadProcessMemory (hProcess, pItem ItemBuf, 512, NULL); }
HeaderItem. Mask=HDI_TEXT; HeaderItem. CchTextMax=512; HeaderItem. PszText=pItem; for (i=0; i{WriteProcessMemory (hProcess, pHeaderItem, & amp; HeaderItem, sizeof (HDITEM), NULL); : : SendMessage (pHeaderCtrl - & gt; HDM_GETITEM GetSafeHwnd (), I, (LPARAM) pHeaderItem); ReadProcessMemory (hProcess, pItem ItemBuf, 512, NULL); }
Void CRemoteListCtrlDlg: : RemoteHeaderItem (HWND HWND) {//GetItemCount Int nHeaderCount=: : SendMessage (hWnd HDM_GETITEMCOUNT, 0, 0); //Get hProcess DWORD pid; GetWindowThreadProcessId (hWnd, & amp; Pid); HANDLE hProcess=OpenProcess (PROCESS_ALL_ACCESS, FALSE, pid); //HDITEM * pHeaderItem=(HDITEM *) VirtualAllocEx (hProcess, NULL, sizeof (HDITEM), MEM_COMMIT, PAGE_READWRITE); Char * pItem=(char *) VirtualAllocEx (hProcess, NULL, 512, MEM_COMMIT, PAGE_READWRITE); if ((! PHeaderItem) | | (! PItem)) {: : MessageBox (NULL, "unable to allocate memory!" , "wrong!" , NULL); The CloseHandle (hProcess); return; } //HDITEM HeaderItem; HeaderItem. CchTextMax=512; HeaderItem. Mask=HDI_TEXT; HeaderItem. PszText=pItem; //Char ItemBuf [512]. for(int i=0; i{HeaderItem. IOrder=I; WriteProcessMemory (hProcess, pHeaderItem, & amp; HeaderItem, sizeof (HDITEM), NULL); : : SendMessage (hWnd HDM_GETITEM, I, (LPARAM) pHeaderItem); ReadProcessMemory (hProcess, pItem ItemBuf, 512, NULL); AfxDump & lt; & lt; ItemBuf & lt; & lt; "\ n"; } //release the memory The CloseHandle (hProcess); VirtualFreeEx (hProcess, pHeaderItem, 0, MEM_RELEASE); VirtualFreeEx (hProcess, pItem, 0, MEM_RELEASE); }
//LPMYLVCOLUMN CRemoteListCtrlDlg: : RemoteLVGetColumn (HWND hLvWnd) {//GetItemCount M_hHdWnd=ListView_GetHeader (m_hLvWnd); nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
Page link:https//www.codepudding.com/Softwareengineering/70074.html