begin process at 2010 02 09 18:35:31
  Trouver un code source :
 
dans
 
Accueil > 

Code

 > 

Applications Windows

 > PATCH TOUT EXE 32BITS POUR Y INSERER UNE IMAGE (GIF ,JPG,BMP )AFFICHÉE LE TEMPS DÉSIRÉ

PATCH TOUT EXE 32BITS POUR Y INSERER UNE IMAGE (GIF ,JPG,BMP )AFFICHÉE LE TEMPS DÉSIRÉ


 Information sur la source

Note :
9,57 / 10 - par 7 personnes
9,57 / 10

  • 1

  • 2

  • 3

  • 4

  • 5

  • 6

  • 7

  • 8

  • 9

  • 10
Catégorie :Applications Windows Classé sous :patch, correctif, image, exe, bitmap Niveau :Débutant Date de création :03/06/2005 Date de mise à jour :17/12/2005 20:24:45 Vu / téléchargé :7 291 / 683

Auteur : quoi

Ecrire un message privé
Commentaire sur cette source (12)
Ajouter un commentaire et/ou une note

 Description

Cliquez pour voir la capture en taille normale
Ce programme permet d'inserer une image (GIF,JPG,BMP) dans n'importre quel  exe 32bits
cette image  s'affichera  en premier plan le temps désiré par l'utilisateur


