Klaus
Nombre de messages : 12331 Age : 75 Localisation : Ile de France Date d'inscription : 29/12/2009
| Sujet: Re: Récupérer un source depuis un executable Mer 29 Aoû 2012 - 9:16 | |
| @Nardo26: Merci pour cette retrouvaille ! J'y ai ajouté le menu Save et voici le rfésultat: - Code:
-
' RecoverSource.bas
dll_on "kernel32.dll"
data 0, 22, 21, 20, 19, 18, 17, 16, 31, 30, 0, 28, 27, 0, 25, 24 data 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8 data 55, 54, 53, 52, 51, 50, 49, 48, 63, 62, 61, 60, 59, 58, 57, 56 data 39, 38, 37, 36, 35, 34, 33, 32, 47, 46, 45, 44, 43, 42, 41, 40 data 87, 86, 85, 84, 83, 82, 81, 80, 95, 94, 93, 92, 91, 90, 89, 88 data 71, 70, 69, 68, 67, 66, 65, 64, 79, 78, 77, 76, 75, 74, 73, 72 data 119,118,117,116,115,114,113,112,127,126,125,124,123,122,121,120 data 103,102,101,100, 99, 98, 97, 96,111,110,109,108,107,106,105,104 data 151,150,149,148,147,146,145,144,159,158,157,156,155,154,153,152 data 135,134,133,132,131,130,129,128,143,142,141,140,139,138,137,136 data 183,182,181,180,179,178,177,176,191,190,189,188,187,186,185,184 data 167,166,165,164,163,162,161,160,175,174,173,172,171,170,169,168 data 215,214,213,212,211,210,209,208,223,222,221,220,219,218,217,216 data 199,198,197,196,195,194,193,192,207,206,205,204,203,202,201,200 data 247,246,245,244,243,242,241,240,255,254,253,252,251,250,249,248 data 231,230,229,228,227,226,225,224,239,238,237,236,235,234,233,232
dim decoder%(255),i%,s$,n%,l%,b%,size%,ps% for i% = 0 to 255 read decoder%(i%) next i%
label mnu_load,mnu_save, mnu_exit,get_size
main_menu 1 sub_menu 2:caption 2,"&File":parent 2,1 sub_menu 3:caption 3,"&Load":parent 3,2:on_click 3,mnu_load sub_menu 8:caption 8,"&Save":parent 8,2:on_click 8,mnu_save sub_menu 4:caption 4,"-" :parent 4,2 sub_menu 5:caption 5,"&Exit":parent 5,2:on_click 5,mnu_exit
memo 6 bar_both 6 full_space 6 font_name 6,"Courier New" open_dialog 7 filter 7,"Program|*.exe" save_dialog 9 filter 9,"Source|*.bas"
end
mnu_load: s$=file_name$(7) if s$="_" then return if 1=file_exists(s$) caption 0,s$ clear 6 filebin_open_read 8,s$ l%=filebin_size(8)
filebin_position 8,l%-4 filebin_hexa_read 8,4,s$ if (s$<>"33422E46") if (1<>message_warning_yes_no("You are sure it's created by Panoramic BASIC ?")) filebin_close 8 return end_if end_if
filebin_position 8,l%-8 s$="" for i%=0 to 3 filebin_read 8,b% s$=s$+chr$(b%) next i% ps%=adr(s$):gosub get_size n%=size%:size%=size%+8 filebin_position 8,l%-size% s$="" for i%=0 to n%-1 filebin_read 8,b% b%=decoder%(b%) if (b%=0) item_add 6,s$ s$="" else s$=s$+chr$(b%) end_if next i% if (len(s$)>0) then item_add 6,s$ filebin_close 8 end_if return mnu_save: s$=file_name$(9) if s$="_" then return if lower$(right$(s$,4))<>".bas" then s$ = s$ + ".bas" if 1=file_exists(s$) if message_confirmation_yes_no("File esists. Overwrite it ?")<>1 then return end_if file_save 6,s$ return
mnu_exit: terminate
get_size: i%=DLL_CALL3("RtlMoveMemory",adr(ps%),ps%,4) i%=DLL_CALL3("RtlMoveMemory",adr(size%),ps%,4) return Code genial de D.J. Peters ! | |
|