Lines Matching defs:head
66 // the wrapper, so we need to keep the leading 5+ bytes ('head') of the
67 // original instructions somewhere with a "jmp old_func+head".
68 // We call these 'head'+5 bytes of instructions a "trampoline".
88 // island and store it in 'head'.
89 size_t head = 0;
90 while (head < 5) {
91 switch (old_bytes[head]) {
95 head++;
98 switch (*(unsigned short*)(old_bytes + head)) { // NOLINT
102 head += 2;
105 head += 3;
108 head += 6;
111 switch (0x00FFFFFF & *(unsigned int*)(old_bytes + head)) {
116 head += 4;
124 if (pool_used + head + 5 > POOL_SIZE)
129 if (!VirtualProtect((void*)old_func, head, PAGE_EXECUTE_READWRITE,
134 _memcpy(trampoline, old_bytes, head);
135 WriteJumpInstruction(trampoline + head, old_bytes + head);
137 pool_used += head + 5;
141 _memset(old_bytes + 5, 0xCC /* int 3 */, head - 5);
143 if (!VirtualProtect((void*)old_func, head, old_prot, &unused_prot))