Tools, etc...


Here are some free utilities I've developed that you may find useful. If you have any questions or problems, send me e-mail..

LockWorkStation This utility calls the Windows LockWorkStation function, which is the same thing that pressing the <WINDOWS>-L keyboard combination does. Useful on systems (like some laptops) that don't have a <WINDOWS> key.
App Pool Dump Script

This script (intended for use on Windows 2003 Server) uses WMI to enumerate the set of running instances of w3wp.exe and, for each, displays which app pool that copy of w3wp.exe is hosting and the corresponding w3wp.exe process ID.

Here's what the output looks like:

C:\>apdump
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

QuickStartV20AppPool (2860)
MSSharePointAppPool (3268)
DefaultAppPool (3652)

Click here to view the source or here to download the script.

App Pool Debug Script

Based on the apdump script above, this script (also intended for use on Windows 2003 Server) uses WMI to enumerate the set of running instances of w3wp.exe and, for each, displays which app pool that copy of w3wp.exe is hosting. But this script then launches the VS.NET JIT debugger with a command line that instructs it to attach to the instance of w3wp.exe that's hosting the app pool you'd like to debug (the name of which is passed as a command line argument to this script).

Here's what the output looks like when you specify the name of an app pool that's not active:

C:\>apdebug NoSuchAppPool
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

Active app pools...
  QuickStartV20AppPool (2860)
  MSSharePointAppPool (3268)
  DefaultAppPool (3652)

The app pool specified (NoSuchAppPool) is not running.

And here's what the output looks like when you specify an active app pool name:

C:\>apdebug QuickStartV20AppPool
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

Active app pools...
  QuickStartV20AppPool (2860)
  MSSharePointAppPool (3268)
  DefaultAppPool (3652)

Launching debugger for 'QuickStartV20AppPool' (2860)...

On staging servers where I tend to do nothing but debug a particular service or app, I stick a shortcut on the desktop that runs the script with the name of the target app pool ready to go.

Click here to view the source or here to download the script.

EatMIPS - CPU Stress Testing Utility This little utility provides a simple slider-bar based user interface for consuming an arbitrary amount of the available processor cycles. The utility automatically detects the number of processors installed on the target system and creates an identical # of MIPS eating threads to ensure that the specified percentage of the total available CPU cycles are being consumed; not just the specified percentage of one processor.

Notes: The prebuilt binary requires the VS.NET runtime libraries on the target system, but the VS.NET and VC6 project files are included along with the source so that you can build the utility to suit.
Visual DbgPak Updated 8/10/2000. This is the graphical version of the above DbgPak utility. Version 1.0.0.178 accomodates much longer directory structures internally and has a couple of cosmetic updates to it. Thanks to Jason Whittington (a fellow DevelopMentor guy) for suggesting the LVS_EX_FULLROWSELECT style bit for my list view. Not being a user interface guy, I never would have run across that if it hadn't been pointed out.

Platform(s) Supported: Windows NT 4, Windows 2000 (version 1.0.0.158 and newer).
Notes: Requires administrator privileges to operate. This utility also requires the Unicode version of MFC (MFC42U.DLL). If you don't already have that DLL, or you have an older version, you can download it here.

CleanVC Updated 6/12/99. Now works with UNC directory paths and directory names containing spaces and supports an optional "pause" command. This utility integrates into the NT shell to provide a "Clean VC Here" option on the context menus for folders in the Windows explorer. It recursively deletes Visual C++'s intermediate output files (*.obj, *.pch, etc) as well as directories named "debug" or "release.". This is a self-extracting archive that installs itself when run. Uninstall capability is provided via the "Add/Remove Programs" control panel applet. Exactly what files and directories are removed are specified in an NT command script, so you can customize the utility to suit your needs. For more details on how to use or customize CleanVC (including how to enable the "pause" option), download CleanVC.txt.

Platform(s) Supported: Windows NT 4, Windows 2000.
Notes: CleanVC.txt

