This is a discussion on "File not found" error returned from CreateHardLink() in IIS Filter within the Windows Web Servers forums, part of the Web Server and Related Forums category; I'm getting a "file not found" error (0x2) returned from the Platform SDK function CreateHardLink(lpFileName, lpExistingFileName, ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
I'm getting a "file not found" error (0x2) returned from the Platform
SDK function CreateHardLink(lpFileName, lpExistingFileName, NULL) that is being called from within an IIS filter. The function is actually called using two CStrings that are assigned from char[]variables: CreateHardLink(CString, CString, NULL); I am logging activity from the filter into a text file. The log entry with the error shows a valid source file -- when I cut/paste from the log into the Windows Explorer's address bar, the file is accessed just fine, so the file definitely exists. The problem may be with certain "special characters" in the file name, though some of the file names it is failing on seem "normal". Here are some of the files I'm getting the "file not found" with (path not shown): Car_Obj3.zip BB_House_Revised.zip Gewächs.zip Autoƒ.sit Note that the 'ä' (ANSI 228) in "Gewächs.zip" and the 'ƒ' (ANSI 198) in "Autoƒ.sit" are both ANSI characters, not unicode. The other two file names contain normal characters (the underscores are ANSI 095). The directory exists where the link is being created. The existing file and the link being created are both on the same locally mounted hard-drive. MORE INTERESTING: I wrote a C++ console app that takes two arguments from the command line: the Link File (including path) and the Existing File (including path). It executes CreateHardLink() using those strings passed in. When executed on the same server that the IIS filter is running on using the same paths/files mentioned above, it creates the hard-link with no errors! It's basically the same code that is in the IIS filter, except the CString arguments that are passed to CreateHardLink() are assigned from the argv[] values passed in from the commandline: CString csHardLinkFileName(argv[1]); CString csExistingFileName(argv[2]); CreateHardLink(csHardLinkFileName, csExistingFileName, NULL); Essentially this is the same code as in the IIS filter, but this works and the filter does not! SPECS - O/S: The IIS filter is running on MS Windows 2000 Server SP4 Platform SDK: July 2002 C++ Compiler: VC++ 6.0 Build options: /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_WINDLL" /D "_AFXDLL" /D "_MBCS" /D "_USRDLL" /D _WIN32_WINNT=0x500 /Fp"Release/ISAPIFilter.pch" /Yu"stdafx.h" /Fo"Release/" /Fd"Release/" /FD /c Very strange! Any answers? Thank you! -James |