Debugging with the Shell - Win32 apps (2024)

  • Article

This topic explains how to debug Shell and namespace extension DLLs.

  • Running the Shell Under a Debugger
  • Running and Testing Shell Extensions
  • Unloading the DLL

Running the Shell Under a Debugger

To debug your extension, you need to run the Shell from the debugger. Follow these steps:

  1. Load the extension's project into the debugger, but do not run it.

  2. Shut down the Shell.

    • For WindowsVista and later:
      1. Display the Start menu.
      2. Press CTRL+SHIFT and right-click on the background of the right half of the Start menu.
      3. From the menu that appears, choose Exit Explorer.
    • For WindowsXP:
      1. From the Start menu, choose Shut down.
      2. Press CTRL+ALT+SHIFT, and click No in the Shut Down Windows dialog box.

    The Shell is now shut down, but all other applications are still running, including the debugger.

  3. Set the debugger to run the extension DLL with Explorer.exe from the Windows directory.

  4. Run the project from the debugger. The Shell will launch as usual, but the debugger will be attached to the Shell's process.

Running and Testing Shell Extensions

You can run and test your extensions in a separate Windows Explorer process to avoid stopping and restarting the desktop and taskbar. Your desktop and taskbar can still be used while you run and test the extensions.

To enable this feature, add the following REG_DWORD entry to the registry.

HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionExplorerDesktopProcess = 1

For this entry to take effect, you must log off and log on again. This setting causes the desktop and taskbar windows to be created in one Explorer.exe process and all other Explorer and folder windows to be opened in a different Explorer.exe process.

In addition to making the running and testing of your extensions more convenient, this setting also makes the desktop more robust as it relates to Shell extensions. Many such extensions (shortcut menu extensions, for example) will be loaded into the nondesktop Explorer.exe process. If this process terminates, the desktop and taskbar will be unaffected, and the next Explorer or folder window will re-create the terminated process.

Unloading the DLL

The Shell automatically unloads any DLL when its usage count is zero, but only after the DLL has not been used for a period of time. This inactive period might be unacceptably long at times, especially when a Shell extension DLL is being debugged. You can shorten the inactive period by adding the following information to the registry.

HKEY_LOCAL_MACHINESoftwareMicrosoftWindowsCurrentVersionExplorerAlwaysUnloadDll
Debugging with the Shell - Win32 apps (2024)

FAQs

Debugging with the Shell - Win32 apps? ›

Debugging means to run your code step by step in a debugging tool like Visual Studio, to find the exact point where you made a programming mistake. You then understand what corrections you need to make in your code and debugging tools often allow you to make temporary changes so you can continue running the program.

How do I debug a Windows application? ›

To get started with Windows debugging, complete the following steps.
  1. Identify the host and target systems. ...
  2. Determine the debugger type: kernel mode or user mode. ...
  3. Choose your debugger environment. ...
  4. Determine how to connect the target and host. ...
  5. Choose either 32-bit or 64-bit debugging tools. ...
  6. Configure symbols.
Dec 20, 2023

What does debugging mode do? ›

Debugging means to run your code step by step in a debugging tool like Visual Studio, to find the exact point where you made a programming mistake. You then understand what corrections you need to make in your code and debugging tools often allow you to make temporary changes so you can continue running the program.

What is debugging in Windows? ›

For example, you might debug by scanning your code looking for typos, or by using a code analyzer. You might debug code by using a performance profiler. Or, you might debug by using a debugger. A debugger is a very specialized developer tool that attaches to your running app and allows you to inspect your code.

How do I enable debugging mode in Windows 10? ›

(Press Windows key+R, and then type cmd.exe in the Run dialog box.) The six additional choices on the Startup Settings menu are of use in specialized circ*mstances: Enable Debugging. This choice starts Windows in kernel debug mode and requires a physical connection to another computer running a debugger.

How do I run an exe file in debug mode? ›

Navigate to the .exe file, select it, and select Open. The file appears as a new project under the current solution. With the new file selected, start debugging the app by selecting an execution command, like Start Debugging, from the Debug menu.

Is debugging a good thing? ›

Debugging is an important part of determining why an operating system, application or program is misbehaving. Even if developers use the same coding standard, it's still likely that a new software program will still have bugs.

When and why would you use debugging? ›

Debugging is the process of finding and resolving coding errors or “bugs” in a software program. Bugs (logical errors, runtime errors, syntax errors and others) can lead to crashes, incorrect or inaccurate outputs, security vulnerabilities, data loss and more.

How to debugging code? ›

Use the values of sample input for which the code fails and try to write the execution of the code on paper and update the values of variables for each iteration according to the conditions in the code and you can identify where the code is given unexpected output and then you can proceed to debug the code.

What is debugging in computer security? ›

Debugging is the identification and resolution of existing and potential issues in software or hardware. Examples of these issues include faulty code (such as source code with logic errors) and manufacturing defects. The debugging process typically involves three steps: Identifying bugs.

What key is used to enable debugging? ›

In this article
KeysMenu equivalent
F5Debug | Go
Shift+F5Debug | Stop Debugging
Ctrl+Shift+F5Debug | Restart
F6File | Attach to a Process
56 more rows
Mar 8, 2023

What happens with USB debugging? ›

USB Debugging allows you to setup communication between your Smartphone and Desktop Phone Manager i.e. you can easily synchronize with the Computer data and its contents.

How do I enable remote debugging? ›

Set up the remote debugger
  1. On the remote computer, find and start the Remote Debugger from the Start menu. ...
  2. The first time you start the remote debugger (or before you have configured it), the Remote Debugging Configuration wizard appears. ...
  3. Select at least one network type you want to use the remote tools on.
Jan 19, 2024

What does enable debugging do in startup settings? ›

Enable debugging

Starts Windows in an advanced troubleshooting mode intended for IT pros and system admins.

Does Windows have a debugger? ›

Debugging Tools for Windows is included in the Windows Driver Kit (WDK). To get the WDK, see Download the Windows Driver Kit (WDK). Debugging Tools for Windows is included in the Windows Software Development Kit (SDK). To download the installer or an ISO image, see Windows SDK on Windows Dev Center.

How do I enable debug logs in an application? ›

By default ERROR , WARN and INFO level messages are logged. You can also enable a “debug” mode by starting your application with a --debug flag. you can also specify debug=true in your application.

How do I debug a program running in the background? ›

Select the process -> click Program/Session -> Program -> Debugging. In debug mode, just change the value of lv_counter to something else and now, you are able to debug your dynamically called program in background.

How do I debug a web application? ›

  1. 1 Understand your web application architecture. ...
  2. 2 Use the browser developer tools. ...
  3. 3 Use a code editor or an IDE with debugging features. ...
  4. 4 Use a logging framework or a tool. ...
  5. 5 Use a testing framework or a tool. ...
  6. 6 Use a debugging methodology or a process. ...
  7. 7 Here's what else to consider.
Sep 20, 2023

Top Articles
Latest Posts
Article information

Author: Rubie Ullrich

Last Updated:

Views: 5997

Rating: 4.1 / 5 (52 voted)

Reviews: 91% of readers found this page helpful

Author information

Name: Rubie Ullrich

Birthday: 1998-02-02

Address: 743 Stoltenberg Center, Genovevaville, NJ 59925-3119

Phone: +2202978377583

Job: Administration Engineer

Hobby: Surfing, Sailing, Listening to music, Web surfing, Kitesurfing, Geocaching, Backpacking

Introduction: My name is Rubie Ullrich, I am a enthusiastic, perfect, tender, vivacious, talented, famous, delightful person who loves writing and wants to share my knowledge and understanding with you.