FIX: SNMP Sample Generates an Application Error

Last reviewed: October 29, 1997
Article ID: Q124961
3.50 WINDOWS NT kbnetwork kbnetwork kbfixlist kbbuglist

The information in this article applies to:

  • Microsoft Win32 Software Development Kit (SDK) version 3.5

SYMPTOMS

The Win32 SDK for Windows NT 3.5 contains a SNMP sample called SNMPUTIL (\MSTOOLS\SAMPLES\WIN32\SNMP\SNMPUTIL). Building this sample generates an executable file that causes an access violation. The message box displayed resembles the following:

                     snmputil.exe - Application Error
   -----------------------------------------------------------------
   The instruction at <address> referenced memory at <address>.  The
   memory could not be "read".

CAUSE

One part of the SNMP run times uses the C run-time routines provided by CRTDLL.DLL. The other part of the SNMP run times uses the C run-time routines that the application uses. Because many people are using Visual C++ to build the samples, the run time routines used are in MSVCRT20.DLL. The access violation occurs when memory allocated using one run time version are freed using a different copy of the run time library.

RESOLUTION

One possible solution is to build the sample application using the CRTDLL.DLL version of the run time library. If you are using the makefile supplied with the Win32 SDK, one way to accomplish this is to:

  1. Copy NTWIN32.MAK from your include directory to the working directory for the sample.
2. Change all references to MSVCRT.LIB in NTWIN32.MAK to CRTDLL.LIB.

If you are using a Visual C++ make file, you can:

  1. Select the "Ignore All Default Libraries" check box in the Linker Project Settings property page.
2. Add CRTDLL.LIB to the "Object/Library Modules" section in the Linker
   Project Settings property page.

NOTE: CRTDLL.LIB does not ship with Visual C++. You can get the CRTDLL.LIB file from the Win32 SDK in the \MSTOOLS\LIB\CRT\<PLATFORM> directory, where <PLATFORM> would be replaced with the type of machine you are using (I386, alpha, and so forth).

If you are using MFC 3.0, you will not be able to use CRTDLL.DLL because MFC 3.0 uses some functions that are not supplied in CRTDLL.DLL.

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products listed at the beginning of this article. This problem was corrected in the Win32 SDK version 3.51.


Additional reference words: 3.50
KBCategory: kbnetwork kbnetwork kbfixlist kbbuglist
KBSubcategory: NtwkSnmp
Solution Type : kbfix


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: October 29, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.