| 176 | } |
| 177 | |
| 178 | bool PE::emitRead() |
| 179 | { |
| 180 | // get file size |
| 181 | DWORD size = GetFileSize(hFile, NULL); |
| 182 | if (size == INVALID_FILE_SIZE) |
| 183 | { |
| 184 | std::cerr << "error while getting input file size: " << std::endl; |
| 185 | return 0; |
| 186 | } |
| 187 | |
| 188 | // resize our bytes vector to size of binary |
| 189 | bytes.resize(size); |
| 190 | |
| 191 | // read raw file bytes into our bytes vector |
| 192 | DWORD bytesRead; |
| 193 | if (!ReadFile(hFile, bytes.data(), size, &bytesRead, NULL)) |
| 194 | { |
| 195 | std::cerr << "error while reading input file: " << std::endl; |
| 196 | return 0; |
| 197 | } |
| 198 | |
| 199 | return 1; |
| 200 | } |
| 201 | |
| 202 | bool PE::addSection(std::string name, DWORD flags, std::vector<BYTE> bytes) |
| 203 | { |
nothing calls this directly
no outgoing calls
no test coverage detected