<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Access Violation NTDLL.DLL]]></title><description><![CDATA[<p>Hallo zusammen.<br />
Ich habe eine DLl in der ein Webcambild eingelesen wird und in Graustufe umgewandelt wird. Beim Aufruf einer Prozedur erhalte ich aber immer den Fehler &quot;Access Violation...&quot;.<br />
Hier der Code aus der Dll sowie der Aufruf aus dem VB-Programm:</p>
<pre><code class="language-cpp">// ImageProcessor.cpp : Definiert den Einsprungpunkt für die DLL-Anwendung.
//

#include &quot;stdafx.h&quot;
#include &quot;VFW.h&quot;

unsigned char *Buffer ;			//Zeiger auf den Pic-Buffer
BITMAPINFO BmpInfo ={0};		//Bitmapinfo				
DWORD ArrWidth;			//Weite des Buffer-Arrays
HDC hBufferDC;							//DC des Buffers
HGDIOBJ hObject;						//GDI-Objekt
HWND m_CamHandle;
HWND DestinateWin;
CAPSTATUS CapStatus;
unsigned char *grayImage;
unsigned char *workingImage;

LRESULT FAR PASCAL _FrameCallbackProc(HWND hWnd, LPVIDEOHDR lpVHdr);

//------------------------------------------------------------------------
// Die folgende Funktion unverändert belassen

BOOL WINAPI DllEntryPoint ( HINSTANCE hDLL, DWORD dwREASON, LPVOID Reserved )
{
	switch (dwREASON)
    { 
		case DLL_PROCESS_ATTACH: {
									break; 
								 }

		case DLL_PROCESS_DETACH: {
									break; 
								 } 		 
    }
	return TRUE;
}

//------------------------------------------------------------------------

void _stdcall OpenCam(HWND LiveWnd,HWND DestWnd)
{
	m_CamHandle = capCreateCaptureWindow(&quot;Capture&quot;,WS_CHILD|WS_VISIBLE,0,0,320,240,LiveWnd,1);
//	::SendMessage(m_CamHandle,WM_CAP_DRIVER_CONNECT,0,0);
//	capGrabFrameNoStop(m_CamHandle);
	capDriverConnect(m_CamHandle, 0);
	::SendMessage(m_CamHandle,WM_CAP_SET_PREVIEWRATE,30,0);
	::SendMessage(m_CamHandle,WM_CAP_SET_OVERLAY,1,0);
	::SendMessage(m_CamHandle,WM_CAP_SET_PREVIEW,1,0);
	DestinateWin = DestWnd;
	capGetStatus(m_CamHandle,&amp;CapStatus,sizeof(CapStatus));
	BmpInfo.bmiHeader.biSize = sizeof(BmpInfo.bmiHeader);
	BmpInfo.bmiHeader.biHeight = CapStatus.uiImageHeight ;
	BmpInfo.bmiHeader.biWidth = CapStatus.uiImageWidth ;
	BmpInfo.bmiHeader.biPlanes = 1;
	BmpInfo.bmiHeader.biBitCount = 24;
	capSetVideoFormat(m_CamHandle, &amp;BmpInfo, sizeof(BITMAPINFO));
}

void _stdcall CloseCam()
{

	::SendMessage(m_CamHandle,WM_CAP_DRIVER_DISCONNECT,0,0);
}

void _stdcall StartCallback()
{
//	BmpInfo = {0};
	grayImage = new unsigned char[3*CapStatus.uiImageHeight * CapStatus.uiImageWidth];
	workingImage = new unsigned char[3*CapStatus.uiImageHeight * CapStatus.uiImageWidth];
	capSetCallbackOnFrame(m_CamHandle,(LPVOID) _FrameCallbackProc);
	capGrabFrameNoStop(m_CamHandle);

}

void _stdcall StopCallback()
{

	capSetCallbackOnFrame(m_CamHandle,NULL);

}

/*
Die Anordnung der Farben ist nicht RGB sondern BGR
Das Bild müsste von unten links nach oben rechts im Speicher liegen
*/

LRESULT FAR PASCAL _FrameCallbackProc(HWND hWnd, LPVIDEOHDR lpVHdr) {

	LARGE_INTEGER lStart, lEnd, lFreq;
	QueryPerformanceFrequency(&amp;lFreq);
	QueryPerformanceCounter(&amp;lStart);

	char buffer[20];
	unsigned long y;
	long gray;
	unsigned char* capPointer =(unsigned char*)(lpVHdr-&gt;lpData);
	HDC DestDC = ::GetDC(DestinateWin);
	ArrWidth = lpVHdr-&gt;dwBufferLength ;

		for(y=0;y&lt;=lpVHdr-&gt;dwBufferLength;(y+=3))
		{
			gray = ((capPointer[y] * 30) + (capPointer[y+1] *60) + (capPointer[y+2] *10))/100;
/*		if(gray &gt;= 100)
		{
		grayImage[y] = 255;
		grayImage[y+1] = 255;
		grayImage[y+2] = 255;
		}
		else
		{
		grayImage[y] = 0;
		grayImage[y+1] = 0;
		grayImage[y+2] = 0;
		}
		*/
		grayImage[y] = capPointer[y];
		grayImage[y+1] = capPointer[y+1];
		grayImage[y+2] = capPointer[y+2];
		}
//	::SetDIBitsToDevice(DestDC,0,0,CapStatus.uiImageWidth ,CapStatus.uiImageHeight ,0,0,0,CapStatus.uiImageHeight ,grayImage,&amp;BmpInfo,DIB_RGB_COLORS);	//Bits in der Picturebox setzen
//	::ReleaseDC(DestinateWin,DestDC);

	QueryPerformanceCounter(&amp;lEnd);
	int ms=((lEnd.QuadPart - lStart.QuadPart) * 1000) / lFreq.QuadPart ;
	itoa(ms,buffer,10);
	return 1;

} 

void _stdcall GrabImage_and_Grayscale()
{
	unsigned long y;
	long gray;
	HDC DestDC = ::GetDC(DestinateWin);
	for(y=0;y&lt;=ArrWidth;(y+=3))
		{
			gray = ((grayImage[y] * 30) + (grayImage[y+1] *60) + (grayImage[y+2] *10))/100;
			workingImage[y] = gray;
			workingImage[y+1] = gray;
			workingImage[y+2] = gray;
		}
	::SetDIBitsToDevice(DestDC,0,0,CapStatus.uiImageWidth ,CapStatus.uiImageHeight ,0,0,0,CapStatus.uiImageHeight ,workingImage,&amp;BmpInfo,DIB_RGB_COLORS);	//Bits in der Picturebox setzen
	::ReleaseDC(DestinateWin,DestDC);
}

void _stdcall GrabImageGray_and_Histogram(long H[])
{
	int x;
	unsigned long y;
	long gray;
	long Ht[256] = {0};
	HDC DestDC = ::GetDC(DestinateWin);
	for(y=0;y&lt;=ArrWidth;(y+=3))
		{
			gray = ((grayImage[y] * 30) + (grayImage[y+1] *60) + (grayImage[y+2] *10))/100;
			Ht[gray]++;
			workingImage[y] = gray;
			workingImage[y+1] = gray;
			workingImage[y+2] = gray;
		}

	::SetDIBitsToDevice(DestDC,0,0,CapStatus.uiImageWidth ,CapStatus.uiImageHeight ,0,0,0,CapStatus.uiImageHeight ,workingImage,&amp;BmpInfo,DIB_RGB_COLORS);	//Bits in der Picturebox setzen
	::ReleaseDC(DestinateWin,DestDC);
	for(x=0;x&lt;=255;x++)
	{
		H[x] = Ht[x];
	}
}
</code></pre>
<p>Der Aufruf:</p>
<pre><code>Private Sub Command6_Click()
Dim H(0 To 255) As Long
Dim x As Integer
For x = 0 To 255
    H(x) = 0
Next x
GrabImageGray_and_Histogram (H(0))
End Sub
</code></pre>
<p>Kann mir da jemand weiterhelfen?</p>
<p>Ronnie</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/196733/access-violation-ntdll-dll</link><generator>RSS for Node</generator><lastBuildDate>Wed, 08 Apr 2026 16:08:44 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/196733.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 02 Nov 2007 12:27:41 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Access Violation NTDLL.DLL on Fri, 02 Nov 2007 12:27:41 GMT]]></title><description><![CDATA[<p>Hallo zusammen.<br />
Ich habe eine DLl in der ein Webcambild eingelesen wird und in Graustufe umgewandelt wird. Beim Aufruf einer Prozedur erhalte ich aber immer den Fehler &quot;Access Violation...&quot;.<br />
Hier der Code aus der Dll sowie der Aufruf aus dem VB-Programm:</p>
<pre><code class="language-cpp">// ImageProcessor.cpp : Definiert den Einsprungpunkt für die DLL-Anwendung.
//

#include &quot;stdafx.h&quot;
#include &quot;VFW.h&quot;

unsigned char *Buffer ;			//Zeiger auf den Pic-Buffer
BITMAPINFO BmpInfo ={0};		//Bitmapinfo				
DWORD ArrWidth;			//Weite des Buffer-Arrays
HDC hBufferDC;							//DC des Buffers
HGDIOBJ hObject;						//GDI-Objekt
HWND m_CamHandle;
HWND DestinateWin;
CAPSTATUS CapStatus;
unsigned char *grayImage;
unsigned char *workingImage;

LRESULT FAR PASCAL _FrameCallbackProc(HWND hWnd, LPVIDEOHDR lpVHdr);

//------------------------------------------------------------------------
// Die folgende Funktion unverändert belassen

BOOL WINAPI DllEntryPoint ( HINSTANCE hDLL, DWORD dwREASON, LPVOID Reserved )
{
	switch (dwREASON)
    { 
		case DLL_PROCESS_ATTACH: {
									break; 
								 }

		case DLL_PROCESS_DETACH: {
									break; 
								 } 		 
    }
	return TRUE;
}

//------------------------------------------------------------------------

void _stdcall OpenCam(HWND LiveWnd,HWND DestWnd)
{
	m_CamHandle = capCreateCaptureWindow(&quot;Capture&quot;,WS_CHILD|WS_VISIBLE,0,0,320,240,LiveWnd,1);
//	::SendMessage(m_CamHandle,WM_CAP_DRIVER_CONNECT,0,0);
//	capGrabFrameNoStop(m_CamHandle);
	capDriverConnect(m_CamHandle, 0);
	::SendMessage(m_CamHandle,WM_CAP_SET_PREVIEWRATE,30,0);
	::SendMessage(m_CamHandle,WM_CAP_SET_OVERLAY,1,0);
	::SendMessage(m_CamHandle,WM_CAP_SET_PREVIEW,1,0);
	DestinateWin = DestWnd;
	capGetStatus(m_CamHandle,&amp;CapStatus,sizeof(CapStatus));
	BmpInfo.bmiHeader.biSize = sizeof(BmpInfo.bmiHeader);
	BmpInfo.bmiHeader.biHeight = CapStatus.uiImageHeight ;
	BmpInfo.bmiHeader.biWidth = CapStatus.uiImageWidth ;
	BmpInfo.bmiHeader.biPlanes = 1;
	BmpInfo.bmiHeader.biBitCount = 24;
	capSetVideoFormat(m_CamHandle, &amp;BmpInfo, sizeof(BITMAPINFO));
}

void _stdcall CloseCam()
{

	::SendMessage(m_CamHandle,WM_CAP_DRIVER_DISCONNECT,0,0);
}

void _stdcall StartCallback()
{
//	BmpInfo = {0};
	grayImage = new unsigned char[3*CapStatus.uiImageHeight * CapStatus.uiImageWidth];
	workingImage = new unsigned char[3*CapStatus.uiImageHeight * CapStatus.uiImageWidth];
	capSetCallbackOnFrame(m_CamHandle,(LPVOID) _FrameCallbackProc);
	capGrabFrameNoStop(m_CamHandle);

}

void _stdcall StopCallback()
{

	capSetCallbackOnFrame(m_CamHandle,NULL);

}

/*
Die Anordnung der Farben ist nicht RGB sondern BGR
Das Bild müsste von unten links nach oben rechts im Speicher liegen
*/

LRESULT FAR PASCAL _FrameCallbackProc(HWND hWnd, LPVIDEOHDR lpVHdr) {

	LARGE_INTEGER lStart, lEnd, lFreq;
	QueryPerformanceFrequency(&amp;lFreq);
	QueryPerformanceCounter(&amp;lStart);

	char buffer[20];
	unsigned long y;
	long gray;
	unsigned char* capPointer =(unsigned char*)(lpVHdr-&gt;lpData);
	HDC DestDC = ::GetDC(DestinateWin);
	ArrWidth = lpVHdr-&gt;dwBufferLength ;

		for(y=0;y&lt;=lpVHdr-&gt;dwBufferLength;(y+=3))
		{
			gray = ((capPointer[y] * 30) + (capPointer[y+1] *60) + (capPointer[y+2] *10))/100;
/*		if(gray &gt;= 100)
		{
		grayImage[y] = 255;
		grayImage[y+1] = 255;
		grayImage[y+2] = 255;
		}
		else
		{
		grayImage[y] = 0;
		grayImage[y+1] = 0;
		grayImage[y+2] = 0;
		}
		*/
		grayImage[y] = capPointer[y];
		grayImage[y+1] = capPointer[y+1];
		grayImage[y+2] = capPointer[y+2];
		}
//	::SetDIBitsToDevice(DestDC,0,0,CapStatus.uiImageWidth ,CapStatus.uiImageHeight ,0,0,0,CapStatus.uiImageHeight ,grayImage,&amp;BmpInfo,DIB_RGB_COLORS);	//Bits in der Picturebox setzen
//	::ReleaseDC(DestinateWin,DestDC);

	QueryPerformanceCounter(&amp;lEnd);
	int ms=((lEnd.QuadPart - lStart.QuadPart) * 1000) / lFreq.QuadPart ;
	itoa(ms,buffer,10);
	return 1;

} 

void _stdcall GrabImage_and_Grayscale()
{
	unsigned long y;
	long gray;
	HDC DestDC = ::GetDC(DestinateWin);
	for(y=0;y&lt;=ArrWidth;(y+=3))
		{
			gray = ((grayImage[y] * 30) + (grayImage[y+1] *60) + (grayImage[y+2] *10))/100;
			workingImage[y] = gray;
			workingImage[y+1] = gray;
			workingImage[y+2] = gray;
		}
	::SetDIBitsToDevice(DestDC,0,0,CapStatus.uiImageWidth ,CapStatus.uiImageHeight ,0,0,0,CapStatus.uiImageHeight ,workingImage,&amp;BmpInfo,DIB_RGB_COLORS);	//Bits in der Picturebox setzen
	::ReleaseDC(DestinateWin,DestDC);
}

void _stdcall GrabImageGray_and_Histogram(long H[])
{
	int x;
	unsigned long y;
	long gray;
	long Ht[256] = {0};
	HDC DestDC = ::GetDC(DestinateWin);
	for(y=0;y&lt;=ArrWidth;(y+=3))
		{
			gray = ((grayImage[y] * 30) + (grayImage[y+1] *60) + (grayImage[y+2] *10))/100;
			Ht[gray]++;
			workingImage[y] = gray;
			workingImage[y+1] = gray;
			workingImage[y+2] = gray;
		}

	::SetDIBitsToDevice(DestDC,0,0,CapStatus.uiImageWidth ,CapStatus.uiImageHeight ,0,0,0,CapStatus.uiImageHeight ,workingImage,&amp;BmpInfo,DIB_RGB_COLORS);	//Bits in der Picturebox setzen
	::ReleaseDC(DestinateWin,DestDC);
	for(x=0;x&lt;=255;x++)
	{
		H[x] = Ht[x];
	}
}
</code></pre>
<p>Der Aufruf:</p>
<pre><code>Private Sub Command6_Click()
Dim H(0 To 255) As Long
Dim x As Integer
For x = 0 To 255
    H(x) = 0
Next x
GrabImageGray_and_Histogram (H(0))
End Sub
</code></pre>
<p>Kann mir da jemand weiterhelfen?</p>
<p>Ronnie</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1396377</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1396377</guid><dc:creator><![CDATA[ronnie.b]]></dc:creator><pubDate>Fri, 02 Nov 2007 12:27:41 GMT</pubDate></item><item><title><![CDATA[Reply to Access Violation NTDLL.DLL on Fri, 02 Nov 2007 15:11:46 GMT]]></title><description><![CDATA[<p>Callstack zeigt was?<br />
Lass es crahsen und attache den Debugger, wenn es nicht schon im Debugger läuft. Dan schu Dir an welcher Array vermutlich zu klein ist.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1396460</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1396460</guid><dc:creator><![CDATA[Martin Richter]]></dc:creator><pubDate>Fri, 02 Nov 2007 15:11:46 GMT</pubDate></item><item><title><![CDATA[Reply to Access Violation NTDLL.DLL on Thu, 08 Nov 2007 11:28:18 GMT]]></title><description><![CDATA[<p>Hallo.<br />
Also, die Array sind nicht zu klein.<br />
Das komische ist, dass der Fehler auftaucht wenn die Prozedur beendet wird und auch nur wenn die Webcam angeschlossen ist.</p>
<p>Ronnie</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1399664</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1399664</guid><dc:creator><![CDATA[Ronnie]]></dc:creator><pubDate>Thu, 08 Nov 2007 11:28:18 GMT</pubDate></item><item><title><![CDATA[Reply to Access Violation NTDLL.DLL on Fri, 09 Nov 2007 05:50:20 GMT]]></title><description><![CDATA[<p>Hallo.<br />
Also, ich hab mich geirrt. Es crasht jetzt auch ohne Webcam.<br />
Hab hier mal einen Auszug von der Aufrufliste und dem Debug-Fenster:</p>
<p>letzte 10 Einträge in Aufrufliste zum Zeitpunkt des Crash:<br />
NTDLL! 7c91eddc() push ebx<br />
NTDLL! 7c9479d6() test byte ptr [eax+5Fh],4<br />
NTDLL! 7c94799c() cmp dword ptr [ebp-4],0<br />
NTDLL! 7c9478c5() xor ebx,ebx<br />
NTDLL! 7c94783a() test al,al<br />
NTDLL! 7c91eafa() or al,al<br />
NTDLL! 7c91378b() pop edi<br />
NTDLL! 7c91eafa() or al,al<br />
NTDLL! 7c91378b() pop edi<br />
NTDLL! 7c91eafa() or al,al</p>
<p>Debug-Fenster:<br />
Nicht abgefangene Ausnahme in Projekt1.exe (MSVBVM60.DLL): 0xC0000005: Access Violation.<br />
Nicht abgefangene Ausnahme in Projekt1.exe: 0xC0000005: Access Violation.<br />
Nicht abgefangene Ausnahme in Projekt1.exe: 0xC0000005: Access Violation.<br />
Nicht abgefangene Ausnahme in Projekt1.exe: 0xC0000005: Access Violation.<br />
Nicht abgefangene Ausnahme in Projekt1.exe: 0xC0000005: Access Violation.<br />
.<br />
.wiederholt sich mehrere 100 mal<br />
.<br />
Nicht abgefangene Ausnahme in Projekt1.exe (NTDLL.DLL): 0xC0000005: Access Violation.</p>
<p>Vielleicht kann ja jemand was damit anfangen.</p>
<p>ronnie</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1400103</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1400103</guid><dc:creator><![CDATA[ronnie.b]]></dc:creator><pubDate>Fri, 09 Nov 2007 05:50:20 GMT</pubDate></item><item><title><![CDATA[Reply to Access Violation NTDLL.DLL on Wed, 14 Nov 2007 16:17:58 GMT]]></title><description><![CDATA[<p>Hallo zusammen,<br />
kann mir denn da wirklich niemand helfen??</p>
<p>Ronnie</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1403194</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1403194</guid><dc:creator><![CDATA[ronnie.b]]></dc:creator><pubDate>Wed, 14 Nov 2007 16:17:58 GMT</pubDate></item></channel></rss>