BuildNum Version 2.0.0.189, updated 8/29/2001. This handy little Add-In for Visual C++ 6.0 will automatically increment a build number for your project. Every time you perform a build from the DevStudio IDE, BuildNum increments a build number in a header file that you can include in your code and will optionally put the new build number in your VERSIONINFO resource record. BuildNum is freeware.

As an Add-In, it operates in the background automatically and can be enabled or disabled, and configured, on a project-by-project basis. Once you enable BuildNum for a specific project, you don't have to do anything manually - it automatically updates the build number header file and your VERSIONINFO recourse each time you build that project.

Changes to 8/29/2001 upload (version 2.0.0.189): BuildNum now first looks for and updates a VERSIONINFO resource in the following prioritized list of places:

  1. <ProjectDir>\res\<ProjectName>.rc2
  2. <ProjectDir>\<ProjectName>.rc2
  3. <ProjectDir>\<ProjectName>.rc
This allows you to relocate your VERSIONINFO resource to an RC2 file that you don't normally have opened in the VC editor, eliminating the annoying message boxes you would previously get from DevStudio after each build when BuildNum modified the .RC file you were working on in the editor.

Platform(s) Supported: Any platform supported by Visual C++ 5.0 or 6.0.
Notes: none.

Running Process Command Line Utility Displays the command line for any running process on Windows NT. Unzip to any directory on your machine (just keep all 3 files together).

Usage is:
cmdline ProcessID

Example:
c:\> cmdline 444
c:\winnt\system32\svchost -k rpcss

Platform(s) Supported: Windows NT 4, Windows 2000.
Notes: Requires administrator privileges to operate.
Source: click here.

Win2k Hard Link
Hard Link Source
September 18, 1999 (version 1.0.0.48). This shell extension takes advantage of the new CreateHardLink function under Windows 2000. Once installed, you can right click in a directory under the Explorer and select New on the context menu, followed by Hard Link. A dialog will be presented asking you to enter the link file name and the target file the link should refer to.

This feature is only available on volumes formatted with the NTFS file system version 5.0 (or greater) that is used by Windows 2000.

Unlike shortcuts, hard links are first class citizens in NTFS. A hard link is just an alias filename for a file on disk. Any change to the hard link is reflected in the original target file that the link refers to. This includes changes to the contents of the file, as well as attributes of the file (like read-only, etc). You delete a link just like you would delete any file in the file system. Only when the last link to a file has been deleted (including the "original" file name) is the underlying file object removed from the volume.

To install this utility, download the EXE file to any location on your hard drive, and then execute "HardLink /regserver".

To uninstall this utility, execute "HardLink /unregserver", then manually delete the EXE file from your hard drive.

Version 1.0.0.46 (or newer) supports both the shell interface (right click in a directory, select New/Hard Link) as well as a command-line interface that can be invoked directory from a command prompt or command script. Command line syntax is HardLink.exe /l:linkfilename /t:targetfilename. Where linkfilename is the hard link alias to create and targetfilename is the existing file on disk the link should refer to.

Platform(s) Supported: Windows 2000.
Notes: Requires volume(s) to be formatted with NTFS 5.

Find Links Utility
Find Links Source
Utility that takes a given file and searches for all links to that file. Since there is no visual feedback on a file's Explorer property page, an exhaustive search of the file system has to be made. This utility allows you to reduce the scope of the search.

Platform(s) Supported: Windows NT 4, Windows 2000.
Notes: Require volume(s) to be formatted with NTFS.

Batch Link Utility
Batch Link Source
Allows you to create a hard link in the current directory to every file in a specified directory. Useful for developers that want to create "local aliases" for header files in other locations without making a copy of the files, which increases disk usage and creates a maintenance problem.

Platform(s) Supported: Windows 2000.
Notes: Requires volume(s) to be formatted with NTFS 5.

GotoRelatedSrc This DevStudio macro opens the .h or .cpp file that corresponds with the currently opened source file name. So if you're currently editing foo.h, executing this macro opens foo.cpp, and vice-versa. I like to assign CTRL-SHIFT-H to this macro ala CTRL-SHIFT-G, which opens the file based on the string beneath the cursor.

Copyright (c) 1998-1999 Mike Woodring.
Last revised: July 11, 2000.