📄 pfwinmodule.cpp
字号:
/////////////////////////////////////////////////////////////////////////////////////////////////////// PowerFish core library// Copyright (C) 1997-2001 Camilla Drefvenborg <elmindreda@home.se>//// 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/////////////////////////////////////////////////////////////////////////////////////////////////////#include <PfBase.h>#include <PfTemplate.h>#include <PfString.h>#include <PfModule.h>#include <windows.h>#include "PfWinModule.h"///////////////////////////////////////////////////////////////////////////////////////////////////// PfWinModule constructors -----------------------------------------------------------------------PfWinModule::PfWinModule(void){ m_hModule = NULL;}PfWinModule::~PfWinModule(void){ Free();}// PfWinModule methods ----------------------------------------------------------------------------bool PfWinModule::Load(const char* szPathName){ PFASSERT(szPathName); m_hModule = LoadLibrary(szPathName); if (!m_hModule) return false; // detect native module { unsigned int* pPowerFishModule = (unsigned int*) FindEntryPoint("PowerFishModule"); if (pPowerFishModule && *pPowerFishModule == __POWERFISH_VERSION__) { PFGETMODULENAME PfGetModuleName = (PFGETMODULENAME) FindEntryPoint("PfGetModuleName"); if (PfGetModuleName) m_Name = PfGetModuleName(); } } return true;}void PfWinModule::Free(void){ if (m_hModule) { FreeLibrary(m_hModule); m_hModule = NULL; m_Name.Destroy(); }}// PfWinModule interface methods ------------------------------------------------------------------void* PfWinModule::FindEntryPoint(const char* szName){ PFASSERT(szName); if (!m_hModule) return NULL; return GetProcAddress(m_hModule, szName);}// PfWinModule accessors --------------------------------------------------------------------------bool PfWinModule::IsLoaded(void) const{ return m_hModule != NULL;}// PfWinModule interface accessors ----------------------------------------------------------------bool PfWinModule::IsNative(void) const{ return m_Name.IsValid();}const char* PfWinModule::GetName(void) const{ return m_Name;}///////////////////////////////////////////////////////////////////////////////////////////////////PfModule* PfLoadModule(const char* szPathName){ PfWinModule* pModule = new PfWinModule(); if (!pModule->Load(szPathName)) { delete pModule; pModule = NULL; return NULL; } return pModule;}///////////////////////////////////////////////////////////////////////////////////////////////////
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -