Unconfigured Ad Widget

Collapse

Anúncio

Collapse
No announcement yet.

Ajuda Matar Processo em Assembly

Collapse
X
 
  • Filter
  • Tempo
  • Show
Clear All
new posts

  • Font Size
    #1

    Ajuda Matar Processo em Assembly

    Bom galera, seguinte, to com um trabalho pra fazer em Assembly onde devo criar um programinha que mata algum processo que esteja sendo executado...
    Estou tentando fazer para matar o processo da calculadora
    Segue o codigo abaixo
    Código:
    .386
    .model flat, stdcall
    option casemap:none
    
    include windows.inc
    include user32.inc
    include kernel32.inc
    includelib user32.lib
    includelib kernel32.lib
    
    
    .data
    Processo		db "calc.exe",0
    ProcError		db"An Error Finding has occured!!", 0
    ProcFinish	db"Process terminated successfully!",0
    errSnapshot	db"CreateToolhelp32Snapshot failed",0
    errProcFirst	db"Deu Erro",0
    
    .data?
    StartupInfo	STARTUPINFO <>
    ProcessInfo	PROCESS_INFORMATION <>
    hSnapshot	HANDLE ?
    ProcEnt		PROCESSENTRY32<?>
    
    .code
    start:
    	invoke CreateToolhelp32Snapshot, TH32CS_SNAPPROCESS,0
    	.if (eax != INVALID_HANDLE_VALUE)
    		mov hSnapshot, eax
    		mov [ProcEnt.dwSize],SIZEOF ProcEnt
    		invoke Process32FirstW,hSnapshot,ADDR ProcEnt
    		.if (eax)
    			@@:
    				invoke lstrcmpi,ADDR Processo, ADDR [ProcEnt.szExeFile]
    				.if (eax == 0)
    					invoke OpenProcess, PROCESS_TERMINATE,FALSE,[ProcEnt.th32ProcessID]
    					.if (eax)
    						invoke TerminateProcess, eax, 0
    						.if eax ==0
    							invoke MessageBox,NULL,addr ProcError,NULL,MB_OK
    						.else
    							invoke MessageBox,NULL,addr ProcFinish,NULL,MB_ICONINFORMATION
    					.endif
    					.else
    						invoke MessageBox,NULL,addr ProcError,NULL,MB_OK
    					.endif
    				.endif
    			 invoke Process32NextW, hSnapshot,ADDR ProcEnt
    			test eax, eax
    			jnz @b
    		.else
    			invoke MessageBox,NULL,ADDR errProcFirst,NULL,MB_OK or MB_ICONERROR
    		.endif
    			invoke CloseHandle,hSnapshot
    	.else
    		invoke MessageBox,NULL,ADDR errSnapshot,NULL,MB_OK or MB_ICONERROR
    	.endif
    invoke ExitProcess, 1
    end start
    O problema é que ele nao consegue achar o processo da calculadora para encerrar, entao ele so mostra a mensagem da linha "errProcFirst"...
    Se alguem poder ajudar serei grato....
    Similar Threads
X
Working...
X