MCPcopy Create free account
hub / github.com/NtQuery/Scylla / calcCorrectPeHeaderSize

Method calcCorrectPeHeaderSize

Scylla/PeParser.cpp:418–441  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

416}
417
418DWORD PeParser::calcCorrectPeHeaderSize(bool readSectionHeaders)
419{
420 DWORD correctSize = pDosHeader->e_lfanew + 50; //extra buffer
421
422 if (readSectionHeaders)
423 {
424 correctSize += getNumberOfSections() * sizeof(IMAGE_SECTION_HEADER);
425 }
426
427 if (isPE32())
428 {
429 correctSize += sizeof(IMAGE_NT_HEADERS32);
430 }
431 else if(isPE64())
432 {
433 correctSize += sizeof(IMAGE_NT_HEADERS64);
434 }
435 else
436 {
437 correctSize = 0; //not a valid PE
438 }
439
440 return correctSize;
441}
442
443DWORD PeParser::getInitialHeaderReadSize(bool readSectionHeaders)
444{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected