Accueil > > > 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
Description
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.
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
Sources de la même categorie
Commentaires et avis
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
|
Derniers Blogs
TECHDAYS PARIS 2010 : LA BI DANS SHAREPOINT 2010TECHDAYS PARIS 2010 : LA BI DANS SHAREPOINT 2010 par ROMELARD Fabrice
Animé par: Vincent Bellet et Baptiste Giraudier La BI dans SharePoint 2010, Les nouveaux services d'application dans SP2010 et SQL Server Reporting services 2008 R2. La BI dans SharePoint est généralisée pour tous afin de permettre à tous les coll...
Cliquez pour lire la suite de l'article par ROMELARD Fabrice TECHDAYS PARIS 2010 : PLAN DE MIGRATION VERS SHAREPOINT 2010TECHDAYS PARIS 2010 : PLAN DE MIGRATION VERS SHAREPOINT 2010 par ROMELARD Fabrice
Animé par: Arnault Nouvel et Antoine Dongois Le processus à prendre : Apprendre (découvrir la plateforme) Préparer (documenter l'historique et choisir la méthode de MAJ) Test (Test de MAJ) Implémenter (Effectuer la MAJ) Valid...
Cliquez pour lire la suite de l'article par ROMELARD Fabrice TECHDAYS PARIS 2010 : LA PLEINIèRE DU SECOND JOURTECHDAYS PARIS 2010 : LA PLEINIèRE DU SECOND JOUR par ROMELARD Fabrice
Après un retour sur l'histoire des TechDays de Paris et le fait que ce soit le plus gros event MS au monde (du fait de sa gratuité), le président de MS France (Eric Boustoullier) a fait une présentation de la vision Microsoft pour les années à venir...
Cliquez pour lire la suite de l'article par ROMELARD Fabrice
Forum
RE : PIC 16F84RE : PIC 16F84 par belounis
Cliquez pour lire la suite par belounis RE : PIC 16F84RE : PIC 16F84 par pont
Cliquez pour lire la suite par pont
Logiciels
DB-MAIN (9.1.0)DB-MAIN (9.1.0)DB-MAIN is a data-modeling and data-architecture tool. It is designed to help developers and anal... Cliquez pour télécharger DB-MAIN Xilisoft DPG Convertisseur (5.1.37.0120)XILISOFT DPG CONVERTISSEUR (5.1.37.0120)Xilisoft DPG Convertisseur offre aux fans de Nintendo DS une bonne solution leur permettant de dé... Cliquez pour télécharger Xilisoft DPG Convertisseur GraphicsGale (2.01.01)GRAPHICSGALE (2.01.01)GraphicsGale est un logiciel de PixelArt avec de nombreuse fonctionnalités permettant de réalisé ... Cliquez pour télécharger GraphicsGale Architecte 3D (Platinum 2010)ARCHITECTE 3D (PLATINUM 2010)Architecte 3D Platinium vous permet de concevoir facilement les plans votre future maison, de l'é... Cliquez pour télécharger Architecte 3D TeamViewer 5 (TeamViewer 5)TEAMVIEWER 5 (TEAMVIEWER 5)Dépanner un ami,expliquer une manipulation devient un jeu d'enfant.
Prise en main d'un autre ord... Cliquez pour télécharger TeamViewer 5
Comparez les prix

HTC Hero
Entre 550€ et 550€
|