- UID
- 31191
注册时间2007-5-1
阅读权限20
最后登录1970-1-1
以武会友
TA的每日心情 | 开心 2024-6-9 16:20 |
---|
签到天数: 24 天 [LV.4]偶尔看看III
|
楼主 |
发表于 2007-10-23 14:43:24
|
显示全部楼层
以下为ASM实现方法
作者也是asm:
.386
.model flat, stdcall
option casemap :none
include windows.inc
include user32.inc
includelib user32.lib
include kernel32.inc
includelib kernel32.lib
ICO_MAIN equ 1000h ;图标
DLG_MAIN equ 1
IDC_EDIT equ 1001
IDC_Kill equ 1002
.data?
hInstance dd ?
.data
szFileName db 'C:\windows\system32\tasklist.exe',0
szCmdLine db 'tasklist.exe > C:\asm.log',0
szFileLook db 'C:\asm.log',0
szPid db 156 dup(0)
szNtsd db 'ntsd -c q -p ',0
sz1 db 156 dup(0)
szOK db 'Kill The Process Success',0
szYes db 'OK',0
.const
MEMORYSIZE equ 65535
.code
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
_ChenLook proc
local hMemory:DWORD
local pMemory:DWORD
local ReadSize:DWORD
local hFile:DWORD
invoke CreateFile, addr szFileLook, GENERIC_READ, FILE_SHARE_READ,\
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL
mov hFile, eax
invoke GlobalAlloc, GMEM_MOVEABLE or GMEM_ZEROINIT, MEMORYSIZE
mov hMemory, eax
invoke GlobalLock, hMemory
mov pMemory, eax
invoke ReadFile, hFile, pMemory, MEMORYSIZE-1, addr ReadSize, NULL
invoke MessageBox,NULL,pMemory,NULL,MB_OK
invoke GlobalUnlock, pMemory
invoke GlobalFree, hMemory
invoke CloseHandle, hFile
invoke DeleteFile,addr szFileLook
ret
_ChenLook endp
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
_Process proc
local stStartUp:STARTUPINFO
local stProcInfo:PROCESS_INFORMATION
invoke GetStartupInfo,addr stStartUp
invoke CreateProcess,NULL,addr szCmdLine,NULL,NULL,NULL,\
CREATE_NO_WINDOW,NULL,NULL,addr stStartUp,addr stProcInfo
ret
_Process endp
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
_KillProcess proc
local stStartUp:STARTUPINFO
local stProcInfo:PROCESS_INFORMATION
invoke lstrcat,addr sz1,addr szNtsd
invoke lstrcat,addr sz1,addr szPid
invoke GetStartupInfo,addr stStartUp
invoke CreateProcess,NULL,addr sz1,NULL,NULL,NULL,\
CREATE_NO_WINDOW,NULL,NULL,addr stStartUp,addr stProcInfo
invoke MessageBox,NULL,addr szOK,addr szYes,MB_OK
ret
_KillProcess endp
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
_ProcDlgMain proc uses ebx edi esi hWnd,wMsg,wParam,lParam
mov eax,wMsg
.if eax == WM_CLOSE
invoke EndDialog,hWnd,NULL
.elseif eax == WM_INITDIALOG
invoke LoadIcon,hInstance,ICO_MAIN
invoke SendMessage,hWnd,WM_SETICON,ICON_BIG,eax
.elseif eax == WM_COMMAND
mov eax,wParam
.if ax == IDOK
call _Process
call _ChenLook
.elseif ax == IDC_Kill
invoke GetDlgItemText,hWnd,IDC_EDIT,addr szPid,sizeof szPid
call _KillProcess
.endif
.else
mov eax,FALSE
ret
.endif
mov eax,TRUE
ret
_ProcDlgMain endp
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
start:
invoke GetModuleHandle,NULL
mov hInstance,eax
invoke DialogBoxParam,hInstance,DLG_MAIN,NULL,offset _ProcDlgMain,NULL
invoke ExitProcess,NULL
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
end start
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
#include <resource.h>
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
#define ICO_MAIN 0x1000 //图标
#define DLG_MAIN 1
#define IDC_EDIT 1001
#define IDC_Kill 1002
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
ICO_MAIN ICON "Main.ico"
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
DLG_MAIN DIALOG 50, 50, 263, 57
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Kill Process By Asm"
FONT 9, "宋体"
STYLE 0x14CA0000
EXSTYLE 0x00000001
{
GROUPBOX "Kill", -1,7,2,249,48
PUSHBUTTON "Get The PID All Of Processes",IDOK,14,12,120,14
LTEXT "Please Enter The PID end Kill The Process:", -1,15,30,174,12
EDITTEXT IDC_EDIT,188,28,29,13,ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP
PUSHBUTTON "Kill It",IDC_Kill,220,28,33,12
}
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
|