begin process at 2010 03 11 19:50:38
  Trouver un code source :
 
dans
 
Accueil > 

Code

 > 

divers

 > CODE POUR DISTRIBUER SES PATCH[MASM]

CODE POUR DISTRIBUER SES PATCH[MASM]


 Information sur la source

Note :
5 / 10 - par 2 personnes
5,00 / 10

  • 1

  • 2

  • 3

  • 4

  • 5

  • 6

  • 7

  • 8

  • 9

  • 10
Catégorie :divers Niveau :Initié Date de création :31/07/2002 Date de mise à jour :31/07/2002 21:05:25 Vu :8 139

Auteur : eedy31

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

 Description

c pas trop compliquer mais g galéré un moment pour y arriver..donc ca peut servir au autre!!

Source

  • .386
  • .model flat,stdcall
  • option casemap:none
  • WinMain proto :DWORD,:DWORD,:DWORD,:DWORD
  • include \masm32\include\windows.inc
  • include \masm32\include\user32.inc
  • include \masm32\include\kernel32.inc
  • include \masm32\include\comdlg32.inc
  • includelib \masm32\lib\user32.lib
  • includelib \masm32\lib\kernel32.lib
  • includelib \masm32\lib\comdlg32.lib
  • .data
  • ButtonID equ 1
  • ButtonID1 equ 2
  • MAXSIZE equ 260
  • OUTPUTSIZE equ 512
  • ClassName db "SimpleWinClass",0
  • AppName db " -=EEDY 31 patch=-",0
  • ButtonClassName db "button",0
  • ButtonText db "Go!!",0
  • ButtonText1 db "Quitter",0
  • MenuName db "FirstMenu",0
  • ofn OPENFILENAME <>
  • FilterString db "All Files",0,"*.*",0
  • db "eXecutables",0,"*.exe",0,0
  • Exe db MAXSIZE dup(0)
  • OurTitle db "Choisis le file à cracker",0
  • MsgCaption db "Erreur",0
  • MsgBoxText db "Fichier protégé en écriture ou utilisé!!",0
  • MsgCaption1 db "Succès!!",0
  • MsgBoxText1 db "Fichier patché avec succès",0
  • NbBytesWritten dd 0
  • hInstance HINSTANCE ?
  • CommandLine LPSTR ?
  • hwndButton HWND ?
  • hwndButton1 HWND ?
  • handle dd ?
  • byte_a_ecrire db 90h
  • .code
  • start:
  • invoke GetModuleHandle, NULL
  • mov hInstance,eax
  • invoke GetCommandLine
  • invoke WinMain, hInstance,NULL,CommandLine, SW_SHOWDEFAULT
  • invoke ExitProcess,eax
  • WinMain proc hInst:HINSTANCE,hPrevInst:HINSTANCE,CmdLine:LPSTR,CmdShow:DWORD
  • LOCAL wc:WNDCLASSEX
  • LOCAL msg:MSG
  • LOCAL hwnd:HWND
  • mov wc.cbSize,SIZEOF WNDCLASSEX
  • mov wc.style, WS_TILED
  • mov wc.lpfnWndProc, OFFSET WndProc
  • mov wc.cbClsExtra,NULL
  • mov wc.cbWndExtra,NULL
  • push hInst
  • pop wc.hInstance
  • mov wc.hbrBackground,COLOR_BTNTEXT +1
  • mov wc.lpszClassName,OFFSET ClassName
  • invoke LoadIcon,NULL,IDI_APPLICATION
  • mov wc.hIcon,eax
  • mov wc.hIconSm,eax
  • invoke LoadCursor,NULL,IDC_ARROW
  • mov wc.hCursor,eax
  • invoke RegisterClassEx, addr wc
  • INVOKE CreateWindowEx,NULL,ADDR ClassName,ADDR AppName,\
  • WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,\
  • CW_USEDEFAULT,250,200,NULL,NULL,\
  • hInst,NULL
  • mov hwnd,eax
  • INVOKE ShowWindow, hwnd,SW_SHOWNORMAL
  • INVOKE UpdateWindow, hwnd
  • .WHILE TRUE
  • INVOKE GetMessage, ADDR msg,NULL,0,0
  • .BREAK .IF (!eax)
  • INVOKE TranslateMessage, ADDR msg
  • INVOKE DispatchMessage, ADDR msg
  • .ENDW
  • mov eax,msg.wParam
  • ret
  • WinMain endp
  • WndProc proc hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
  • .IF uMsg==WM_DESTROY
  • invoke PostQuitMessage,NULL
  • .elseif uMsg==WM_CREATE
  • ; --> CREER BUTTON
  • invoke CreateWindowEx,NULL, ADDR ButtonClassName,\
  • ADDR ButtonText,\
  • WS_CHILD or WS_VISIBLE or BS_DEFPUSHBUTTON,\
  • 10,140,100,20,hWnd,ButtonID,hInstance,NULL
  • mov hwndButton,eax
  • ; --> CREER BUTTON
  • invoke CreateWindowEx,NULL, ADDR ButtonClassName,ADDR ButtonText1,\
  • WS_CHILD or WS_VISIBLE or BS_PUSHBUTTON ,\
  • 130,140,100,20,hWnd,ButtonID1,hInstance,NULL
  • mov hwndButton1,eax
  • .ELSEIF uMsg==WM_COMMAND
  • mov eax,wParam
  • .if ax==1
  • mov ofn.lStructSize,SIZEOF ofn
  • push hWnd
  • pop ofn.hWndOwner
  • push hInstance
  • pop ofn.hInstance
  • mov ofn.lpstrFilter, OFFSET FilterString
  • mov ofn.lpstrFile, OFFSET Exe
  • mov ofn.nMaxFile,MAXSIZE
  • mov ofn.Flags, OFN_FILEMUSTEXIST or \
  • OFN_PATHMUSTEXIST or OFN_LONGNAMES or\
  • OFN_EXPLORER or OFN_HIDEREADONLY
  • mov ofn.lpstrTitle, OFFSET OurTitle
  • invoke GetOpenFileName, ADDR ofn
  • .if eax==TRUE
  • ;Ouverture de l'exe
  • invoke CreateFileA,offset Exe,0C0000000h ,1,0,3,80h,0
  • mov handle, eax
  • ;TRES IMPORTANT DE L'OUVRIR DE CETTE FACON SINON CA MARCHE PAS!!
  • .if eax==INVALID_HANDLE_VALUE
  • invoke MessageBox, NULL,addr MsgBoxText, addr MsgCaption, MB_OK
  • jmp @end
  • .endif
  • ;Deplacement dans le fichier
  • invoke SetFilePointer,handle,0FEh,0,0 ;on se place a l'offset FE
  • ;Ecriture dans le fichier
  • mov esi,offset byte_a_ecrire
  • invoke WriteFile,handle,esi,1,offset NbBytesWritten,0
  • ;et voila!
  • invoke MessageBox, NULL,addr MsgBoxText1, addr MsgCaption1, MB_OK
  • invoke CloseHandle,handle
  • .endif
  • .else
  • invoke DestroyWindow, hWnd
  • .endif
  • .ELSE
  • @end:
  • invoke DefWindowProc,hWnd,uMsg,wParam,lParam
  • ret
  • .ENDIF
  • xor eax,eax
  • ret
  • WndProc endp
  • end start
.386
.model flat,stdcall
option casemap:none
WinMain proto :DWORD,:DWORD,:DWORD,:DWORD

include \masm32\include\windows.inc
include \masm32\include\user32.inc
include \masm32\include\kernel32.inc
include \masm32\include\comdlg32.inc


includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\comdlg32.lib




.data
ButtonID equ 1
ButtonID1 equ 2
MAXSIZE equ 260
OUTPUTSIZE equ 512

ClassName db "SimpleWinClass",0
AppName  db "    -=EEDY 31 patch=-",0

ButtonClassName db "button",0 
ButtonText db "Go!!",0
ButtonText1 db "Quitter",0

MenuName db "FirstMenu",0
ofn  OPENFILENAME <>
FilterString db "All Files",0,"*.*",0
            db "eXecutables",0,"*.exe",0,0
Exe db MAXSIZE dup(0)
OurTitle db "Choisis le file à cracker",0

MsgCaption      db "Erreur",0
MsgBoxText      db "Fichier protégé en écriture ou utilisé!!",0

MsgCaption1      db "Succès!!",0
MsgBoxText1      db "Fichier patché avec succès",0


NbBytesWritten   dd 0 

hInstance HINSTANCE ?
CommandLine LPSTR ?
hwndButton HWND ? 
hwndButton1 HWND ? 
handle dd ?

byte_a_ecrire   db 90h



.code
start:
   invoke GetModuleHandle, NULL
   mov    hInstance,eax
   invoke GetCommandLine
   invoke WinMain, hInstance,NULL,CommandLine, SW_SHOWDEFAULT
   invoke ExitProcess,eax

WinMain proc hInst:HINSTANCE,hPrevInst:HINSTANCE,CmdLine:LPSTR,CmdShow:DWORD
   LOCAL wc:WNDCLASSEX
   LOCAL msg:MSG
   LOCAL hwnd:HWND
   mov  wc.cbSize,SIZEOF WNDCLASSEX
   mov  wc.style, WS_TILED  
   mov  wc.lpfnWndProc, OFFSET WndProc
   mov  wc.cbClsExtra,NULL
   mov  wc.cbWndExtra,NULL
   push  hInst
   pop  wc.hInstance
   mov  wc.hbrBackground,COLOR_BTNTEXT +1
   mov  wc.lpszClassName,OFFSET ClassName
   invoke LoadIcon,NULL,IDI_APPLICATION
   mov  wc.hIcon,eax
   mov  wc.hIconSm,eax
   invoke LoadCursor,NULL,IDC_ARROW
   mov  wc.hCursor,eax
   invoke RegisterClassEx, addr wc
   INVOKE CreateWindowEx,NULL,ADDR ClassName,ADDR AppName,\
          WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,\
          CW_USEDEFAULT,250,200,NULL,NULL,\
          hInst,NULL
   mov  hwnd,eax
   INVOKE ShowWindow, hwnd,SW_SHOWNORMAL
   INVOKE UpdateWindow, hwnd
   .WHILE TRUE
          INVOKE GetMessage, ADDR msg,NULL,0,0
                .BREAK .IF (!eax)
                INVOKE TranslateMessage, ADDR msg
                INVOKE DispatchMessage, ADDR msg
   .ENDW
   mov    eax,msg.wParam
   ret
WinMain endp

WndProc proc hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM  

   .IF uMsg==WM_DESTROY
      invoke PostQuitMessage,NULL
      .elseif uMsg==WM_CREATE
; -->  CREER  BUTTON
                    invoke CreateWindowEx,NULL, ADDR ButtonClassName,\ 
                                  ADDR ButtonText,\ 
                                  WS_CHILD or WS_VISIBLE or BS_DEFPUSHBUTTON,\ 
                                  10,140,100,20,hWnd,ButtonID,hInstance,NULL 
                                  mov  hwndButton,eax

; -->  CREER BUTTON
        invoke  CreateWindowEx,NULL, ADDR ButtonClassName,ADDR ButtonText1,\
                WS_CHILD or WS_VISIBLE or BS_PUSHBUTTON  ,\
                  130,140,100,20,hWnd,ButtonID1,hInstance,NULL
        mov    hwndButton1,eax
        




   .ELSEIF uMsg==WM_COMMAND
      mov eax,wParam
      .if ax==1

         mov ofn.lStructSize,SIZEOF ofn
         push hWnd
         pop  ofn.hWndOwner
         push hInstance
         pop  ofn.hInstance
         mov  ofn.lpstrFilter, OFFSET FilterString
         mov  ofn.lpstrFile, OFFSET Exe
         mov  ofn.nMaxFile,MAXSIZE
         mov  ofn.Flags, OFN_FILEMUSTEXIST or \
                        OFN_PATHMUSTEXIST or OFN_LONGNAMES or\
                        OFN_EXPLORER or OFN_HIDEREADONLY
         mov  ofn.lpstrTitle, OFFSET OurTitle
         invoke GetOpenFileName, ADDR ofn

         .if eax==TRUE
                     
              ;Ouverture de l'exe
                                         
                     invoke CreateFileA,offset Exe,0C0000000h ,1,0,3,80h,0
                        mov handle, eax
                  ;TRES IMPORTANT DE L'OUVRIR DE CETTE FACON SINON CA MARCHE PAS!!
                        
                        
                        .if eax==INVALID_HANDLE_VALUE
                        invoke MessageBox, NULL,addr MsgBoxText, addr MsgCaption, MB_OK
                        jmp @end
                        .endif 

                ;Deplacement dans le fichier
                              
                        invoke SetFilePointer,handle,0FEh,0,0 ;on se place a l'offset FE
        ;Ecriture dans le fichier    
                        mov esi,offset byte_a_ecrire                    
                        invoke WriteFile,handle,esi,1,offset NbBytesWritten,0
                        
        ;et voila!          
                        invoke MessageBox, NULL,addr MsgBoxText1, addr MsgCaption1, MB_OK
                        invoke CloseHandle,handle  
            
                         .endif
                      
                                 
      .else
         invoke DestroyWindow, hWnd
   
.endif
   .ELSE
      @end:
      invoke DefWindowProc,hWnd,uMsg,wParam,lParam
      ret
   .ENDIF
   xor    eax,eax
   ret
WndProc endp
end start 

 Conclusion

des amélioration a venir et je suis en train de concocter un patcher ki compare le fichier d'origine et celui patché et ki sort un patch à distibuer automatikement(100% asm bien sur!)
donc a bientot !!


 Sources du même auteur

Source avec Zip OPERATIONS SUR LES NOMBRES A VIRGULE AVEC LE FPU[MASM32]
Source avec Zip LIEN HYPERTEXT DS VOTRE FENETRE
Source avec Zip PETIT EDITEUR PE[MASM]
Source avec Zip RÉVELER LES MOTS DE PASSES CACHÉS PAR UN ÉTOILE(*)[MASM]
Source avec Zip FAIRE BOUGER LE TITRE DE L'APPLICATION[MASM]

 Sources de la même categorie

Source avec une capture DESSIN DE RECTANGLES (POSITION, TAILLE, COULEUR, ÉPAISSEUR) par macsou01
RECHERCHE DES PALINDROMES D'UN TEXTE SAISI. par PCBill
Source avec Zip LIBRAIRIE GRAPHIQUE (ET PLUS) EN MODE RÉEL par epineurien
Source avec Zip Source avec une capture LIB PROGRESSBAR (PERSONNALISABLE , DÉGRADÉ DE COULEUR,POURCE... par knetus
Source avec Zip Source avec une capture AFFICHE COULEUR par knetus

Commentaires et avis

Commentaire de BlackWizzard le 01/08/2002 00:36:34 administrateur CS

ça C une source que je cherche depuis longtemps!
C du tres bon boulot man!

je V enfin pouvoir faire mes patch pour mes vieux prog dont G plus le source...

Commentaire de BlackWizzard le 01/08/2002 00:39:55 administrateur CS

tu t'y connais pas en php, ni en html, mais en asm, tu assure! :p

Commentaire de DarkBoss le 20/02/2004 14:51:36

euhhh g une kestion pourkoi quand j' ai un fichier exe de 280 ko ke g patche a l' offset 00000000h par 90h il me fait un fichier de 4,10MO ???

 Ajouter un commentaire




Nos sponsors


Appels d'offres

Sondage...

Comparez les prix


HTC Magic

Entre 429€ et 429€

CalendriCode

Mars 2010
LMMJVSD
1234567
891011121314
15161718192021
22232425262728
293031    

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,468 sec (4)

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