access-violation

Access Violation Using memcpy or Assignment to an Array in a Struct

Update 2: Well I’ve refactored the work-around that I have into a separate function. This way, while it’s still not ideal (especially since I have to free outside the function the memory that is allocated inside the function), it does afford the ability to use it a little more generally. I’m still hoping for a more optimal and elegant s...

Accessing outside the memory allocated by the program. (Accessing other app's memory)

Is there a way to access (read or free) memory chunks that are outside the memory that is allocated for the program without getting access violation exceptions. Well what I actually would like to understand apart from this, is how a memory cleaner (system garbage collector) works. I've always wanted to write such a program. (The languag...

Access Violation When Writing Dynamic 2D Array... Sometimes

This program is meant to generate a dynamic array, however it gives an access violation error when writing when given certain dimensions. Eg: R = 6, C = 5 crashes, but then R = 5, C = 6 doesn't. In case your wondering, it isn't my homework to "fix" this broken program, this is the method we were taught in class. Also part of my assessmen...

C toLowerCase Function won't work - Access violation

Hi, I have a simple function which takes an array of characters as an argument, and converts all the characters to lower case. However, I get a weird access violation error. Here's the code: void toLower(char *rec) { int i=0; while (rec[i]!='\0') { if (rec[i]>='A' && rec[i]<='Z') rec[i]='a'+rec[i]-'A'; //this is ...

Access violation when running native C++ application that uses a /clr built DLL

I'm reorganzing a legacy mixed (managed and unmanaged DLLs) application so that the main application segment is unmanaged MFC and that will call a C++ DLL compiled with /clr flag that will bridge the communication between the managed (C# DLLs) and unmanaged code. Unfortuantely, my changed have resulted in an Access violation that occurs...

Why does CoUninitialize cause an error on exit?

I'm working on a C++ application to read some data from an Excel file. I've got it working, but I'm confused about one part. Here's the code (simplified to read only the first cell). //Mostly copied from http://www.codeproject.com/KB/wtl/WTLExcel.aspx #import "c:\Program Files\Common Files\Microsoft Shared\OFFICE11\MSO.DLL" #import "c:...

How to debug nondeterministic access violation crash?

Our C#/COM/C++ application is crashing and I need help debugging it. Running with gflags enabled and WinDbg attached, we determined the crashes are caused by an access violation, but we haven't been able to narrow it down any more than that. We are not seeing the issue on all machines; there are a couple of machines that seem to reproduc...

What is causing System.AccessViolationException when I access an ADODB Field's Value?

I am connecting to a PostgreSQL database from a .Net web service (both on a Windows XP machine). On a few occasions recently, on a few different computers, we have received System.AccessViolationException errors. One stack trace I was able to obtain showed that it was occuring when I took an ADODB.recordset and obtained the value of a ...

AccessViolationException outside Visual Studio?

Hello, I'm developing a small C# winforms application that consumes an unmanaged C++ library. I have no access to the code of this library. If I'm in Visual Studio and I runt my application, do my calls to the library everything is working find. Once I run CTRL + F5 I get an AccessViolationException. I did some testing, created anoth...

Access violation of member of pointer object

So I am coding this client/server program. This code is from the client side. The client has an instance of an object mpqs_sieve *instance_; The reason I make it as a pointer is, that mpqs_sieve only has a constructor that takes 3 arguments, and I want to instantiate it at a later point in time. The client first gets some data from t...

Delphi access violation assigning local variable

This seems like the simplest thing in the world and I'm ready to pull my hair out over it. I have a unit that looks like this ; Unit myUnit; // ... //normal declarations //... Public //bunch of procedures including Procedure myProcedure; const //bunch of constants var //bunch of vars including myCounter:integer; Implementation Use...

Uncatchable AccesViolationException

Hi all, I'm getting close to desperate.. I am developing a field service application for Windows Mobile 6.1 using C# and quite some p/Invoking. (I think I'm referencing about 50 native functions) On normal circumstances this goes without any problem, but when i start stressing the GC i'm getting a nasty 0xC0000005 error witch seems unc...

How should a software product handle an access violation

We have a software product in c++, that due to documented problems with the compiler generates faulty code (Yes I know it is horrible in itself). This among other bugs causes Access Violations to be thrown. Our response to that is to catch the error and continue running. My question is, is this a responsible approach? Is it responsibl...

visual studio 2010 migration : Modification of a Library created object causes access violation

I am migrating a project from vs 2005 to vs 2010 and the problem appeared. My program links statically to a C library. I am making a call in this library that returns a C++ object which itself has a public member that is a struct. When I try to modify some values in this struct from my code, I got some access violation errors. In the ...

VS2008 C++ MFC Access Violation ONLY when stepping through debug mode

Hi. This is crazy. It started happening in my main project, so I created a tiny sample brand-new project to reproduce it in and sure enough.. It does NOT happen in a sample project I created that is only a Win32 console app. I'm running this on Win7x64, if that matters. VS2008 SP1. Here goes. I create a small dialog app with a button...

Using the .NET BackgroundWorker from VB6 fails with an AccessViolationException

The following MSDN example promises to demonstrate how to use the .NET BackgroundWorker from VB6 but it fails with an AccessViolationException. The only workaround is to compile the VB6 code as P-code, but that is not a viable option for us. http://msdn.microsoft.com/en-us/library/aa719109(VS.71).aspx Here are lots of details of the p...

Exceptions and Access Violations in Paint events in Windows

After executing some new code, my C++ application started to behave strange (incorrect or incomplete screen updates, sometimes no screen updates at all). After a while we found out that the new code is causing an Access Violation. Strange enough, the application simply keeps on running (but with the incorrect screen updates). At first ...

Access Violation Exception only appearing when running C# app without debugger attached

I have an application that works fine in Visual Studios 2008, and I am trying to get it into VS 2010 in order to use .NET 4, and I have a really weird problem. When I run the code from either Release mode or Debug mode with the debugger attached (F5), I have no problems running the program. However, when I run the program from either R...

Help catching AV with WinDbg and ADPlus 7.0

I want to catch Memory Access Violation in SQL Server Compact Edition like this described at http://debuggingblog.com/wp/2009/02/18/memory-access-violation-in-sql-server-compact-editionce/ The suggested config is: <ADPlus> <Settings> <RunMode>CRASH</RunMode> <Option>Quiet</Option> <ProcessName>MyApp.exe</ProcessName> ...

Random Access Violation Exception in WPF Application

Hi, I am facing weird problem while running regression tests on my WPF Application. I am getting AccessViolationException with different stacktraces each time. First : Message :Attempted to read or write protected memory. This is often an indication that other memory is corrupt. StackTrace : at MS.Win32.PresentationCore.UnsafeNativ...