Einstiegspunkt kann nicht gefunden werden bei dll ???



  • hier mein source:

    __declspec (dllexport) int checkSerial(AnsiString serial)
    {
      if(serial == "test")
      {
         ShowMessage("drin");
    
        return 1;
      }
      else
      {
        ShowMessage("fehler");
    
       return 0;
      }
    }
    

    das ganze hab ich nun als dll compiliert und wollte ich in mein installshield reinpacken um das passwort zu prüfen aber install shield jammert immer das er keinen einstiegspunkt der funktion checkSerial finden kann ...

    wisst ihr woran das liegen könnte ???



  • das ganze hab ich nun als dll compiliert

    Ja, und wo bitte ist die DllMain()? Das ist der Einstiegspunkt, der verlangt wird.



  • //---------------------------------------------------------------------------
    
    #include <vcl.h>
    #include <windows.h>
    #pragma hdrstop
    
    #pragma argsused
    int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void* lpReserved)
    {
            return 1;
    }
    //---------------------------------------------------------------------------
    
    __declspec (dllexport) int checkSerial(int serial)
    {
      if(serial == 0123)
      {
         ShowMessage("drin");
    
        return 1;
      }
      else
      {
        ShowMessage("fehler");
    
       return 0;
      }
    }
    


  • wenn ich die datei kompiliere dann bekomme ich immer wie gesagt einstiegspunkt nicht gefunden. eigene dlls will er auchnicht aber die kompilierte von dennen die aus dem unteren source besteht geht. ich weisnicht sieht mir nach visual c++ aus, kann ich sowas denn überhaupt mit dem bcb kompileren ????

    hier mal die datei von install shield:

    // ValidateSN.cpp : Defines the entry point for the DLL application.
    //
    
    #include "stdafx.h"
    #include <tchar.h>
    #include <stdlib.h>
    #include "ValidateSN.h"
    
    BOOL APIENTRY DllMain( HANDLE hModule, 
                           DWORD  ul_reason_for_call, 
                           LPVOID lpReserved
    					 )
    {
        return TRUE;
    }
    
    LONG WINAPI ValidateSN(HWND hwnd, LPSTR szSrcDir, LPSTR szSupport, LPSTR szSerialNum, LPSTR szDbase)
    {
    	//Check for proper length
    	if (_tcslen( szSerialNum ) != SERIALNUMBER_LENGTH)
    	{
    		#ifdef _DEBUG //Display Debug information
    			MessageBox(GetFocus(), szSerialNum, "Length Validation Failed", MB_OK);		
    		#endif
    		return VALDIATION_FAILED;
    	}
    
    	//Copy serial number to temp variable before parsing
    	TCHAR szTemp[255];
    	_tcscpy(szTemp, szSerialNum);
    
    	//Get individual fields of the serial number (tokens separated by '-' chracter)
    	LPSTR szField1 = _tcstok( szTemp, TOKEN_SEPERATOR );
        LPSTR szField2 = _tcstok( NULL, TOKEN_SEPERATOR );
        LPSTR szField3 = _tcstok( NULL, TOKEN_SEPERATOR );
    
    	#ifdef _DEBUG  //Display Debug information
    		CHAR szTmp[1024];
    		wsprintf(szTmp, "szSerialNum=%s. \nField #1=%s \nField #2=%s \nField #3=%s", szSerialNum, szField1, szField2, szField3);
    		MessageBox(GetFocus(), szTmp, "Serial Number Debug Window", MB_OK);
    	#endif 
    
    	//Validate three fields in this example
    	if (ValidateField1(szField1) != VALIDATION_SUCCESS)
    	{
    		#ifdef _DEBUG //Display Debug information
    			MessageBox(GetFocus(), szField1, "Field #1 Validation Failed", MB_OK);		
    		#endif
    
    		return VALDIATION_FAILED;
    	}
    	else if (ValidateField2(szField2) != VALIDATION_SUCCESS)
    	{
    		#ifdef _DEBUG //Display Debug information
    			MessageBox(GetFocus(), szField2, "Field #2 Validation Failed", MB_OK);
    		#endif
    
    	    return VALDIATION_FAILED;
    	}
    	else if (ValidateField3(szField3) != VALIDATION_SUCCESS)
    	{
    		#ifdef _DEBUG //Display Debug information
    			MessageBox(GetFocus(), szField3, "Field #3 Validation Failed", MB_OK);
    		#endif
    
    		return VALDIATION_FAILED;
    	}
    	else
    		return VALIDATION_SUCCESS;
    }
    
    LONG ValidateField1(LPSTR szField1)
    {
    	int rValue;
    //	MessageBox(GetFocus(), SERIALNUM_FIELD1, "Value of Field1", MB_OK);
    	//First field must be the string 'Field1'
    	rValue = _tcsicmp (szField1, SERIALNUM_FIELD1);
    	if(rValue == 0)
    		return 1;
    	else
    		return 0;
    }
    
    LONG ValidateField2(LPSTR szField2)
    {
    
    	long lNumToValidate = atoi (szField2);
    
    	//Second field must be a multiple of 5
    	if ((lNumToValidate % 5) == 0)
    		return VALIDATION_SUCCESS;
    	else 
    		return VALDIATION_FAILED;
    }
    
    LONG ValidateField3(LPSTR szField3)
    {
    	//Don't do anything - accept all values in third field
    	return VALIDATION_SUCCESS;
    
    }
    

Anmelden zum Antworten