mirror of https://github.com/x64dbg/GleeBug
Static.Pattern documentation
This commit is contained in:
parent
6393ae8ffe
commit
f1ac2efec5
|
|
@ -104,7 +104,7 @@ namespace GleeBug
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t Pattern::Find(const uint8* data, size_t datasize, unsigned char* pattern, size_t patternsize)
|
size_t Pattern::Find(const uint8* data, size_t datasize, const uint8* pattern, size_t patternsize)
|
||||||
{
|
{
|
||||||
if (patternsize > datasize)
|
if (patternsize > datasize)
|
||||||
patternsize = datasize;
|
patternsize = datasize;
|
||||||
|
|
|
||||||
|
|
@ -17,12 +17,65 @@ namespace GleeBug
|
||||||
} nibble[2];
|
} nibble[2];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Formats pattern string to only contain [0-9A-Fa-f\?].
|
||||||
|
\param pattern Pattern to format.
|
||||||
|
\return The formatted pattern.
|
||||||
|
*/
|
||||||
static std::string FormatPattern(const std::string & pattern);
|
static std::string FormatPattern(const std::string & pattern);
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Transforms a string pattern to a nibble structure.
|
||||||
|
\param patterntext The pattern string to find.
|
||||||
|
\param [out] pattern Transformed pattern.
|
||||||
|
\return true if it succeeds, false otherwise.
|
||||||
|
*/
|
||||||
static bool Transform(const std::string & patterntext, std::vector<Byte> & pattern);
|
static bool Transform(const std::string & patterntext, std::vector<Byte> & pattern);
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Finds the first occurrence of a pattern in a buffer.
|
||||||
|
\param data The buffer to search in.
|
||||||
|
\param datasize The size of the buffer.
|
||||||
|
\param pattern The pattern to find.
|
||||||
|
\return Offset of the first occurrence found. -1 when not found.
|
||||||
|
*/
|
||||||
static size_t Find(const uint8* data, size_t datasize, const std::vector<Byte> & pattern);
|
static size_t Find(const uint8* data, size_t datasize, const std::vector<Byte> & pattern);
|
||||||
static size_t Find(const uint8* data, size_t datasize, unsigned char* pattern, size_t patternsize);
|
|
||||||
|
/**
|
||||||
|
\brief Finds the first occurrence of a pattern in a buffer.
|
||||||
|
\param data The buffer to search in.
|
||||||
|
\param datasize The size of the buffer.
|
||||||
|
\param pattern The pattern to find. The pattern supports wildcards (1? ?? ?6 78).
|
||||||
|
\return Offset of the first occurrence found. -1 when not found.
|
||||||
|
*/
|
||||||
static size_t Find(const uint8* data, size_t datasize, const char* pattern);
|
static size_t Find(const uint8* data, size_t datasize, const char* pattern);
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Finds the first occurrence of a pattern in a buffer.
|
||||||
|
\param data The buffer to search in.
|
||||||
|
\param datasize The size of the buffer.
|
||||||
|
\param pattern The pattern to find.
|
||||||
|
\param patternsize The size of the pattern to find.
|
||||||
|
\return Offset of the first occurrence found. -1 when not found.
|
||||||
|
*/
|
||||||
|
static size_t Find(const uint8* data, size_t datasize, const uint8* pattern, size_t patternsize);
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Writes a pattern in a buffer. This function writes as many bytes as possible from the pattern.
|
||||||
|
\param [in,out] data The buffer to write the pattern in.
|
||||||
|
\param datasize The size of the buffer.
|
||||||
|
\param pattern Specifies the pattern. The pattern supports wildcards (1? ?? ?6 78).
|
||||||
|
*/
|
||||||
static void Write(uint8* data, size_t datasize, const char* pattern);
|
static void Write(uint8* data, size_t datasize, const char* pattern);
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Search and replace a pattern in a buffer.
|
||||||
|
\param [in,out] data The buffer to search and replace in.
|
||||||
|
\param datasize The size of the buffer.
|
||||||
|
\param searchpattern The pattern to find. The pattern supports wildcards (1? ?? ?6 78).
|
||||||
|
\param replacepattern The pattern to replace the found occurrence with. The pattern supports wildcards (1? ?? ?6 78).
|
||||||
|
\return true if it succeeds, false if it fails.
|
||||||
|
*/
|
||||||
static bool Snr(uint8* data, size_t datasize, const char* searchpattern, const char* replacepattern);
|
static bool Snr(uint8* data, size_t datasize, const char* searchpattern, const char* replacepattern);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue