How exactly is an exe loaded into memory

本文探讨了如何将EXE文件加载到内存中并运行,涉及使用.NET Framework进行程序加载的技术细节。此外,还讨论了SynchronizationContext的工作原理及其在多线程环境中的一致性保障作用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

http://msdn.microsoft.com/en-us/magazine/cc301805.aspx
http://www.codeproject.com/Articles/13897/Load-an-EXE-File-and-Run-It-from-Memory
http://www.joachim-bauch.de/tutorials/loading-a-dll-from-memory/




Synchronization Context articles: 
http://msdn.microsoft.com/en-us/magazine/gg598924.aspx(It's all about Synchronization Context)
http://www.codeproject.com/Articles/31971/Understanding-SynchronizationContext-Part-I


STA Threads:
http://blogs.msdn.com/b/jfoscoding/archive/2005/04/07/406341.aspx(Why is STAThread request)




book: Window internal




The original question is that: as portal executional is loaded into memory, then why can't it be replace when it's running?
Also take some time to find out why vs can edit code when it's debugging. 






Load assembly from disk programmaticly. 
using(FileStream fs = new FileStream("", FileMode.Open))
{
BinaryReader br = new BinaryReader(fs);
Byte[] bin = br.ReadBytes(Convert.ToInt32(fs.Length));
Assembly a = Assembly.Load(bin);


MethodInfo entry = a.EntryPoint;
if (entry != null)
{
object o = a.CreateInstance(entry.Name);
entry.Invoke(o,null);
}
};



MKVDS_SHRTNAMLNX1_CP
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值