`
buliedian
  • 浏览: 1222282 次
  • 性别: Icon_minigender_2
  • 来自: 北京
文章分类
社区版块
存档分类
最新评论

pbkiller导出的源码批量修复和批量导入技术(转)

阅读更多

pbkiller导出的源码批量修复和批量导入技术

原文:http://itmed.blog.sohu.com/96898840.html 原文发表于2008-08-10 作者深蓝无忌


<!-- / icon and title --><!-- message -->
1用pbkiller可以从pbd导出"*.sr?"这样的文件,但是不能直接导出pbl
2由于pb导入"*.sr?"时,由于(1)类之间的依赖关系,若a的父类为b,先导a是不行的(2)pbkiller导出的源码有部分源码错误。
3鉴于以上情况,本人写了serachandreplace脚本,对错误语法进行替换
4网上搜索到了一个批量导入"*.sr?"的程序,pb写的,用pbkiller反编译出来,但存在反编译错误
5由4知,用到了PBORC80.DLL,OD跟踪pb的导入对象的过程,得到了pb导入用到的函数参数,修复了反编译错误
====================================================
如下是serchandreplace的正则替换脚本,修复部分pbkiller导出的源码错误
getclassdefinition\(\)替换classdefinition

getscriptlist\(\)替换scriptlist

getscript\(1,\[*[]\]\).getname\()\替换scriptlist\[%1\].name

getvariablelist\(\)

getvariable\(1,\[*[]\]\).getname\()\替换variablelist\[%1\].name

getargumentlist\(\)

getargument\(1,\[*[]\]\).getname\()\替换argumentlist\[%1\].name

getlocalvariablelist\(\)

getlocalvariable\(1,\[*[]\]\).getname\()\替换localvariablelist\[%1\].name


\?\?\?\?\?=l?_*[]$替换%2=l%1_%2


,"+",+.\?\?\?\?\?(,|\))替换,"%1",%2.%1%3

\(+\)+\!messagebox\(\?\?\?\?\?\)替换messagebox\("",%1,%2\!\)


,\[+\](,|\))替换,{%1}%2
====================================================
如下是pb导入的核心函数,你可以写一个批处理,就不用一个一个手工导入源码了
forward
globaltypen_cst_pborcfromnonvisualobject
endtype
endforward

globaltypen_cst_pborcfromnonvisualobjectautoinstantiate
endtype
globaln_cst_pborcn_cst_pborc

typeprototypes
publicfunctionlongsessionopen7()library"PBORC70.DLL"aliasfor"PBORCA_SessionOpen"
publicsubroutinesessionclose7(longhorcasession)library"PBORC70.DLL"aliasfor"PBORCA_SessionClose"
publicfunctionintegersessionsetlibrarylist7(longhorcasession,refstringplibnames[],integerinumberoflibs)library"PBORC70.DLL"aliasfor"PBORCA_SessionSetLibraryList"
publicfunctionintegersessionsetcurrentappl7(longhorcasession,stringlpszappllibname,stringlpszapplname)library"PBORC70.DLL"aliasfor"PBORCA_SessionSetCurrentAppl"
publicfunctionintegerlibraryentryexport7(longhorcasession,stringlpszlibraryname,stringlpszentryname,longotentrytype,refstringlpszexportbuffer,longlexportbuffersize)library"PBORC70.DLL"aliasfor"PBORCA_LibraryEntryExport"
publicfunctionintegercompileentryimport7(longhorcasession,stringlpszlibraryname,stringlpszentryname,longotentrytype,stringlpszcomments,stringlpszentrysyntax,longlentrysyntaxbuffsize,longpcomperrorproc,longpuserdata)library"PBORC70.DLL"aliasfor"PBORCA_CompileEntryImport"
publicfunctionlongsessionopen8()library"PBORC80.DLL"aliasfor"PBORCA_SessionOpen"
publicsubroutinesessionclose8(longhorcasession)library"PBORC80.DLL"aliasfor"PBORCA_SessionClose"
publicfunctionintegersessionsetlibrarylist8(longhorcasession,refstringplibnames[],integerinumberoflibs)library"PBORC80.DLL"aliasfor"PBORCA_SessionSetLibraryList"
publicfunctionintegersessionsetcurrentappl8(longhorcasession,stringlpszappllibname,stringlpszapplname)library"PBORC80.DLL"aliasfor"PBORCA_SessionSetCurrentAppl"
publicfunctionintegerlibraryentryexport8(longhorcasession,stringlpszlibraryname,stringlpszentryname,longotentrytype,refstringlpszexportbuffer,longlexportbuffersize)library"PBORC80.DLL"aliasfor"PBORCA_LibraryEntryExport"
publicfunctionintegercompileentryimport8(longhorcasession,stringlpszlibraryname,stringlpszentryname,longotentrytype,stringlpszcomments,stringlpszentrysyntax,longlentrysyntaxbuffsize,longpcomperrorproc,longpuserdata)library"PBORC80.DLL"aliasfor"PBORCA_CompileEntryImport"
publicfunctionlongsessionopen9()library"PBORC90.DLL"aliasfor"PBORCA_SessionOpen"
publicsubroutinesessionclose9(longhorcasession)library"PBORC90.DLL"aliasfor"PBORCA_SessionClose"
publicfunctionintegersessionsetlibrarylist9(longhorcasession,refstringplibnames[],integerinumberoflibs)library"PBORC90.DLL"aliasfor"PBORCA_SessionSetLibraryList"
publicfunctionintegersessionsetcurrentappl9(longhorcasession,stringlpszappllibname,stringlpszapplname)library"PBORC90.DLL"aliasfor"PBORCA_SessionSetCurrentAppl"
publicfunctionintegerlibraryentryexport9(longhorcasession,stringlpszlibraryname,stringlpszentryname,longotentrytype,refstringlpszexportbuffer,longlexportbuffersize)library"PBORC90.DLL"aliasfor"PBORCA_LibraryEntryExport"
publicfunctionintegercompileentryimport9(longhorcasession,stringlpszlibraryname,stringlpszentryname,longotentrytype,stringlpszcomments,stringlpszentrysyntax,longlentrysyntaxbuffsize,longpcomperrorproc,longpuserdata)library"PBORC90.DLL"aliasfor"PBORCA_CompileEntryImport"
publicfunctionlongsessionopen10()library"PBORC100.DLL"aliasfor"PBORCA_SessionOpen"
publicsubroutinesessionclose10(longhorcasession)library"PBORC100.DLL"aliasfor"PBORCA_SessionClose"
publicfunctionintegersessionsetlibrarylist10(longhorcasession,refstringplibnames[],integerinumberoflibs)library"PBORC100.DLL"aliasfor"PBORCA_SessionSetLibraryList"
publicfunctionintegersessionsetcurrentappl10(longhorcasession,stringlpszappllibname,stringlpszapplname)library"PBORC100.DLL"aliasfor"PBORCA_SessionSetCurrentAppl"
publicfunctionintegerlibraryentryexport10(longhorcasession,stringlpszlibraryname,stringlpszentryname,longotentrytype,refstringlpszexportbuffer,longlexportbuffersize)library"PBORC100.DLL"aliasfor"PBORCA_LibraryEntryExport"
publicfunctionintegercompileentryimport10(longhorcasession,stringlpszlibraryname,stringlpszentryname,longotentrytype,stringlpszcomments,stringlpszentrysyntax,longlentrysyntaxbuffsize,longpcomperrorproc,longpuserdata)library"PBORC100.DLL"aliasfor"PBORCA_CompileEntryImport"
publicfunctionlongsessionopen()library"PBORC90.DLL"aliasfor"PBORCA_SessionOpen"
publicsubroutinesessionclose(longhorcasession)library"PBORC90.DLL"aliasfor"PBORCA_SessionClose"
publicfunctionintegersessionsetlibrarylist(longhorcasession,refstringplibnames[],integerinumberoflibs)library"PBORC90.DLL"aliasfor"PBORCA_SessionSetLibraryList"
publicfunctionintegersessionsetcurrentappl(longhorcasession,stringlpszappllibname,stringlpszapplname)library"PBORC90.DLL"aliasfor"PBORCA_SessionSetCurrentAppl"
publicfunctionintegerlibraryentryexport(longhorcasession,stringlpszlibraryname,stringlpszentryname,longotentrytype,refstringlpszexportbuffer,longlexportbuffersize)library"PBORC90.DLL"aliasfor"PBORCA_LibraryEntryExport"
publicfunctionintegercompileentryimport(longhorcasession,stringlpszlibraryname,stringlpszentryname,longotentrytype,stringlpszcomments,stringlpszentrysyntax,longlentrysyntaxbuffsize,longpcomperrorproc,longpuserdata)library"PBORC90.DLL"aliasfor"PBORCA_CompileEntryImport"
endprototypes

typevariables
publiclongpborca_application
publiclongpborca_datawindow=1
publiclongpborca_function=2
publiclongpborca_menu=3
publiclongpborca_query=4
publiclongpborca_structure=5
publiclongpborca_userobject=6
publiclongpborca_window=7
publiclongpborca_pipeline=8
publiclongpborca_project=9
publiclongpborca_proxyobject=10
publiclongpborca_binary=11
publicintegerpborca_ok
publiclongpborca_invalidparms=-1
publiclongpborca_dupoperation=-2
publiclongpborca_objnotfound=-3
publiclongpborca_badlibrary=-4
publiclongpborca_liblistnotset=-5
publiclongpborca_libnotinlist=-6
publiclongpborca_libioerror=-7
publiclongpborca_objexists=-8
publiclongpborca_invalidname=-9
publiclongpborca_buffertoosmall=-10
publiclongpborca_comperror=-11
publiclongpborca_linkerror=-12
publiclongpborca_currapplnotset=-13
publiclongpborca_objhasnoancs=-14
publiclongpborca_objhasnorefs=-15
publiclongpborca_pbdcounterror=-16
publiclongpborca_pbdcreaterror=-17
publiclongpborca_checkouterror=-18
endvariables

forwardprototypes
publicfunctionintegerof_importfile(stringas_syntax,stringas_object,longal_type,stringas_pbl,stringas_library[],stringas_appl)
endprototypes

publicfunctionintegerof_importfile(stringas_syntax,stringas_object,longal_type,stringas_pbl,stringas_library[],stringas_appl);longli_handle
longll_sid
longll_index
integerli_result


ll_sid=sessionopen()
li_result=sessionsetlibrarylist(ll_sid,as_library,upperbound(as_library))

ifli_result=0then
li_result=sessionsetcurrentappl(ll_sid,as_library[1],as_appl)

ifli_result=0then
li_result=compileentryimport(ll_sid,as_pbl,as_object,al_type,"Messagebox->gf_msgbox",as_syntax,len(as_syntax),0,0)

ifli_result<>0then
li_handle=fileopen("status.txt",linemode!,write!,lockwrite!,append!)
filewrite(li_handle,string(li_result)+"-"+as_pbl+"-"+as_object)
fileclose(li_handle)
else
li_handle=fileopen("status.txt",linemode!,write!,lockwrite!,append!)
filewrite(li_handle,string(li_result)+"-"+as_pbl+"-"+as_object)
fileclose(li_handle)
endif

else
li_handle=fileopen("status.txt",linemode!,write!,lockwrite!,append!)
filewrite(li_handle,string(li_result)+"-"+as_pbl+"-"+as_object)
fileclose(li_handle)
endif

else
li_handle=fileopen("status.txt",linemode!,write!,lockwrite!,append!)
filewrite(li_handle,string(li_result)+"-"+as_pbl+"-"+as_object)
fileclose(li_handle)
endif

sessionclose(ll_sid)
returnli_result
endfunction

onn_cst_pborc.create
callsuper::create
triggerevent("constructor")
endon

onn_cst_pborc.destroy
triggerevent("destructor")
callsuper::destroy
endon
分享到:
评论

相关推荐

    PBDWEDIT PB反编译伴侣

    由于它支持批量从pb文件中导出数据窗口(许多PB反编译工具并不能直接反编译数据窗口),并且该工具内含一款针对pbkiller的修复插件pbkillerrepair,该插件除修复pbkiller导出代码中的某些语法错误外,更关键的是它绑定...

    PB源码文件导出工具(PB Picker)

    一个可以批量从PBL文件导出为srd,srw文件的小工具。 操作: 选择PBL文件所在文件夹,选择导出目标路径,点击Export按钮,PBL文件夹中所有的PBL文件中的SRW和SRD可迅速导出。 注意:此版本有导出源码32K限制,修正版...

    PBkiller反编译工具

    PowerBuilder 反编译工具 ,完美反编译PBD文件,dw可以另存为PBL

    pbkiller

    "pbkiller"是一款专门针对PowerBuilder(PB)应用程序的反编译工具,它能够帮助开发者或者逆向工程人员解析和理解PowerBuilder的源代码逻辑,尽管原始的源代码通常是不可见的。PowerBuilder是一种流行的面向对象的...

    pb反编译工具 PBKiller

    - **技术要求**:掌握一定的PowerBuilder知识和逆向工程基础,才能有效地利用PBKiller。 - **备份原始数据**:在使用任何反编译工具之前,务必备份原始PBL库,以防意外损坏。 - **谨慎使用**:反编译工具可能会产生...

    pb工具pbkiller2

    pb工具pbkiller2

    PBKiller pb反编译工具

    总之,PBKiller作为PB反编译工具,对于那些需要理解和修复无源代码的PB应用程序的开发者来说,是一个宝贵的资源。然而,它同时也提醒我们在软件开发和管理中,保持源代码的安全和备份的重要性。

    pbkiller2.5.18 PB反编译

    7. **工具使用技巧**:掌握PBkiller的使用方法,包括如何加载.pbl或.exe文件,如何查看和导出反编译结果,以及如何理解和解读反编译后的代码。 综上所述,PBkiller2.5.18是一款针对PowerBuilder应用程序的专业反...

    pbkiller.rar_PBKILLER_PBKiller2.5.18.rar_PowerBuilder_pb_pbkille

    pbkiller2.5.18 PB 可反编译出PB6,7,8,9,10编译后的程序中的所有对象 和源码

    PBKiller V2.5.18

    总的来说,PBKiller V2.5.18是PowerBuilder开发者和逆向工程领域的利器,它通过反编译技术帮助用户重新获得已编译文件的源代码形式,从而便于代码的调试、维护和学习。尽管反编译的结果可能并不完美,但在没有源码的...

    pbkiller2.5.18 PB反编译.rar

    在使用PBKiller时,用户需要首先将目标PBL文件导入到软件中。该工具会分析这些文件,然后显示出反编译的结果,通常包括函数、变量、事件处理程序和其他编程元素。虽然反编译的代码可能不会完全与原始源代码一致,...

    最新反编译工具pbkiller

    2. **源码恢复**:PBKiller能将PBL库文件中的二进制代码转换为接近原始的PowerScript源代码,帮助开发者阅读和理解程序逻辑。 3. **数据窗口还原**:由于DataWindow是PB的关键组成部分,PBKiller能够解析并重构...

    PB反编译器PBKiller 1.5.07 破解版

    不多说了,经典的PB反编译器PBKiller 可以反编译powerbuilder6.5-9.0版本的程序,优秀程序员必备工具 文件列表: PB反编译器PBKiller 1.5.07 破解版\FileList.TXT PB反编译器PBKiller 1.5.07 破解版\kernel.dat PB反...

    PB反编译工具(PBKILLER)

    不仅如此,PBKiller还支持对程序资源的修改,包括图像、文本和其他非代码元素,这对于定制化开发或者修复原有程序的界面和功能非常有用。 反编译过程中,PBKiller会尝试还原原始的语法结构,包括逻辑控制、数据类型...

    PBkiller2.5.18

    2. **数据文件解析**:压缩包内的文件如vm196.dat、vm169.dat等可能是PBKiller用于识别和处理游戏过程中的特定数据或配置文件。这些文件可能包含了针对不同游戏环境的优化策略或算法。 3. **内核交互**:kernel.dat...

    pbkiller 用来反编译powerbuilder 的PBD文件

    pbkiller的工作原理可能涉及多种技术,包括但不限于静态分析、符号执行、字节码解码等。它可能能够识别并重构PBL(PowerBuilder Library)中的函数、方法、变量和数据结构。反编译的结果可能不如原始的PowerScript...

    PBKiller 1.5.07

    PBKiller 1.5.07 是一个专门针对PowerBuilder(PB)应用程序的反编译工具,旨在帮助用户从PB6至PB9版本编译后的程序中恢复和查看源代码及对象。在IT领域,反编译器是一种用于解析已编译的二进制代码并尝试重构其原始...

    PBKiller2.5.18

    PBKiller是一款非常优秀的PB反编译器,它可以反编译PB6.7.8.9编译出来的所有对象和源码。

    pbkiller2.5.18 免费

    3. `PBKiller.exe`:这是PBKiller的主要可执行文件,用户通过运行这个文件来启动和使用该工具。它是Windows操作系统下的可执行程序,负责执行PBKiller的主要功能,如扫描、清除或阻止问题软件。 4. `下载使用说明....

Global site tag (gtag.js) - Google Analytics