powerbuilder decomplier 完成基本分析和编程(图8张)

用了十多天,完成了基本编程,bcb编程。主要函数已经完成。目前能对struct和function解析了,win和uo的还在debug。

 

给一个反编译后的代码示意:还差浮点数取值(因为不同编程工具对浮点的规定不同,c++的double并非pb的double,必须取相应的bit规定来得到浮点数,for while循环(jp已经实现,但是要复活成for while还需要点工夫),枚举常量没搞定,搞定的话,就能反编译一般性的function了。不过expression分析部分结构已经很完备,只是一共500多个pcode码,现在只测试出200个。后续将大量测试pb的demos来修正之。当然自己的程序也可以作为测试之用。

 

//看我反编译出来的代码,感觉还比较整洁,说实话,第一次用bcb编程。但是短短几天足以领略c++的高效快速。还有就是一不小心就犯的错,比如在if条件那里对变量意外赋值了,所以保持0x0001 == var1的倒写习惯是多么重要。

 

//object name: lf_111.fun
global type lf_111 from function_object
end type

forward prototypes
global <FUNCTION_OR_SUBRUNTINE> <RETURN_DATATYPE> lf_111(<PARAM_LIST>) <THROWS_OBJNAME> 
end prototypes

global <FUNCTION_OR_SUBRUNTINE> <RETURN_DATATYPE> lf_111(<PARAM_LIST>) <THROWS_OBJNAME>


//Variables List
any a1
int b1 = 32767
int b2 = -32767
long c1 = 655356
long c2 = -655356
longlong d1 = 9223372036854775807
longlong d2 = -9223372036854775807
real e1 = 1120403587
real e2 = 3267887235
string ls_111 = "VVVVVVVVVVVVVVVVVVVV"
char f1 = 'A'
char f2 = 'z'
char f3 = '~r'
uint g1 = 255
ulong h1 = 655357
double j1 = 3.14159265141593
long b
string k1 = ""
string k2 = "this is a box"
string k3 = "this~r~na~h13"
string k4 = "中国中国中国中国中国中国中国中国"
date m1 = 1101-01-11
time n1 = 12:01:01.100002
datetime p1 = datetime(date(1000-07-11),time(12:01:01.000002))
dec q1 = 3.14159202581504
dec{0} q2 = 3.14159202581504
dec{4} q3 = 3.14159202581504
dec{18} q4 = 3.14159202581504
dec r1 = 3.14159202581504
int aaaa
long ll_b
longlong lll_c
dec ldc_d
real lrl_e
ulong lul_f
uint lui_g
dec ax
long ll_bb
longlong lll_cc
dec ldc_dd
real lrl_ee
ulong lul_ff
uint lui_gg
datastore uo_1
boolean lbb_1
boolean lbb_2
long a
string ls_aaa
char bbb
border lbr
border lbr1
border lbr2
border lbr3
border lbr4
border lbr5
border lbr6
border lbr7
//global var: w_win w_win
//global var: w_main w_main
long ll_currentrow
datawindow adw_datawindow
string arg_amt
string arg_format
string right_string

 

//Exprssion  lines: 62
abs(j1 + 1)
beep(10)
blob("111")
b = ceiling(j1)
max(1,2)
min(1,2)
ls_aaa = rightw(ls_aaa,2) + rightw(ls_aaa,2) + rightw(ls_aaa,2)
bbb = char(ls_aaa)
j1 = abs(j1)
j1 = acos(j1)
j1 = integer(j1)
j1 = long(j1)
j1 = longlong(j1)
messagebox("j1",j1)
messagebox("q1",q1)
messagebox("q2",q2)
messagebox("q3",q3)
messagebox("q4",q4)
j1 = messagebox("r1",r1)
lbb_1 = fileexists(ls_aaa)
fileclose(a)
a += (b)
a ++
a --
a += ((1 + 2 + 3) - 4)
a += (b)
a -= (b)
a *= (b)
a = a / 1
a = b + 1 - ((2) / 3) * 4
aaaa = ll_b
aaaa = lll_c
aaaa = ldc_d
aaaa = lrl_e
aaaa = lul_f
aaaa = lui_g
return 65535
return 4.00000000011642
return 4.00000000011642 + 4.00000000011642
uo_1 = create datastore
destroy(uo_1)
lbb_1 = lbb_1 and lbb_2
open(w_win)
open(w_main)
w_win.hide()
w_win.postevent("111",1,1)
w_main.settoolbar(1,true )
w_win.show()
w_win.getparent()
w_main.hide()
w_main.show()
w_main.getparent()
adw_datawindow.setredraw(false )
ll_currentrow = adw_datawindow.getrow()
adw_datawindow.selectrow(0,false )
adw_datawindow.selectrow(ll_currentrow,true )
adw_datawindow.setfocus()
adw_datawindow.setredraw(true )
return ll_currentrow
right_string = string(arg_amt,arg_format)
right_string = left("     ",len(arg_format) - len(right_string)) + right_string
return 1

end function

 

 

//////////////////////////////////

数组下标操作费了我五个小时调整,已经很完美了,非常完美。

global <FUNCTION_OR_SUBRUNTINE> <RETURN_DATATYPE> lf_111(<PARAM_LIST>) <THROWS_OBJNAME>
//Variables List
string ls_arr0[]
string ls_arr1[10]
string ls_arr2[2 to 10]
string ls_arr3[5,6,7,8]
string ls_arr4[2 to 5,3 to 6,4 to 7,5 to 8]
string ls_local
long ll_local
//global var: string gs_array[2]
//global var: string gs_array2[5,5]

//Exprssion  lines: 14
ls_local = ls_arr0[3]
ls_local = ls_arr1[5]
ls_local = ls_arr2[5]
ls_local = ls_arr3[1,2,3,4]
ls_local = ls_arr4[3,4,5,6]
ls_local = gs_array[2]
ls_local = gs_array2[2,2]
ls_arr0[3] = ls_local
ls_arr1[5] = ls_local
ls_arr2[5] = ls_local
ls_arr3[1,2,3,4] = ls_local
ls_arr4[3,4,5,6] = ls_local
gs_array[2] = ls_local
gs_array2[2,2] = ls_local

end function

 

//20090904: 完成了function头部申明信息:返回数据类型,参数列表,throws类型。基本完成一个简单function的解析了:

//object name: lf_333.fun
global type lf_333 from lf_333
end type

forward prototypes
global function int lf_333(int param1,ref int param2,readonly int param3,readonly int param4) throws exception
end prototypes

global function int lf_333(int param1,ref int param2,readonly int param3,readonly int param4) throws exception;
//variables list
//param:int param1
//param:int param2
//param:int param3
//param:int param4
int li_aaa
long ll_bbb
string ls_aaa
nonvisualobject uox
nonvisualobject uoy
nonvisualobject uoz
int li_ccc[2,2,2]  = {1,2,3,4,5,6,7,8}

//exprssion  lines: 23
li_aaa = integer(getcurrentdirectory() + "aaa" + "bbb" + string(1997))
uox = create nonvisualobject
uoy = create nonvisualobject
uoz = create nonvisualobject
li_aaa = 1 + 2 + 3 + 4 + 5
li_aaa = ((((1) - 2) - 3) - 4) - 5                                   //括号部分后续优化之。
li_aaa = ((((1) * 2) * 3) * 4) * 5
ll_bbb = ((((1) / 2) / 3) / 4) / 5
li_aaa = integer(ll_bbb)
li_aaa = abs(li_aaa)
li_aaa = ll_bbb
ll_bbb = 1 + 2 + 3 + 4 + 5
ll_bbb = ((((1) - 2) - 3) - 4) - 5
ll_bbb = ((((1) * 2) * 3) * 4) * 5
ll_bbb = ((((1) / 2) / 3) / 4) / 5
ll_bbb = long(ll_bbb)
ll_bbb = li_ccc[1,1,1]
li_aaa = lf_count(li_aaa,li_aaa,li_aaa,ls_aaa,ls_aaa,ls_aaa)
li_aaa = lf_count2()
li_aaa = lf_count3()
li_aaa = lf_count4()
li_aaa = lf_count5()
return 1

end function

 

 

//20090905:今天很好地处理了枚举变量的初始值和赋值(取)

//object name: lf_333.fun
global type lf_333 from lf_333
end type

forward prototypes
global subroutine  lf_333() throws exception
end prototypes

global subroutine  lf_333() throws exception;
//variables list
alignment la_1 = left!
alignment la_2 = right!
alignment la_3 = center!
alignment la_4 = justify!
band lb_1 = header!
band lb_2 = detail!
band lb_3 = footer!

//exprssion  lines: 7
la_1 = left!
la_1 = right!
la_1 = center!
la_1 = justify!
lb_1 = header!
lb_1 = detail!
lb_1 = footer!

end function

 

//20090909:搞定了内嵌sql单行取值,并与变量直接绑定。pic6

 

//20090912: 完善了sql语句格式内嵌语式的参数绑定。

 

//20090915:完成最困难的win和uo,menu等文件格式的解析。工作接近收尾。图pic8

 

附图6张:

 

pic1: 

powerbuilder decomplier 完成基本分析和编程(图8张)_第1张图片

 

pic2: 

 

pic3:

 

 

pic4:

powerbuilder decomplier 完成基本分析和编程(图8张)_第2张图片

 

pic5:

powerbuilder decomplier 完成基本分析和编程(图8张)_第3张图片

 

pic6:

powerbuilder decomplier 完成基本分析和编程(图8张)_第4张图片

 

pic7 趋近完美的内嵌sql,含参数对应。

powerbuilder decomplier 完成基本分析和编程(图8张)_第5张图片

 

pic8: 完成win,men,uo等格式解析,接近收尾

 

powerbuilder decomplier 完成基本分析和编程(图8张)_第6张图片

 

你可能感兴趣的:(编程,function,String,Integer,PowerBuilder,subroutine)