Source

  • .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
  • include c:\masm32\include\GetValue.inc
  • include c:\masm32\include\oleaut32.inc
  • include c:\masm32\include\ole32.inc
  • include c:\masm32\include\winmm.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
  • includelib c:\masm32\lib\winmm.lib
  • includelib c:\masm32\lib\oleaut32.lib
  • includelib c:\masm32\lib\ole32.lib
  • includelib c:\masm32\lib\GetValue.lib
  • DialogProc PROTO : HWND, : UINT, : WPARAM, : LPARAM
  • OnCommand PROTO : HWND, : WPARAM
  • FileOpen PROTO : DWORD,:DWORD,:DWORD
  • FileMap PROTO : DWORD,:DWORD,:DWORD,:DWORD
  • .CONST
  • OPCODESIZE equ 70Dh
  • OFF_JUMP_PT_ENTRY equ 332h
  • OFF_ELAPSE_TIME equ 45Ah
  • IDD_DIALOG equ 100
  • IDB_BKG equ 300
  • IDB_EXIT equ 301
  • IDB_OPEN1 equ 302
  • IDB_OPEN2 equ 303
  • IDB_PATCH equ 304
  • IDC_EXENAME equ 400
  • IDC_BMPNAME equ 401
  • IDC_TIME equ 402
  • IDC_TEST equ 403
  • CR_BACKGROUND equ 00876265h
  • CR_TEXT equ 00FFDADDh
  • KEYCOLOR equ 00FEFEFEh
  • NOTE_C equ 403C78C0h
  • NOTE_E equ 40407BC0h
  • NOTE_G equ 40437BC0h
  • .DATA
  • old_pt_entry DD 0
  • new_pt_entry DD 0
  • imagebase DD 0
  • off_new_section DD 0
  • off_to_file DD 0
  • off_v_data DD 0
  • hBKG DD 0
  • hBgColor DD 0
  • hBgEdit DD 0
  • hPatch DD 0
  • ptr_PE DD 0
  • h_mapPE DD 0
  • h_filePE DD 0
  • SIZE_PE DD 0
  • ptr_PICTURE DD 0
  • h_mapPICTURE DD 0
  • h_filePICTURE DD 0
  • SIZE_FILE_PICTURE DD 0
  • FilterStrBMP db "Image Files (*.bmp;*.gif;*.jpg)",0,"*.bmp;*.gif;*.jpg",0,0
  • FilterStrEXE db "Executable Files (*.exe)",0,"*.exe",0,0
  • filename db 200 dup(0)
  • lpfile db 50 dup(0)
  • OPFN dd 76
  • hwnd dd 0,0,0,0,0,0,offset filename,200
  • dd offset lpfile,50,0,0,0,0,0,0,0
  • msg1 db '(*.EXE) NON VALIDE !',0
  • msg2 db '(*.EXE) NON PATCHABLE',0
  • msg3 db '(*.EXE) DEJA CHARGER OU EN LECTURE SEUL !'
  • STRNULL db 0
  • STRDEFT db '5000',0
  • hMidiOut DD 0
  • include patch03.hex
  • include xlpicture.asm
  • include skinbtn.asm
  • .CODE
  • PROGRAMME:
  • ;###########################################
  • ;------------------- WINMAIN ---------------
  • ;###########################################
  • Invoke XLoadImage,IDB_BKG
  • Invoke CreatePatternBrush,eax
  • mov hBKG,eax
  • INVOKE CreateSolidBrush, CR_BACKGROUND
  • mov hBgColor, eax
  • INVOKE DialogBoxParam,400000h, IDD_DIALOG,0, ADDR DialogProc, 0
  • INVOKE DeleteObject,hBKG
  • INVOKE DeleteObject,hBgColor
  • INVOKE ExitProcess, 0
  • ;###########################################
  • ;------------------- DIALOGPROC ------------
  • ;###########################################
  • DialogProc PROC hWnd: HWND, uMsg: UINT, wParam: WPARAM, lParam: LPARAM
  • mov eax,[ebp+12]
  • cmp eax,WM_CTLCOLORDLG
  • je WMCOLORDLG
  • cmp eax,WM_CTLCOLORSTATIC
  • je WMCOLORSTATIC
  • cmp eax,WM_CTLCOLOREDIT
  • je WMCOLOREDIT
  • cmp eax,WM_LBUTTONDOWN
  • je WMLBTNDOWN
  • cmp eax,WM_COMMAND
  • je WMCOMMAND
  • cmp eax,WM_INITDIALOG
  • je WMINITDLG
  • cmp eax,WM_CLOSE
  • je WMCLOSE
  • jmp DLG
  • WMCOLORDLG: mov eax, hBgColor
  • ret
  • WMCOLORSTATIC: INVOKE SetBkMode, wParam, TRANSPARENT
  • INVOKE GetDlgCtrlID, lParam
  • cmp eax,IDC_TEST
  • jne @static
  • mov eax,hBKG
  • ret
  • @static: INVOKE SetTextColor, wParam, CR_TEXT
  • mov eax, hBgColor
  • ret
  • WMCOLOREDIT: INVOKE SetBkMode, wParam,TRANSPARENT
  • INVOKE SetTextColor, wParam, CR_TEXT
  • mov eax,hBgColor
  • ret
  • WMLBTNDOWN: Invoke SendMessage,hWnd,WM_NCLBUTTONDOWN,HTCAPTION,[ebp+20]
  • jmp DLG
  • WMCOMMAND: Invoke OnCommand,hWnd,wParam
  • jmp DLG
  • WMINITDLG: mov eax,hWnd
  • mov hwnd,eax
  • Invoke midiOutOpen,ADDR hMidiOut,0,0,0,CALLBACK_NULL
  • Invoke XButton,hWnd,NOTE_C,219,208,IDB_EXIT,600
  • Invoke XButton,hWnd,NOTE_E,330,88,IDB_OPEN1,601
  • Invoke XButton,hWnd,NOTE_G,330,128,IDB_OPEN2,602
  • Invoke XButton,hwnd,NOTE_C,37,208,IDB_PATCH,603
  • Invoke GetDlgItem,hWnd,603
  • mov hPatch,eax
  • Invoke ShowWindow,eax,SW_HIDE
  • jmp DLG
  • WMCLOSE: Invoke midiOutClose, hMidiOut
  • INVOKE EndDialog, hWnd, 0
  • DLG: xor eax, eax
  • ret
  • DialogProc ENDP
  • ;##################################################
  • ;----------------------- ONCOMMAND ----------------
  • ;##################################################
  • OnCommand PROC hWnd: HWND, wParam : WPARAM
  • mov eax,wParam
  • cmp ax,602
  • je CMD_OPENBMP
  • cmp ax,601
  • je CMD_OPENEXE
  • cmp ax,603
  • je CMD_PATCH
  • cmp ax,600
  • je CMD_QUIT
  • ret
  • CMD_OPENBMP: Invoke FileOpen,ADDR h_filePICTURE,ADDR FilterStrBMP,0
  • test eax,eax
  • jnz @mapbmp
  • ret
  • @mapbmp: invoke GetFileSize, eax, NULL
  • mov SIZE_FILE_PICTURE,eax
  • Invoke FileMap,h_filePICTURE,ADDR h_mapPICTURE,PAGE_READONLY,0
  • mov ptr_PICTURE,eax
  • call GetInfoBMP
  • Invoke UnmapViewOfFile,ptr_PICTURE
  • Invoke CloseHandle,h_mapPICTURE
  • ret
  • CMD_OPENEXE: Invoke FileOpen,ADDR h_filePE,ADDR FilterStrEXE,GENERIC_WRITE
  • test eax,eax
  • jnz @mapexe
  • ret
  • @mapexe: invoke GetFileSize, eax, NULL
  • mov SIZE_PE,eax
  • Invoke FileMap,h_filePE,ADDR h_mapPE,PAGE_READWRITE,0
  • mov ptr_PE,eax
  • call GetInfoPE
  • Invoke UnmapViewOfFile,ptr_PE
  • Invoke CloseHandle,h_mapPE
  • ret
  • CMD_PATCH: Invoke ShowWindow,hPatch,SW_HIDE
  • Invoke EnableWindow,hPatch,FALSE
  • mov eax,OPCODESIZE
  • add eax,SIZE_FILE_PICTURE
  • add eax,4
  • test eax,511
  • jz @mul512
  • shr eax,9
  • inc eax
  • shl eax,9
  • @mul512: add eax,SIZE_PE
  • Invoke FileMap,h_filePE,ADDR h_mapPE,PAGE_READWRITE,eax
  • mov ptr_PE,eax
  • Invoke FileMap,h_filePICTURE,ADDR h_mapPICTURE,PAGE_READONLY,0
  • mov ptr_PICTURE,eax
  • call Patch
  • Invoke UnmapViewOfFile,ptr_PE
  • Invoke CloseHandle,h_mapPE
  • Invoke CloseHandle,h_filePE
  • mov h_filePE,0
  • Invoke UnmapViewOfFile,ptr_PICTURE
  • Invoke CloseHandle,h_mapPICTURE
  • Invoke CloseHandle,h_filePICTURE
  • mov h_filePICTURE,0
  • Invoke SetDlgItemText ,hwnd,IDC_EXENAME,ADDR STRNULL
  • Invoke SetDlgItemText ,hwnd,IDC_BMPNAME,ADDR STRNULL
  • Invoke SetDlgItemText ,hwnd,IDC_TIME,ADDR STRDEFT
  • ret
  • CMD_QUIT: Invoke SendMessage,hwnd,WM_CLOSE,0,0
  • ret
  • OnCommand ENDP
  • ;#####################################################
  • ;-------------- OUVERTURE D'UN FICHIER AVEC BOITE OPEN
  • ;#####################################################
  • FileOpen PROC addrhfile : DWORD,addrfilter : DWORD,DesirAccess : DWORD
  • ;--------boite open
  • lea eax,filename
  • mov byte ptr [eax],0
  • mov eax,addrfilter
  • mov [OPFN+12],eax
  • mov [OPFN+52],OFN_LONGNAMES or OFN_HIDEREADONLY \
  • or OFN_FILEMUSTEXIST or OFN_PATHMUSTEXIST
  • mov [OPFN+44],0
  • push offset OPFN
  • call GetOpenFileName
  • test eax,eax
  • jz Annuler
  • ;----------------------fermer hande file
  • mov edi,addrhfile
  • Invoke CloseHandle,[edi]
  • ;-----------------------désactive btn patch
  • Invoke ShowWindow,hPatch,SW_HIDE
  • Invoke EnableWindow,hPatch,FALSE
  • ;-------------ouvrir fichier
  • mov eax,DesirAccess
  • or eax,GENERIC_READ
  • Invoke CreateFile,ADDR filename,eax,\
  • 0,0,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,0
  • mov edx,eax
  • inc edx
  • jnz openOK
  • push offset msg3
  • call MSGERROR
  • xor eax,eax
  • jmp Annuler
  • openOK:
  • stosd
  • Annuler:
  • ret
  • FileOpen ENDP
  • ;############################################
  • ;----------------------- MAPPAGE D'UN FICHIER
  • ;############################################
  • FileMap PROC hfile : DWORD,addrhMap : DWORD,desirAccess : DWORD,sizeMap : DWORD
  • mov esi,desirAccess
  • Invoke CreateFileMapping,hfile,0,esi,0,sizeMap,0
  • mov edi,addrhMap
  • mov [edi],eax
  • ;-------------optenir le pointeur
  • add esi,2
  • Invoke MapViewOfFile,eax,esi,0,0,0
  • ret
  • FileMap ENDP
  • ;//////////////////////////////////////
  • ;------------------OPTENIR INFO BITMAP
  • ;//////////////////////////////////////
  • GetInfoBMP proc
  • Invoke SetDlgItemText ,hwnd,IDC_BMPNAME,ADDR filename
  • mov eax,h_filePE
  • test eax,eax
  • jz nopatch
  • Invoke ShowWindow,hPatch,SW_SHOW
  • Invoke EnableWindow,hPatch,TRUE
  • nopatch: ret
  • GetInfoBMP endp
  • ;//////////////////////////////////////
  • ;----------------- OPTENIR INFO SUR PE
  • ;//////////////////////////////////////
  • GetInfoPE proc
  • ;----test validité
  • cmp word ptr [eax],'ZM'
  • jnz noValidePE
  • ;--------taille sections header
  • mov edx,[eax+60];PEH
  • add eax,edx ;+ptr_mapp
  • ;----test validité
  • cmp dword ptr [eax],4550h
  • jnz noValidePE
  • push [eax+40]
  • pop old_pt_entry
  • push [eax+52]
  • pop imagebase
  • mov di,[eax+6] ;nbrsection
  • mov cx,[eax+6]
  • shl di,5
  • shl cx,3
  • add di,cx
  • movzx edi,di
  • ;---------taille place libre dans header
  • add edx,248 ;+size peh
  • add edx,edi ;+size section header
  • mov off_new_section,edx
  • add edx,[eax+212];+size bound import
  • mov ecx,[eax+84] ;size header to file
  • sub ecx,edx
  • ;--------
  • cmp ecx,40
  • jl noPlace
  • Invoke SetDlgItemText ,hwnd,IDC_EXENAME,ADDR filename
  • mov eax,h_filePICTURE
  • test eax,eax
  • jz noPa
  • Invoke ShowWindow,hPatch,SW_SHOW
  • Invoke EnableWindow,hPatch,TRUE
  • ret
  • noValidePE:
  • push offset msg1
  • call MSGERROR
  • ret
  • noPlace:
  • push offset msg2
  • call MSGERROR
  • noPa:
  • ret
  • GetInfoPE endp
  • ;###############################
  • ;---------------------- PATCHAGE
  • ;###############################
  • Patch proc
  • ;-----decalage du bound import
  • mov eax,ptr_PE
  • add eax,[eax+60]
  • inc word ptr [eax+6];inc nbr sections
  • mov ecx,[eax+212] ;size bound import
  • test ecx,ecx
  • jz noboundimport
  • mov esi,[eax+208] ;off bound import
  • add esi,ecx
  • add esi,ptr_PE
  • add dword ptr [eax+208],40
  • mov edi,[eax+208]
  • add edi,ecx
  • add edi,ptr_PE
  • std
  • rep movsb
  • cld
  • noboundimport:
  • ;###################################################################
  • ;--------------ECRIRE DS HEADER : AJOUT SECTION,NOUVEAU PT D'ENTREE,
  • ; NOUVELLE TAILLE DE L'IMAGE
  • ;###################################################################
  • ;------------- AJOUT SECTION
  • mov edi,off_new_section
  • add edi,ptr_PE
  • ;-------------- NOM
  • mov dword ptr [edi],'ttt.'
  • mov dword ptr [edi+4],0
  • ;-------------- TAILLE VIRTUELLE
  • mov eax,OPCODESIZE
  • add eax,SIZE_FILE_PICTURE
  • mov dword ptr [edi+8],eax
  • ;-------------- offset virtuelle
  • mov eax,[edi-32]
  • add eax,[edi-28]
  • test eax,0FFFh
  • jz @mul1000h
  • shr eax,12
  • inc eax
  • shl eax,12
  • @mul1000h:
  • mov dword ptr [edi+12],eax
  • mov edx,imagebase
  • add edx,eax
  • mov off_v_data,edx
  • mov new_pt_entry,eax
  • ;------- size to file
  • mov eax,OPCODESIZE;size_opcode
  • add eax,SIZE_FILE_PICTURE
  • test eax,511
  • jz mul200h
  • shr eax,9
  • inc eax
  • shl eax,9
  • mul200h:
  • mov dword ptr [edi+16],eax
  • ;------- off to file
  • mov eax,[edi-24]
  • add eax,[edi-20]
  • mov dword ptr [edi+20],eax
  • mov off_to_file,eax
  • ;----------
  • mov dword ptr [edi+24],0
  • mov dword ptr [edi+28],0
  • mov dword ptr [edi+32],0
  • ;-------- caracteristic
  • mov dword ptr [edi+36],0FE000020h
  • ;--------------- NOUVELLE TAILLE DE L'IMAGE
  • mov eax,[edi+8]
  • add eax,[edi+12]
  • test eax,0FFFh
  • jz SizeOfImage
  • and eax,0FFFFF000h
  • add eax,1000h
  • SizeOfImage:
  • mov edx,ptr_PE
  • add edx,[edx+60]
  • mov [edx+80],eax
  • ;----------------- NOUVEAU PT D'ENTREE
  • push new_pt_entry
  • pop [edx+40]
  • ;#########################################################
  • ;----------------- PETITE MODIFICATION DANS L'OPCODE -----
  • ;#########################################################
  • lea edi,opcode
  • ;-------- CALCUL DU SAUT AU POINT D'ENTREE INITIAL
  • mov edx,new_pt_entry
  • add edx,OFF_JUMP_PT_ENTRY
  • add edx,3
  • sub edx,old_pt_entry
  • not edx
  • mov dword ptr [edi+OFF_JUMP_PT_ENTRY],edx ;saut ancien point d'entree
  • ;------- REGLAGE TIMER
  • Invoke GetDlgItemInt,hwnd,IDC_TIME,0,FALSE
  • push eax
  • pop [edi+OFF_ELAPSE_TIME] ;elapse time
  • ;#####################################################################
  • ;--------------- COPIE DE L'OPCODE ET DU FICHIER IMAGE DANS PROG CIBLE
  • ;#####################################################################
  • ;---------- copie opcode dans fichier
  • lea esi,opcode
  • mov edi,ptr_PE
  • add edi,off_to_file
  • mov ecx,OPCODESIZE
  • rep movsb
  • ;---------- copie fichier image dans fichier
  • mov esi,ptr_PICTURE
  • push SIZE_FILE_PICTURE
  • pop [edi]
  • add edi,4
  • mov ecx,SIZE_FILE_PICTURE
  • rep movsb
  • ret
  • Patch endp
  • ;////////////////////////////////////////////
  • MSGERROR PROC
  • Invoke MessageBox,hwnd,[esp+12],ADDR lpfile,MB_ICONEXCLAMATION
  • Invoke CloseHandle,h_filePE
  • mov h_filePE,0
  • Invoke SetDlgItemText ,hwnd,IDC_EXENAME,ADDR STRNULL
  • ret 4
  • MSGERROR ENDP
  • end PROGRAMME
