ATL80.DLL from VS2005 RTM won't start on NT4

If an attempt is made to load the RTM ATL80.DLL on NT4, an error message is shown complaining that the import GetLongPathNameW could not be found in KERNEL32.DLL and as such, the process cannot start.

As the MSDN docs for GetLongPathName() show, it's very simple to work-around this problem in source-code (ie static library) by including NewAPIs.h.  However when linking with ATL80.DLL this solution is not possible, since ATL80.DLL does not do this, and I can't make it do it without re-compiling the DLL.

So why not just link with ATL statically   Well, I have just added support for ActiveX control containment to my app, which runs on a wide variety of Windows platforms, including NT4.  The MSDN2 docs on control containment are completely out-of-date (they refer to "AtlAxWin7") , but infer that I must use the ATL DLL in order to do control containment - it's not possible using the static library.  Sure enough, if I try and build my control containment code with the static ATL library, it won't run as-is, but that doesn't necessarily mean it's impossible.

Is it possible to get ActiveX control containment working with the VS2005 RTM static ATL library (ie without ATL80.DLL)   If not, is there any other work-around possible for me, except to stop using ATL completely   Our customers have thousands of NT4 installs, so dropping support for NT4 is not an available option.


Answer this question

ATL80.DLL from VS2005 RTM won't start on NT4

  • Rajnish

    You mean close my business and go find another job   No thanks.  I thought I already made it very clear that this is not an option, so I don't understand why you suggested it.

    In fact I found an easy fix for this today.  To support ActiveX control containment with the static (ie non-DLL) ATL library, just include the headers like this:

    #include <oleauto.h>

    HRESULT LoadTypeLibFromATL80(const OLECHAR *szFile, ITypeLib ** pptlib)

    {

    return LoadTypeLib(L"ATL80.DLL", pptlib);

    }

    #define LoadTypeLib LoadTypeLibFromATL80

    #include <atlbase.h>

    #include <atlhost.h>

    Make sure you declare a CComModule somewhere in your code (either static or global), and then everything just works.  Note that ATL80.DLL will still be required by your code, but it will never be loaded by your application, and can just be included in the current directory (or wherever) - it will just be used as a type library, not as a DLL.

    Another possibility would be to extract the type library from ATL80.DLL and embed it within your own application.


  • JTWX

    I decided to remove all dependencies on ATL80.DLL from my application to avoid having to ship this DLL.  This meant moving ATL80.DLL's type library into my exe, which turned out to be pretty trivial.  Here's how to do it:

    1) Copy atl.idl from the ATL source code directory into your project directory and use VS2005 to add it to your project.  Right-click on the file in VS2005 and change the output file to be "atl.tlb" in the current directory.

    2) Add the following to your RC file (assuming you already have one):

    1 TYPELIB MOVEABLE PURE "atl.tlb"

    That's it - now you can host ActiveX controls without ATL80.DLL.

    Note that both this method and the previous method I posted result in an assertion failure inside ATL in DEBUG builds.  This is a bug, and I have reported it to Microsoft.  See this KB article for more info about all this stuff: http://www.kbalertz.com/kb_832687.aspx (sure wish I'd found that last week).


  • Hoakie

    Thanks for the great info - it helps a lot. 

    I should also mention that the CRT (msvcr80.dll) also cannot be used on NT4.  I posted rebuild instructions for the CRT on this board.

  • michaelv

    PS: I know MS doesn't support NT4 anymore, but reminding me of that fact doesn't help me, since I have to support it.  All help appreciated.
  • Babba72

    You can't fix this. NT4 is no longer a target platform for VS2005!

    I don't recommend this:
    The only way I see is to build you own version of ATL80 under a new name. This will create your own personal DL hell!

    I recommend:
    Drop NT4 support!

  • ATL80.DLL from VS2005 RTM won't start on NT4