Announcement

Collapse
No announcement yet.

need a sample dll for generic plugin

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • need a sample dll for generic plugin

    Hi, Im new to dll's and winamp plugins.

    I was wondering if anyone has a sample gen_plugin dll which is completely empty and doesnt do anything, just has all the necessary methods needed for winamp to register it?

    Im using VS.NET, but shouldnt make a difference.

    This is the main hurdle Im facing. I know how to do the rest once I have the bare bones dll to work with

    Cheers.

  • #2
    I'd like to get my hands on one of those also..I'm using a wrapper which isnt very efficient, but it works

    Comment


    • #3
      This can be compiled with vc++ 6.0

      Put the code in two files: gen_empty.h and gen_empty.c (not *.cpp)

      //-----------------------
      //gen_empty.h
      //-----------------------
      #ifndef gen_empty_h
      #define gen_empty_h

      typedef struct {
      int version;
      char *description;
      int (*init)();
      void (*config)();
      void (*quit)();
      HWND hwndParent;
      HINSTANCE hDllInstance;
      } winampGeneralPurposePlugin;

      #define GPPHDR_VER 0x10

      extern winampGeneralPurposePlugin *gen_plugins[256];
      typedef winampGeneralPurposePlugin * (*winampGeneralPurposePluginGetter)();

      #endif //gen_empty_h

      //-----------------------
      //gen_empty.c
      //-----------------------
      #include <windows.h>
      #include "gen_empty.h"

      int init(void);
      void config(void);
      void quit(void);
      winampGeneralPurposePlugin plugin = {
      GPPHDR_VER, //
      "Empty (gen_empty.dll)",// Description
      init, // Initialization function
      config, // Configuration function
      quit // Deinitialization function
      };

      int init()
      {
      MessageBox(plugin.hwndParent,"init","",MB_OK);
      return 0;
      }

      void config()
      {
      MessageBox(plugin.hwndParent,"config","",MB_OK);
      }

      void quit()
      {
      MessageBox(plugin.hwndParent,"quit","",MB_OK);
      }

      __declspec( dllexport ) winampGeneralPurposePlugin * winampGetGeneralPurposePlugin()
      {
      return &plugin;
      }

      //-----------------
      Bananskib

      Comment


      • #4
        Ah.. could you convert this to C++?

        Comment


        • #5
          Originally posted by baafie
          Ah.. could you convert this to C++?
          OMG
          What do you think this was written in???
          http://www.blorp.com/~thor

          Comment


          • #6
            My first post was written in C, not C++.

            I use VC++ 6.0 - and I'm NOT AN EXPERT IN C++

            I zipped the project as well :-)

            I didn't find out myself - most of it has been posted before.

            1. Make a new project : MFC AppWizard DLL, name it gen_test4 if you want to copy paste the code below.
            2. Add the 2 header files to the project (frontend.h, gen.h) (gen.h is listed below - frontend.h: http://www.winamp.com/nsdn/winamp2x/dev/sdk/FRONTEND.H)


            -- gen.h - start ---
            typedef struct {
            int version;
            char *description;
            int (*init)();
            void (*config)();
            void (*quit)();
            HWND hwndParent;
            HINSTANCE hDllInstance;
            } winampGeneralPurposePlugin;

            #define GPPHDR_VER 0x10

            extern winampGeneralPurposePlugin *gen_plugins[256];
            typedef winampGeneralPurposePlugin * (*winampGeneralPurposePluginGetter)();
            -- gen.h - end ---

            [][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]

            -- gen_test4.h - start --
            #if !defined(AFX_GEN_TEST4_H__E840A61D_E8A1_49BB_8977_31A218301C01__INCLUDED_)
            #define AFX_GEN_TEST4_H__E840A61D_E8A1_49BB_8977_31A218301C01__INCLUDED_

            #if _MSC_VER > 1000
            #pragma once
            #endif // _MSC_VER > 1000

            #ifndef __AFXWIN_H__
            #error include 'stdafx.h' before including this file for PCH
            #endif

            #include "resource.h" // main symbols

            /////////////////////////////////////////////////////////////////////////////
            // CGen_test4App
            // See gen_test4.cpp for the implementation of this class
            //

            class CGen_test4App : public CWinApp
            {
            public:
            CGen_test4App();

            int winampInit(void);
            void winampConfig(void);
            void winampQuit(void);

            // Overrides
            // ClassWizard generated virtual function overrides
            //{{AFX_VIRTUAL(CGen_test4App)
            //}}AFX_VIRTUAL

            //{{AFX_MSG(CGen_test4App)
            // NOTE - the ClassWizard will add and remove member functions here.
            // DO NOT EDIT what you see in these blocks of generated code !
            //}}AFX_MSG
            DECLARE_MESSAGE_MAP()
            };


            /////////////////////////////////////////////////////////////////////////////

            //{{AFX_INSERT_LOCATION}}
            // Microsoft Visual C++ will insert additional declarations immediately before the previous line.

            #endif
            // !defined
            //(AFX_GEN_TEST4_H__E840A61D_E8A1_49BB_8977_31A218301C01__INCLUDED_)

            -- gen_test4.h - end --

            [][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]

            -- gen_test4.cpp - start --

            // gen_test4.cpp : Defines the initialization routines for the DLL.
            //

            #include "stdafx.h"
            #include "gen.h"
            #include "gen_test4.h"

            #ifdef _DEBUG
            #define new DEBUG_NEW
            #undef THIS_FILE
            static char THIS_FILE[] = __FILE__;
            #endif



            /////////////////////////////////////////////////////////////////////////////
            // CGen_test4App

            BEGIN_MESSAGE_MAP(CGen_test4App, CWinApp)
            //{{AFX_MSG_MAP(CGen_test4App)
            // NOTE - the ClassWizard will add and remove mapping macros here.
            // DO NOT EDIT what you see in these blocks of generated code!
            //}}AFX_MSG_MAP
            END_MESSAGE_MAP()

            /////////////////////////////////////////////////////////////////////////////
            // CGen_test4App construction

            CGen_test4App::CGen_test4App()
            {

            }

            int CGen_test4App::winampInit(void)
            {
            AfxMessageBox("winampInit()");
            return 0;
            }


            /////////////////////////////////////////////////////////////////////////////
            // Winapp methods
            /////////////////////////////////////////////////////////////////////////////
            void CGen_test4App::winampConfig(void)
            {
            AfxMessageBox("winampConfog()");
            }

            void CGen_test4App::winampQuit(void)
            {
            AfxMessageBox("winampQuit()");
            }

            /////////////////////////////////////////////////////////////////////////////

            /////////////////////////////////////////////////////////////////////////////
            // The one and only CGen_test4App object

            CGen_test4App theApp;

            ////////////////////
            // Winamp Stuff
            int init(void) { AFX_MANAGE_STATE(AfxGetStaticModuleState()); return theApp.winampInit(); }
            void config(void) { AFX_MANAGE_STATE(AfxGetStaticModuleState()); theApp.winampConfig(); }
            void quit(void) { AFX_MANAGE_STATE(AfxGetStaticModuleState()); theApp.winampQuit(); };
            winampGeneralPurposePlugin plugin = {
            GPPHDR_VER, //
            "gen_test4 (gen_test4.dll)", // Description
            init, // Initialization function
            config, // Configuration function
            quit // Deinitialization function
            };
            extern "C" {
            __declspec(dllexport) winampGeneralPurposePlugin *winampGetGeneralPurposePlugin(void)
            {
            AFX_MANAGE_STATE(AfxGetStaticModuleState());
            return &plugin;
            }
            }
            // End Winamp Stuff
            ///////////////////

            -- gen_test4.cpp - start --


            have fun,
            Bananskib

            Comment


            • #7
              and the project zipped !

              forgot it :-)

              bananskib
              Attached Files

              Comment


              • #8
                Originally posted by Thor
                OMG
                What do you think this was written in???
                N00b.

                Comment


                • #9
                  Originally posted by bananskib
                  My first post was written in C, not C++.
                  ..Lots o' code
                  have fun,
                  Bananskib
                  Yes I have seen this before.. excellent work. it is not what I meant though. I was looking for a plugin written in C++ in the Win32 API, not MFC.

                  Comment


                  • #10
                    C code should compile fine in CPP after adding a few typecast fixes and extern "C" on _declspec(dllexport) function.

                    Comment


                    • #11
                      also like an example Win32 project

                      I've managed to build a general plug in using the MFC example gen_test4 but i'd also rather build one from a stripped down Win32 dll project as well.

                      i've downloaded the SDK, if anyone has a Win32 project which compiles using that SDK and could zip it up and put it on this thread, it'd be very cool.

                      remember - VB sucks.

                      Comment


                      • #12
                        anyone got a template in VB (other than genwrapper, ick) for a plugin? I know it wont be by any means short enough to paste in here, but I would love to be able to turn all these programs I have into plugins.

                        Comment


                        • #13
                          For all of you who are as dumb as myself, here it is then

                          gen.h
                          code:

                          typedef struct {
                          int version;
                          char *description;
                          int (*init)();
                          void (*config)();
                          void (*quit)();
                          HWND hwndParent;
                          HINSTANCE hDllInstance;
                          } winampGeneralPurposePlugin;

                          #define GPPHDR_VER 0x10

                          extern "C" winampGeneralPurposePlugin *gen_plugins[256];
                          typedef winampGeneralPurposePlugin * (*winampGeneralPurposePluginGetter)();

                          main.cpp
                          code:

                          #include <windows.h>
                          #include "gen.h"

                          #define PLUGINNAME "Empty plug-in v0.1"

                          BOOL APIENTRY _DllMainCRTStartup(HANDLE hMod, DWORD r, void *empty)
                          {
                          return 1;
                          }

                          extern "C" winampGeneralPurposePlugin plugin;

                          int init() {return 0;}
                          void config() {}
                          void quit() {}

                          winampGeneralPurposePlugin plugin = {
                          GPPHDR_VER,
                          PLUGINNAME,
                          init,
                          config,
                          quit,
                          0
                          };

                          extern "C" __declspec( dllexport ) winampGeneralPurposePlugin * winampGetGeneralPurposePlugin()
                          {
                          return &plugin;
                          }

                          Comment


                          • #14
                            I don't get your point, what you're writing is still C code.

                            Aus -- NoisePort.Org, chronicles of the french canadian alien (Temporarly down during the move).

                            Comment


                            • #15
                              Yes, but this way I can use C++ in my application, which is great for me because I suck at C.

                              Comment

                              Working...
                              X
                              😀
                              🥰
                              🤢
                              😎
                              😡
                              👍
                              👎