diff --git a/post-process-pe.c b/post-process-pe.c index b29eed2e7..7083d3e22 100644 --- a/post-process-pe.c +++ b/post-process-pe.c @@ -381,12 +381,12 @@ ms_validation(PE_COFF_LOADER_IMAGE_CONTEXT *ctx) Section = ctx->FirstSection; //printf("NumberOfSections=%d\n",ctx->NumberOfSections); - for (i = 0; i < ctx->NumberOfSections; i++, Section++) { + 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"); - return; + return; } } debug(INFO, "%14s: %s\n","Section-Wr-Exe", "PASS"); @@ -518,7 +518,8 @@ static void __attribute__((__noreturn__)) usage(int status) fprintf(out, " -v Be more verbose\n"); fprintf(out, " -N Disable the NX compatibility flag\n"); fprintf(out, " -n Enable the NX compatibility flag\n"); - fprintf(out, " -m Microsoft validation\n"); + fprintf(out, " -M Disable test for Microsoft's signing requirements\n"); + fprintf(out, " -m Enable test for Microsoft's signing requirements\n"); fprintf(out, " -h Print this help text and exit\n"); exit(status); @@ -553,7 +554,7 @@ int main(int argc, char **argv) }; int longindex = -1; - while ((i = getopt_long(argc, argv, "hNnmqv", options, &longindex)) != -1) { + while ((i = getopt_long(argc, argv, "hNnMmqv", options, &longindex)) != -1) { switch (i) { case 'h': case '?': @@ -565,6 +566,9 @@ int main(int argc, char **argv) case 'n': set_nx_compat = true; break; + case 'M': + set_ms_validation = false; + break; case 'm': set_ms_validation = true; break;