By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,915 Members | 1,365 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,915 IT Pros & Developers. It's quick & easy.

Decompiling and modifying an Assembly....

P: n/a
Gaz
....and recompiling it again

Hi all,

I've got an Assembly DLL and associated .NetModules and want to amend
a function in one of the .NetModules

I've used ILDASM to decompile the .NetModules into IL so I can modify
the code but am having trouble trying to compile up the .NetModule and
effectively renew the Assembly.

If I use ILASM to rebuild the .NetModule I get an error
'System.IO.FileLoadException - The check of the modules hash failed'
when trying to use my Assembly DLL so obviously I need to do a full
rebuild of the Assembly DLL.

However, if I try to us AL.exe with any of my NetModule .il files I
get an 'unspecified error' when it tries to import them....

Can anyone tell me the necessary sequence of events required to :
disassemble an Assembly and it's NetModules,
Modify the IL of one of the NetModules,
Rebuild the NetModules and Assembly DLL correctly

I'm new to C# and apologise if this is a daft question, but I've not
seen an answer for disassembling, modifying and rebuilding an Assembly
in the Groups so far and would appreciate any help!

Thanks for your time,

Gareth
Nov 15 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Gaz <Ga****@hotmail.com> wrote:
I've got an Assembly DLL and associated .NetModules and want to amend
a function in one of the .NetModules

I've used ILDASM to decompile the .NetModules into IL so I can modify
the code but am having trouble trying to compile up the .NetModule and
effectively renew the Assembly.


Do you have the legal right to modify this code? If so, couldn't you
just ask the author for the original source code, modify that, and then
recompile it in a normal way?

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 15 '05 #2

P: n/a
Gaz,
Legal issues notwithstanding, this is most likely because the assembly you
are attempting to ILASM from il code was a strong-named assembly. You would
have to remove the public key portion and any other similar metadata.
--Peter

"Gaz" <Ga****@hotmail.com> wrote in message
news:7c**************************@posting.google.c om...
...and recompiling it again

Hi all,

I've got an Assembly DLL and associated .NetModules and want to amend
a function in one of the .NetModules

I've used ILDASM to decompile the .NetModules into IL so I can modify
the code but am having trouble trying to compile up the .NetModule and
effectively renew the Assembly.

If I use ILASM to rebuild the .NetModule I get an error
'System.IO.FileLoadException - The check of the modules hash failed'
when trying to use my Assembly DLL so obviously I need to do a full
rebuild of the Assembly DLL.

However, if I try to us AL.exe with any of my NetModule .il files I
get an 'unspecified error' when it tries to import them....

Can anyone tell me the necessary sequence of events required to :
disassemble an Assembly and it's NetModules,
Modify the IL of one of the NetModules,
Rebuild the NetModules and Assembly DLL correctly

I'm new to C# and apologise if this is a daft question, but I've not
seen an answer for disassembling, modifying and rebuilding an Assembly
in the Groups so far and would appreciate any help!

Thanks for your time,

Gareth

Nov 15 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.