Einzelnen Beitrag anzeigen

Departure

Registriert seit: 2. Aug 2008
2 Beiträge
 
#206

Re: WinSpy - Der Fenster Spion (Update 06.09.08)

  Alt 31. Okt 2008, 12:37
Thanks toms, I have looked over the source code it seems pretty old and uses units thats not in delphi latest releases but it end up all fine with some modifycations so i did'nt have to use UprocessMemManger unit which in retuned used old delphi units.

I used VirtuallAllocEx instead and the following is what resulted

Delphi-Quellcode:
Procedure TForm1.GetItemsSysListView(SysListHWND: Hwnd; Listbox: TListBox);
Var
iCount,i : integer;
lvItem : LV_ITEM;
plvRemoteItem : ^LV_ITEM;
pszItemText : PChar;
pszRemoteItemText : PChar;
nReadWritten : DWORD;
ProcessHND : THandle;
PID : DWORD;
stResult : string;
const
ITEM_BUFFER : Integer = $4000;

begin
if SysListHWND = 0 then RaiseLastWin32Error;
GetWindowThreadProcessId(SysListHWND, @PID);
ProcessHND:= OpenProcess(PROCESS_VM_OPERATION or PROCESS_VM_READ or PROCESS_VM_WRITE or PROCESS_QUERY_INFORMATION,false, PID);
  try
    pszItemText := AllocMem(ITEM_BUFFER);
    FillMemory(addr(lvItem), sizeof(LV_ITEM), 0);
    plvRemoteItem := VirtualAllocEx(ProcessHND, nil, sizeof(LV_ITEM), MEM_COMMIT, PAGE_READWRITE);
    pszRemoteItemText := VirtualAllocEx(ProcessHND, nil, ITEM_BUFFER, MEM_COMMIT, PAGE_READWRITE);

    iCount:= sendmessage(SysListHWND,LVM_GETITEMCOUNT,0,0);
    dec(iCount);
    lvItem.cchTextMax := ITEM_BUFFER;
    lvItem.iSubItem := 2;
    lvItem.pszText := pszRemoteItemText;
    stResult:= '';
    for i:= 0 to iCount do
    begin
      if (not WriteProcessMemory(ProcessHND, plvRemoteItem, addr(lvItem), sizeof(LV_ITEM), nReadWritten)) then
         showmessage(inttostr(getLastError));
         SendMessage(SysListHWND, LVM_GETITEMTEXT, WPARAM(i), LPARAM(plvRemoteItem));
      if (not ReadProcessMemory(ProcessHND, pszRemoteItemText, pszItemText, ITEM_BUFFER, nReadWritten)) then
         showmessage(inttostr(getLastError));
         stResult:= stResult + strpas(pszItemText);
         ListBox.Items.Append(pszItemText);
    end;
  finally
    FreeMem(pszItemText);
    VirtualFreeEx(ProcessHND, pszRemoteItemText, 0, MEM_RELEASE);
    VirtualFreeEx(ProcessHND, plvRemoteItem, 0, MEM_RELEASE);
  end;
end;
as you can see im actually after a specific subitem in systemlistview. Thanks for your help it was greatly appericated

[edit=Luckie]Inserted Delphi code tags. Mfg, Luckie[/edit]
  Mit Zitat antworten Zitat