Microsoft KB Archive/11342

INCLUDE File Search Path ID Number: Q11342

4.00 MS-DOS enduser |

Question: MASM is using the wrong search path for INCLUDE files when the file name begins with “/”, “&quot;,”.&quot;, or a drive letter followed by a colon.

Response: Microsoft has confirmed this to be a problem in Version 4.00 of Macro Assembler. The problem is corrected in Version 5.00. The correct search path for INCLUDE files in MASM is the following:


 * 1) If the file name begins with “/”, “&quot;,”.&quot;, or a drive letter followed by a colon, search using only the path as specified.
 * 2) Otherwise use all the /I paths in order, then use the current directory.

MASM Version 4.00 does not work correctly. The path it uses is the following:


 * 1) Any INCLUDE file specified with a drive specifier is searched for on the named drive in the named directory.
 * 2) All other INCLUDE files are searched for in the directories specified on the command line, from left to right. If a full path name is specified, the leading &quot;&quot; is stripped and the remainder is treated as a partial path name.
 * 3) Any files specified with a full path name are searched for in the given directory.
 * 4) Otherwise, the current directory is searched.

The problem is that a leading “/”, “&quot;, or”.&quot; is not respected. The workaround for INCLUDE file names with a leading “/” or “&quot; is to include a drive-specifier as well. The workaround for INCLUDE file names with a leading”.&quot; is to specify “/I.” on the command line before any other “/I” arguments. Note that if you want to specify the root directory of another drive, use “/IC:” instead of &quot;/IC:&quot;. The latter is not recognized. Using a directory to find a file means appending the file name as written to the directory name (including a terminating slash in the directory name).