locked
\\?\ path prefix RRS feed

  • Question

  • User1666090797 posted
    Hello,
    I have an ISAPI mudule that calls a managed C++ DLL. The managed DLL works OK when called from a normal windows application, but I get E0434F4D exception when calling from an ISAPI module. I think the problem is related to the fact that my ISAPI module is loaded from path that starts with \\?\C:\ instead of C:\.

    Does anybody have an idea about the exception or how to disable that path mangling for my ISAPI module?
    Monday, September 21, 2009 11:49 AM

Answers

  • User511787461 posted

    Is you ISAPI dll statically linked to export functions in the managed dll - I would suggest using LoadLibrary/GetProcAddress to get the exported functions from the managed dll - the \\?\ prefix to the path is something IIS does for security reason and CLR does not handle it correctly as you have already noticed.

    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Monday, September 21, 2009 1:08 PM

All replies

  • User511787461 posted

    Is you ISAPI dll statically linked to export functions in the managed dll - I would suggest using LoadLibrary/GetProcAddress to get the exported functions from the managed dll - the \\?\ prefix to the path is something IIS does for security reason and CLR does not handle it correctly as you have already noticed.

    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Monday, September 21, 2009 1:08 PM
  • User1666090797 posted

    Thank you for your prompt reply. Actually the ISAPI module is written in Delphi (do not ask why) and there is a special syntax that in turn does LoadLibrary/GetProcAddress. However, my question is how to disable the \\?\ prefixing at least for development and troubleshooting purposes. Is there a configuration switch?

    Tuesday, September 22, 2009 5:27 AM
  • User511787461 posted

    No, there is no switch to change that behavior.

    Tuesday, September 22, 2009 3:10 PM
  • User1666090797 posted

    OK, provided that CLR does not handle that prefix correctly, how is a native ISAPI DLL supposed to call a mixed (native+managed) DLL?

    Wednesday, September 23, 2009 8:16 AM
  • User511787461 posted

    If you do LoadLibrary yourselves on the mixed dll rather than depending on being statically linked - you can make sure that the path you pass to LoadLibrary is not in the \\?\ format.

    Wednesday, September 23, 2009 12:50 PM
  • User1666090797 posted

    OK, I understand.

    Is there anything special about the worker process or the way it treats ISAPI modules, cause the same configuration works OK when loaded from a normal windows process but  fails (with the mentioned exception in the first post of the thread) when run from the worker process?

    In other word - is there any special sandboxing of the worker process that may cause problems with calling a mixed DLL from the ISAPI module?

    Thursday, September 24, 2009 10:20 AM