CBC高手会么?外壳程序谁会做?请指点一下小弟,分不够加!!

mostneed 2003-01-10 11:32:34
我想把自己的文件里(资源里)的2进制文件(.exe)读出来,然后加载到内存中并运行。

具体要怎么做呢? 提供参考资料也有分。

thx!!
...全文
38 22 打赏 收藏 转发到动态 举报
写回复
用AI写文章
22 条回复
切换为时间正序
请发表友善的回复…
发表回复
fi9 2003-01-17
  • 打赏
  • 举报
回复
我明白一些你楼主的意思,其实你这个不叫什么外壳程序,也不是很必要去了解PE文件格式,因为,它还有个重定位的东东,所以不是那么的简单!!
其实,你所说的,用一个词最好说--“虚拟机”,就是像以前的basic和现在流行的java一样!你去看一下这方面的吧--虚拟机。
mostneed 2003-01-16
  • 打赏
  • 举报
回复
非常感谢各位高手的提示

我找到upx的代码地址

http://familiehaase.de/cywgin/compression/upx/
squirrelX 2003-01-15
  • 打赏
  • 举报
回复
有点说明一下,《windows环境下32位汇编语言程序设计》的作者就是我上面写的网址(http://61.153.195.10:8080/list.asp?part1=1&part2=5)的站长。(本人不认识,不是广告)

书里面的内容有些有用的都是网友发表的文章,和加壳相关的好象叫冷雨飘心的比较清楚(同样我也不认识)。在csdn上这人也发表过东西,你去问问他吧。

to jfetcn(jfet):
upx版本是多少?能否给我一份?(太懒了,没仔细找)
谢谢了。hereissquirrel@yahoo.com.cn
Behard 2003-01-14
  • 打赏
  • 举报
回复
mark
RomanticProgrammer 2003-01-14
  • 打赏
  • 举报
回复
关注.
jfetcn 2003-01-14
  • 打赏
  • 举报
回复
建议看看《windows环境下32位汇编语言程序设计》,在加壳程序中需要用到代码重定位,高级语言基本不能搞定。
还有就是UPX这个咚咚有源代码可以看看。
NowCan 2003-01-13
  • 打赏
  • 举报
回复
哪儿跟哪儿啊,那个是文件捆绑。最后还是试放到文件在执行。
squirrelX 2003-01-13
  • 打赏
  • 举报
回复
http://61.153.195.10:8080/list.asp?part1=1&part2=5
里有PE的详细解释,可以参考
sjd163 2003-01-12
  • 打赏
  • 举报
回复
请参考:
http://www.vckbase.com/vckbase/vckbase12/vc/nonctrls/misc_21/1221002.htm
语言不同道理是一样的。
mostneed 2003-01-12
  • 打赏
  • 举报
回复
呵呵,asm也没人回答。问了2天了

不过很感谢楼上各位的提示
squirrelX 2003-01-12
  • 打赏
  • 举报
回复
哈哈,RomanticProgrammer(兰企鹅||南极俺最帅) 搞错了,楼主说的外壳不是shell的意思。

不过这个我也不会,可以去asm的地方问问这个问题,弄清楚PE是避免不了了。BCB这里估计没人研究加壳方面的内容。

要加密的话,自己写个外壳效果我想应该不错的。:)
mostneed 2003-01-11
  • 打赏
  • 举报
回复
先谢谢楼上大哥:

codeguru 上别人的回复,给大家看看,一起学习交流。

Ask: execute program from memory
I want to activate an exe file but without having the file on the disk but the file is all in the memory.

Reply:
allocate memory.
Load/compile/create/whatever the programcode into that part of memory.
Arrange for any needed address fixups.
Call/jump to the code loaded in memory.

Pretty straightforward stuff really.

Some extra info:

You will need to alloacte the memory with VirtualAlloc so you can set the memory flags correctly. Specifically, you will need the Execute permission.


Something like....

// typedef functionpointer to the type of function you need.
typedef void (*PFMyFunc)();
// actual functionpointer
PFMyFunc pfMyFunc;

LPVOID lpMem = VirtualAlloc (NULL, dwSizeNeeded, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
pfMyFunc = (PFMyFunc)lpMem; // Store address in function pointer so we can call it.

// create/copy code to lpMem....
// Do any required address fixups
pfMyFunc(); // Call the code.

VirtualFree (lpMem);

ask:
After it has been loaded in memory
does anyone know how to dynamically call the main() or winmain function in any executable ,just like the OS does it ?
Without having to look through dumpbin and whatnot.
Looked everywhere, it should be so easy but it's nowhere documented. Or is it?

reply:
PE structure
Inside the IMAGE_NT_HEADERS structure of the executables PE structure is a field for the address of entry point. You just get the IMAGE_NT_HEADERS from the IMAGE_DOS_HEADER, and use that as your pointer to the runtime startup code (use proper calling convention!).

reply:
You can't easily run an EXE file this way, but you can use it to run code you create on the fly (I've used this in programs that had a built in programming language that gets compiled to native intel code).

An exe requires a whole lot more than the simple outline I gave. An Exe won't usually work since it'll require a separate process. Some exe's require to be loaded at specific memory addresses and such.
Running another exe inside the process space of your own program will violate many rules/assumptions that programs rely on, and I doubt highly it would work. The closest you could get to running another 'program' inside your own process space would be to compile the other 'program' to a DLL instead of an EXE.


看来要完全实现我的想法,要研究pe了.
myy 2003-01-11
  • 打赏
  • 举报
回复
直接架载到内存运行,恐怕不容易,不过可以用一个方法把正在运行的
exe文件删掉,可以在以前的帖子中搜一下。
mostneed 2003-01-11
  • 打赏
  • 举报
回复
TO: myy()

呵呵,和我想法一样。

不过我是想能不能直接架载到内存运行??
createPreocess的确要文件。

to:RomanticProgrammer

不要意思,麻烦你再来bcb版。我的意思你应该知道,现在也有很多加壳程序,所以我就干脆叫外壳程序了,呵呵。概念不清请见谅。。

请继续关注!
myy 2003-01-11
  • 打赏
  • 举报
回复
人家真想破你的,你放在那里都不行的。

建议:

你的被释放的exe 可以设计成必须加命令行参数才能运行的,比如:

mini.exe -dcbsdcb -kcjnbasdkj -jcbkas -cknjaskn

mini.exe里面判断命令行参数,不是上面的就不运行,人家在资源管理器里
根本没法执行的。这样,就算留了痕迹,也不太要紧的。甚至你的mini.exe的
后缀都可以不是“.exe”,但要用CreatProcess启动。
mustang_zr 2003-01-11
  • 打赏
  • 举报
回复
学习
wylpro 2003-01-11
  • 打赏
  • 举报
回复
你去申请一个映象选择子(CS)的然后将数据直接解码到程序段中,之后CALL这个程序。用完后再摸掉数据。
dos下用DPMI申请选择子。
win32下用DLL的函数具体我忘了。
你必须知道自己的程序中空闲快的位置,保证空闲快大小够用。
或者用LocalAlloc(...);申请一段代码内存。
然后用LocalPageLock(...);把内存锁定,不允许页面移动和磁盘交换。
申请映象选择子(CS),写数据,执行。
调用完成后释放内存。
不过这种方法不一定真能防止解密。
s98231106 2003-01-10
  • 打赏
  • 举报
回复

什么东西啊
RomanticProgrammer 2003-01-10
  • 打赏
  • 举报
回复
还不是,呵呵
外壳程序是利用Windows提供的COM接口,进行对Windows的扩展和调用的程序..

mostneed 2003-01-10
  • 打赏
  • 举报
回复
to myy() :

谢谢你的回复, 但是我是要直接加载到内存中运行,读到临时文件夹中会留下痕迹被别人破密的。

有什么办法么?

to: RomanticProgrammer(兰企鹅||南极俺最帅)
呵呵,这样是了么?帅哥
加载更多回复(2)

1,221

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder Windows SDK/API
社区管理员
  • Windows SDK/API社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