unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, commctrl, ExtCtrls;type TForm1 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end;var Form1: TForm1;implementation{$R *.dfm}{Fun??o para pegar o texto do Item da ListView}function PegaTexto(s: string): string;varc: Char;i: integer;Src,Dst: PChar;begini:=length(s);SetLength(Result,i);Src:=pointer(s);Dst:=pointer(Result);While i <> 0 do begin c:=Src^; if (c>='A') and (c<='Z') then Inc(c,32); Dst^:=c; Inc(Src); Inc(Dst); Dec(i); end;end;procedure Esconde(proc: string);vardwSize,dwNumBytes,PID,hProc: Cardinal;PLocalShared,PSysShared: PlvItem;h: THandle;iCount,i: integer;szTemp: string;begin{Pega o Handle da ListView}h:=FindWindow('#32770',nil);h:=FindWindowEx(h,0,'#32770',nil);h:=FindWindowEx(h,0,'SysListView32',nil);{Pega o número de itens da ListView}iCount:=SendMessage(h, LVM_GETITEMCOUNT,0,0);for i:=0 to iCount-1 do begin {Define o tamanho de cada item da ListView} dwSize:=sizeof(LV_ITEM) + sizeof(CHAR) * MAX_PATH; {Abre um espa?o na memória do NOSSO programa para o PLocalShared} PLocalShared:=VirtualAlloc(nil, dwSize, MEM_RESERVE + MEM_COMMIT, PAGE_READWRITE); {Pega o PID do processo taskmgr} GetWindowThreadProcessId(h,@PID); {Abre o processo taskmgr} hProc:=OpenProcess(PROCESS_ALL_ACCESS,false,PID); {Abre um espa?o na memória do taskmgr para o PSysShared} PSysShared:=VirtualAllocEx(hProc, nil, dwSize, MEM_RESERVE OR MEM_COMMIT, PAGE_READWRITE); {Define as propriedades do PLocalShared} PLocalShared.mask:=LVIF_TEXT; PLocalShared.iItem:=0; PLocalShared.iSubItem:=0; PLocalShared.pszText:=LPTSTR(dword(PSysShared) + sizeof(LV_ITEM)); PLocalShared.cchTextMax:=100; {Escreve PLocalShared no espa?o de memória que abriu no taskmgr} WriteProcessMemory(hProc,PSysShared,PLocalShared,1024,dwNumBytes); {Pega o texto to item i e passa pro PSysShared} SendMessage(h,LVM_GETITEMTEXT,i,LPARAM(PSysShared)); {Passa o PSysShared para o PLocalShared} ReadProcessMemory(hProc,PSysShared,PLocalShared,1024,dwNumBytes); {Passa o texto do Item para szTemp} szTemp:=pchar(dword(PLocalShared)+sizeof(LV_ITEM)); {Se esse texto contiver a string proc deleta o item} if pos(proc,PegaTexto(szTemp)) > 0 then ListView_DeleteItem(h,i); {Libera os espa?os de memória utilizados} VirtualFree(pLocalShared, 0, MEM_RELEASE); VirtualFreeEx(hProc, pSysShared, 0, MEM_RELEASE); {Fecha o handle do processo} CloseHandle(hProc); end;end;procedure TForm1.Button1Click(Sender: TObject);beginesconde('notepad.exe');end;end.
1:2:3:4:5:6:7:8:9:10:11:12:13:14:15:16:17:18:19:20:21:22:23:24:25:26:27:28:29:30:31:32:33:34:35:36:37:38:39:40:41:42:43:44:45:46:47:48:49:50:51:52:53:54:55:56:57:58:59:60:61:62:63:64:65:66:67:68:69:70:71:72:73:74:75:76:77:78:79:80:81:82:83:84:85:86:87:88:89:90:91:92:93:94:95:96:97:98:99:100:101:102:103:104:105:106:107:108:109:110:111:112:113:114:115:116:117:118:
联系客服