Soyez le premier à donner votre avis sur cette source.
Vue 6 611 fois - Téléchargée 427 fois
;à chaque item du liste box est associé ;un pointeur sur une structure à taille variable ;selon le nombre d'icone que contient l'icone, ;cette structure est présentée: ;struct_data_item ;WORD TYPE ;WORD NBR_ICON ;WORD ID1,ID2... ;...selon NBR_ICON .386 .model flat,stdcall option casemap:none include c:\masm32\include\windows.inc include c:\masm32\include\user32.inc include c:\masm32\include\kernel32.inc include c:\masm32\include\gdi32.inc include c:\masm32\include\comdlg32.inc includelib c:\masm32\lib\user32.lib includelib c:\masm32\lib\kernel32.lib includelib c:\masm32\lib\gdi32.lib includelib c:\masm32\lib\comdlg32.lib .data szdisplayname db 'EXTACTICON',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 FORMHEX db '0123456789ABCDEF' FilterStExe db "Executable Files (*.dll;*.exe)",0,"*.dll;*.exe",0 db "All Files",0,"*.*",0,0 FilterStrIco db "fichier icone (*.ico)",0,"*.ico",0,0 ;db "All Files",0,"*.*",0,0 FilterStrCurs db "fichier curseur (*.cur)",0,"*.cur",0 ;db "All Files",0,"*.*",0,0 buffer db 200 dup (0) lpfile db 50 dup (0) initDir db 100 dup (0) OPFN dd 76,0,0,0,0,0,0,offset buffer,512 dd offset lpfile,50,0,0,0,0,0,0,0 str_raw db 'TYPE ID OFFSET SIZE',0 str_grpicon db 'ICONES',0 str_icon db 'ICONE',0 str_cursor db 'CURSOR',0 str_grpcursor db 'CURSORS ',0 msg1 db 'PE NON VALIDE !',0 m_item1 db 'ouvrir executable',0 m_item2 db 'extraire ico,cur',0 m_item3 db 'copier item',0 h_mpopup dd 0 buf db 100 dup(0) buf2 db 100 dup(20h) cl_list db 'LISTBOX',0 cl_btn db 'BUTTON',0 cl_scrl db 'SCROLLBAR',0 hbtn dd 0 hlist dd 0 hscrl dd 0 hinst dd 0 hModule dd 0 hIcon dd 0 hHeap dd 0 bloc_scrl dd 0 bloc_data dd 0 filesize dd 0 cur_item dd 0 Extico db '.ico' .code PROGRAMME: ;-----------------------WINMAIN----------------------------- push 512 push GPTR call GlobalAlloc push eax ;arg GlobalFree mov dword ptr [ebp-4],eax mov edx,DS_CENTER or edx,WS_POPUP or edx,WS_SYSMENU ;or edx,DS_MODALFRAME or edx,WS_CAPTION mov dword ptr [eax],edx mov word ptr [eax+10],0 mov word ptr [eax+12],0 mov word ptr [eax+14],290 mov word ptr [eax+16],100 push 0 call GetModuleHandle mov hinst,eax call GetProcessHeap mov hHeap,eax push 0 push offset DialogProc push 0 push [ebp-4] push hinst call DialogBoxIndirectParam call GlobalFree push 0 call ExitProcess ;---------------------------------DIALOGPROC--------------------------- DialogProc proc push ebp mov ebp,esp cmp dword ptr [ebp+12],WM_INITDIALOG jnz @wmclose push offset szdisplayname push [ebp+8] call SetWindowText push 501 push hinst call LoadIcon push eax push ICON_SMALL push WM_SETICON push [ebp+8] call SendMessage call CreateMenu push eax push offset m_item1 push 1 ;ID push 0 push eax call AppendMenu pop eax push eax push [ebp+8] call SetMenu call CreatePopupMenu mov h_mpopup,eax push offset m_item2 push 2 ;ID push 0 push eax call AppendMenu push offset m_item3 push 3 ;ID push 0 push h_mpopup call AppendMenu push 0 push hinst push 500 ;ID push [ebp+8] push 170 push 320 push 0 push 5 push LBS_DISABLENOSCROLL or LBS_NOINTEGRALHEIGHT \ or LBS_HASSTRINGS or LBS_NOTIFY or WS_CHILD or \ WS_VISIBLE or WS_VSCROLL push 0 push offset cl_list push WS_EX_CLIENTEDGE call CreateWindowEx mov hlist,eax ;---choisis police push 11 call GetStockObject push 0 push eax push 30h push hlist call SendMessage push 0 push hinst push 500 ;ID push [ebp+8] push 170 push 200 push 0 push 350 push WS_CHILD or WS_VISIBLE or BS_OWNERDRAW push 0 push offset cl_btn push 0;WS_EX_CLIENTEDGE call CreateWindowEx mov hbtn,eax push 0 push hinst push 200 ;ID push [ebp+8] push 170 push 15 push 0 push 560 push WS_CHILD or WS_VISIBLE or SBS_VERT push 0 push offset cl_scrl push 0 call CreateWindowEx mov hscrl,eax invoke HeapAlloc,hHeap,HEAP_ZERO_MEMORY,28 mov bloc_scrl,eax mov dword ptr [eax],28 ;sizeofstruct mov dword ptr [eax+4],SIF_DISABLENOSCROLL or SIF_ALL mov dword ptr [eax+16],170 @wmclose: cmp dword ptr [ebp+12],WM_CLOSE jnz @wmcontextm xor eax,eax push 0 push [ebp+8] call EndDialog mov esp,ebp pop ebp ret @wmcontextm: cmp dword ptr [ebp+12],WM_CONTEXTMENU jnz @wmcommand invoke SendMessage,hlist, LB_GETCURSEL,0,0 cmp eax,0FFFFFFFFh jz @wmcommand mov ax,[ebp+20];yposcur movzx eax,ax mov bx,[ebp+22];xposcur movzx ebx,bx push 0 push [ebp+8] push 0 push ebx push eax push 0 push h_mpopup call TrackPopupMenu @wmcommand: cmp dword ptr [ebp+12],WM_COMMAND jnz @wmdrawitem cmp word ptr[ebp+16],1 jnz @cmd1 push [ebp+8] call MappFile @cmd1: cmp word ptr[ebp+16],2 jnz @cmd2 call Extract @cmd2: cmp word ptr[ebp+16],3 jnz @cmd3 call cpytoclipboard @cmd3: ;cmp word ptr[ebp+16],500 ;jnz @wmdrawitem cmp word ptr[ebp+18],LBN_SELCHANGE jnz @wmdrawitem call SelChange jmp @endprocd @wmdrawitem: cmp dword ptr [ebp+12],WM_DRAWITEM jnz @wmvscroll mov eax,[ebp+20] cmp dword ptr [eax+4],500 jnz @wmvscroll invoke SendMessage,hlist,LB_GETCOUNT,0,0 test eax,eax jz @wmvscroll push [ebp+20] push [ebp+16] call DrawItem @wmvscroll: cmp dword ptr [ebp+12],WM_VSCROLL jnz @endprocd push [ebp+16] call OnVScroll @endprocd: xor eax,eax mov esp,ebp pop ebp ret 16 DialogProc endp OnVScroll proc push ebp mov ebp,esp sub esp,32 mov dword ptr[ebp-32],28 mov dword ptr[ebp-28],SIF_ALL lea esi,[ebp-32] push esi push SB_CTL push hscrl call GetScrollInfo mov edx,[ebp-12] ;y mov eax,[ebp+8] cmp ax,SB_LINEDOWN push ax jnz @sblup inc edx @sblup: pop ax cmp ax,SB_LINEUP push ax jnz @sbpageup dec edx @sbpageup: pop ax cmp ax,SB_PAGEUP push ax jnz @sbpagedown sub edx,[ebp-16] @sbpagedown: pop ax cmp ax,SB_PAGEDOWN push ax jnz @sbthumposition add edx,[ebp-16] @sbthumposition: pop ax cmp ax,SB_THUMBPOSITION push ax jnz @sbthumbtrack mov edx,[ebp-12] @sbthumbtrack: pop ax cmp ax,SB_THUMBTRACK jnz @endswitch mov edx,[ebp-8] @endswitch: push 1 push edx push SB_CTL push hscrl call SetScrollPos push FALSE push 0 push hbtn call InvalidateRect push hbtn call UpdateWindow mov esp,ebp pop ebp ret 4 OnVScroll endp ;----------------CLIP BOARD------------- cpytoclipboard proc push ebp mov ebp,esp sub esp,4 ;reserve 4 octet pour handle MEM invoke SendMessage,hlist, LB_GETCURSEL,0,0 test eax,eax js @noselectitem invoke SendMessage,hlist, LB_GETTEXT,eax,ADDR buf push hlist call OpenClipboard call EmptyClipboard push 200 push GMEM_ZEROINIT or GMEM_MOVEABLE or GMEM_SHARE call GlobalAlloc ;cree l'espace MEMOIRE mov [ebp-4],eax ;retourne un handle push eax call GlobalLock ;donne ptr sur MEMOIRE mov edi,eax lea esi,buf push esi @c: lodsb stosb test al,al jnz @c mov al,0 mov ecx,100 pop edi rep stosb push [ebp-4] call GlobalUnlock push [ebp-4] push 1 ;type texte call SetClipboardData call CloseClipboard push [ebp-4] call GlobalFree @noselectitem: mov esp,ebp pop ebp ret cpytoclipboard endp ;------------------------------------- ;------------------CHANGEMENT DE SELECTION LSTBOX---- SelChange proc push ebp mov ebp,esp ;------------on recupere ptr associé à l'item invoke SendMessage,hlist, LB_GETCURSEL,0,0 test eax,eax jnz @memdata invoke SendMessage,hlist, LB_SETCURSEL,1,0 @memdata: invoke SendMessage,hlist,LB_GETITEMDATA,eax,0 push eax ;ptr item_data call memdata mov ebx,bloc_scrl ;----------mask scroll info mov edx,SIF_ALL or edx,SIF_DISABLENOSCROLL mov dword ptr [ebx+4],edx ;---------min scroll info mov dword ptr [ebx+8],0 mov [ebx+12],eax ;-------- pos scroll info mov dword ptr [bloc_scrl+20],0 push 1 push bloc_scrl push SB_CTL push hscrl call SetScrollInfo push 0 push 0 push hbtn call InvalidateRect mov esp,ebp pop ebp ret SelChange endp ;--------------OUVERTURE ET MAPPAGE DU FICHIER---------------------- MappFile proc push ebp mov ebp,esp sub esp,16 lea eax,FilterStExe mov [OPFN+12],eax mov eax,OFN_PATHMUSTEXIST or eax,OFN_FILEMUSTEXIST or eax,OFN_HIDEREADONLY or eax,OFN_LONGNAMES mov [OPFN+52],eax mov [OPFN+44],0 push 100 push offset initDir call GetSystemDirectory push offset OPFN call GetOpenFileName and eax,eax jnz mapping mov esp,ebp pop ebp ret mapping: push 0 push OPEN_EXISTING push 0 push FILE_SHARE_READ push GENERIC_READ push offset buffer call CreateFile mov dword ptr [ebp-12],eax push 0 push 0 push 0 push PAGE_READONLY push 0 push eax call CreateFileMapping mov dword ptr [ebp-8],eax push 0 push 0 push 0 push FILE_MAP_READ push eax call MapViewOfFile mov dword ptr [ebp-4],eax cmp word ptr [eax],'ZM' jnz exitMappFile add eax,[eax+60] cmp dword ptr [eax],4550h jnz noValidPE push eax lea edi,[szdisplayname+10] mov byte ptr [edi],'-' inc edi push edi push offset lpfile call scopy push offset szdisplayname push [ebp+8] call SetWindowText pop eax push [ebp+8] push eax push [ebp-4];ptr_mapp call GetRsrc jmp exitMappFile noValidPE: push 0 push offset msg1 push offset msg1 push 0 call MessageBox exitMappFile: push [ebp-4] call UnmapViewOfFile push [ebp-8] call CloseHandle push [ebp-12] call CloseHandle mov esp,ebp pop ebp ret 4 MappFile endp ;--------------LIBERE MEM----- freedata proc mov eax,hModule test eax,eax jnz free ret free: push hModule call FreeLibrary push bloc_data push 0 push hHeap call HeapFree invoke SendMessage,hlist,LB_GETCOUNT,0,0 test eax,eax jnz freeitem ret freeitem: ;dec eax mov ecx,eax freenext: push ecx invoke SendMessage,hlist,LB_GETITEMDATA,ecx,0 push eax push 0 push hHeap call HeapFree pop ecx dec ecx test ecx,ecx jnz freenext ret freedata endp ;----------------------------- ;-------------LIT SECTION RSRC ET STOCKE LES DONNEES -------------- ;arg1 ptr mappfile, arg2 addr PE GetRsrc proc push ebp mov ebp,esp sub esp,32 call freedata push 0 push 0 push LB_RESETCONTENT push hlist call SendMessage push 1 push 0 push hbtn call InvalidateRect mov eax,[ebp+12] add eax,248 ;eax=OFF_SECTION_HEADER ;------------------ recherche section de resource dans le header mov ecx,5 findsection: cmp dword ptr[eax],'rsr.' jz itssection add eax,40 dec ecx test ecx,ecx jnz findsection mov esp,ebp pop ebp ret 12 itssection: mov edx,[eax+12] ;edx=RVA SECTION mov dword ptr [ebp-8],edx mov eax,[eax+20] ;eax=off_file rsrc mov dword ptr [ebp-12],eax ;RAW SECTION add eax,[ebp+8] ;eax=pmap_off_file rsrc mov dword ptr [ebp-4],eax ;sauvegarde ;------------------- push eax push LOAD_LIBRARY_AS_DATAFILE push 0 push offset buffer call LoadLibraryEx mov hModule,eax invoke SendMessage,hlist,LB_ADDSTRING,0,ADDR str_raw pop eax mov cx,[eax+12] mov dx,[eax+14] add cx,dx movzx ecx,cx ;ecx = NBR_DIR_ENTRY add eax,16 ;eax = RSRC_DIR_ENTRY next_dir_entry: push ecx push eax mov edx,[eax] mov dword ptr [ebp-32],edx test edx,0FFFFFF00h jnz next_type ;si le type est un string passe au suivant cmp edx,1 ;curseur ? jnz @1 mov dword ptr [ebp-16],offset str_cursor jmp @4 @1: cmp edx,3 ;icone ? jnz @2 mov dword ptr [ebp-16],offset str_icon jmp @4 @2: cmp edx,12 ;grp_cursor ? jnz @3 mov dword ptr [ebp-16],offset str_grpcursor jmp @4 @3: cmp edx,14 ;grp_icon ? jnz next_type ;si le type pas icone pas curseur pas groupe icone pas grp cur suivant mov dword ptr [ebp-16],offset str_grpicon @4: mov edx,[eax+4] and edx,00FFFFFFh add edx,[ebp-4] ;edx= ADDR SUB_DIR_TO_MAPFILE mov cx,[edx+12] add cx,[edx+14];cx= NBR_SUBDIR_ENTRY add edx,16 ;edx=START_SUBDIRS movzx ecx,cx next_subdir_entry: push ecx push edx mov ebx,[edx] mov dword ptr [ebp-20],ebx ;ebx= ID_RSRC mov ebx,[edx+4];ebx=ADDR_DIR_DATA and ebx,00FFFFFFh add ebx,[ebp-4];ebx=ADDR_DIR_DATA_TO_MAPFILE mov ebx,[ebx+20];ebx=ADDR_SUBDIR_DATA and ebx,00FFFFFFh add ebx,[ebp-4];ebx=ADDR_SUBDIR_DATA_TO_MAPFILE mov edi,[ebx];edi=RVA_DATA sub edi,[ebp-8] add edi,[ebp-12] mov dword ptr [ebp-24],edi ;save mov edi,[ebx+4];edi=SIZE_DATA mov dword ptr [ebp-28],edi ;save ;----------formatage de la chaine----- ;-------------reinit buf2 lea edi,buf2 mov al,20h mov cx,100 rep stosb ;---------------- lea edi,buf2 push edi push edi push [ebp-16] call scopy mov byte ptr [edi-1],20h pop edi add edi,10 push edi push edi test dword ptr [ebp-20],0FFFF0000h jz idnbr mov edx,[ebp-20] and edx,0000FFFFh add edx,[ebp-4] push edx call UnicodeAnsi mov byte ptr [edi],20h jmp @addr idnbr: push [ebp-20] call BinAsciiDec push offset buf call scopy mov byte ptr [edi-1],20h @addr: pop edi add edi,10 push edi push offset buf push [ebp-24] call BinAsciiHex call scopy mov byte ptr [edi-1],20h push edi push offset buf push [ebp-28] call BinAsciiHex call scopy ;--------------écrit la chaine invoke SendMessage,hlist,LB_ADDSTRING,0,ADDR buf2 ;------------ cmp dword ptr [ebp-32],12 jz @7 cmp dword ptr [ebp-32],14 jnz @8 @7: mov ebx,[ebp-24];addr data add ebx,[ebp+8];eax=addr data to mappfile mov cx,[ebx+4];nbr de sous icone movzx ecx,cx push [ebp-32];type push ecx ;nbr de sous icone push eax ;index_item push ebx ;addr data to mappfile call grpmem jmp @9 @8: push eax invoke HeapAlloc,hHeap,HEAP_ZERO_MEMORY,10 mov edx,[ebp-32] mov ebx,[ebp-20] mov word ptr [eax],dx ;type mov word ptr [eax+2],1 ;nbr mov word ptr [eax+4],bx ;id pop ebx invoke SendMessage, hlist, LB_SETITEMDATA,ebx,eax @9: pop edx pop ecx add edx,8 dec ecx test ecx,ecx jnz next_subdir_entry next_type: pop eax pop ecx add eax,8 dec ecx test ecx,ecx jnz next_dir_entry ;--------ptr mem pour fichier invoke HeapAlloc,hHeap,HEAP_ZERO_MEMORY,0 mov bloc_data,eax invoke SendMessage,hlist,LB_GETCOUNT,0,0 dec eax jz noitem ;si ya rien on ce casse invoke SendMessage,hlist,LB_SETCURSEL,1,0 call SelChange push hlist call SetFocus jmp fitem noitem: invoke SendMessage,hlist,LB_RESETCONTENT,0,0 fitem: mov esp,ebp pop ebp ret 12 GetRsrc endp ;---------------------------MEMORISE STRUCTS GROUPS-------------------------------- ;arg1 addr data, arg2 index item, arg3 nbr sous icones, arg4 type grpmem proc push ebp mov ebp,esp mov eax,[ebp+16] mov edx,eax shl edx,2 shl eax,1 add eax,edx add eax,4 invoke HeapAlloc,hHeap,HEAP_ZERO_MEMORY,eax push eax ;ptr_mem mov edx,[ebp+20] sub edx,11 mov ecx,[ebp+16] mov word ptr [eax],dx mov word ptr [eax+2],cx mov ebx,[ebp+8] add ebx,18 add eax,4 nextID: mov dx,[ebx] mov word ptr [eax],dx add ebx,14 add eax,2 dec ecx test ecx,ecx jnz nextID pop eax invoke SendMessage, hlist, LB_SETITEMDATA,[ebp+12],eax mov esp,ebp pop ebp ret 16 grpmem endp ;---------MEM FICHIER ET CREE ICONE(S)------ memdata proc push ebp mov ebp,esp sub esp,28 ;-----------reserve mem pour fichier invoke HeapReAlloc,hHeap,HEAP_ZERO_MEMORY,bloc_data,100000 mov bloc_data,eax ;--- mov dword ptr [ebp-28],0 ;--- mov edx,[ebp+8] mov cur_item,edx mov bx,[edx] movzx ebx,bx mov dword ptr [ebp-4],ebx ;type mov cx,[edx+2] movzx ecx,cx ;------------écrit l'entete de 6 octets ds bloc ;word res,word type,word nbr mov word ptr [eax],0 cmp ebx,3 jnz @11 mov word ptr [eax+2],1 ;icone @11: cmp ebx,1 jnz @12 mov word ptr [eax+2],2 ;curseur @12: mov word ptr [eax+4],cx ;nbr ;------------------------------------- mov ebx,eax add ebx,6 mov eax,ecx shl eax,4 add eax,6 mov dword ptr [ebp-20],eax ;taille header ou debut des données add edx,4 mov edi,ecx shl edi,1 add edi,edx mov dword ptr [ebp-24],edi ;addr first handle next_elem: push edx push ecx push ebx ;--------------chercher la resource-------- push [ebp-4] ;type rsrc mov bx,[edx] movzx ebx,bx push ebx ;id rsrc push hModule call FindResource mov dword ptr [ebp-8],eax ;hRes ;------------charger la resource----- push [ebp-8];hRes push hModule call LoadResource mov dword ptr [ebp-12],eax ;hGlobal ;-----------optenir la taille de la resource push [ebp-8];hRes push hModule call SizeofResource cmp dword ptr [ebp-4],1 jnz itnscur sub eax,4 ;si curseur on reduit la taille de 4 itnscur: mov dword ptr [ebp-16],eax ;dwSize ;-----------creer un pointeur sur la resource push [ebp-12];hGlobal call LockResource cmp dword ptr [ebp-4],1 jnz iticon add eax,4 ;si curseur on avance le pointeur de 4 iticon: ;--------écrire dans bloc_data pop ebx push ebx mov edx,[eax+4] mov byte ptr [ebx],dl ;largeur mov edx,[eax+8] shr edx,1 add dword ptr [ebp-28],edx ;pour scrollbar info add dword ptr [ebp-28],20 mov byte ptr [ebx+1],dl ;hauteur mov edx,[eax+32] mov byte ptr [ebx+2],dl ;nbr de couleur mov byte ptr [ebx+3],0 ;reserve mov word ptr [ebx+4],1 ;nbr plan mov dx,[eax+14] mov word ptr [ebx+6],dx ;nbr octets par pixel mov edx,[ebp-16] mov dword ptr [ebx+8],edx ;nbr d'octets de données associées mov edx,[ebp-20] mov dword ptr [ebx+12],edx ;addresse des données dans le fichier mov edi,bloc_data add edi,[ebp-20] mov esi,eax mov ecx,[ebp-16] rep movsb push 0 push [eax+4] ;hauteur push [eax+4] ;largeur push 30000h push 1 push [ebp-16];dwSize push eax ;ptr resource call CreateIconFromResourceEx mov edx,[ebp-24] mov dword ptr [edx],eax ;recup hicon dans itemdata add dword ptr [ebp-24],4 mov eax,[ebp-16] add dword ptr [ebp-20],eax ;prochaine addr ou taille fichier en fin de boucle pop ebx pop ecx pop edx add ebx,16 add edx,2 dec ecx test ecx,ecx jnz next_elem ;---------taille fichier mov eax,[ebp-20] mov filesize,eax ;---------nmax scroll info mov eax,[ebp-28] mov esp,ebp pop ebp ret 4 memdata endp ;--------------------------DESSINE DrawItem proc push ebp mov ebp,esp sub esp,32 mov esi,[ebp+12] ;DRAWITEMSTRUCT ;----------creation du contexte d'affichage en mémoire push [esi+24] call CreateCompatibleDC mov dword ptr [ebp-4],eax ;hMemDC push [esi+40] push [esi+36] push [esi+24] call CreateCompatibleBitmap mov dword ptr [ebp-8],eax ;hMemBmp push eax push [ebp-4] call SelectObject mov dword ptr [ebp-12],eax ;hOldBmp ;----------- fond push COLOR_BTNFACE call GetSysColor push eax call CreateSolidBrush push eax ;arg DeleteObject lea edi,[esi+28] push eax push edi push [ebp-4] call FillRect call DeleteObject push SB_CTL push hscrl call GetScrollPos neg eax mov dword ptr [ebp-16],eax ;init pos.y ;--------------init rect text mov dword ptr [ebp-32],20;left mov dword ptr [ebp-24],100;right ;-------dessin de l'icone mov edi,cur_item mov cx,[edi+2] movzx ecx,cx ;nbr mov edx,ecx shl edx,1 add edx,4 add edi,edx ;addr premier hicon mov edx,bloc_data add edx,18 @next_ico: push ecx push edx mov eax,[edx] add eax,bloc_data ;info_header push eax push esi push edi push eax push [eax+4] call BinAsciiDec push offset buf2 push offset buf call scopy mov byte ptr [edi-1],'x' pop eax push eax push edi push offset buf push [eax+4] call BinAsciiDec call scopy mov byte ptr [edi-1],',' pop eax mov dx,[eax+14];bitbcount cmp dx,4 jz @16col cmp dx,8 jz @256col mov eax,1 jmp @colcount @16col: mov eax,16 jmp @colcount @256col: mov eax,256 @colcount: push edi push offset buf push eax call BinAsciiDec call scopy push TRANSPARENT push [ebp-4] call SetBkMode ;-----rec text mov eax,[ebp-16] ;y mov dword ptr [ebp-28],eax ;top add eax,20 mov dword ptr [ebp-20],eax ;bottom ;------ lea eax,[ebp-32] push DT_LEFT or DT_SINGLELINE or DT_VCENTER push eax push 0FFFFFFFFh push offset buf2 push [ebp-4] call DrawText add dword ptr [ebp-16],20 ;y+=20 pop edi pop esi pop eax push DI_NORMAL push 0 push 0 push [eax+4] push [eax+4] push [edi];hIcon push [ebp-16] ;y mov edx,[eax+4] add dword ptr [ebp-16],edx ;prochain y push 20 ;x push [ebp-4] call DrawIconEx add edi,4 pop edx pop ecx add edx,16 dec ecx test ecx,ecx jnz @next_ico ;-------------recopie le contexte à l'écran push SRCCOPY push 0 push 0 push [ebp-4] push [esi+40] push [esi+36] push 0 push 0 push [esi+24] call BitBlt ;-----------liberation des resources push [ebp-12] push [ebp-4] call SelectObject push [ebp-4] call DeleteDC push [ebp-8] call DeleteObject mov esp,ebp pop ebp ret 8 DrawItem endp ;-----------------EXTRACTION------------------------- Extract proc push ebp mov ebp,esp sub esp,4 mov al,0 mov ecx,200 lea edi,buffer rep stosb mov ebx,bloc_data cmp word ptr [ebx+2],1 jnz itscurs lea eax,FilterStrIco lea edi,[FilterStrIco+22] jmp filterstr itscurs: lea eax,FilterStrCurs lea edi,[FilterStrCurs+25] filterstr: mov dword ptr [OPFN+60],edi mov [OPFN+12],eax mov eax,OFN_PATHMUSTEXIST or eax,OFN_OVERWRITEPROMPT or eax,OFN_HIDEREADONLY or eax,OFN_LONGNAMES mov [OPFN+52],eax mov [OPFN+44],0 push offset OPFN call GetSaveFileName ;-------------------------creer fichier push 0 push FILE_ATTRIBUTE_NORMAL push CREATE_ALWAYS push 0 push 0 push GENERIC_WRITE push offset buffer call CreateFile push eax ;--------------------------------écrit le fichier lea edx,[ebp-4] push 0 push edx push filesize ;nbr d'octets à écrire push bloc_data ;off data à écrire push eax ;handle du fichier call WriteFile ;-------------------------------fermer le fichier pop eax push eax call CloseHandle mov esp,ebp pop ebp ret Extract endp ;-----------------------------DWORD EN CHAINE ASCII DEC---------------------------------------- BinAsciiDec proc push ebp mov ebp,esp mov eax,[ebp+8] sub esp,20 ;creer une zone temporaire de 20 bytes mov esi,ebp dec esi mov byte ptr [esi],0 mov ecx,1 mov ebx,10 ;10 pour la division divis: mov edx,0 ;eax=quotient précédent div ebx ;diviser par 10 add dl,'0' ;convertir reste en ASCII dec esi ;on écrit de droite à guauche mov [esi],dl ;stocker dans zone temporaire inc ecx test eax,eax jne divis ;tant que reste diff zéro lea edi,buf rep movsb ;ds:si->es:di mov esp,ebp ;suppression zone temporaire pop ebp ret 4 ;depile l'argument dword (4 bytes) BinAsciiDec endp ;-----------------------------DWORD EN CHAINE ASCII HEX--------------------------------- ;arg1 DWORD:valeur BinAsciiHex proc push ebp mov ebp,esp lea edi,buf lea esi,FORMHEX mov eax,[ebp+8] ror eax,24 mov ecx,4 xor ebx,ebx xor edx,edx NEXTB: mov dl,al mov bl,dl shr dl,4 ;dl=4 bits poid fort and bl,00001111b ;bl=4 bits poid faible push esi push esi add esi,edx mov dl,[esi] mov byte ptr [edi],dl inc edi pop esi add esi,ebx mov bl,[esi] pop esi mov byte ptr [edi],bl rol eax,8 inc edi loop NEXTB mov esp,ebp pop ebp ret 4 ;depile les arguments 4 bytes BinAsciiHex endp ;---------------------------CONVERTI UNICODE EN ANSI------------------------------- ;arg1 src,arg2 dest UnicodeAnsi proc push ebp mov ebp,esp mov esi,[ebp+8] mov edi,[ebp+12] mov cl,[esi] inc esi nuni: inc esi movsb dec cl test cl,cl jnz nuni mov byte ptr [edi],0 mov esp,ebp pop ebp ret 8 UnicodeAnsi endp ;---------------------------COPIE UNE CHAINE A UNE ADDRESSE------------------------ ;arg1 src,arg2 dest scopy proc push ebp mov ebp,esp mov esi,[ebp+8] mov edi,[ebp+12] @cpy:lodsb stosb test al,al jnz @cpy pop ebp ret 8 scopy endp end PROGRAMME ;DLGTEMPLATE STRUCT DWORD ; style DWORD ? ; dwExtendedStyle DWORD ? ; cdit WORD ?; ; x WORD ? ; y WORD ? ; lx WORD ? ; ly WORD ? ;DLGTEMPLATE ENDS ;DRAWITEMSTRUCT STRUCT ; CtlType DWORD ? ; CtlID DWORD ? ; itemID DWORD ? ; itemAction DWORD ? ; itemState DWORD ? ; hwndItem DWORD ? ; hdc DWORD ? ; rcItem RECT <> ; itemData DWORD ? ;DRAWITEMSTRUCT ENDS ;SCROLLINFO STRUCT ; cbSize DWORD ? ; fMask DWORD ? ; nMin DWORD ? ; nMax DWORD ? ; nPage DWORD ? ; nPos DWORD ? ; nTrackPos DWORD ? ;SCROLLINFO ENDS
3 févr. 2005 à 18:54
Bravo pour le boulot effectué!
3 févr. 2005 à 12:17
3 févr. 2005 à 10:14
mais tu aurais pu te simplifier le vie en utilisant un RadAsm http://radasm.visualassembler.com/ et en utilisant Invoke plutot que de faire des push mauel avant l'apel des apis (ce qui ralonge inutilement le source).
Sinon, Bravo.
ManChesTer.
31 janv. 2005 à 22:10
en tout cas bravo !!!
petite question ça t'as pris combien de temps? j'imagine que tu doit être passioné et que tu n'as pas compter tes heures mais pour avoir une idée
10/10 pour la "beauté du geste"
Vous n'êtes pas encore membre ?
inscrivez-vous, c'est gratuit et ça prend moins d'une minute !
Les membres obtiennent plus de réponses que les utilisateurs anonymes.
Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.
Le fait d'être membre vous permet d'avoir des options supplémentaires.