用于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.

59 lines
2.1 KiB

5 months ago
/********************************************************************
Created Date: 2009-11-05
Author: wuding
Version: 2.0
Last Version Date: 2010-06-13
Modified History:
version Date Author Description
2009-11-05 wuding version 1.0
2010-06-13 wuding version 2.0 LoadFromFile引起的bug,IncreaseSize,SetBlobContent等方法
2012-12-13 wuding version 3.0 image
********************************************************************/
#pragma once
#ifndef __MEMORY_BUFFER_H
#define __MEMORY_BUFFER_H
#pragma warning(disable: 4786)
class BlobBuffer
{
public:
enum { BLOB_BUFFER_BLOCK_SIZE = 8 * 1204 };
private:
unsigned char *m_BlobPtr; //实际数据指针
unsigned long m_lBlobLen; //实际数据总大小
unsigned long m_lBufferLen; //缓冲区总大小
unsigned long m_ReadLen; //读取位置
unsigned char m_BlobBuffer[BLOB_BUFFER_BLOCK_SIZE];
void Reset();
public:
BlobBuffer();
~BlobBuffer();
void Clear();
void ClearContent();
void ResetRead();
/*
nIncreaseSize,bCopyOldData==false表示
bAllocBufLen true表示设置缓冲内容长度false表示函数调完后不影响原有GetBlobLength
*/
void IncreaseBufferSize(unsigned long nIncreaseSize, bool bCopyOldData = true);
void AllocBuffer(unsigned long nBufSize);
unsigned long GetBlobLength() const;
unsigned long GetBlobBufferLength();
const unsigned char *GetBlobPtr();
unsigned char *GetBlobRealPtr();
void SetBlobContent(const unsigned char *BlobPtr, unsigned long nBlobLen);
void AppendBlobContent(const unsigned char *BlobPtr, unsigned long nBlobLen);
void AppendBlobContentChar(const unsigned char BlobChar);
bool LoadBlobFromFile(const char *sFileName);
bool SaveBlobToFile(const char *sFileName);
bool LoadBlobFromFile(const wchar_t *sFileName);
bool SaveBlobToFile(const wchar_t *sFileName);
};
#endif