.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
include c:\masm32\include\GetValue.inc
include c:\masm32\include\oleaut32.inc
include c:\masm32\include\ole32.inc
include c:\masm32\include\winmm.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
includelib c:\masm32\lib\winmm.lib

includelib c:\masm32\lib\oleaut32.lib
includelib c:\masm32\lib\ole32.lib
includelib c:\masm32\lib\GetValue.lib


DialogProc PROTO : HWND, : UINT, : WPARAM, : LPARAM
OnCommand  PROTO : HWND, : WPARAM
FileOpen   PROTO : DWORD,:DWORD,:DWORD
FileMap    PROTO : DWORD,:DWORD,:DWORD,:DWORD

.CONST

OPCODESIZE            equ 70Dh
OFF_JUMP_PT_ENTRY     equ 332h
OFF_ELAPSE_TIME       equ 45Ah

IDD_DIALOG             equ 100
IDB_BKG                equ 300
IDB_EXIT               equ 301
IDB_OPEN1         equ 302
IDB_OPEN2         equ 303
IDB_PATCH         equ 304
IDC_EXENAME       equ 400
IDC_BMPNAME       equ 401
IDC_TIME          equ 402
IDC_TEST          equ 403

CR_BACKGROUND     equ 00876265h
CR_TEXT           equ 00FFDADDh
KEYCOLOR          equ 00FEFEFEh

