Files
Work/image/DLLFLAGS.HPP
2024-08-07 09:16:27 -04:00

89 lines
1.6 KiB
C++

#ifndef _IMAGE_DLLFLAGS_HPP_
#define _IMAGE_DLLFLAGS_HPP_
#ifndef _COMMON_PUREVIEWOFFILE_HPP_
#include <common/pview.hpp>
#endif
class DLLFlags
{
public:
enum DLLType{PerProcessLibInit=0x0001,PerProcessLibTerm=0x0002,
PerThreadLibInit=0x0004,PerThreadLibTerm=0x0008};
DLLFlags(DLLType dllType=PerProcessLibInit);
DLLFlags(const DLLFlags &someDLLFlags);
~DLLFlags();
DLLFlags &operator=(const DLLFlags &someDLLFlags);
WORD operator==(const DLLFlags &someDLLFlags)const;
WORD operator<<(PureViewOfFile &pureView);
DLLType dllType(void)const;
void dllType(DLLType dllType);
WORD isValid(void)const;
private:
DLLType mDLLType;
};
inline
DLLFlags::DLLFlags(DLLType dllType)
: mDLLType(dllType)
{
}
inline
DLLFlags::DLLFlags(const DLLFlags &someDLLFlags)
{
*this=someDLLFlags;
}
inline
DLLFlags::~DLLFlags()
{
}
inline
DLLFlags &DLLFlags::operator=(const DLLFlags &someDLLFlags)
{
dllType(someDLLFlags.dllType());
return *this;
}
inline
WORD DLLFlags::operator==(const DLLFlags &someDLLFlags)const
{
return dllType()==someDLLFlags.dllType();
}
inline
WORD DLLFlags::operator<<(PureViewOfFile &pureView)
{
WORD dllType;
pureView.read(dllType);
mDLLType=(DLLType)dllType;
if(!isValid())return FALSE;
return TRUE;
}
inline
DLLFlags::DLLType DLLFlags::dllType(void)const
{
return mDLLType;
}
inline
void DLLFlags::dllType(DLLType dllType)
{
mDLLType=dllType;
}
inline
WORD DLLFlags::isValid(void)const
{
if(PerProcessLibInit==dllType())return TRUE;
if(PerProcessLibTerm==dllType())return TRUE;
if(PerThreadLibInit==dllType())return TRUE;
if(PerThreadLibTerm==dllType())return TRUE;
return FALSE;
}
#endif