January 31, 2001

By Karen Kenworthy

IN THIS ISSUE

A lot of folks have written about the new Computer Profiler since its debut a few weeks ago. Most of you reported that this little program does a good job of discovering information about a PC. Its list of over 100 details about your computer's configuration and capabilities has been interesting. Some of you have even found it useful.

But a few folks have told me about Profiler's habit of displaying misinformation. In a few cases, it has misidentified the type of CPU found inside some computers. In other cases, the Profiler has said that a computer is attached to a network when it isn't. The program has even miscounted the number of buttons on a person's mouse.

Why does this happen? Why does the Profiler work perfectly most of the time, but occasionally return incorrect information, seemingly at random? To see why, let's first take a look at how the Profiler works.

Under The Hood

In almost all cases, the information the Profiler displays comes straight from Windows. Windows needs to know a lot about a computer's hardware, in order to perform its job. And of course, Windows knows everything there is to know about its own configuration. So it's a good place to go, if you want to learn about a PC.

Fortunately, Windows makes most of its store of information available to anyone, or any program, that asks. Several of Windows' built-in functions exist just for this purpose. For example, Windows' GetSystemMetrics function can return dozens of different measurements related to a computer, including screen size, the height of windows title bars, the size of icons, and more. It can also report the number of monitors attached to a PC, and even the number of buttons on the computer's mouse.

The Profiler makes extensive use of GetSystemMetrics, using it to obtain about twenty percent of the information it displays. The other Windows functions used by the program include:

GetSystemInfo (Details about the CPU)
GetSystemPowerStatus (Battery life and power source)
GlobalMemoryStatus (Information about virtual and physical memory)
EnumPorts (Port data)
GetLogicalDrives (Physical and network drives attached to this PC)
GetVolumeInformation (Information about each drive)
GetComputerName (The network name of this computer)
GetUserName (The login name of current user)
GetCurrentHwProfile (Name of current Hardware Profile)
GetTimeZoneInformation (TZ where computer resides, plus more)

Now you might think, since the Profiler relies on Windows for most of its information, that Windows is to blame for any mistakes. But like many parts of the world of computers, the explanation for the Profiler's mistakes isn't quite that simple.

The full explanation is a bit more complicated. In fact, it's really the answer to a larger question: Why does software lie?

Why Software Lies

Despite persistent rumors to the contrary, all the available scientific evidence indicates computer programmers are from planet earth. In short, they are human beings. And like other humans, they make mistakes.

I made a mistake in the original release of the Profiler, for example. I improperly decoded the bit pattern returned by the Windows function GetVersionEx. As a result, the Profiler mistakenly reported some Windows 98 installations as running Windows 95.

That misinformation was purely my fault. I simply misread the documentation provided by Microsoft. But sometimes there are extenuating circumstances. Sometimes, the human failing responsible for misinformation is really unavoidable.

Take, for instance, Windows' detection of your computer's CPU chip make and model. Most modern CPUs will reveal this information, if asked properly. But older CPUs do not.

Discovering details about these less forthcoming chips is a bit like the old children's game of "Twenty Questions." Windows starts with a long list of possible chip makes, models, and variations. It then asks the mystery chip to perform a certain type of calculation. If the result is correct, eliminates certain chips, and leaves others. Windows might then ask the CPU to store some data in a region of the chip called a Register, then ask the chip to retrieve that information. If the round trip through the chip leaves the data intact, another group of chips are eliminated, while others remain. This detective work continues until Windows eliminates all but one possible CPU chip.

The process sounds simple and foolproof, but it's not. What if one of Windows' tests eliminates all of the remaining possibilities? That leaves Windows with no suspects -- it has no idea what type of CPU chip is being used. It may be a new chip, released since this version of Windows was created. Or it may be a defect in the chip itself, causing it to fail in a way other types of chips normally misbehave. Whatever the reason, Windows, and the programmers who wrote it, are fooled.

Clone CPU chips add to the confusion, and possibility for error. These copies of other manufacturer's designs try their best to look and act exactly like the original. The better they do this job, the harder it is for programmers to create tests that accurately detect them.

Driver Dilemma

Suppose your company invents a new computer widget.

Now operating systems never talk directly to widgets. Oh no. Each widget must come with a small bit of software, called a driver. The driver knows how to talk to a particular make and model of widget. The driver also knows how to talk to Windows. So the driver becomes a sort of translator, sitting between Windows and the widget.

So before you can start selling your new widget, you must open a can of programmers, and order them to create a driver for your new device. Off they go, to their dark little cubicles, ready to warm themselves by the soft glow from their 21-inch monitors.

In no time at all, they are back. Not with a driver, but with a problem. When it starts, Windows routinely asks each widget attached to its computer how many knobs it has. Until now, no widget has every had more than two.

