In MOF, numbers are digits that describe numerical values. MOF provides a variety of data types that translate into Automation, and also allows those numbers to be in different formats. The following table lists the numeric values that MOF supports.

Data typeAutomation typeDescription

Signed 8-bit integer.


Signed 16-bit integer.


Signed 32-bit integer.


Signed 64-bit integer in string form. This type follows hexadecimal or decimal format according to the American National Standards Institute (ANSI) C rules.


4-byte floating-point value that follows the Institute of Electrical and Electronics Engineers, Inc. (IEEE) standard.


8-byte floating-point value that follows the IEEE standard.


Unsigned 8-bit integer.


Unsigned 16-bit integer.


Unsigned 32-bit integer.


Unsigned 64-bit integer in string form. This type follows hexadecimal or decimal format according to ANSI C rules.


Although flexible, MOF code does encounter some changes when dealing with Automation:

  • You must encode 64-bit integers as strings.

    Automation does not support a 64-bit integral type.

  • Automation types do not always correspond in bit size to MOF data types.

    For example, Automation uses VT_I4 to return an unsigned 16-bit value. This discrepancy exists because of sign-extension problems. If Automation used VT_I2 instead of VT_I4, 65,536 would appear to be the value –1, causing type and range problems. Similarly, Automation represents the uint32 type as VT_I4 because there exists no larger integer type to contain uint32.

  • You do not need to change any representation for 8-bit numeral types.

    Automation supports VT_UI1, an unsigned 8-bit type.

MOF supports long constants. You declare a long constant using a simple series of digits with an optional negative sign. A long constant cannot exceed the size of the variable that is declared to hold it. Some examples of long constants are 1000 and –12310.

MOF also supports alternate numerical formats. The following table lists the special characters you must use to describe hexadecimal, binary, and octal constants.

ConstantSpecial characterExample



val = 65


0x prefix

val = 0x41


Leading 0

val = 0101


Trailing B

val = 1000001B


You can use a floating-point constant to represent scientific notation as well as fractions, as shown next:


WMI considers floating-point constants as VT_R8 types for Automation.

The following example describes class and instance declarations that illustrate how to use each of the numeric data types to set properties:

Class NumericDataClass
   [key] uint8 Duint8;
   SInt8       Dchar;
   UInt16      Dtword;
   Sint16      Dinst16;
   UInt32      Ddword;
   Sint32      Dinst1;
   Sint32      Dinst2;
   Sint32      Dinst3;
   Sint32      Dinst4;
   Sint32      Dinst5;
   Real32      Dfloat;
   Real64      Ddouble1;
   Real64      Ddouble2;

instance of NumericDataClass
   Duint8   =  122;
   Dchar    = -128;
   Dtword   =  30;
   Dinst16  = -1445;
   Ddword   =  6987777;
   Dinst1   = -455589;
   Dinst2   =  23;
   Dinst3   =  03;         // Base 8
   Dinst4   =  0xFe;       // Base 16
   Dinst5   =  11b;        // Base 2
   Dfloat   =  3.1478;
   Ddouble1 =  99987.3654;
   Ddouble2 =  2.3e-2;