原文:http://itmed.blog.sohu.com/96898840.html 原文发表于2008-08-10 作者深蓝无忌
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 |