title: Run an .exe file on apache?
body: <p>I'm trying to run a cgi executable file through a html form as in this code:</p>
  
  <pre><code> &lt;html&gt;
  
   &lt;head&gt;
  &lt;title&gt;CGI Form&lt;/title&gt;
  &lt;meta http-equiv="content-type" content="text/html;charset=utf-8" /&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  &lt;form action="C:\WWW\cgi-bin\y.exe" method="get"&gt;
      &lt;input type="text" name="string1" /&gt;
      &lt;input type="text" name="string2" /&gt;
      &lt;input type="text" name="string3" /&gt;
      &lt;input type="submit" name="submit" value="Submit" /&gt;
  &lt;/form&gt;
  &lt;/body&gt;
  
  &lt;/html&gt;
  </code></pre>
  
  <p>And here it is the cgi code compiled as y.exe and saved in the path specified in the action:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;string.h&gt;
  
  int main(void)
  {
  char *buffer, string1[100], string2[100], string3[100], merged[300]; 
  
  buffer = getenv("QUERY_STRING"); 
  
  if(buffer == NULL) 
  {
      printf("&lt;p&gt;Error: No data&lt;/p&gt;");
  }
  else
  {
      if(sscanf(buffer, "string1=%s&amp;string2=%s&amp;string3=%s", string1, string2, string3) !=      3) 
      {
          printf("Data missing!");
      }
      else
      {   
          strcpy(merged, string1); 
          strcat(merged, string2); 
          strcat(merged, string3); 
  
          printf("Content-Type: text/html\n\n");
          printf("&lt;html&gt;\n"
                 "&lt;head&gt;\n"
                     "&lt;title&gt;CGI Form Merge Strings&lt;/title&gt;\n"
                 "&lt;/head&gt;\n"
                 "&lt;body&gt;\n"
                     "Merged string is: %s\n"
                 "&lt;/body&gt;\n"
                 "&lt;/html&gt;\n", merged);  
      }
  }
  
  return 0;
  </code></pre>
  
  <p>}</p>
  
  <p>I've tried to reconfigure the httpd.conf file with this:</p>
  
  <pre><code>AddHandler cgi-script .exe
  ScriptAlias /cgi-bin/ "C:/WWW/cgi-bin/"
  </code></pre>
  
  <p>and</p>
  
  <pre><code>&lt;Directory "C:/WWW/cgi-bin"&gt;
      AllowOverride All
      Options +ExecCGI
      Options FollowSymLinks 
      Require all granted
      AddHandler cgi-script .cgi
      AddHandler cgi-script .exe
  &lt;/Directory&gt;
  </code></pre>
  
  <p>However this does not fix the problem.</p>