access-violation

C++ a NULL pointer in the STL container

Hello! I am, unfortunately, not working on a program developed by myself fully. I recently I noticed a Visual Studio Fatal Error on operator-- of unordered_set, which was called from simple insertion of a pointer to unordered_set. After reviewing the locals, I've noticed that set only has 2 elements last of which is NULL (so I suppose ...

Word2007: Access Violation Exception was unhandled when execute Selection.Find.Execute

I read a lot of posts on this terrible and annoying error: "Access Violation Exception was unhandled ". But only one post on Word2007 and the raising command "Selection.Find.Execute ". The proposed solution was to reinstall Word2007 and it is a little bit trivial! I try to explain my environment. I have a little application written in ...

Access violation where there wasn't one before

I'm P/Invoking out to Graphviz as shown here. When I wrote that blog entry, the code worked just fine. Now, I'm putting together an HttpModule that renders Graphviz graphs using that code, but I get an AccessViolationException at agmemread. // Native signature Agraph_t agmemread(char *); // P/Invoke Signature [DllImport(LIB_GRAPH)] pri...

MySQL Zend Framework - SQLSTATE[42000]: Syntax error or access violation: 1064

I've read every response I could fine on SO before posting this question. Although similar, none addressed my particular problem (or I didn't recognize them doing so). I have a table class that extends Zend_Db_Table_Abstract. In the model, I'm trying to return a single row using a join() method and based on the table ID like this: ...

Using Registry module crashes Perl with Access Violation

Our perl program crashes when started on customer's Windows machine. Further tests shows that with the perl distribution we provide, a simple "hello world" script works, but breaks if it includes the line: use Win32::TieRegistry(Delimiter=>'\\'); It crashes with Access Violation for accessing a zero pointer. The stack points to regist...

Why is my char* writable and sometimes read only in C++

I have had really big problems understand the char* lately. Let's say I made a recursive function to revert a char* but depending on how I initialize it I get some access violations, and in my C++ primer I didn't find anything giving me the right path to understand so I am seeking your help. CASE 1 First case where I got access violatio...

C++: access violation exception when calling a method

I've got a strange problem here. Assume that I have a class with some virtual methods. Under a certain circumstances an instance of this class should call one of those methods. Most of the time no problems occur on that stage, but sometimes it turns out that virtual method cannot be called, because the pointer to that method is NULL (as ...

System.AccessViolationException in wmp.dll module

I'm at a total loss of what to do. I am using an AxWindowsMediaPlayer object that is created programatically and added to the form's controls: Private Sub PlayNext(ByVal path As String) Dim wA As Rectangle = Screen.PrimaryScreen.Bounds Dim vidPlayer As New AxWMPLib.AxWindowsMediaPlayer Controls.Add(vidPlayer) With vidPl...

Can objects be unwinded before they are created on stack?

We have been debugging a strange case for some days now, and have somewhat isolated the bug, but it still doesn't make any sense. Perhaps anyone here can give me a clue about what is going on. The problem is an access violation that occur in a part of the code. Basically we have something like this: void aclass::somefunc() { try { ...

"Attempted to read or write protected memory. This is often an indication that other memory is corrupt" DllImporting C#

I am getting this weird error while trying to marshal data to my DLL function and back to the C# code. I don't see where I am passing null or reading invalid memory and this error is so vague. Any clues?? Code below: The FeeCalculation function is exported as follows in the DLL: extern "C" __declspec(dllexport) void __stdcall FeeCalc...

string to PCWSTR -> strange return(C++)

Hello, i'm really new to C++-programming and i've got an a problem with writing into a xml document. I'm using a slightly changed example of xml outputter from msdn (http://msdn.microsoft.com/en-us/library/ms766497(VS.85).aspx). HRESULT CreateAndAddTestMethodNode(string name) { HRESULT hr = S_OK; IXMLDOMElement* pElement = NULL; CHK_...

Berkeley DB: What am I doing wrong here?

I wrote a small program to explore using Berkeley DB with C#. using System; using System.Collections.Generic; using System.IO; using System.Text; using BerkeleyDB; namespace bdbtest { class Program { const string dbfile = @"c:\tmp\test.db"; const int nIndexes = 5, nRecords = 500; static SecondaryKeyGenDe...

C# .Net file in use issue

I'm having an issue opening files that have recently been closed by the .Net framework. Basically, what happens is the following: Read in an XML file using DataSet.ReadXml() Make some changes to the data Write out the XML file using DataSet.WriteXml() Copy the XML file to a new location using File.Copy FTP the file using a cus...

Access violations in strange places when using Windows file dialogs

A long time ago I found out that I was getting access violations in my code due to the use of the Delphi Open File and/or Save File dialogs, which encapsulate the Windows dialogs. I asked some questions on a few forums and I was told that it may have been due to the way some programs add hooks to the shell system that result in DLLs ge...

Access violation exception from Delphi's Supports -> QueryInterface

Hi, I have the following piece of code: for i := 0 to FControlList.Count - 1 do if Supports(IMyControl(FControlList[i]), IMyControlEx) then begin MyControlEx := IMyControl(FControlList[i]) as IMyControlEx; MyControlEx.DoYourMagic(Self, SomeData); end; This code is called many times during my applic...

C# Win Forms Access Violation Exception

I keep getting the following error: System.AccessViolationException was unhandled Message="Attempted to read or write protected memory. This is often an indication that other memory is corrupt." Source="FEDivaNET" StackTrace: at Diva.Handles.FEDivaObject.dropReference() at Diva.Handles.FEDivaObject.!FEDivaObject() ...

What happens to an ActiveX control (COleControl) after the call to OnDestroy() ?

I have an ActiveX control written in C++ that runs in Internet Explorer 8. Most of the time (approx 90%) when the tab or browser containing the control is closed, there is an access violation like this: The thread 'Win32 Thread' (0x1bf0) has exited with code 0 (0x0). Unhandled exception at 0x77b3b9fd in iexplore.exe: 0xC0000005: Access ...

Is there a default buffer length for 'sprintf' method?

Hi, I used sprintf method to format data to a string which I want to write to a file, in C++ console application using VS 2008. The Input is a particular message, which has various variables and values (ex: Type 'int' and Value '10' / Type string and value "abc", etc.) When I send a two messages it works perfectly. But When I send more ...

AccessViolationException, attempted to read or write protected memory

I'm using a dll that contains unmanaged code for interacting with specific hardware, and I'm trying to use it from C#, but I keep getting an AccessViolationException. What's causing it, and how can I fix it? namespace FingerPrint { public unsafe partial class Form1 : Form { [DllImport("MyDll.dll")] public static ex...

Access reading error when using class member variable

Hi, I have a class with private member variables declared in a header file. In my constructor, I pass in some filenames and create other objects using those names. This works fine. When I try to add another member variable, however, and initialize it in the constructor, I get an access reading violation. I sent the code to someone else ...