Heap Error Occurs in Setupapi.dll During Debug (277798)



The information in this article applies to:

  • Microsoft Windows 2000 Server SP1
  • Microsoft Windows 2000 Advanced Server SP1
  • Microsoft Windows 2000 Professional SP1

This article was previously published under Q277798
IMPORTANT: This article contains information about modifying the registry. Before you modify the registry, make sure to back it up and make sure that you understand how to restore the registry if a problem occurs. For information about how to back up, restore, and edit the registry, click the following article number to view the article in the Microsoft Knowledge Base:

256986 Description of the Microsoft Windows Registry

SYMPTOMS

When you debug a Microsoft Visual C++ application in Microsoft Visual Studio on Windows 2000 with Service Pack 1, you may receive an error message that resembles the following:
Error: Heap block at 0xnnnnnnnn modified at 0xnnnnnnnn past required size of 0xnnnn
Alternatively, you may receive the following error message
user breakpoint hit in...
followed by a hexdecimal code. In the Visual C++ disassembly window, Int 3 (breakpoint interrupt) is shown as the current instruction.

CAUSE

This is due to a bug in Service Pack 1. When the path given in the following registry key

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion

for the DevicePath value is longer than MaxPath, the buffer size is recalculated incorrectly, and, when the string is written, it trespasses beyond the buffer. The debug heap detects this overrun and generates the error message.

RESOLUTION

Install the available hotfix. For additional information, click the article number below to view the article in the Microsoft Knowledge Base:

275918 Problems with Winsock Programs After Applying Windows 2000 SP1

WORKAROUND

To work around this problem, either uninstall Service Pack 1 or install Windows 2000 Service Pack 2.

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.

This problem was corrected in Windows 2000 Service Pack 2.

MORE INFORMATION

To determine if this is the problem, follow these steps:

WARNING: If you use Registry Editor incorrectly, you may cause serious problems that may require you to reinstall your operating system. Microsoft cannot guarantee that you can solve problems that result from using Registry Editor incorrectly. Use Registry Editor at your own risk.
  1. Check the following registry key:

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\DevicePath

  2. Save the existing registry entry and reduce the DevicePath value to %system32%\inf.
  3. Restart the computer.
  4. Repeat the test. If the problem no longer occurs, it is due to the bug that is described in the "Cause" section.

Modification Type:MajorLast Reviewed:2/11/2004
Keywords:kbDSWNET2003Swept kbbug kbpending KB277798