Skip to content

Commit

Permalink
add M option + follow C coding style
Browse files Browse the repository at this point in the history
-add 'M' option to disable ms-validation
-remove dead code
-remove warning message
-run clang-format

Co-authored-by: Peter Jones <[email protected]>
Co-authored-by: Kamil Aronowski <[email protected]>
Signed-off-by: Dennis Tseng <[email protected]>
  • Loading branch information
3 people committed Jun 26, 2023
1 parent 6548f2b commit fa5add1
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions post-process-pe.c
Original file line number Diff line number Diff line change
Expand Up @@ -349,11 +349,8 @@ set_dll_characteristics(PE_COFF_LOADER_IMAGE_CONTEXT *ctx)
newflags = oldflags | EFI_IMAGE_DLLCHARACTERISTICS_NX_COMPAT;
else
newflags = oldflags & ~(uint16_t)EFI_IMAGE_DLLCHARACTERISTICS_NX_COMPAT;
if (oldflags == newflags) {
warnx("Dll Characteristics(0x%04x) indentical to previous one",
ctx->PEHdr->Pe32Plus.OptionalHeader.DllCharacteristics);
if (oldflags == newflags)
return;
}

debug(INFO, "Updating DLL Characteristics from 0x%04hx to 0x%04hx\n",
oldflags, newflags);
Expand All @@ -380,9 +377,7 @@ ms_validation(PE_COFF_LOADER_IMAGE_CONTEXT *ctx)
"PASS":"FAIL");

Section = ctx->FirstSection;
//printf("NumberOfSections=%d\n",ctx->NumberOfSections);
for (i=0, Section = ctx->FirstSection; i < ctx->NumberOfSections; i++, Section++) {
//printf("name=%s, Charact=0x%04x\n",Section->Name,Section->Characteristics);
if ((Section->Characteristics & EFI_IMAGE_SCN_MEM_WRITE) &&
(Section->Characteristics & EFI_IMAGE_SCN_MEM_EXECUTE)) {
debug(INFO, "%14s: %s\n","Section-Wr-Exe", "FAIL");
Expand Down Expand Up @@ -541,7 +536,10 @@ int main(int argc, char **argv)
{.name = "enable-nx-compat",
.val = 'n',
},
{.name = "ms-validation",
{.name = "disable ms-validation",
.val = 'M',
},
{.name = "enable ms-validation",
.val = 'm',
},
{.name = "quiet",
Expand Down

0 comments on commit fa5add1

Please sign in to comment.