NOTE_C            equ 403C78C0h
NOTE_E            equ 40407BC0h
NOTE_G            equ 40437BC0h


.DATA

old_pt_entry        DD 0
new_pt_entry        DD 0
imagebase           DD 0
off_new_section     DD 0
off_to_file         DD 0
off_v_data          DD 0
hBKG                DD 0
hBgColor            DD 0
hBgEdit             DD 0
hPatch              DD 0


ptr_PE              DD 0
h_mapPE             DD 0
h_filePE            DD 0
SIZE_PE             DD 0
   

ptr_PICTURE         DD 0
h_mapPICTURE        DD 0
h_filePICTURE       DD 0 
SIZE_FILE_PICTURE   DD 0




FilterStrBMP db "Image Files (*.bmp;*.gif;*.jpg)",0,"*.bmp;*.gif;*.jpg",0,0
FilterStrEXE db "Executable Files (*.exe)",0,"*.exe",0,0
             
filename     db 200 dup(0)
lpfile       db 50  dup(0)
OPFN         dd  76
hwnd         dd  0,0,0,0,0,0,offset filename,200
             dd  offset lpfile,50,0,0,0,0,0,0,0



msg1     db '(*.EXE) NON VALIDE !',0 
msg2     db '(*.EXE) NON PATCHABLE',0
msg3     db '(*.EXE) DEJA CHARGER OU EN LECTURE SEUL !'
STRNULL  db  0
STRDEFT  db '5000',0

hMidiOut DD 0
include patch03.hex
include xlpicture.asm
include skinbtn.asm
.CODE
PROGRAMME:

;###########################################
;------------------- WINMAIN ---------------
;###########################################



Invoke XLoadImage,IDB_BKG 
Invoke CreatePatternBrush,eax
mov    hBKG,eax
INVOKE CreateSolidBrush, CR_BACKGROUND
mov hBgColor, eax
INVOKE DialogBoxParam,400000h, IDD_DIALOG,0, ADDR DialogProc, 0
INVOKE DeleteObject,hBKG
INVOKE DeleteObject,hBgColor
INVOKE ExitProcess, 0

