A customer reported an incompatibility in Windows 7: If A: is a floppy drive and they call LoadLibrary("A:\\foo.dll")
and there is no disk in the drive, the LoadLibrary
call fails with the error ERROR_NOT_READY
. Previous versions of Windows failed with the error ERROR_MOD_NOT_FOUND
.
Both error codes are reasonable responses to the situation. “The module couldn’t be found because the drive is not ready.” Programs should treat a failed LoadLibrary
as a failed library load and shouldn’t be sensitive to the precise reason for the error. (They can display a more specific error to the user based on the error code, but overall program logic shouldn’t depend on the error code.)
Fortunately, the customer discovered this discrepancy during their pre-release testing and were able to accommodate this change in their program before ever releasing it. A sigh of relief from the application compatibility team.
February 3rd, 2012
The compatibility constraints of error codes, episode 2
Category
Topics
Author
Raymond has been involved in the evolution of Windows for more than 30 years. In 2003, he began a Web site known as The Old New Thing which has grown in popularity far beyond his wildest imagination, a development which still gives him the heebie-jeebies. The Web site spawned a book, coincidentally also titled The Old New Thing (Addison Wesley 2007). He occasionally appears on the Windows Dev Docs Twitter account to tell stories which convey no useful information.
0 comments