CreateThread Exception



  • Hay,

    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
    mit 2 void pointern (Funktions- und Parameterpointer). Diese 2 Werte sollen benutzt werden um mit ihnen einen Thread zu erzeugen (CreateThread). Mein Code:

    //...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->hExecution = CreateThread( NULL,
    										   NULL,
    										   (LPTHREAD_START_ROUTINE) _pTask->pFunction,
    										   _pTask->pParameter,
    										   NULL,
    										   NULL
    										   );
    		}
    		catch(
    			...//char * exeption
    			)
    		{
    			//This->pModulResource->LastError = exept;
    			return TRUE;
    		}
    
    		if( 
               !_pTask->hExecution 
    		     )
            {
    				return TRUE;
    		}
    	}
    	return FALSE;
    }
    
    /********************************************************************************************/
    

    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?



  • gehts, wenn du es nicht in ner dll machst?



  • Ich versuche es gleich einmal aus. danke


Anmelden zum Antworten