DaemonAPI.cpp
资源名称:warftpd.zip [点击查看]
上传用户:surprise9
上传日期:2007-01-04
资源大小:426k
文件大小:2k
源码类别:
Ftp客户端
开发平台:
Visual C++
- // This is part of the WAR SOFTWARE SERIES initiated by Jarle Aase
- // Copyright 1996 by Jarle Aase. All rights reserved.
- // See the "War Software Series License Agreement" for details concerning
- // use and distribution.
- // ---
- // This source code, executables and programs containing source code or
- // binaries or proprietetary technology from the War Software Series are
- // NOT alloed used, viewed or tested by any governmental agencies in
- // any countries. This includes the government, departments, police,
- // military etc.
- // ---
- // This file is intended for use with Tab space = 2
- // Created and maintained in MSVC Developer Studio
- // ---
- // NAME : DaemonAPI.cpp
- // PURPOSE : Daemon extention dll base class
- // PROGRAM :
- // DATE : Febr 16 1997
- // AUTHOR : Jarle Aase
- // ---
- // REVISION HISTORY
- //
- #include "stdafx.h"
- #include "WarDaemon.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- int CDaemonAPI::m_ModuleCnt = 1000; // Start on 1000
- CDaemonAPI::CDaemonAPI()
- {
- m_ModuleNum = 0;
- CAPIHandler::m_pCurrentLoadingModule = this;
- }
- CDaemonAPI::~CDaemonAPI()
- {
- ASSERT(CAPIHandler::GetPtr() != NULL);
- if (CAPIHandler::GetPtr())
- CAPIHandler::GetPtr()->Unload(this);
- }
- void CDaemonAPI::InitializeCOptions()
- {
- ;
- }
- int CDaemonAPI::ApiInitInstance(int Event, WPARAM wParam, LPARAM lParam)
- {
- return 0;
- }
- int CDaemonAPI::ApiExitInstance(int Event, WPARAM wParam, LPARAM lParam)
- {
- if (m_ModuleNum)
- SaveAll();
- return 0;
- }
- // Create and register the service
- // Return 0 on success
- int CDaemonAPI::Register(LPCSTR Name)
- {
- ASSERT(AfxIsValidString(Name));
- if (FindOptionGroup(Name))
- return WDAPIE_NAME_EXIST;
- // Initialize global variables
- m_pLog = CDaemonBase::GetSvr()->m_Log;
- m_pBase = CDaemonBase::GetSvr();
- InitializeCOptions();
- CAPIHandler::m_CurrentLoadingModuleNum = m_ModuleCnt;
- Create(NULL, NULL, Name, m_ModuleNum = m_ModuleCnt++);
- LoadAll();
- return 0;
- }
- CDaemonAPI *CDaemonAPI::GetPtr()
- {
- ASSERT(FALSE); // Must be overloaded
- return NULL;
- }
- CDllInfo *CDaemonAPI::GetDLLInfo()
- {
- CLinkedListItem *Item;
- ASSERT(CAPIHandler::GetPtr() != NULL);
- CLinkedList *pList = &CAPIHandler::GetPtr()->m_Plugins;
- for(Item = pList->First(); Item; Item = pList->Next(Item))
- {
- CDllInfo *pDLL = (CDllInfo *)pList->Ptr(Item);
- if (pDLL->m_pAPI == this)
- return pDLL;
- }
- return NULL;
- }