Why does CreateProcess give error 193 (%1 is not a valid Win32 app)

后端 未结 4 1176
花落未央
花落未央 2020-11-28 16:13

The code below fails to start documents. I get error 193 (%1 is not a valid Win32 app). Starting executables work fine. The files are properly associated, they start the cor

相关标签:
4条回答
  • 2020-11-28 16:50

    Let me add an example here:

    I'm trying to build Alluxio on windows platform and got the same issue, it's because the pom.xml contains below step:

          <plugin>
            <artifactId>exec-maven-plugin</artifactId>
            <groupId>org.codehaus.mojo</groupId>
            <inherited>false</inherited>
            <executions>
              <execution>
                <id>Check that there are no Windows line endings</id>
                <phase>compile</phase>
                <goals>
                  <goal>exec</goal>
                </goals>
                <configuration>
                  <executable>${build.path}/style/check_no_windows_line_endings.sh</executable>
                </configuration>
              </execution>
            </executions>
          </plugin>
    

    The .sh file is not executable on windows so the error throws.

    Comment it out if you do want build Alluxio on windows.

    0 讨论(0)
  • 2020-11-28 16:56

    The most likely explanations for that error are:

    1. The file you are attempting to load is not an executable file. CreateProcess requires you to provide an executable file. If you wish to be able to open any file with its associated application then you need ShellExecute rather than CreateProcess.
    2. There is a problem loading one of the dependencies of the executable, i.e. the DLLs that are linked to the executable. The most common reason for that is a mismatch between a 32 bit executable and a 64 bit DLL, or vice versa. To investigate, use Dependency Walker's profile mode to check exactly what is going wrong.

    Reading down to the bottom of the code, I can see that the problem is number 1.

    0 讨论(0)
  • 2020-11-28 17:09

    Your Button2Click and Button3Click functions pass klad.xls and smimime.txt. These files most likely aren't actual executables indeed.

    In order to open arbitrary files using the application associated with them, use ShellExecute

    0 讨论(0)
  • 2020-11-28 17:15

    If you are Clion/anyOtherJetBrainsIDE user, and yourFile.exe cause this problem, just delete it and let the app create and link it with libs from a scratch. It helps.

    0 讨论(0)
提交回复
热议问题