Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / June 2007

Tip: Looking for answers? Try searching our database.

AccessViolationException Occurred

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mehul Gurjar - 14 Jun 2007 13:27 GMT
Hello,

I am trying to call an API Function (API is written in C Language). On a
particular function I am getting an exception

"AccessViolationException was unhandled by user... Attempted to read or
write protected memory. This is often an indication that other memory is
corrupt."

Can anyone please help me to resolve this problem ?

With regards,

Mehul Gurjar
Mattias Sjögren - 14 Jun 2007 21:32 GMT
>Can anyone please help me to resolve this problem ?

Only if you post relevant parts of your code.

Mattias

Signature

Mattias Sjögren [C# MVP]  mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.

Mehul Gurjar - 15 Jun 2007 13:58 GMT
Hi Marttis,

Pls check the code as follows. I am getting the error when I am passing
parameters to the native API Function

public int MyFunction(int vi1, int vi2, string vs3, ref int ri4, ref int
rl5) {
           return nativeAPIFunction(vi1, vi2, vs3, ref ri4, ref rl5);
       }

With regards,

>>Can anyone please help me to resolve this problem ?
>
> Only if you post relevant parts of your code.
>
> Mattias
Mattias Sjögren - 16 Jun 2007 12:42 GMT
>public int MyFunction(int vi1, int vi2, string vs3, ref int ri4, ref int
>rl5) {
>            return nativeAPIFunction(vi1, vi2, vs3, ref ri4, ref rl5);
>        }

We really need to see the C side too. At least the function signature.
If you have the implementation or working calling code in some other
language that may help as well.

Mattias

Signature

Mattias Sjögren [C# MVP]  mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.

Ben Voigt [C++ MVP] - 15 Jun 2007 21:29 GMT
> Hello,
>
[quoted text clipped - 4 lines]
> write protected memory. This is often an indication that other memory is
> corrupt."

The API has a bug, or you sent a bad pointer.

> Can anyone please help me to resolve this problem ?
>
> With regards,
>
> Mehul Gurjar

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.