mingw C program with setup in its name won't r

2019-07-18 15:53发布

问题:

I've written the classic 3 line "Hello World" in C:

#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <strings.h>
#include <string.h>

int main(int argc, char **argv)
{
  printf("Hello World!\r\n");
  exit(0);
}

Compile on linux targeting win32:

i686-w64-mingw32-gcc -o helloWorld.exe -g -march=i586 helloWorld.c

Move the hellowWorld.exe to windows 7 machine, runs fine ... Now, I rename it to anything with 'setup' in the name, like hellosetupWorld.exe and UAC fires when I try to run it, and it fails to run even if I answer the UAC popup 'yes it's ok, run it'. Later I get a popup asking if my program installed properly.

This seems to be new behavior. Has anyone else seen this? I've tested this on a virgin windows 7 from MSDN in a virtual machine with almost nothing else installed. Same problem.

Heh ... not just mingw. This happens if I compile with visual studio at the command line, like cl Hello.c

I get exactly the same behavior. Put 'setup' somewhere in the name, and the program won't run.

Thanks in advance.