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

Method getBytes

src/virtual_instruction.cpp:12–37  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10VirtualInstruction::VirtualInstruction(DWORD vmHandlerRva) : vmHandlerRva(vmHandlerRva) {};
11
12std::vector<BYTE> VirtualInstruction::getBytes()
13{
14 std::vector<BYTE> bytes;
15
16 // convert vmHandlerRva into a BYTE vector
17 std::vector<BYTE> vmHandlerRvaBytes = convertToByteVector<DWORD>(vmHandlerRva);
18 bytes.insert(bytes.end(), vmHandlerRvaBytes.begin(), vmHandlerRvaBytes.end());
19
20 // if operand exists, convert it into a BYTE vector
21 if (hasOperand)
22 {
23 std::vector<BYTE> operandBytes;
24
25 switch (operandSize)
26 {
27 case 8: operandBytes = convertToByteVector<long long>(operand); break;
28 case 4: operandBytes = convertToByteVector<DWORD>(operand); break;
29 case 2: operandBytes = convertToByteVector<WORD>(operand); break;
30 case 1: operandBytes = convertToByteVector<BYTE>(operand); break;
31 }
32
33 bytes.insert(bytes.end(), operandBytes.begin(), operandBytes.end());
34 }
35
36 return bytes;
37}
38
39void VirtualInstruction::setOperand(long long operand) { this->operand = operand; }

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected