Embedded Resource!!

  • Thread starter Thread starter VJ
  • Start date Start date
V

VJ

Can I add a embedded resource at run-time to assembly I trust.?. The
embedded resource that I want to add is a XML file.

VJ
 
Oop, sorry, I misread you, missed the runtim part.
You can't modify a DLL while it's used, therefore you can't a resource into
it.
Beside you do that only at compile time.
 
VJ said:
Can I add a embedded resource at run-time to assembly I trust.?. The
embedded resource that I want to add is a XML file.

No, not if it is loaded. Apart from anything else the file will be
locked by the process. In addition, Windows has a copy-on-write
mechanism so if you change the DLL you won't be changing the code that
will be accessible in memory.

As to whether you can change the DLL if it is not loaded, well, that is
more difficult to answer. If the assembly does not have a strong name
then there will not be any tamper proof checks (see my security tutorial
for details) so you could change the assembly. However, you'll have to
change the assembly's metadata tables, which involves a low level
manipulation of the bytes in the file. It's far too much effort and
prone to errors. You'll be better off using a linked resource and
changing that instead (see my Fusion tutorial for an example of how to
do this).

Richard
 
Back
Top