<?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[CreateThread Exception]]></title><description><![CDATA[<p>Hay,</p>
<p>Schreibe gerade an einem Modul in Form einer DLL. Bin dabei aber leider auf einen Fehler gestoßen. Folgendes passiert : Ich lade die DLL, ich initialisiere eine Instanz der beinhalteten Klasse und reiche einer Memberfunktion eine Datenstruktur<br />
mit 2 void pointern (Funktions- und Parameterpointer). Diese 2 Werte sollen benutzt werden um mit ihnen einen Thread zu erzeugen (CreateThread). Mein Code:</p>
<pre><code class="language-cpp">//...layout.h

typedef DWORD (*PFUNC) (PVOID);

typedef struct Task{

	PFUNC                                    pFunction;
	PVOID                                    pParameter;

	HANDLE                                   *Event;
	HANDLE                                   hExecution;
}TASK, *PTASK;

//...ck_class.cpp

/********************************************************************************************/

/* Achieve the execution of a task 
   -Creating a thread with the given resource,
    while checking the resource, determing if it
	is valid or not. Output by this process, such
	as threadhandle, threadID will be handles by
	the application itself and not by the module. */
DWORD
ck_class::AchieveTask( LPVOID _pClass, PTASK _pTask ){

	DWORD                    Status                        = NULL;
	CMODULE::PCKCLASS        This                          = (CMODULE::PCKCLASS) _pClass;

	Status = NULL;
	if( 
		!Status 
		)
	{

		try{
		_pTask-&gt;hExecution = CreateThread( NULL,
										   NULL,
										   (LPTHREAD_START_ROUTINE) _pTask-&gt;pFunction,
										   _pTask-&gt;pParameter,
										   NULL,
										   NULL
										   );
		}
		catch(
			...//char * exeption
			)
		{
			//This-&gt;pModulResource-&gt;LastError = exept;
			return TRUE;
		}

		if( 
           !_pTask-&gt;hExecution 
		     )
        {
				return TRUE;
		}
	}
	return FALSE;
}

/********************************************************************************************/
</code></pre>
<p>Liegt es daran das die DLL vielleicht in ein anderes Segment gemapped wird und die VA's dadurch ungültig werden? Ausserdem wird die Ausnahme die bei dem Call auftritt nich Abgefangen. Wie kommts?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/267095/createthread-exception</link><generator>RSS for Node</generator><lastBuildDate>Wed, 02 Sep 2026 16:03:23 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/267095.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 19 May 2010 00:41:44 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to CreateThread Exception on Wed, 19 May 2010 00:41:44 GMT]]></title><description><![CDATA[<p>Hay,</p>
<p>Schreibe gerade an einem Modul in Form einer DLL. Bin dabei aber leider auf einen Fehler gestoßen. Folgendes passiert : Ich lade die DLL, ich initialisiere eine Instanz der beinhalteten Klasse und reiche einer Memberfunktion eine Datenstruktur<br />
mit 2 void pointern (Funktions- und Parameterpointer). Diese 2 Werte sollen benutzt werden um mit ihnen einen Thread zu erzeugen (CreateThread). Mein Code:</p>
<pre><code class="language-cpp">//...layout.h

typedef DWORD (*PFUNC) (PVOID);

typedef struct Task{

	PFUNC                                    pFunction;
	PVOID                                    pParameter;

	HANDLE                                   *Event;
	HANDLE                                   hExecution;
}TASK, *PTASK;

//...ck_class.cpp

/********************************************************************************************/

/* Achieve the execution of a task 
   -Creating a thread with the given resource,
    while checking the resource, determing if it
	is valid or not. Output by this process, such
	as threadhandle, threadID will be handles by
	the application itself and not by the module. */
DWORD
ck_class::AchieveTask( LPVOID _pClass, PTASK _pTask ){

	DWORD                    Status                        = NULL;
	CMODULE::PCKCLASS        This                          = (CMODULE::PCKCLASS) _pClass;

	Status = NULL;
	if( 
		!Status 
		)
	{

		try{
		_pTask-&gt;hExecution = CreateThread( NULL,
										   NULL,
										   (LPTHREAD_START_ROUTINE) _pTask-&gt;pFunction,
										   _pTask-&gt;pParameter,
										   NULL,
										   NULL
										   );
		}
		catch(
			...//char * exeption
			)
		{
			//This-&gt;pModulResource-&gt;LastError = exept;
			return TRUE;
		}

		if( 
           !_pTask-&gt;hExecution 
		     )
        {
				return TRUE;
		}
	}
	return FALSE;
}

/********************************************************************************************/
</code></pre>
<p>Liegt es daran das die DLL vielleicht in ein anderes Segment gemapped wird und die VA's dadurch ungültig werden? Ausserdem wird die Ausnahme die bei dem Call auftritt nich Abgefangen. Wie kommts?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1899322</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1899322</guid><dc:creator><![CDATA[e_lfanew]]></dc:creator><pubDate>Wed, 19 May 2010 00:41:44 GMT</pubDate></item><item><title><![CDATA[Reply to CreateThread Exception on Wed, 19 May 2010 02:42:34 GMT]]></title><description><![CDATA[<p>gehts, wenn du es nicht in ner dll machst?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1899325</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1899325</guid><dc:creator><![CDATA[fdgsg]]></dc:creator><pubDate>Wed, 19 May 2010 02:42:34 GMT</pubDate></item><item><title><![CDATA[Reply to CreateThread Exception on Wed, 19 May 2010 03:11:57 GMT]]></title><description><![CDATA[<p>Ich versuche es gleich einmal aus. danke</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1899328</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1899328</guid><dc:creator><![CDATA[e_lfanew]]></dc:creator><pubDate>Wed, 19 May 2010 03:11:57 GMT</pubDate></item></channel></rss>