Link to home
Start Free TrialLog in
Avatar of ROBERT MECHLER
ROBERT MECHLERFlag for United States of America

asked on

Well tested 32 dll not loading on windows server 2012 r2

I have a website that uses a 32 bit dll created in C++ in 2000 that creates a one way hash. It works when called from a WEBSITES running on all the following windows servers.  2003,2008,2008r2,2012 and 2016. In other words on the 32 bit servers it runs from the windows\system32 directory and on the 64 bit servers is loads from the windows\SYSWOW64 directory. I am administrator on all the computers involved.

Website on 2012 r2 has 32 bit enabled on the .net 4.0 application pool. The dll is a standard dll and does not need to be registered.

I'd like to avoid requesting the client switch to 2012 or 2016 and I really would not like to have to create this as a web service and run it from another server where it is known to work.

Someone suggested that Group Policy for my login may have been changed. I know next to nothing about that sort of thing. I always request that the standalone webserver be set up with all standard settings.

    Private Declare Function VBEncrypt Lib "UtilitiesDll.dll" (ByVal lpPwd As String, ByVal lpEncrypt As String, ByVal nSize As Integer) As Integer
.
.
    Public Function HashPassword(ByVal Password As String) As String
        Dim EncryptedPassword As String = New String("*", 32)
        Encrypt.VBEncrypt(Password, EncryptedPassword, 32)
        Return EncryptedPassword
    End Function

Open in new window


UtilitiesDLL.dll gives the error, "Unable to load"

Bob
ASKER CERTIFIED SOLUTION
Avatar of Jane Updegraff
Jane Updegraff
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of evilrix
How is UtilitiesDll.dll built? I know it's a 32 bit build, but is it built statically linked to the C runtime or dynamically linked? Is it possible to build a 64 bit version? How is the application loaded, explicit or implicit DLL loading? Does the library have other dependencies (as alluded by Jane - follow her advice on how to check this)? Have you considered writing a test harness for this DLL to test it standalone without the additional hassle of running the main application?
Avatar of ROBERT MECHLER

ASKER

Visual Studio 6 C++ Enterprise from the year 2000. We bought another small software company back in 2006. One of their applications had been using this DLL since 2000 with no issues. I am not sure we have the correct version of the C++ source code.  Haven't needed to change the DLL in 11 years.

 No other dependencies. Loaded when first  needed. I wrote a small aspx web site which does nothing but accept the password in plain text, calls the DLL HashPassword function through the vb code behind (See code above)  and returns the HASHED password as a string of 32 0-F uppercase into another textbox.

This program runs using the exact same code on 64 bit Windows 2008r2, 2012 and 2016 without issue. It does not run on Windows 2012r2 at this customer's site. I'm having a separate Windows 2012r2 box set up to see if it will run there.

After further research I found an issue with IIS on 2012 R2. IF KB2919355 was ever installed, then IIS stopped functioning. Tried to do a reinstall of IIS and it would not uninstall (greyed out options in the IIS role). Windows had provided another patch to fix the inability to Uninstall IIS.  Applied that. Still could not uninstall IIS. I'm guessing the enable 32 bit application didn't take and that is why the 32bit DLL wouldn't load at runtime.

I'll also check for msvcr71.dll being present. I did not set up the server myself.

I think it's a bad install, especially with the KB2919355 having a known issue. The update actually covered Windows 8.1 and Windows 2012 r2, which made no sense to me.

Since it is a one purpose box at the customer's site, I think I'll just have them reinstall the most basic install from scratch. That way I can install IIS myself, to make sure all features are checked. I believe I saw a sub role that referred to enabling 32 bit dlls to run.

Bob
msvcr71.dll is present.
I wrote this morning a  small vb.net form (not website)  which calls the UtilitiesDLL.dll in the SysWOW64 (I assume that is where it would call it from directory) It runs on all my local computers, but not on the client's Windows 2012r2.

I'm beginning to wonder if any program that calls a 32bit DLL will run. Is it possible to install Windows Server 2012 R2 where it won't run any 32 DLL's?

I'll try some other programs.
I can't imagine why a Windows Server instance would be unable to call all 32-bit DLLs, that doesn't seem to be a logical choice, assuming it's possible to choose as an option during installation, which it may well be although I don't recall that. Maybe someone else here knows if that's actually a thing?  I like the idea of trying to install some other 32-bit apps to see if it can handle any or just not this one. After that, you've already spent a long time trying to get it working, I would say it may be time to call it a day and reinstall the OS as you suggested and see if you can get the site running in a fresh environment.
Agreed. In the end a reinstall has often been the answer.

The dependency walker indicated the following were also not found on this server instance

API-MS-WIN-CORE-KERNEL32-PRIVATE-L1-1-1.DLL
API-MS-WIN-CORE-PRIVATEPROFILE-L1-1-1.DLL
API-MS-WIN-CORE-SHUTDOWN-L1-1-1.DLL
API-MS-WIN-SERVICE-PRIVATE-L1-1-1.DLL
EXT-MS-WIN-NTUSER-UICONTEXT-EXT-L1-1-0.DLL
IESHIMS.DLL
MFPLAT.DLL
SETTINGSYNCPOLICY.DLL
WLANAPI.DLL

I ran the 64 bit version of dependency walker for the above.

When I tried the 32 bit dependency walker  profiler it ran up to a point then the froze.
Wow it really does seem as if this server isn't able to run any 32-bit anything. That's just weird. I'm trying to imagine why anyone would do that. I'm thinking that you are indeed at am impasse, unless there is a way to add 32-bit functionality in add and remove windows components or roles and features. I can't recall anything like that in either, though.
Found out that the problem is not related exclusively to IIS. I created a simple desktop VB.NET app that calls the same 32 bit DLL. This test program  also worked on all the other computers mentioned but not Windows 2012R2 AND Windows 10.  Although it's worked for over a decade, it's now starting to fail on certain machines.

Is it possible to easily copy the code over to Visual Studio 2010 c++ empty project and recompile as 64 bit?  Hoping that being able to debug it will find the issue that up till now hasn't caused any issues.

Bob
I actually found the reason myself. The file MSVCRTD.DLL was not present on the Windows  2012 R2 customer server I was working with. The date for the DLL was 1998 and I think it was associated with Visual Studio 6.  I put it in the syswow6432 directory and the problem went away. Maybe this will be helpful to someone else.
It was a matter of something not being installed by default. It may have been a custom install with certain things not included. I know how to fix it though.
Thanks to Jane for getting me on the correct path to explore.