iczelion tut35[5]

[入库:2005年8月19日] [更新:2007年3月24日]

本文简介:选择自 jimgreen 的 blog

al settext:settextex .if umsg==wm_initdialog push hwnd pop hsearch invoke setdlgitemtext,hwnd,idc_findedit,addr findbuffer invoke setdlgitemtext,hwnd,idc_replaceedit,addr replacebuffer .elseif umsg==wm_command mov eax,wparam shr eax,16 .if ax==bn_clicked mov eax,wparam .if ax==idcancel invoke sendmessage,hwnd,wm_close,0,0 .elseif ax==idok invoke getdlgitemtext,hwnd,idc_findedit,addr findbuffer,sizeof findbuffer invoke getdlgitemtext,hwnd,idc_replaceedit,addr replacebuffer,sizeof replacebuffer mov findtext.chrg.cpmin,0 mov findtext.chrg.cpmax,-1 mov findtext.lpstrtext,offset findbuffer mov settext.flags,st_selection mov settext.codepage,cp_acp .while true invoke sendmessage,hwndrichedit,em_findtextex,fr_down,addr findtext .if eax==-1 .break .else invoke sendmessage,hwndrichedit,em_exsetsel,0,addr findtext.chrgtext invoke sendmessage,hwndrichedit,em_settextex,addr settext,addr replacebuffer .endif .endw .endif .endif .elseif umsg==wm_close mov hsearch,0 invoke enddialog,hwnd,0 .else mov eax,false ret .endif mov eax,true ret replaceproc endp gotoproc proc hwnd:dword, umsg:dword, wparam:dword, lparam:dword local lineno:dword local chrg:charrange .if umsg==wm_initdialog push hwnd pop hsearch .elseif umsg==wm_command mov eax,wparam shr eax,16 .if ax==bn_clicked mov eax,wparam .if ax==idcancel invoke sendmessage,hwnd,wm_close,0,0 .elseif ax==idok invoke getdlgitemint,hwnd,idc_lineno,null,false mov lineno,eax invoke sendmessage,hwndrichedit,em_getlinecount,0,0 .if eax>lineno invoke sendmessage,hwndrichedit,em_lineindex,lineno,0 invoke sendmessage,hwndrichedit,em_setsel,eax,eax invoke setfocus,hwndrichedit .endif .endif .endif .elseif umsg==wm_close mov hsearch,0 invoke enddialog,hwnd,0 .else mov eax,false ret .endif mov eax,true ret gotoproc endp prepareeditmenu proc hsubmenu:dword local chrg:charrange invoke sendmessage,hwndrichedit,em_canpaste,cf_text,0 .if eax==0 ; no text in the clipboard invoke enablemenuitem,hsubmenu,idm_paste,mf_grayed .else invoke enablemenuitem,hsubmenu,idm_paste,mf_enabled .endif invoke sendmessage,hwndrichedit,em_canundo,0,0 .if eax==0 invoke enablemenuitem,hsubmenu,idm_undo,mf_grayed .else invoke enablemenuitem,hsubmenu,idm_undo,mf_enabled .endif invoke sendmessage,hwndrichedit,em_canredo,0,0 .if eax==0 invoke enablemenuitem,hsubmenu,idm_redo,mf_grayed .else invoke enablemenuitem,hsubmenu,idm_redo,mf_enabled .endif invoke sendmessage,hwndrichedit,em_exgetsel,0,addr chrg mov eax,chrg.cpmin .if eax==chrg.cpmax ; no current selection invoke enablemenuitem,hsubmenu,idm_copy,mf_grayed invoke enablemenuitem,hsubmenu,idm_cut,mf_grayed invoke enablemenuitem,hsubmenu,idm_delete,mf_grayed .else invoke enablemenuitem,hsubmenu,idm_copy,mf_enabled invoke enablemenuitem,hsubmenu,idm_cut,mf_enabled invoke enablemenuitem,hsubmenu,idm_delete,mf_enabled .endif ret prepareeditmenu endp parsebuffer proc uses edi esi hheap:dword,pbuffer:dword, nsize:dword, arrayoffset:dword,parray:dword local buffer[128]:byte local inprogress:dword mov inprogress,false lea esi,buffer mov edi,pbuffer invoke charlower,edi mov ecx,nsize searchloop: or ecx,ecx jz finished cmp byte ptr [edi]," " je endofword cmp byte ptr [edi],9 ; tab je endofword mov inprogress,true mov al,byte ptr [edi] mov byte ptr [esi],al inc esi skipit: inc edi dec ecx jmp searchloop endofword: cmp inprogress,true je wordfound jmp skipit wordfound: mov byte ptr [esi],0 push ecx invoke heapalloc,hheap,heap_zero_memory,sizeof wordinfo push esi mov esi,eax assume esi:ptr wordinfo invoke lstrlen,addr buffer mov [esi].wordlen,eax push arrayoffset pop [esi].pcolor inc eax invoke heapalloc,hheap,heap_zero_memory,eax mov [esi].pszword,eax mov edx,eax invoke lstrcpy,edx,addr buffer mov eax,parray movzx edx,byte ptr [buffer] shl edx,2 ; multiply by 4 add eax,edx .if dword ptr [eax]==0 mov dword ptr [eax],esi .else push dword ptr [eax] pop [esi].nextlink mov dword ptr [eax],esi .endif pop esi pop ecx lea esi,buffer mov inprogress,false jmp skipit finished: .if inprogress==true invoke heapalloc,hheap,heap_zero_memory,sizeof wordinfo push esi mov esi,eax assume esi:ptr wordinfo invoke lstrlen,addr buffer mov [esi].wordlen,eax push arrayoffset pop [esi].pcolor inc eax invoke heapalloc,hheap,heap_zero_memory,eax mov [esi].pszword,eax mov edx,eax invoke lstrcpy,edx,addr buffer mov eax,parray movzx edx,byte ptr [buffer] shl edx,2 ; multiply by 4 add eax,edx .if dword ptr [eax]==0 mov dword ptr [eax],esi .else push dword ptr [eax]

本文关键:iczelion asm
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top