Setting a Breakpoint on a Windows API Function

Last reviewed: July 17, 1997
Article ID: Q92988
4.00 4.01 4.10 WINDOWS kbtool

The information in this article applies to:

  • Microsoft CodeView for Windows, versions 4.0, 4.01, and 4.1

During the process of debugging an application with CodeView for Windows, it is sometimes helpful to set a breakpoint on a Windows API. The text below details the required steps to set a breakpoint:

  1. Run the N2D.BAT file in the BIN directory (by default, WINDEV\BIN or C700\BIN) to activate the Windows debugging kernel.

  2. Run the CVPACK utility on the GDI.EXE, KRNL286.EXE, KRNL386.EXE, and USER.EXE files in the WINDOWS\SYSTEM directory. Running the utility allows CVW to access the public symbols in these files.

  3. Start Windows and load CodeView for Windows (CVW).

  4. Load the application into CVW.

  5. In the CVW Command window, enter the following command:

          bp <FUNCTION_NAME>
    

    where <FUNCTION_NAME> is the name of the function to break on. For example, bp GETMESSAGE.

    NOTE: The name of the function must be in uppercase letters because each Windows API is called using the Pascal calling convention. Also, CVW version 4.0 hangs Windows if you set a breakpoint on an API function that CVW calls. This problem is fixed in CVW version 4.01.

  6. When CVW halts execution, access the Calls menu. Function names in the menu are ordered from the function called least recently at the bottom of the menu to the function with the breakpoint at the top of the menu. Therefore, the second function from the top of the menu is the function that called the API function on which the breakpoint is set.

If you are using Windows for Workgroups 3.11, the debug kernel files that Visual C++ 1.5 comes with do not have symbols. Because USER, GDI, and KRNL386 have not changed since Windows 3.1, you should use the Windows 3.1 versions of these files. Visual C++ 1.0 has the Windows 3.1 debug kernel.


Additional reference words: kbinf kbinf 4.00 4.10
KBCategory: kbtool
KBSubcategory: CvwIss
Keywords : kb16bitonly


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: July 17, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.