MCPcopy Create free account
hub / github.com/CloverHackyColor/CloverBootloader / FindMemMask

Function FindMemMask

rEFIt_UEFI/Platform/kext_patcher.cpp:174–186  ·  view source on GitHub ↗

UINTN FindSection(const UINT8 *Source, UINTN len, const UINT8* seg, const UINT8* sec) { BOOLEAN eq; for (UINTN i = 0x20; i < len; i++) { eq = TRUE; for (UINTN j = 0; j < 16 && (sec[j] != 0); j++) { if (Source[i + j] != sec[j]) { eq = FALSE; break; } } if (eq) { for (UINTN j = 0; j < 16 && (seg[j] != 0); j++) { if (Source[i + 0x10 + j

Source from the content-addressed store, hash-verified

172}
173*/
174UINTN FindMemMask(const UINT8 *Source, UINTN SourceSize, const UINT8 *Search, UINTN SearchSize, const UINT8 *MaskSearch, UINTN MaskSize)
175{
176 if (!Source || !Search || !SearchSize) {
177 return KERNEL_MAX_SIZE;
178 }
179
180 for (UINTN i = 0; i < SourceSize - SearchSize; ++i) {
181 if (CompareMemMask(&Source[i], Search, SearchSize, MaskSearch, MaskSize)) {
182 return i;
183 }
184 }
185 return KERNEL_MAX_SIZE;
186}
187
188UINTN SearchAndReplaceMask(UINT8 *Source, UINT64 SourceSize, const UINT8 *Search, const UINT8 *MaskSearch, UINTN SearchSize,
189 const UINT8 *Replace, const UINT8 *MaskReplace, INTN MaxReplaces)

Callers 1

Calls 1

CompareMemMaskFunction · 0.85

Tested by

no test coverage detected