Say I have the following script:

Option Explicit

Const HKEY_CLASSES_ROOT = &H80000000
Const REG_SZ = 1

Dim arrKeys, arrTypes

Dim oReg: Set oReg = GetObject("winmgmts:root/DEFAULT:StdRegProv")

oReg.EnumValues HKEY_CLASSES_ROOT, ".txt", arrKeys, arrTypes

Dim i, value

If Not IsNull(arrTypes) Then
For i = LBound(arrTypes) to UBound(arrTypes)
If arrTypes(i) = REG_SZ Then
oReg.GetStringValue HKEY_CLASSES_ROOT, ".txt", arrKeys(i), value
MsgBox value
End If
Next
End If

Using .txt, I get three popups. One for the default value name, one
for 'Content Type', and
one for 'PerceivedType'.

For .key, there's only one value name - the default one. It's valueis
regfile and is of type REG_SZ. Yet I get an error when the
abovescript runs on .key. My question is... why? Why would
EnumValues include the default value in its enumeration when the
default value isn't the only one while, at the same time, not
including the default value when it is the only one? Is there a work-
around?