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

Method emitRead

src/pe.cpp:178–200  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

176}
177
178bool 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
202bool PE::addSection(std::string name, DWORD flags, std::vector<BYTE> bytes)
203{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected