Erratic Ramblings

torsdag 19. juni 2008

Two tiny tools you're missing

If you've ever used the command line on a Unix or Linux computer, you know the text processing commands available are incredibly powerful.

UnxUtils is one of many port of the Unix command line tools to Windows. However, it has two additional tools which make the others tools a lot more useful in a Windows environment. They're called pclip and gclip.

pclip pastes the text on the Windows clipboard to standard output.
gclip puts text piped to it and puts it on the Windows clipboard.

For instance,
dir /b *.dll | pclip
will put the filenames of all dlls in the current folder on the clipboard, so you can paste them into Excel. That's a lot easier than marking and copying the text in the command prompt Window.

Another example is,
cat file.txt | pclip
which will put the entire content of file.txt on the clipboard, while
gclip | sort | uniq | pclip
will remove all duplicated lines from the text on the clipboard (and, I admit, as a side-effect sort the lines as well).

The search and replace functionality of text editors is a lot easier to use than commands like grep and sed, but sometimes things that should've been easy in editors just isn't. In those cases, the command line can be easier. Just press CTRL-A, CTRL-C to get the text on the clipboard, do you're (p|g)clip magic on the command line, and press CTRL-P to paste the result back in the editor. It even works well with data in Excel (but not cells with formulas, obviously).

As a bonus, UnxUtils are native Win32 builds of the tools. No cygwin, and no Posix subsystem required.

These tools really belong in your %PATH%.

onsdag 18. juni 2008

The case of a broken Windows DVD Maker

The problem

One of the nice gems in Windows Vista is the Windows DVD maker, which is incredibly easy to use. Except when it doesn't work that is.

On one of my two home computers the burning process stopped at 0.2% with the error message

"Invalid class string"

Great.


The solution

Since you're probably googling for the solution, I'll tell you now. On my computer, two registry keys had to be deleted:

HKEY_CLASSES_ROOT\CLSID\{083863F1-70DE-11D0-BD40-00A0C911CE86}\Instance\{79D28B7F-A6BD-49EF-8CEA-EA0E7791589E}
HKEY_CLASSES_ROOT\CLSID\{083863F1-70DE-11D0-BD40-00A0C911CE86}\Instance\{138130AF-A79B-45D5-B4AA-87697457BA87}

Remember to back up the keys first, either by exporting them in the registry editor, or by creating a restore point using System Restore).

If Nero stops working, restore them.

If Windows DVD Maker still doesn't work, read on to find out which keys to delete on your computer.


What's going on here?

I believe the keys are registrations of Nero codes. The first one is Nero Audio Processor and the latter is "Nero Digital Audio Decoder". Both are found under a key called "ActiveMovie Filter Class Manager".

Unfortunately, they're not really installed.

Windows DVD Maker apparently loads the codecs during the first .2% of the burn process. However, although still listed in the system, they've been uninstalled, and Windows DVD maker fails as a result of that.

The root cause is probably the Nero uninstaller not correctly removing the codecs from the system.


How could you tell which keys to delete?

Googling the error message really just returned one suggestion for mending the program, but apparently copied to a million sites on the Internet. Adding host:microsoft.com to the search returned the same answer, but probably the original posting.

The error message "Invalid class string" indicates that the program is trying to create a COM object by passing a GUID (you know, like {1B544C20-FD0B-11CE-8C63-00AA0044B51E}) to the operating system. Windows will then look in the registry under HKEY_CLASSES_ROOT\Clsid\{1B544C20-FD0B-11CE-8C63-00AA0044B51E} for information on which dll to load.

In the case of Windows DVD Maker, this failed for some unknown GUID.

Luckily, Process Monitor can tell you what key it is. Filter on "Process Name is DVDMaker.exe ,Include" and let it capture events while you're burning a DVD. When the burn process stops with the "Invalid class string" error message, look for a RegOpenKey operation at the end of the log on any key like HKCR\ClsId\{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} which FAILS.

On my computer, I first saw that DVDMaker.exe successfully read the

HKEY_CLASSES_ROOT\CLSID\{083863F1-70DE-11D0-BD40-00A0C911CE86}\Instance\{79D28B7F-A6BD-49EF-8CEA-EA0E7791589E}

key, but then failed to read the

HKEY_CLASSES_ROOT\CLSID\{79D28B7F-A6BD-49EF-8CEA-EA0E7791589E}

a couple of log lines later. If you look at the preceeding lines of the log, you can clearly a pattern being broken here.

Unfortunately, since Windows DVD Maker stops at the first error, you'll have to repeat process until all nonexisting codecs have been removed from the list.