2011-08-03 07:07:57 -06:00
|
|
|
#ifndef HEXSEARCH_H
|
|
|
|
#define HEXSEARCH_H
|
|
|
|
#include <vector>
|
2011-12-31 04:48:42 -07:00
|
|
|
#include "Core.h" //for some reason process.h needs core
|
|
|
|
#include "MemAccess.h"
|
2011-08-03 07:07:57 -06:00
|
|
|
|
|
|
|
//(not yet)implemented using Boyer-Moore algorithm
|
|
|
|
|
|
|
|
class Hexsearch
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
typedef std::vector<int> SearchArgType;
|
|
|
|
enum SearchConst //TODO add more
|
|
|
|
{
|
|
|
|
ANYBYTE=0x101,DWORD_,ANYDWORD,ADDRESS
|
|
|
|
};
|
|
|
|
|
2012-01-05 15:39:14 -07:00
|
|
|
Hexsearch(const SearchArgType &args,char * startpos,char * endpos);
|
2011-08-03 07:07:57 -06:00
|
|
|
~Hexsearch();
|
|
|
|
|
|
|
|
void Reset(){pos_=startpos_;};
|
2012-01-05 15:39:14 -07:00
|
|
|
void SetStart(char * pos){pos_=pos;};
|
2011-08-03 07:07:57 -06:00
|
|
|
|
2012-01-03 17:45:11 -07:00
|
|
|
void * FindNext();
|
|
|
|
std::vector<void *> FindAll();
|
2011-08-03 07:07:57 -06:00
|
|
|
|
|
|
|
private:
|
2011-08-03 08:59:06 -06:00
|
|
|
bool Compare(int a,int b);
|
|
|
|
void ReparseArgs();
|
2011-08-03 07:07:57 -06:00
|
|
|
SearchArgType args_;
|
2012-01-05 15:39:14 -07:00
|
|
|
char * pos_,* startpos_,* endpos_;
|
2011-08-03 07:07:57 -06:00
|
|
|
std::vector<int> BadCharShifts,GoodSuffixShift;
|
|
|
|
void PrepareGoodSuffixTable();
|
|
|
|
void PrepareBadCharShift();
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|