从主存储器执行文件. [英] Execute a file from main memory.

查看:70
本文介绍了从主存储器执行文件.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现系统调用从Java中的磁盘运行文件.它的Runtime.getruntime.exec().现在,我需要系统调用才能从主内存运行文件.
我的文件已加载到
int File [1000]; //这包含我的文件,即byes的连续数组.
整数大小; //此数字包含文件大小,即文件有多少字节.
字符串文件类型; //包含文件类型.

因此,我在主内存中拥有所有文件属性.
(记住文件不在磁盘上的主存储器中.)
我需要运行大小为"size"的"File []","filetype"会告诉我要调用哪个系统程序.

请告诉我执行此工作的系统调用.

I found the system call to run file from disk in java. Its Runtime.getruntime.exec(). Now I need a system call to run a file from main memory.
My File is loaded in
int File[1000]; //This contains my file i.e. sequential array of byes.
int size; //This number contains file size i.e. how many bytes file has.
String filetype; // It contains file type.

Thus I have all file attributes in main memory.
(Remember file is in main memory not on the disk.)
I need to run "File[]" of size "size" and "filetype" informs me which system program to invoke.

Please tell me system call to do this job.

推荐答案

没有一个.您可以通过Win32 LoadLibrary() [ ^ ]函数,但这可能比它值得的麻烦更多.
There isn''t one. You could possibly do it via the Win32 LoadLibrary()[^] function, but it''s probably more trouble than it''s worth.


正如其他人提到的那样,您可以将文件保存到磁盘,然后启动它.

但是,您不能仅从内存中的图像启动进程.

仅调用应用程序的入口点也是不安全的,因为它将期望拥有进程空间.您可能会发现一些有趣的方式来使会话崩溃,因为应用程序会分配资源并重新映射地址空间以满足其需求...
As others have mentioned, you could save the file to disk, then launch it.

You can''t however just start a process from an image in memory.

It would also be unsafe to simply call the entry point of the application, as it''s going to expect to own the process space. You''ll prob ably find some interesting ways to crash your session this way, as the application allocates resources and remaps your address space to suit it''s needs...


这篇关于从主存储器执行文件.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