用于EagleEye3.0 规则集漏报和误报测试的示例项目,项目收集于github和gitee
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

43 lines
1.0 KiB

#pragma once
namespace SOUI {
//加载组件辅助类
//组件需要提供SCreateInstance接口。接口定义必须是funSCreateInstance
class SComLoader
{
typedef BOOL (*funSCreateInstance)(IObjRef **);
public:
SComLoader()
:m_hMod(0)
,m_funCreateInst(NULL)
{
m_szDllPath[0]=0;
}
~SComLoader()
{
if(m_hMod) FreeLibrary(m_hMod);
}
BOOL CreateInstance(LPCTSTR pszDllPath,IObjRef **ppObj,LPCSTR pszFnName = "SCreateInstance")
{
if(!m_funCreateInst)
{
m_hMod=LoadLibrary(pszDllPath);
if(!m_hMod) return FALSE;
m_funCreateInst=(funSCreateInstance)GetProcAddress(m_hMod,pszFnName);
if(!m_funCreateInst)
{
FreeLibrary(m_hMod);
return FALSE;
}
_tcscpy(m_szDllPath,pszDllPath);
}
return m_funCreateInst(ppObj);
}
protected:
HMODULE m_hMod;
funSCreateInstance m_funCreateInst;
TCHAR m_szDllPath[MAX_PATH];
};
}//end of soui