如何运行res里面包含的exe文件(100分)

Q

qfgj

Unregistered / Unconfirmed
GUEST, unregistred user!
res里面包含了一个exe文件,用流读出来,如何不另存为文件直接运行此exe文件
 
你试怎么放到res中的?
 
建立一个rc文件,然后用BRCC32编译
 
不能完成的任务<br>这是WINDOWS决定的,没办法
 
&nbsp;最近大家都在讨论这个问题。。。。但是似乎没有好的解决方案,实现是肯定可以的,<br>&nbsp; &nbsp;要不那些加密软件怎么弄的?他们并不是释放到磁盘上运行的。。。但是很复杂。。。
 
我想,应该做的,就是模仿PE装载器的动作。。。。
 
这还不简单,不需要放在Res中,放在exe的文件尾部,<br>要运行是取出来,用winexec执行就可以,下面的两个函数是关键:<br><br>//将一个exe文件加到原文件的后面;<br>Function Cjt_AddtoFile(SourceFile,TargetFile:string): Boolean;<br>var<br>&nbsp; Target, Source: TFileStream;<br>&nbsp; MyFileSize: integer;<br>begin<br>&nbsp; try<br>&nbsp; &nbsp; Source:=TFileStream.Create(SourceFile,fmOpenRead or fmShareDenyWrite);<br>&nbsp; &nbsp; Target:=TFileStream.Create(TargetFile,fmOpenWrite or fmShareExclusive);<br>&nbsp; &nbsp; try<br>&nbsp; &nbsp; &nbsp; Target.Seek(0,soFromEnd);//&amp;Iacute;ù&amp;Icirc;&amp;sup2;&amp;sup2;&amp;iquest;&amp;Igrave;í&amp;frac14;&amp;Oacute;×&amp;Ecirc;&amp;Ocirc;&amp;acute;<br>&nbsp; &nbsp; &nbsp; Target.CopyFrom(Source,0);<br>&nbsp; &nbsp; &nbsp; //&amp;frac14;&amp;AElig;&amp;Euml;&amp;atilde;×&amp;Ecirc;&amp;Ocirc;&amp;acute;&amp;acute;ó&amp;ETH;&amp;iexcl;&amp;pound;&amp;not;&amp;sup2;&amp;cent;&amp;ETH;&amp;acute;&amp;Egrave;&amp;euml;&amp;cedil;¨&amp;sup3;&amp;Igrave;&amp;Icirc;&amp;sup2;&amp;sup2;&amp;iquest;;<br>&nbsp; &nbsp; &nbsp; MyFileSize:=Source.Size+4;//Sizeof(MyFileSize);<br>&nbsp; &nbsp; &nbsp; Target.WriteBuffer(MyFileSize,4);//sizeof(MyFileSize));<br>&nbsp; &nbsp; finally<br>&nbsp; &nbsp; &nbsp; Target.Free;<br>&nbsp; &nbsp; &nbsp; Source.Free;<br>&nbsp; &nbsp; end;<br>&nbsp; except<br>&nbsp; &nbsp; Result:=False;<br>&nbsp; &nbsp; Exit;<br>&nbsp; end;<br>&nbsp; Result:=True;<br>end;<br><br>//先前放在exe原文件 的Exe文件取出来<br>Function Cjt_DetachFromFile(SourceFile, TargetFile :string): Boolean;<br>var<br>&nbsp; Source: TFileStream;<br>&nbsp; Target: TMemoryStream;<br>&nbsp; MyFileSize: integer;<br>begin<br>&nbsp; try<br>&nbsp; &nbsp; Target:=TMemoryStream.Create;<br>&nbsp; &nbsp; Source:=TFileStream.Create(SourceFile, fmOpenRead or fmShareDenyWrite);<br>&nbsp; &nbsp; try<br>&nbsp; &nbsp; &nbsp; Source.Seek(-sizeof(MyFileSize),soFromEnd);<br>&nbsp; &nbsp; &nbsp; Source.ReadBuffer(MyFileSize, sizeof(MyFileSize));//&amp;para;&amp;Aacute;&amp;sup3;&amp;ouml;×&amp;Ecirc;&amp;Ocirc;&amp;acute;&amp;acute;ó&amp;ETH;&amp;iexcl;<br>&nbsp; &nbsp; &nbsp; Source.Seek(-MyFileSize,soFromEnd);//&amp;para;¨&amp;Icirc;&amp;raquo;&amp;micro;&amp;frac12;×&amp;Ecirc;&amp;Ocirc;&amp;acute;&amp;Icirc;&amp;raquo;&amp;Ouml;&amp;Atilde;<br>&nbsp; &nbsp; &nbsp; Target.CopyFrom(Source,MyFileSize-sizeof(MyFileSize));//&amp;Egrave;&amp;iexcl;&amp;sup3;&amp;ouml;×&amp;Ecirc;&amp;Ocirc;&amp;acute;<br>&nbsp; &nbsp; &nbsp; Target.SaveToFile(TargetFile);//&amp;acute;&amp;aelig;·&amp;Aring;&amp;micro;&amp;frac12;&amp;Icirc;&amp;Auml;&amp;frac14;&amp;thorn;<br>&nbsp; &nbsp; finally<br>&nbsp; &nbsp; &nbsp; Target.Free;<br>&nbsp; &nbsp; &nbsp; Source.Free;<br>&nbsp; &nbsp; end;<br>&nbsp; except<br>&nbsp; &nbsp; Result:=false;<br>&nbsp; &nbsp; Exit;<br>&nbsp; end;<br>&nbsp; Result:=true;<br>end;<br>
 
哦,sorry, 我没有看清楚,你要不解开了运行,我无能为力!<br>帮我回答这个问题。<br>http://www.delphibbs.com/delphibbs/dispq.asp?lid=2530945
 
&nbsp;这两个函数好眼熟,在哪里见过。。特别是 &nbsp; -&gt; &nbsp;"Cjt" 。。
 
to;xuxiaohan<br>&nbsp; &nbsp;错!就您这句,能存到内存吗?<br>  Target.SaveToFile(TargetFile);//&amp;acute;&amp;aelig;·&amp;Aring;&amp;micro;&amp;frac12;&amp;Icirc;&amp;Auml;&amp;frac14;&amp;thorn;
 
to: 刘麻子<br>&nbsp; &nbsp;Cjt=陈经涛
 
这都是来混分的,把别人的代码贴过来,连作者一字不提.
 
wjp888,:<br>&nbsp; 我不是混分的,大家认为呢?
 
ok,了解! 上面不恰当的话我已经删除了! 请原谅 !
 
楼主的做法好象不行,可以使用流来把各个可执行文件打包来完成。
 
不知道D能不能用VB的RES资源文件,能的话就方便了,VB的资源编辑器太方便了
 
wjp888:<br>&nbsp; ★作者: <br>&nbsp; 陈经韬 <br>&nbsp; Http:Lovejingtao.126.com <br>&nbsp; E-Mail: Lovejingtao@21.cn.com <br><br>&nbsp; 我保留Cjt作为函数的名称一部分,是对陈经韬的尊重,我已经说我无能为力,你说我骗分?,你对陈经韬的名字写错了,别人还没有说你呢
 
陈经韬是个他妈的骗子!孤傲不凡,还真把自己当回事!我为什么这样说呢?<br>上次有个问题很急,找QQ同他请教,我操他妈好话我说尽了,一口一个大师,一句一个求教,发了10次才回一次,还没解决!真他妈冷漠至极!!!在它主页上看到说什么网页上可以执行EXE文件,全中国只有几个人知道,真操他娘吹他妈的牛!问他(超过5次以上),答曰“可以”然后再也没有下文!操陈经韬它妈地逼你不知道就说不知道,不愿答就不愿答,至少给一个干脆脆的回答!自持懂点知识(谁知道是不是抄来的)就好象很他妈地B牛B一样!本来老子上QQ就提心掉胆(公司不允)就在那里干等他到下班都没回一句!我立刻把它这鸟人删除了!!如果说你忙,好,你可以告诉我你现在忙,妈地个B,一句话都没有!那次我还是被网管发现了,结果训斥一顿。我操它妈陈经韬自以为自己很懂吗?他主页上的那些破技术我后来也全部掌握了,效率比它的还要高,代码更精简,但也不是从它那里学来的!操你妈地逼陈经韬自认为自己贴了些代码被人家转贴就很不得了了,就可以对这些不懂的小弟兄摆架子装牛逼,你它妈算什么鸟人!
 
我说句放,不存出来是不能实现的。
 
顶部