IIS 6 and Invalid CGI Filename

I got this question a couple of days ago.


Hi there;

I am getting this error message whenever i try to click on Help Menu on my site that is running on IIS 6:

Other – Exception: Formatting Response – EFOpenError Cannot open file

This help menu calls a CGI & dll file, so I tried adding these files extention on Aplication extention within IIS but I am still getting the same error I tried using FileMon to help me resolving this issue and I got the following:

412     3:33:44 PM      w3wp.exe:3288   OPEN    F:\InetPub\wwwroot\merchxfer\cgi-bin/help_web_sales.html        NAME INVALID    Options: Open  Access: All     

Help please.



The first step to allowing CGI and ISAPI DLL to run is to add them to Web Service Extension and enable them. However, that merely allows IIS to load and execute the binary code. It does not mean that code runs and does the right thing, as we see here.

There are two things that you should note.


  1. The \\?\ prepended to the filename
  2. The forward-slash ‘/’ character in the filename

The \\?\ originates from IIS6 and is a security measure. It is valid Win32 File IO syntax and turns off any filename canonicalizations, assuring that IIS gets exactly the file resource that the user requested.

The forward-slash ‘/’ is probably what is causing problems for the CGI. Forward-slash is not a valid character in NTFS, so there is no way that the file resource can be opened. This is confirmed by FileMon reporting NAME INVALID.

If this CGI worked on prior versions of IIS, it likely worked by accident. Without debugging the CGI, it will not be possible to determine the cause of the ‘/’, but my guess would be that the problem is with the CGI. Given a URL to /cgi-bin/cgi.exe/help_web_sales.htm , it likely picked up:

  1. \\?\F:\Inetpub\wwwroot\merchxfer\cgi-bin from the CGI variable PATH_TRANSLATED
  2. /help_web_sales.htm from the CGI variable PATH_INFO

And the CGI is responsible for turning that information into a valid filename prior to using it as such.


Comments (5)

  1. David Wang says:

    One of the most fundamental security changes in IIS6 appends \? to all filesystem access by IIS. This…

  2. David Wang says:

    I recently sat down and thought a little about the typical user experience when troubleshooting IIS6,…

  3. Girish says:


    I am running into the same issue with an ISAPI dll. This is legacy code that sets the Current Directory to \?e:… causing our ASP.Net pages to fail on IIS6.0. Is there an api that will convert \?e:… to e:… ?

  4. David.Wang says:

    Girish – ASP.Net has QFEs such that it works with the \? syntax, so you should upgrade to it.


  5. Daniel Auta says:

    What causes the following problem? Exception EFOpenError in module ECDL.exe at 0001ECCA. Cannot open file “C:Windowssystem32licence.dat”.  

    The system cannot find the file specified