PGina



  • Hallo

    Ich entwickle ein plugin für PGina dort gibt es einen pluginLayer damit ich .Net in c++ benutzen kann doch leider wurde dort .Net 1 benutzt wenn ich nun im plugin tester die erstellt dll lade kommt dieser fehler

    R6033
    - Attempt to use MSIL code from this assembly during native code initialization
    This indicate a bug in your application. It is most likely the result of calling an MSIL-compiled(/clr) function from a native constructor or from DllMain

    was bedeutet der fehler oder wie kann ich den umgehen

    wenn ich nun das plugin ein zweites mal lade ohne den plugin tester zu schliessen läuft das plugin wie gewohnt

    meine frage ist ob jemand damit schon erfahrung hatte und es einfach möglich ist pgina mit .net 2.0 zu entwikeln oder ob ich zbp einen neuen pluginLayer entwerfen müsste damit dieses problem nichtmerh auftaucht

    Hier die cpp zu dem pluginLayer genauere und quellcode sind unter http://sourceforge.net/project/showfiles.php?group_id=53525 zu finden

    /*
    pGina C# plugin conversion layer
    Written by Dan Charney on 14 April 2005
    Using lots of code stolen from Nathan Yocom (see copyright notice below)
    and as a result, unfortunately subject to GPL version >= 2
    
    This program has NO WARRANTY, nor is there any implied warranty of 
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GPL for more
    details.
    
    If you need to contact me, instructions for doing so can be found in
        READ THIS BEFORE COMPLAINING.txt
    
    Before you do contact me, actually read the stuff that's in that file.
    */
    
    /*
    pGina Dummy plugin example code - skeleton code for pGina plugin development
    Copyright (C) 2002 Nathan Yocom, Michael Wright
    
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License
    as published by the Free Software Foundation; either version 2
    of the License, or (at your option) any later version.
    
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
    
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
    
    http://pgina.cs.plu.edu
    Email: nate@yocom.org
    Snail Mail:
      Nathan Yocom
      9 Evergreen Farms Rd
      Scarborough, ME 04074
      Phone: 207-450-4948
    */
    // DummyPlugin.cpp : Defines the entry point for the DLL application.
    // Sample plugin for pGina Project - For description of methods see
    // pGina Plugin Specifications Document or visit us at: http://pgina.cs.plu.edu
    
    //#define UNICODE
    #define PLUGIN_LAYER
    #using <pGina.NET.dll>
    #include "pluginLayer.h"
    #include "dotnet.h"
    #include "changeThis.h"
    #include <wchar.h>
    #include <tchar.h>
    
    using namespace DotNetLayer;
    
    BOOL APIENTRY DllMain(HANDLE hModule, DWORD  ul_reason_for_call,
     LPVOID lpReserved){
        switch (ul_reason_for_call) {
    		case DLL_PROCESS_ATTACH:
    		case DLL_THREAD_ATTACH:
    		case DLL_THREAD_DETACH:
    		case DLL_PROCESS_DETACH:
    			break;
        }
        return TRUE;
    }
    
    /* This is the function that pGina calls to find out whether a user is 
       authorized or not it is also the place to put changes in per-user 
       configurations etc. 
    */
    DUMMYPLUGIN_API BOOL UserLogin(LPTSTR Username, LPTSTR Password, 
     pGinaInfo *settingsInfo) {
        MyPlugin __gc * thisPlugin = new MyPlugin(new PGinaPlugin(settingsInfo));
        return thisPlugin->userLogin(toStr(Username), toStr(Password));
    }
    
    DUMMYPLUGIN_API BOOL ChangeUserPassword(LPTSTR Username,LPTSTR OldPassword,
     LPTSTR NewPassword) {
        MyPlugin __gc * thisPlugin = new MyPlugin();
        return thisPlugin->changePassword(toStr(Username), toStr(OldPassword),
         toStr(NewPassword));
    }
    
    DUMMYPLUGIN_API LPCTSTR AboutPlugin(void) {
        MyPlugin __gc * thisPlugin = new MyPlugin();
        return fromStr(thisPlugin->aboutPlugin());
    }
    
    DUMMYPLUGIN_API void ChangePluginSettings(void) {
        MyPlugin __gc * thisPlugin = new MyPlugin();
        thisPlugin->changePluginSettings();
    }
    
    DUMMYPLUGIN_API void LoginHook(pGinaInfo *settingsInfo) {
    	MyPlugin __gc * thisPlugin = new MyPlugin(new PGinaPlugin(settingsInfo));
        thisPlugin->onLogin();
    }
    
    DUMMYPLUGIN_API void LogoutHook(pGinaInfo *settingsInfo) {
        MyPlugin __gc * thisPlugin = new MyPlugin(new PGinaPlugin(settingsInfo));
        thisPlugin->onLogout();
    }
    
    DUMMYPLUGIN_API BOOL IsRequired(void) {
        MyPlugin __gc * thisPlugin = new MyPlugin();
        return thisPlugin->isNecessary();
    }
    


  • Du hast in der DLL in statischen Klassen obder globalen Varibalen .NET DInge verwendet. Das ist nicht erlaubt.



  • Hallo ich hatte jetzt die dllmain mit #pragma unmanaged umschlossen nun funktioniert es und ich bekomme keinerlei fehlermeldungen

    #pragma unmanaged
    BOOL APIENTRY DllMain(HANDLE hModule, DWORD  ul_reason_for_call,
     LPVOID lpReserved){
        switch (ul_reason_for_call) {
    		case DLL_PROCESS_ATTACH:
    		case DLL_THREAD_ATTACH:
    		case DLL_THREAD_DETACH:
    		case DLL_PROCESS_DETACH:
    			break;
        }
        return TRUE;
    }
    #pragma managed
    


  • hatte aber noch die frage ob man das alles so machen sollte, ist das der richtige weg dieses problem zu lösen. Das ziel war ja .net in einer nativen datei zu verwenden

    Gruß Tobi


Anmelden zum Antworten