This tip is for Novell Products (eDirectory, IDM, etc.) and third-party applications that observe a dependency on dwmapi.dll with the Vista OS.

Problem

When you deploy such an application on a system with Internet Explorer 7 installed, the application library or binary shows a dependency on dwmapi.dll, which cannot be resolved unless you uninstall IE7. Most of the forum discussion on this problems suggest uninstalling IE7 on the, but this is not the right solution. This article explains how this dependency was added to application library/binary and how to handle the situation.

IE7 comes with MS 2003 Server, or it may be downloaded from Internet, or there may be IE7 upgrades that update IEFRAME.DLL in the system32 folder. This IEFRAME.DLL file has a dependency on dwmapi.dll. The dependency chain below shows how the application is hooked to dwmapi.dll.

Our Application => ADVAPI32.DLL => WINSTA.DLL => NETAPI32.DLL => DNSAPI.DLL =>IPHLPAPI.DLL => MPRAPI.DLL => ACTIVEDS.DLL => ADSLDPC.DLL => CREDUI.DLL => SHELL32.DLL => SHDOCVW.DLL => MSHTML.DLL => IEFRAME.DLL => DWMAPI.DLL

So how do you handle the dependency?

DWMAPI.DLL does not exist on any non-Vista box. The only call made into dwmapi.dll is DwmExtendFrameIntoClientArea, which is used to set what parts of the window should be rendered with glass and what should be rendered as opaque. The DwmExtendFrameIntoClientArea function gets called if OSVERSIONINFO.dwMajorVersion returns at least 6, which means you are running your application on Windows Server 2008 or Windows Vista.

Following is a sample that verifies this. (To understand the API’s used in the sample, refer to http://msdn2.microsoft.com/en-us/library/ms724834.aspx )

// DWMAPI.cpp : Defines the entry point for the console application.

#include <windows.h>
#include <stdio.h>

int main(int argc, char* argv[])
{
	OSVERSIONINFO osvi;
	osvi.dwOSVersionInfoSize=sizeof(OSVERSIONINFO);

	printf("GetVersionEx Returns %d\n",GetVersionEx(&osvi));

	if( osvi.dwPlatformId == VER_PLATFORM_WIN32_NT)
	{
		printf("VER_PLATFORM_WIN32_NT\n");
	}

	printf("dwMajorVersion %d \n",osvi.dwMajorVersion );

	return 0;
}

If osvi.dwMajorVersion >=6, then your application may require dwmapi.dll at runtime. And in this case, the operating system is Vista or Windows Server 2008, which has dwmapi.dll.

What do you need to if osvi.dwMajorVersion <6? DWMAPI.DLL is a delay load module. The Windows demand-loading .dll concept prevents it from loading until a call to DwmExtendFrameIntoClientArea is made. This call is never made on a non-Vista box, due to the dwMajorVersion check explained above. If an application or .dll is set up to resolve everything before it runs (i.e., ignore the delay-loaded aspect), then it will fail.

Solution

Use late binding, if you are currently using the early binding concept. On the other hand, if it is delay linked, it will never hit this bug. In fact, most standard applications/libraries (e.g., notepad.exe and iexplorer.exe) have this dependency and still work without problems, so your application should work fine.

What you should not do:

* Create your own dwmapi.dll that has DwmExtendFrameIntoClientArea function implementation.
* Ask all users (customers, developers, etc.) to uninstall IE7.
* Change the build system configuration to take care of this dependency during build time. This is because IE7 installed on the deployment box is causing the problem.

0 votes, average: 0.00 out of 50 votes, average: 0.00 out of 50 votes, average: 0.00 out of 50 votes, average: 0.00 out of 50 votes, average: 0.00 out of 5 (0 votes, average: 0.00 out of 5)
You need to be a registered member to rate this post.
Loading...
Categories: Uncategorized

Disclaimer: As with everything else at NetIQ Cool Solutions, this content is definitely not supported by NetIQ, so Customer Support will not be able to help you if it has any adverse effect on your environment.  It just worked for at least one person, and perhaps it will be useful for you too.  Be sure to test in a non-production environment.

Leave a Reply

Leave a Comment

  • anonymous says:

    Do you mean that the only solution is to change the source code of any application which may use early binding? Also, could you give a reference to an example of exactly how you change early binding to late binding? It it a code thing or a compiler or linker parameter? What if I don’t have access to the source code of the troubled dll?

    • raghuveer_talekar says:

      What i meant by early or late binding here is that…. the library load time , i.e when your application depends on some library .. Is that library getting loaded as soon as your application comes up .. i.e early binding.. .. Or the library is getting loaded when you make an call to function in that library.. i.e on demand.. i.e late binding w.r.t application calls.

      Binding are dealt with applications or libraries compiler/linker flags , one should refer to these flags specified by the compiler or linker.

      If you don’t have the source code for the library that you depend on.. most of the time as per dwmapi.dll is delay load module. or you are directly linked to dwmapi.dll.. ( is that possible?? ) then you need to checkout compiler/linker flags to make it delay load… There can be other ways…..too…

  • anonymous says:

    I would also like to know the necessary code or build changes.

    — Robert Pollak

    • raghuveer_talekar says:

      before answering your question i would just give you the trick in general for below question…

      How can one check whether dependent libraries are delay load module ?
      User depends.exe i.e dependency walker tool that comes with VS Studio or older version of vs too…..the hour glass icon against the library will tell you that its delay loaded i.e on demand api call load module.. Refer this for more information.. http://www.dependencywalker.com

      Now answering to your original question….
      There is lot of fundamental details which are already available in many other great people have already written. Please follow the link… http://www.codeproject.com/KB/DLL/Delay_Loading_Dll.aspx ( Credit to Sachin Sangoi for good article on this )

Mar 20, 2008
6:42 am
Reads:
5,798
Score:
Unrated
Active Directory Authentication Automation Cloud Computing Cloud Security Configuration Customizing Data Breach DirXML Drivers End User Management Identity Manager Importing-Exporting / ICE/ LDIF Intelligent Workload Management IT Security Knowledge Depot LDAP Monitoring Open Enterprise Server Passwords Reporting Secure Access Supported Troubleshooting Workflow