;###########################################      
;------------------- DIALOGPROC ------------
;###########################################


  DialogProc PROC hWnd: HWND, uMsg: UINT, wParam: WPARAM, lParam: LPARAM
  mov  eax,[ebp+12]
  cmp  eax,WM_CTLCOLORDLG
  je   WMCOLORDLG
  cmp  eax,WM_CTLCOLORSTATIC
  je   WMCOLORSTATIC
  cmp  eax,WM_CTLCOLOREDIT
  je   WMCOLOREDIT
  cmp  eax,WM_LBUTTONDOWN
  je   WMLBTNDOWN
  cmp  eax,WM_COMMAND
  je   WMCOMMAND
  cmp  eax,WM_INITDIALOG
  je   WMINITDLG
  cmp  eax,WM_CLOSE
  je   WMCLOSE
  jmp  DLG
WMCOLORDLG:    mov eax, hBgColor
               ret
WMCOLORSTATIC: INVOKE SetBkMode, wParam, TRANSPARENT
               INVOKE GetDlgCtrlID, lParam
               cmp    eax,IDC_TEST
               jne    @static
               mov    eax,hBKG
               ret
@static:       INVOKE SetTextColor, wParam, CR_TEXT
               mov eax, hBgColor
               ret
WMCOLOREDIT:   INVOKE SetBkMode, wParam,TRANSPARENT
               INVOKE SetTextColor, wParam, CR_TEXT
               mov eax,hBgColor
               ret
WMLBTNDOWN:    Invoke SendMessage,hWnd,WM_NCLBUTTONDOWN,HTCAPTION,[ebp+20]
               jmp  DLG
WMCOMMAND:     Invoke OnCommand,hWnd,wParam
               jmp DLG
WMINITDLG:     mov    eax,hWnd
               mov    hwnd,eax
               Invoke midiOutOpen,ADDR hMidiOut,0,0,0,CALLBACK_NULL
               Invoke XButton,hWnd,NOTE_C,219,208,IDB_EXIT,600
               Invoke XButton,hWnd,NOTE_E,330,88,IDB_OPEN1,601
               Invoke XButton,hWnd,NOTE_G,330,128,IDB_OPEN2,602
               Invoke XButton,hwnd,NOTE_C,37,208,IDB_PATCH,603
              
               Invoke GetDlgItem,hWnd,603
               mov    hPatch,eax
               Invoke ShowWindow,eax,SW_HIDE
              
               jmp DLG
WMCLOSE:       Invoke    midiOutClose, hMidiOut 
               INVOKE EndDialog, hWnd, 0
DLG:           xor eax, eax
               ret
DialogProc ENDP

;##################################################
;----------------------- ONCOMMAND ----------------
;##################################################

OnCommand PROC hWnd: HWND, wParam : WPARAM

       mov  eax,wParam
       cmp  ax,602
       je   CMD_OPENBMP
       cmp  ax,601
       je   CMD_OPENEXE
       cmp  ax,603
       je   CMD_PATCH
       cmp  ax,600
       je   CMD_QUIT
       ret

CMD_OPENBMP: Invoke FileOpen,ADDR h_filePICTURE,ADDR FilterStrBMP,0
             test eax,eax
             jnz  @mapbmp
             ret
@mapbmp:     invoke GetFileSize, eax, NULL    
             mov    SIZE_FILE_PICTURE,eax
             Invoke FileMap,h_filePICTURE,ADDR h_mapPICTURE,PAGE_READONLY,0
             mov  ptr_PICTURE,eax
             call GetInfoBMP
             Invoke UnmapViewOfFile,ptr_PICTURE
             Invoke CloseHandle,h_mapPICTURE
             ret
        
CMD_OPENEXE: Invoke FileOpen,ADDR h_filePE,ADDR FilterStrEXE,GENERIC_WRITE
             test eax,eax
             jnz  @mapexe
             ret
@mapexe:     invoke GetFileSize, eax, NULL
              mov  SIZE_PE,eax
             Invoke FileMap,h_filePE,ADDR h_mapPE,PAGE_READWRITE,0
             mov ptr_PE,eax
             call GetInfoPE
             Invoke UnmapViewOfFile,ptr_PE
             Invoke CloseHandle,h_mapPE
             ret
       
CMD_PATCH:   Invoke ShowWindow,hPatch,SW_HIDE
             Invoke EnableWindow,hPatch,FALSE

             mov  eax,OPCODESIZE
             add  eax,SIZE_FILE_PICTURE
             add  eax,4
             test eax,511
             jz @mul512
             shr eax,9
             inc eax
             shl eax,9
@mul512:     add  eax,SIZE_PE
             Invoke FileMap,h_filePE,ADDR h_mapPE,PAGE_READWRITE,eax
             mov ptr_PE,eax
             Invoke FileMap,h_filePICTURE,ADDR h_mapPICTURE,PAGE_READONLY,0
             mov  ptr_PICTURE,eax

             call Patch
       
             Invoke UnmapViewOfFile,ptr_PE
             Invoke CloseHandle,h_mapPE
             Invoke CloseHandle,h_filePE
             mov    h_filePE,0
      
             Invoke UnmapViewOfFile,ptr_PICTURE
             Invoke CloseHandle,h_mapPICTURE
             Invoke CloseHandle,h_filePICTURE
             mov    h_filePICTURE,0
       
             Invoke SetDlgItemText ,hwnd,IDC_EXENAME,ADDR STRNULL
             Invoke SetDlgItemText ,hwnd,IDC_BMPNAME,ADDR STRNULL
             Invoke SetDlgItemText ,hwnd,IDC_TIME,ADDR STRDEFT

             ret
CMD_QUIT:    Invoke SendMessage,hwnd,WM_CLOSE,0,0
             ret  
