;Homepage:http://correy.webs.com
;QQ:112426112
.386
.model flat,stdcall
option casemap:none
include windows.inc
include kernel32.inc
include user32.inc
includelib user32.lib
includelib kernel32.lib
include comctl32.inc
includelib comctl32.lib
include psapi.inc
includelib psapi.lib
.data
szClassName db "correy",0
szCaptionMain db "made by correy",0
ListViewClass db 'SysListView32',0;ListBox
szstatic db "Static",0
windowstitle db 'PID(十六进制)',0
windowsclass db "程序名",0
allpath db "程序的完整路径",0
szhwindows db "主窗口的句柄(十六进制)",0
cwindowstitle db '模块的句柄',0
cwindowsclass db "模块的完整路径",0
cszhwindows db "子窗口的句柄(十六进制)",0
nowindowstitle db "获取失败!",0
sznochildwindows db "获取模块失败!",0
notice db "说明:双击上面的程序,可以在下面显示她加载模块的相关信息。",0
;有一些程序不能获取,特别是系统程序。
;本程序没有技术含量,但有使用价值。我不喜欢用别人的东西,我喜欢用自己的东西。到时间,积累的多了,自己就可以写操作系统了。
.data?
hInstance dd ?
hWinMain dd ?
hlist dd ?
hlist2 dd ?
stWndClass WNDCLASSEX <>
stMsg MSG <>
lvc LV_COLUMN <>
lvi LV_ITEM <>
buffer db 256 dup (?)
bufferl db 8 dup (?),0
hstatic dd ?
me MODULEENTRY32 <>
hSnapShot dd ?
stProcess PROCESSENTRY32 <>
hSnapShot0 dd ?
hMod dd ?
.code
mulit proc m:dword;一个子程序供String2Dword调用
mov ecx,m
.if ecx==1
mov ebx,1
ret
.endif
mov ebx,1
mul10:
imul ebx,16
dec ecx
cmp ecx,1
jne mul10
ret
mulit endp
String2Dword proc uses ecx edi edx esi String:DWORD
LOCAL Result:DWORD ;把一个形如:“6789abcd”的字符串转换成数字:6789abcd存放在eax中。
mov Result,0
mov edi,String
mov ecx,8
calc:
mov bl,byte ptr [edi]
movzx ebx,bl
.if bl >= "A" && bl <= "F"
sub bl,"A"
add bl,10
.elseif
sub bl,"0"
.endif
push ecx
push ebx
invoke mulit,ecx
mov eax,ebx
pop ebx
imul eax,ebx
add Result,eax
pop ecx
inc edi
dec ecx
cmp ecx,0
jne calc
mov eax,Result
ret
String2Dword endp
showeax proc;坚决拒绝使用wsprintf等类似函数。
pushad ;坚决不用c/c++的msvcrt.dll等系列函数。
mov ecx,8 ;坚决拒绝运行时库与.net等环境。
xor esi,esi ;坚决拒绝java等虚拟机环境。
againp: ;把eax的内容以十六进制的形式显示。
dec ecx
rol eax,4
push eax
and eax,0Fh
cmp eax,9
jg big
add eax,30h
mov [bufferl+esi],al
pop eax
inc esi
cmp ecx,0
jne againp
je showp
big:
add eax,37h
mov [bufferl+esi],al
pop eax
inc esi
cmp ecx,0
jne againp
showp:
popad
ret
showeax endp
liuchunli proc uses ebx edi esi,hWnd,uMsg,wParam,lParam
local p:POINT
local x:dword
local y:dword
.if uMsg == WM_CLOSE
invoke DestroyWindow,hWinMain
invoke PostQuitMessage,NULL
.elseif uMsg == WM_CREATE
INVOKE CreateWindowEx,WS_EX_CLIENTEDGE,addr ListViewClass,0,WS_CHILD or WS_VISIBLE or LVS_REPORT or LVS_SHAREIMAGELISTS,\
0,0,700,200,hWnd,0,hInstance,0
mov hlist,eax
mov lvc.imask,LVCF_TEXT+LVCF_WIDTH
mov lvc.pszText,offset windowstitle
mov lvc.lx,100
invoke SendMessage,hlist, LVM_INSERTCOLUMN, 0, addr lvc
mov lvc.pszText,offset windowsclass
mov lvc.lx,150
invoke SendMessage,hlist, LVM_INSERTCOLUMN, 1 ,addr lvc
mov lvc.pszText,offset allpath
mov lvc.lx,350
invoke SendMessage,hlist,LVM_INSERTCOLUMN,2,addr lvc
invoke SendMessage,hlist,LVM_SETEXTENDEDLISTVIEWSTYLE,LVS_EX_FULLROWSELECT,LVS_EX_FULLROWSELECT
mov lvi.iItem,0
invoke CreateToolhelp32Snapshot,TH32CS_SNAPPROCESS,0
mov hSnapShot0,eax
mov stProcess.dwSize,sizeof stProcess
invoke Process32First,hSnapShot0,addr stProcess
.while eax
mov eax,stProcess.th32ProcessID
call showeax
mov lvi.imask,LVIF_TEXT;输出进程的pid
lea eax,bufferl
mov lvi.pszText,eax
mov lvi.iSubItem,0
invoke SendMessage,hlist,LVM_INSERTITEM,0,addr lvi
lea eax,stProcess.szExeFile
mov lvi.pszText,eax
mov lvi.iSubItem,1
invoke SendMessage,hlist,LVM_SETITEM,0,addr lvi;注意第二次用LVM_SETITEM
invoke OpenProcess,410h,0,stProcess.th32ProcessID
invoke GetModuleFileNameEx,eax,hMod,addr buffer,260
invoke lstrlen,addr buffer
.if eax==0;如错误,输出提示。
mov lvi.pszText,offset nowindowstitle
mov lvi.iSubItem,2
invoke SendMessage,hlist,LVM_SETITEM,0,addr lvi
.else
lea eax,buffer;
mov lvi.pszText,eax
mov lvi.iSubItem,2
invoke SendMessage,hlist,LVM_SETITEM,0,addr lvi
.endif
invoke Process32Next,hSnapShot0,addr stProcess
.endw
invoke CloseHandle,hSnapShot0
INVOKE CreateWindowEx,WS_EX_CLIENTEDGE,addr ListViewClass,0,WS_CHILD or WS_VISIBLE or LVS_REPORT or LVS_SHAREIMAGELISTS,0,200,700,200,hWnd,0,hInstance,0
mov hlist2,eax
mov lvc.imask,LVCF_TEXT+LVCF_WIDTH
mov lvc.pszText,offset cwindowstitle
mov lvc.lx,100
invoke SendMessage,hlist2, LVM_INSERTCOLUMN, 0, addr lvc
mov lvc.pszText,offset cwindowsclass
mov lvc.lx,500
invoke SendMessage,hlist2, LVM_INSERTCOLUMN, 1 ,addr lvc
invoke SendMessage,hlist2,LVM_SETEXTENDEDLISTVIEWSTYLE,LVS_EX_FULLROWSELECT,LVS_EX_FULLROWSELECT
INVOKE CreateWindowEx,WS_EX_CLIENTEDGE,addr szstatic,0,WS_CHILD or WS_VISIBLE or SS_LEFT or WS_GROUP,0,400,700,100,hWnd,0,hInstance,0
MOV hstatic,EAX
invoke SendMessage,eax,WM_SETTEXT,0,addr notice
.elseif uMsg==WM_NOTIFY
push edi
mov edi,lParam
assume edi:ptr NMHDR
mov eax,[edi].hwndFrom
.if eax==hlist
.if [edi].code==NM_DBLCLK
invoke SendMessage,hlist2,LVM_DELETEALLITEMS,0,0
invoke SendMessage,hlist,LVM_GETNEXTITEM,-1,LVNI_FOCUSED
mov lvi.iItem,eax
mov lvi.iSubItem,0
mov lvi.cchTextMax,256
mov lvi.imask,LVIF_TEXT
mov lvi.pszText,offset buffer
invoke SendMessage,hlist,LVM_GETITEM,0,addr lvi
invoke String2Dword,addr buffer
mov lvi.iItem,0
.if eax==0;此处有个小逻辑的错误,若pid==0会显示两个”模块获取失败“。请看官改正之。
mov lvi.imask,LVIF_TEXT
lea eax,sznochildwindows
mov lvi.pszText,eax
mov lvi.iSubItem,0
invoke SendMessage,hlist2,LVM_INSERTITEM,0,addr lvi
.else
invoke CreateToolhelp32Snapshot,TH32CS_SNAPMODULE,eax;0
mov hSnapShot,eax
mov me.dwSize,sizeof me
invoke Module32First,hSnapShot,addr me
.while eax
mov eax,me.hModule
call showeax
mov lvi.imask,LVIF_TEXT
lea eax,bufferl
mov lvi.pszText,eax
mov lvi.iSubItem,0
invoke SendMessage,hlist2,LVM_INSERTITEM,0,addr lvi
lea eax,me.szExePath
mov lvi.pszText,eax
mov lvi.iSubItem,1
invoke SendMessage,hlist2,LVM_SETITEM,0,addr lvi
invoke RtlZeroMemory,addr me.szExePath,sizeof me.szExePath
invoke Module32Next,hSnapShot,addr me
.endw
invoke CloseHandle,hSnapShot
.endif
.if !eax;如果失败,显示提示。
mov lvi.imask,LVIF_TEXT
lea eax,sznochildwindows
mov lvi.pszText,eax
mov lvi.iSubItem,0
invoke SendMessage,hlist2,LVM_INSERTITEM,0,addr lvi
.endif
.endif
.endif
pop edi
.else
invoke DefWindowProc,hWnd,uMsg,wParam,lParam
ret
.endif
xor eax,eax
ret
liuchunli endp
start:
invoke InitCommonControls
invoke GetModuleHandle,NULL
mov hInstance,eax
mov stWndClass.hInstance,eax
invoke LoadIcon,hInstance,1
mov stWndClass.hIcon,eax
invoke LoadCursor,0,32512
mov dword ptr stWndClass+28,eax
mov stWndClass.cbSize,48
mov stWndClass.style,3
mov stWndClass.lpfnWndProc,offset liuchunli
mov stWndClass.hbrBackground,6
mov stWndClass.lpszClassName,offset szClassName
invoke RegisterClassEx,addr stWndClass
invoke CreateWindowEx,200h,offset szClassName,offset szCaptionMain,0Ca0000h,80000000h,80000000h,710,530,0,0,hInstance,0
mov hWinMain,eax
invoke ShowWindow,hWinMain,1
invoke UpdateWindow,hWinMain
.while TRUE
invoke GetMessage,addr stMsg,0,0,0
.break .if eax == 0
invoke TranslateMessage,addr stMsg
invoke DispatchMessage,addr stMsg
.endw
invoke ExitProcess,0
end start
;made at 2010.02.09
没有评论:
发表评论