#include "winplus.h"
#pragma hdrstop
#include "..\cppdecl\plugcommon.hpp"

class StubPlugin : public IPlugIn
{
  virtual char* __stdcall MenuName();
  virtual Boolean __stdcall CanDo();
  virtual void __stdcall PluginMain();
} Stub;

char* __stdcall StubPlugin::MenuName()
{
  return "О библитеке поддержки ...";
}

Boolean __stdcall StubPlugin::CanDo()
{
  return 1;
}

void __stdcall StubPlugin::PluginMain()
{
  CInfoReport msg;
  msg.Report("Оберточная библиотека 'WinPlus' версия 3.0.\n"
    "Copyleft (L) Смирнов В.А.");
}

int __declspec(dllexport) __stdcall PlugInsEnumerate(TEnumPlugInsProc EnumProc)
{
  EnumProc(&Stub);
  return 1;
}

int RefCount = 0;

// Точка входа
int WINAPI DllMain(HINSTANCE hinst, unsigned long reason, void*)
{
  switch(reason)
  {
//  case DLL_THREAD_ATTACH:
//  case DLL_THREAD_DETACH:
  case DLL_PROCESS_ATTACH:
    RefCount++;
    if(RefCount>1)
    {
      CWarnReport msg;
      msg.Report("WinPlus: RefCount=%d > 1. WARNING: this ver isn't multithreaded !",RefCount);
    }
    break;
  case DLL_PROCESS_DETACH:
    RefCount--;
    break;
  }
  return 1;
}