OnCommand ENDP
;#####################################################
;-------------- OUVERTURE D'UN FICHIER AVEC BOITE OPEN
;#####################################################
FileOpen PROC addrhfile : DWORD,addrfilter : DWORD,DesirAccess : DWORD

   
     ;--------boite open
       lea   eax,filename
       mov   byte ptr [eax],0

       mov eax,addrfilter
       mov [OPFN+12],eax
       
       mov [OPFN+52],OFN_LONGNAMES or OFN_HIDEREADONLY \
       or OFN_FILEMUSTEXIST or OFN_PATHMUSTEXIST  
       mov [OPFN+44],0
       push offset OPFN
       call GetOpenFileName
       test eax,eax
       jz   Annuler
;----------------------fermer hande file       
       mov  edi,addrhfile
       Invoke CloseHandle,[edi]
       
;-----------------------désactive btn patch
        Invoke ShowWindow,hPatch,SW_HIDE
        Invoke EnableWindow,hPatch,FALSE

;-------------ouvrir fichier
       mov    eax,DesirAccess
       or     eax,GENERIC_READ
       Invoke CreateFile,ADDR filename,eax,\
       0,0,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,0
 
       mov  edx,eax
       inc  edx
       jnz  openOK
       push offset msg3
       call MSGERROR
       xor  eax,eax
       jmp  Annuler
openOK:
        stosd

Annuler:
       ret
FileOpen ENDP
;############################################
;----------------------- MAPPAGE D'UN FICHIER
;############################################
FileMap PROC hfile : DWORD,addrhMap : DWORD,desirAccess : DWORD,sizeMap : DWORD
       mov    esi,desirAccess
       Invoke CreateFileMapping,hfile,0,esi,0,sizeMap,0
       mov  edi,addrhMap 
       mov [edi],eax
       ;-------------optenir le pointeur
       add    esi,2
       Invoke MapViewOfFile,eax,esi,0,0,0
       ret 

FileMap ENDP
;//////////////////////////////////////
;------------------OPTENIR INFO BITMAP
;//////////////////////////////////////
GetInfoBMP proc
         Invoke SetDlgItemText ,hwnd,IDC_BMPNAME,ADDR filename
         mov    eax,h_filePE
         test   eax,eax
         jz     nopatch
         Invoke ShowWindow,hPatch,SW_SHOW
         Invoke EnableWindow,hPatch,TRUE
nopatch: ret
GetInfoBMP endp
;//////////////////////////////////////
;----------------- OPTENIR INFO SUR  PE
;//////////////////////////////////////
GetInfoPE proc
      
;----test validité
       cmp word ptr [eax],'ZM'
       jnz noValidePE
;--------taille sections header
       mov  edx,[eax+60];PEH
       add  eax,edx     ;+ptr_mapp
;----test validité

       cmp  dword ptr [eax],4550h
       jnz  noValidePE
       push [eax+40]
       pop  old_pt_entry
       push [eax+52]
       pop  imagebase
       mov  di,[eax+6]  ;nbrsection
       mov  cx,[eax+6]
       shl  di,5
       shl  cx,3
       add  di,cx
       movzx edi,di
       
;---------taille place libre dans header

       add  edx,248  ;+size peh
       add  edx,edi  ;+size section header
       mov off_new_section,edx 
       add  edx,[eax+212];+size bound import
       mov  ecx,[eax+84] ;size header to file
       sub  ecx,edx
       
;--------
       cmp  ecx,40
       jl   noPlace
       Invoke SetDlgItemText ,hwnd,IDC_EXENAME,ADDR filename
       mov    eax,h_filePICTURE
       test   eax,eax
       jz     noPa
       Invoke ShowWindow,hPatch,SW_SHOW
       Invoke EnableWindow,hPatch,TRUE

       ret 
noValidePE:
       push offset msg1
       call MSGERROR
       ret 
noPlace:
       push offset msg2
       call MSGERROR
 noPa:      
       ret 
GetInfoPE endp
;###############################
;---------------------- PATCHAGE 
;###############################      
Patch proc
     
      
       
;-----decalage du bound import


      mov  eax,ptr_PE
      add  eax,[eax+60]
      inc word ptr [eax+6];inc nbr sections
      mov  ecx,[eax+212] ;size bound import

      test ecx,ecx 

      jz     noboundimport
      mov  esi,[eax+208] ;off bound import
      add  esi,ecx
      add  esi,ptr_PE
      add  dword ptr [eax+208],40
      mov  edi,[eax+208]
      add  edi,ecx
      add  edi,ptr_PE
      std
      rep movsb
      cld
noboundimport:

;###################################################################
;--------------ECRIRE DS HEADER : AJOUT SECTION,NOUVEAU PT D'ENTREE,
;              NOUVELLE TAILLE DE L'IMAGE
;###################################################################

;-------------  AJOUT SECTION
    
     mov  edi,off_new_section
     add  edi,ptr_PE
     
;-------------- NOM

      mov dword ptr [edi],'ttt.'
      mov dword ptr [edi+4],0
      
;-------------- TAILLE VIRTUELLE

      mov eax,OPCODESIZE 
      add eax,SIZE_FILE_PICTURE
      mov dword ptr [edi+8],eax
      
;-------------- offset virtuelle

      mov  eax,[edi-32]
      add  eax,[edi-28]
      test eax,0FFFh
      jz @mul1000h
      shr   eax,12
      inc   eax
      shl   eax,12
@mul1000h:
      mov  dword ptr [edi+12],eax
      mov  edx,imagebase
      add  edx,eax
      mov  off_v_data,edx
      mov  new_pt_entry,eax
      

;------- size to file

      mov  eax,OPCODESIZE;size_opcode
      add  eax,SIZE_FILE_PICTURE
      test eax,511
      jz mul200h
      shr eax,9
      inc eax
      shl eax,9
mul200h:
      mov  dword ptr [edi+16],eax
