Why does shlwapi import a nonexistent function?

Raymond Chen

Commenter charless asks why shlwapi.dll imports a nonexistent function from mpr.dll, which shows up in dependency tools as a broken import. Because that function did exist at one point, although it doesn’t exist any more. The function in question was available only on Windows 95-series versions of Windows. It never existed on Windows NT or any of its successors. But remember that shlwapi.dll was originally developed for Internet Explorer, which ran on Windows 95 as well as Windows NT. Internet Explorer checked the operating system and called the Windows 95-only function only after verifying that it was running on Windows 95. If it was running on Windows NT, then it never called the function and therefore never stepped on the land mine known as ERROR_PROC_NOT_FOUND. Okay, so why does shlwapi still link to the function long after the Windows 95 series of operating systems have become obsolete? Removing a function, even a function that doesn’t do anything, even an undocumented function that doesn’t do anything, is a dangerous endeavor. Suppose you have a program that links to the function, but just like Internet Explorer, it is clever and checks whether it is running on Windows NT before calling it. If you remove the useless function from shlwapi, then that program will fail to load, even though it never calls the offending function, and now you have an application compatibility problem on your hands. Since it’s a small function that doesn’t do anything, it’s a lot less risky simply to leave the function in.

Even though it doesn’t do anything except fail.

0 comments

Discussion is closed.

Feedback usabilla icon