access-violation

Access violation in MFC dll (wrapped in C++/CLI) started from C# program

一世执手 提交于 2019-12-11 07:28:37
问题 I have written an managed C++/CLI wrapper for mfc dll (C++) and have some access violations after second call of dll! Wrapper // in .h typedef CKeyManagerServerApp* (*KeyManagerInstance)(CCommonUtils *); ManagedKeyInterface::ManagedKeyInterface() { HINSTANCE m_keyManagerLib = LoadLibrary("pathToDll"); KeyManagerInstance _createInstance = (KeyManagerInstance)GetProcAddress(m_keyManagerLib, "GetInstance"); // get native reader interface from managed reader interface CCommonUtils

Error PInvoking Function

落花浮王杯 提交于 2019-12-11 07:14:13
问题 I have the following code as part of my control. SetReaderMode function creates the structure and calls the function explained here, http://msdn.microsoft.com/en-us/library/bb775599(VS.85).aspx When I run this code, i get the error Attempted to read or write protected memory. This is often an indication that other memory is corrupt. I'm not sure what the issue may be. What am I doing wrong? <DllImport("Comctl32.dll", EntryPoint:="#383", _ CallingConvention:=CallingConvention.StdCall)> _

OpenCV - Access violation reading location “somewhere in highgui lib”

▼魔方 西西 提交于 2019-12-11 06:56:13
问题 got following code: #include <opencv2/core/core.hpp> #include <opencv2/highgui/highgui.hpp> #include <opencv2/imgproc/imgproc.hpp> using namespace cv; using namespace std; void captureAndThreshold(); int main() { captureAndThreshold(); return 0; } void captureAndThreshold() { VideoCapture cap(0); if(!cap.isOpened()) // check if we succeeded return; Mat thresh, frame; namedWindow("Example Feed",1); while(true) { cap >> frame; if (!frame.empty()) { cvtColor(frame, thresh, CV_BGR2GRAY);

Access Violation when i drop a TidSMTP on a Form

。_饼干妹妹 提交于 2019-12-11 06:54:41
问题 i've a problem with Delphi XE4: when i drop on a form an TIdSmtp or TIsSSLIOHandlerSocketOpenSSL i receive this error: [511EDABF]{IndySystem180.bpl} IdStack.TIdStack.IncUsage (Line 688, "IdStack.pas" + 11) + $7 [511EEBB2]{IndySystem180.bpl} IdComponent.TIdComponent.InitComponent (Line 229, "IdComponent.pas" + 1) + $5 [50EE84A2]{IndyCore180.bpl} IdTCPConnection.TIdTCPConnection.InitComponent (Line 912, "IdTCPConnection.pas" + 1) + $2 [50EE0D99]{IndyCore180.bpl} IdTCPClient.TIdTCPClientCustom

C# WinForms exception: A first chance exception of type 'System.AccessViolationException'

独自空忆成欢 提交于 2019-12-11 05:39:58
问题 I have a basic WinForms application. I'm making a call to an external API which is generating the following exception: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. A first chance exception of type 'System.AccessViolationException' occurred in UavController.exe The call looks like this: outputBroker.SelectedObjectPaths.AddWithID(((AgAircraft)aircraft).Path, ((AgAircraft)aircraft).InstanceName); I can't find any indication of the problem

Access violation on 'ret' instruction

强颜欢笑 提交于 2019-12-11 04:44:33
问题 I've got this function, which consists mostly of inline asm. long *toarrayl(int members, ...){ __asm{ push esp mov eax, members imul eax, 4 push eax call malloc mov edx, eax mov edi, eax xor ecx, ecx xor esi, esi loopx: cmp ecx, members je done mov esi, 4 imul esi, ecx add esi, ebp mov eax, [esi+0xC] mov [edi], eax inc ecx add edi, 4 jmp loopx done: mov eax, edx pop esp ret } } And upon running, I get an access violation on the return instruction. I'm using VC++ 6, and it can sometimes mean

Why do I get an access violation when setting the value of an IHTMLInputTextElement?

筅森魡賤 提交于 2019-12-11 03:26:49
问题 I get the following error: Access Violation at address 0050AA07 in module "project1.exe". Read of address 00000000. I'm trying to auto fill a form in TWebBrowser. It's just a field called 'login' on a form. What does it mean? How do I solve it? procedure TForm1.Button2Click(Sender: TObject); var doc: IHTMLDocument2; frm: IHTMLFormElement; fld: IHTMLInputTextElement; begin doc := webbrowser1.Document as IHTMLDocument2; frm := doc.forms.item(0, EmptyParam) as IHTMLFormElement; fld := frm.item(

How to debug AccessViolationException coming from native code

南楼画角 提交于 2019-12-10 23:21:54
问题 I'm writing managed code, and I'm using managed bindings (qt4dotnet) for an unmanaged library (Qt). Now and then, I get an AccessViolationException coming somewhere from Qt, but I don't know how to debug that. I don't even get a stacktrace further than the managed/unmanaged boundary (meaning I don't know what part of Qt crashed on me). By the way, I'm running my app inside the VS debugger. How do I debug the exception? 回答1: Project + Properties, Debug tab, tick "Enable unmanaged code

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

不问归期 提交于 2019-12-10 22:57:45
问题 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 FeeCalculation(char *cin, char *cout, char *flimit, char *frate, char *fwindow, char *fincrement, char *fbird, char *fparameter, char *fvalidation, char *fcoupon);

AccessViolation occurs in RichTextBox.ScrollToCaret

柔情痞子 提交于 2019-12-10 20:09:57
问题 A hard to track exception is occuring when non-UI threads try to Append their output to RichTextBox UI control in the Main Thread. This exception occurs at random times, mostly when the threads are calling this method in quick succession. It occurs even in just 2 non-UI threads. Below is the code of AppendLog method. It is in the Main UI's Form class. I spawn 2 threads and pass them this method as Action<string> logDelegate I even have the syncobject in place. public void AppendLog(string