;------- off to file

      mov  eax,[edi-24]
      add  eax,[edi-20]
      mov  dword ptr [edi+20],eax
      mov  off_to_file,eax

;----------
     mov  dword ptr [edi+24],0
     mov  dword ptr [edi+28],0
     mov  dword ptr [edi+32],0
;-------- caracteristic
mov   dword ptr [edi+36],0FE000020h


;--------------- NOUVELLE TAILLE DE L'IMAGE

     mov  eax,[edi+8]
     add  eax,[edi+12]
     test eax,0FFFh
     jz   SizeOfImage
     and  eax,0FFFFF000h
     add  eax,1000h
SizeOfImage:
    mov  edx,ptr_PE
    add  edx,[edx+60]
    mov  [edx+80],eax
   
;----------------- NOUVEAU PT D'ENTREE 
    push new_pt_entry
    pop  [edx+40]
    
;######################################################### 
;----------------- PETITE MODIFICATION DANS L'OPCODE -----
;#########################################################

   lea edi,opcode
 
;-------- CALCUL DU SAUT AU POINT D'ENTREE INITIAL

   mov  edx,new_pt_entry
   add  edx,OFF_JUMP_PT_ENTRY
   add  edx,3
   sub  edx,old_pt_entry
   not  edx
   mov  dword ptr [edi+OFF_JUMP_PT_ENTRY],edx ;saut ancien point d'entree
   
;------- REGLAGE TIMER

  Invoke GetDlgItemInt,hwnd,IDC_TIME,0,FALSE
  push eax
  pop  [edi+OFF_ELAPSE_TIME] ;elapse time

;#####################################################################
;--------------- COPIE DE L'OPCODE ET DU FICHIER IMAGE DANS PROG CIBLE
;#####################################################################


;---------- copie opcode dans fichier 
  lea esi,opcode
  mov edi,ptr_PE
  add edi,off_to_file
  mov ecx,OPCODESIZE
  rep movsb 
;---------- copie fichier image dans fichier
  mov esi,ptr_PICTURE
  push SIZE_FILE_PICTURE
  pop  [edi]
  add  edi,4
  mov ecx,SIZE_FILE_PICTURE
  rep movsb  

     
       ret  
Patch endp

;////////////////////////////////////////////
MSGERROR PROC
      Invoke MessageBox,hwnd,[esp+12],ADDR lpfile,MB_ICONEXCLAMATION
      Invoke CloseHandle,h_filePE
      mov    h_filePE,0
      Invoke SetDlgItemText ,hwnd,IDC_EXENAME,ADDR STRNULL
      ret 4
MSGERROR ENDP
end PROGRAMME

 Conclusion

Je tiens à remercier BLUEBIBUBBLE pour sa participation graphique
j'ai mis un Readme.txt dans le zip.


 Fichier Zip

Les Membres Club peuvent télécharger directement un fichier contenu dans le zip sans télécharger le zip en entier !

Télécharger le zip


 Historique

03 juin 2005 15:48:49 :
faute d'hortographe
09 juin 2005 14:48:48 :
Le plus IMPORTANT la librairie "skinbtn.lib" n'était pas compatible W2K 1.GetFileSize au lieu de SetFilePointeur pour obtenir la taille d'un fichier 2.Le prog utilise ma propre librairie "xlpicture.lib" pour charger les gif (la fonction XLoadImage au lieu de BitmapFromResource de masm) 3.Le plus IMPORTANT la librairie "skinbtn.lib" n'était pas compatible W2K
17 décembre 2005 20:24:45 :
1.L'ancienne version ne chargeait que des image *.bmp maintenant (bmp ,gif ,jpg) 2.j'avais fais un fonction getApis pour obtenir l'addr de toute les apis utilisée ds le codepatch beaucoup de code boulot de fou pour trouver les addresses et en plus le programme ne pouvait tourner que sur le pc ou il avait été patché ce qui ne peut plus être le cas (les addr sont trouvées par le patch et il trouve tout seul l'addr des ses données) je n'ai que une section à ajouté dont les caractéristic sont code+R+W 3.le zip ne contenait pas le code des fonctions XLoadImage et XButton c'est offert pour noël

 Sources du même auteur

Source avec Zip TEXTURE AVEC DIRECTX9
Source avec Zip FLOATTOHEX CODE DE BRUNEWS RETRENSCRIS EN ASM PAR MOI
Source avec Zip SPLASH SCREEN
Source avec Zip EXTRACTICONES
Source avec Zip DUMP HEXADECIMAL

 Sources de la même categorie

Source avec Zip Source avec une capture BASE DE REGISTRE ET TRANSFERE DE BMP DANS SYSTEM32 par vincent2795
Source avec Zip RÉSOUDRE LES PROBLÈMES DE VERSIONS DU SYSTÈME OU DE DLL par ToutEnMasm
Source avec Zip DEXPLORE INTERFACE HELP2 MICROSOFT DOCUMENT EXPLORER par ToutEnMasm
Source avec Zip DEXPLORE INTERFACE HELP2 MICROSOFT DOCUMENT EXPLORER par ToutEnMasm
Source avec Zip Source avec une capture ANALYSEUR DE TRAFIC (WINPCAP) par ORdream

 Sources en rapport avec celle ci

Source avec Zip [TUTO]PRISE EN MAIN ET CRÉATION DE .EXE À L'AIDE D'UN DÉBUGU... par rt15
Source avec Zip CONVERSION BITMAP 1, 4, 8, 24 ET 32 BITS par BLUEBIBUBBLE
PATCHER par sirozz
Source avec Zip Source avec une capture [MASM32] CRACK (PATCH) par Dean

Commentaires et avis

Commentaire de FearBlue le 04/06/2005 18:05:50

Ta source est tres intéressante meme si je n'y comprend rien :)
Je  trouve l'idée amusante :)
Bonne continuation
FB

Commentaire de x5man le 05/06/2005 12:02:36

