Windows\WMI\Mofcomp fails with error 0X8004400c


Symptoms


MofComp fails with error SYNTAX 0X8004400c: Expected property or method name.

Cause


This error can occur if you are trying to add a dynamic entry for a property name that contains special characters such as parenthesis or brackets.  For example, if you are using the registry provider to populate a WMI property based on a DWORD registry value named "Test(minimum)", MOFComp will fail with the error above.

Resolution


To allow MOFComp to successfully process the MOF, edit the MOF to escape the opening and closing parenthesis using a carat character ("^", shift-6 on an US-English keyboard).  Note that you cannot use the backslash as an escape character for this sequence as you can for other special characters.

Example:

BAD:

 

[DYNPROPS]
Class Assignment_64
{
[key] string KeyName;
Uint32 GPSiteAssignmentRetryDuration(Hour);
};
 
[DYNPROPS]
Instance of Assignment_64
{
KeyName="RegKeyToMOF_64";
//below is one line, may wrap
[PropertyContext("Local|HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\SMS\\Mobile Client|GPSiteAssignmentRetryDuration(Hour)"),Dynamic,Provider("RegPropProv")] GPSiteAssignmentRetryDurationHour;
};            

 

GOOD:

 

[DYNPROPS]
Class Assignment_64
{
Uint32 GPSiteAssignmentRetryDurationHour;
};
 
[DYNPROPS]
Instance of Assignment_64
{
KeyName="RegKeyToMOF_64";
//below is one line, may wrap
[PropertyContext("Local|HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\SMS\\Mobile Client|GPSiteAssignmentRetryDuration^(Hour^)"),Dynamic,Provider("RegPropProv")] GPSiteAssignmentRetryDurationHour;
};

More Information


 

MOF property names must be alphanumeric or underscore only:  http://msdn.microsoft.com/en-us/library/aa394554(VS.85).aspx.  This means that there must be a disconnect between the property name and the registry key it derives from.  In the example above, the registry value GPSiteAssignmentRetryDuration(Hour) becomes GPSiteAssignmentRetryDurationHour.

The backslash character (\) is the escape sequence for most queries and paths.  For characters such as the backslash and quotes, it must be used.

The carat character (^) is the escape sequence for instances of classes and other derived data.  There are other special characters, such as curly brackets ({}) can also use this escape sequence. \( and \) are not legal.

MOFComp will not throw an error on an unescaped character.  It simply reports a null value.  This is by design.

Common errors:

 

1. Illegal character in the property name results in this error:

 

C:\temp>mofcomp foo3.mof
Microsoft (R) MOF Compiler Version 6.1.7600.16385
Copyright (c) Microsoft Corp. 1997-2006. All rights reserved.
Parsing MOF file: foo3.mof
foo3.mof (12): error SYNTAX 0X8004400c: Expected property or method name
 
Compiler returned error 0x8004400c
 
*** Line 12 = Uint32 GPSiteAssignmentRetryInterval(Min);
 

2.  An illegal character in the instance properties throws this error:

 

C:\temp>mofcomp foo3.mof
Microsoft (R) MOF Compiler Version 6.1.7600.16385
Copyright (c) Microsoft Corp. 1997-2006. All rights reserved.
Parsing MOF file: foo3.mof
foo3.mof (26): error SYNTAX 0X80044002: Expected semicolon or '='
 
Compiler returned error 0x80044002

 

*** Line 26 = [PropertyContext("Local|HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\SMS\\Mobile Client|GPSiteAssignmentRetryInterval^(Min^)"),Dynamic,Provider("RegPropProv")] GPSiteAssignmentRetryInterval(Min);
 

3.  Attempting to use backslash rather than a carat results in this error

 

C:\temp>mofcomp foo3.mof
Microsoft (R) MOF Compiler Version 6.1.7600.16385
Copyright (c) Microsoft Corp. 1997-2006. All rights reserved.
Parsing MOF file: foo3.mof
foo3.mof (26): error SYNTAX 0X80044007: Illegal constant value. (Numeric value out of range or strings without quotes)
 
Compiler returned error 0x80044007
 
*** Line 26 = [PropertyContext("Local|HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\SMS\\Mobile Client|GPSiteAssignmentRetryInterval\(Min\)"),Dynamic,Provider("RegPropProv")] GPSiteAssignmentRetryIntervalMin;