MCPcopy Create free account
hub / github.com/connorjaydunn/BinaryShield / getBytecodeIndex

Method getBytecodeIndex

src/function.cpp:95–116  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

93}
94
95DWORD Function::getBytecodeIndex(int instructionIndex)
96{
97 DWORD bytecodeIndex = 0;
98
99 /*
100 the following is a hacky solution to the fact instruction[0] will have "non-real" instructions
101 to deal with the vm context. A better solution will be required in order to support x86 call.
102 Perhaps we should implement a second vector of type VirtualInstruction that will store these
103 "injected" instructions.
104 */
105 if (instructionIndex == 0)
106 {
107 // length of "injected" virtual instructions (VM::popVmContext())
108 bytecodeIndex = 0x55;
109 }
110
111 // calculate the bytecode index of instructionIndex via summing all previous instruction bytecode sizes
112 for (int i = 0; i < instructionIndex; i++)
113 bytecodeIndex += instructions[i].getVirtualInstructionBytes().size();
114
115 return bytecodeIndex;
116}
117
118std::vector<BYTE> Function::getVirtualInstructionBytes()
119{

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected