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

Failed to load DLL: Invalid access to memory location

P: 1
Hi,

I'm a noob with C# .NET (in fact, I've only just started looking at it within the last 24 hours) so please excuse me.

[DllImportAttribute("test.dll", EntryPoint = "_test@24", CharSet = CharSet.Ansi, ExactSpelling = false, SetLastError = false, PreserveSig = true, CallingConvention = CallingConvention.Winapi, BestFitMapping = false, ThrowOnUnmappableChar = false)]
[PreserveSigAttribute()]

I am trying to use that with a DLL that is packed with yoda's protector 1.03.3 and I am getting the error quoted in the subject title when trying to call the function. I'm using code directly taken from a working project and all my debugging has shown the parameters and everything leading up to the function call to be completely correct.

I've been reading around and believe it could have something to do with the DLL relocs trying to access read-only memory or something similar to that? If so, how would I go about solving this? Editing the DLL is not really feasible, as the original author lost his source code a long time ago, and unpacking it is not the easiest of things. Also, I *believe* this code works fine in .NET 2003 as the original application used for the exact same DLL was compiled under .NET 2003, but in the 2008 version it's causing this error.

Any ideas?

Thanks,

Nick
Feb 5 '09 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.