L'idee elle est superbe ! 9/10 et a noter le Batch s'il contient cette ligne :: @Echo off Ca ne va afficher que les instrucions importates ! Tres bien Quoi ! (drole de Pseudo )

Commentaire de x5man le 05/06/2005 14:25:19

T'as utilisé la Lib XButton Cool !
Au fait y a une autre Lib pour le Mapping ,une PE Lib super Extra :: http://pe-lib.sourceforge.net/

(btw les Lib nous facilite la Vie ;)  

Commentaire de BLUEBIBUBBLE le 06/06/2005 20:46:38

FearBlue a raison, j’ai bouffé deux boites d’aspirine et j’ai toujours rien capté !!! Heureusement que t'a classé le code niveau débutant et j'espère que tu vas pas nous pondre un truc niveau expert !!! ;)
H'chement bien quand même...

Commentaire de x5man le 07/06/2005 17:37:15

Bon voyons BLUEBIBUBBLE !
Le prog de Quoi Map l'image et le file ExE. Puis il ajoute une section au file choisi ( il gonfle l'exe )
Puis il redirige l'OEP ( Original Entry Point ). Il cherche les Adresse des Apis et il est inclut ds l'exe avec le reste du code ... (je vais etudier cette derniere partie avec plus de precision )
Seya

Commentaire de Zootella le 17/06/2005 20:23:53

Bonjour,

Vraiment bien comme code!!

Mais est-ce possible d'avoir un truc basic ? c'est à dire le même programme avec une dialogbox normal et au lieu d'afficher image qu'il affiche juste une MessageBox, serait-ce possible de le faire ?

Si non, c'est pas trop grave ;), Merci.

Commentaire de BLUEBIBUBBLE le 12/07/2005 19:14:57

Hello,
Le code complet (avec les sources des librairies) est accessible sur mon site à cette url:

http://www.rph-concept.com/download/exepatch.zip

Commentaire de c3rb3r3 le 23/07/2005 03:14:37

Bonjour à toi,

Une note de 9/10 pour une idée qui change des habituelles.

Bonne continuation, c'est très agréable.

Commentaire de eRoZion le 13/08/2005 14:40:00

Ta source est bien et ce qu'elle fait aussi est sympa étant donné qu'elle modifie l'header PH assez simplement.

Par contre ce qui est très dommage c'est qu'une fois l'exe patché, lorsqu'il est lancé le splash-screen fonctionne très bien mais dès qu'il disparait la focale n'est plus sur le programme et on doit recliquer sur la barre des tâches pour le voir apparaitre au premier plan. :(

Je pense que ca ne doit pas être très difficile à rectifier ça en utilisant un API32, mais je n'en suis qu'à mes balbutiments en assembleur et mon temps libre est relativement restreint ; mais l'idée est là. ;)


eRoZion

Commentaire de eRoZion le 13/08/2005 14:41:25

Je te mets 9/10.


eRoZion

Commentaire de patatalo le 31/12/2005 08:29:22 administrateur CS

salut,

Dommage que tu n'ai pas utilisé les structures PE, ça aurait facilité grandement la lecture du code.

@++

Commentaire de youcef23 le 11/10/2006 12:30:53

je recherche le patch ou flash ou des sites de recherches de telechargement de software ou flash ou patch pour ouvrire les channels television

 Ajouter un commentaire


Discussions en rapport avec ce code source dans le forum

modification bitmap [ par noel70 ] Bonjour a tous.Voila, j'essaie depuis un moment de modifier un fichier image (bmp ou jpg),Dans un premier, j'ai essayer d'afficher cette image dans un comment créer un fichier image d'une disquette sous dos ? [ par hudson ] bonjour,je voudrais savoir comment créer une image d'une disquette sous dos en yincluant mon fichier boot + un fichier kernel...pour faire tourne la structure des fichier exe [ par izou ] je veux savoire quelle est le role de la table de relogement dans les fichier exe afficher une image jpeg avec la fonction StretchDIBits ? [ par mitch19 ] bonjour, j'essaye depuis quelques temps d'afficher une image jpeg avecla commande  StretchDIBits, en vain ! mon programme plante lamentablement ! desassember un .exe pour date d'expiration [ par ozexperience ] salutje voudrait si qqun pourrait menvoyer windasm pour desassembler un logiciel afin de minitier au crackingjutilise hackman pour le moment je voulai ajout d'une variable dans un exe [ par tezca_system ] Sans avoir lu encore toutes mes docs (vos bouts de codes et les liens de vos sites), je me pose une question. Est il possible d'integerer une variable Compilation d'un fichier COM avec MASM [ par Oeil_de_taupe ] Bonjour,J'imagine que mon manque de neurone peut expliquer mon problème mais je viens de chercher pendant toute l'arprès-midi sans trouver la solution Creer un exe qui va chercher un fichier texte sur le net ? [ par sharkjo ] Voila mon souci je cheche a creer un programe ce programme grace a un bouton quand on clique dessus il ca aller checher des infos que jai place dans u SE [ par TheGorgo ] Bonjour a tous, en fait mon message concerne les systemes d'exploitations en general. je voudrais creer un se de base compatible avec les programmes Exe simple codé sans linker [ par Mareck666 ] Bonjour tout le monde, voila mon pb afin de mieu comprendre le format EXE 16 bits (ok sa sert plus a rien de codé des application avec sa, mai bn c'es


Nos sponsors


Sondage...

Comparez les prix


HTC Hero

Entre 550€ et 550€

CalendriCode

Février 2010
LMMJVSD
1234567
891011121314
15161718192021
22232425262728

Consulter la suite du CalendriCode

 
Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel (EBArtSoft), Merci à Vincent pour ses précieux conseils.
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés

Google Coop CodeS-SourceS Google Coop CodeS-SourceS
Temps d'éxécution de la page : 0,624 sec (4)

Nous contacter | Annoncer sur CodeS-SourceS | Mentions légales