But your ground-breaking new widget will have three knobs. No one knows what Windows will do if a widget, through its driver, reports three knobs. Will it shrug its shoulders, record the information, and then get on with its other business? Or will it go into a rage, shouting "Three knobs! No widget has three knobs!" Perhaps it will receive the information, then wander aimlessly, addled by this unexpected news. Different version of Windows, past, present, and future might even react differently!

If Windows handles this information gracefully, what about the applications that run under Windows? How will they respond when told of the third knob? The possibilities are just as frightening, and even harder to foresee.

Clearly, none of your programmers want to be responsible for the consequences of reporting three knobs. And your marketing department isn't too crazy about it either. There are too many combinations of applications and flavors of Windows to test them all. What to do?

The answer is simple: The driver must lie.

To ensure the greatest possible compatibility with existing software, the "installed base," the driver must claim to have no more than two knobs. The special features, made possible by a third knob, must be implemented without forcing changes on other software. Someday the world may be safe for openly three-knobbed widgets, but not today.

This example may be fanciful, but it does illustrate the dilemma faced every day by software authors. In fact, if you replace "widget" with mouse, and "knob" with "button" you'll have a real-life example of the driver dilemma. To this day, if you call Windows' GetSystemMetrics function and ask how many buttons are on a mouse, its answer will be no more than two.

How to innovate, without upsetting the installed base of software around the world? In many cases, the solution is to appear like older, proven drivers and other software. Add new features in unconventional ways. This approach solves one problem, backwards compatibility, but creates another. By resorting to deception and trickery, software becomes more elaborate and fragile.

White Lies

Other software lies are completely benign. All parties agree in advance to the deception, and expect it. In fact, these lies are necessary. Without them most PCs wouldn't function.

One of these lies is called the HAL or Hardware Abstraction Layer. A part of Windows NT and Windows 2000, this software can be thought of as a driver for the motherboard. It hides all the details of motherboard circuits such as the Programmable Interrupt Controller (PIC), access to adapter card busses, even the behavior of multiple CPUs. The HAL makes your particular motherboard to be a generic, single-processor CPU, regardless of its actually circuitry, allowing Windows to work with different motherboard designs.

Many sound cards also tell a little white lie. While each manufacturer uses different circuits and provides different features, most cards today can emulate an older card called the SoundBlaster. Made by Creative Labs, the SoundBlaster card was the first widely popular sound card for PCs, and much software was written just for it.

To compete, other manufacturers, and even Creative Labs itself, added SoundBlaster compatibility to all their future products. Through a combination of hardware and driver software, these boards told the lie that they were actually good, old SoundBlasters. By this ruse, they are able to fool software that will work with SoundBlasters and nothing else, while also providing advanced features to more open-minded programs.

A recent survey rated computer programmers as the most trusted and admired profession. True, I only asked a couple of programmer friends, and my Mom. But I'm pretty sure the survey is accurate. Either way, I hope these discussions of software shortcomings don't leave you disillusioned.

Instead, they should make us all realize the amazing intricacy of these electronic parts of our lives. They are truly among the most complex inventions ever conceived by the mind of man. The miracle isn't that computers don't work perfectly. It's that they work at all. :)

While you ponder this, if you'd like to try Profiler 1.4, visit the program's home page, https://www.karenware.com/powertools/ptprofile. There you can download the program, and its Visual Basic source code too. As always, they're both free.

I'll spend the next week trying to think more deep thoughts for our next meeting. And I'll spend some fun time, cruising around the 'net. If you catch me doing either, be sure to wave and say "Hi!"

YouTube button
Downloads Today: 62
More than 6000 downloads monthly
Received $60.87 this month* — Thanks!

License for Work

A license is required to use any or all of these tools for your work. You only need one per lifetime. If you make money with Karen's software, read her license agreement.

License for Work $25

Donations + Other Ways

Power Tools Newsletter

November 1st, 2023:

  • What is Karen's QR Code Talker?
  • What is a QR code?
  • What is a Code Talker?

List of All Issues since '99

24835 Verified Subscribers

Subscribe to receive new issues of the newsletter about Karen and her free Power Tools.

Click here to Subscribe

November Revenue* $60.87
*Licenses + Donations - PayPal Fees
Oct $211 Sep $166 Aug $173 Jul $225 Jun $324 May $200 Apr $700 Mar $273 Feb $405 Jan $56 (2023) Dec $349 Nov $546 Oct $253 Sep $232 Aug $189 Jul $379 Jun $188 May $484 Apr $212 Mar $519 Feb $89 Jan $462 (2022) Dec $1088 Nov $151 Oct $133 USD — Thanks again!