David_Bennett

I am on the Windows Vista Parental controls team, working on the next version of windows and specifically the parental controls aspects of it. I worked on the web filter, and many other aspects of the system from the control panel up.

Using RatingSystem WMI in Parental Controls

Using RatingSystem WMI in Parental Controls

  • Comments 1
  • Likes

Windows Parental Controls exposes a RatingSystem class that can be used to find all the rating systems on the system as well as the name and all the ratings used inside the system.  This is what is used inside Windows Parental Controls to show the pretty pages where you select the rating system you want to use and also the places where you select what rating you want to allow up to inside the control panel.

To get the list of RatingSystems you need to enumerate all the rating systems using WMI.  The rating system has a bunch of information associated with it, including the ID, Type, LongName, ShortName, Description, WebAddress (web site for the rating system), LogoPath (Icon/logo for the rating system), LogoResourceID, LogoResourceType, Version.  The RatingSystem information is shared with Gamesux to display the games information in the games panel inside Windows Vista.

The Type is one of the enum (well, not Max obviously):

enum tagRATING_SYSTEM_TYPE
{
     RATING_SYSTEM_TYPE_ALL = 0,
     RATING_SYSTEM_TYPE_GAMES = 1,
     RATING_SYSTEM_TYPE_WEB = 2,
     RATING_SYSTEM_TYPE_MAX = 4
} RATING_SYSTEM_TYPE;

In the default windows install there is only one Web rating system and this is not changeable.  The LogoResourceType is the type of the data associated with the logo; currently this will always return "PNGFILE".  The rest of the details are fairly self explanatory.

The Rating contains the following information ID (GUID), LongName, ShortName, Description, IsDepreciated, UpdatedRating, Level, MinAge, IconPath, IconResourceID, IconType.  If the rating is Depreciated, it points to the new rating (that is not depreciated) in the UpdatedRating element.  This new updated rating is the GUID for the new updated rating, and you can find it by looking for the specific GUID for the rating.  To find all the rating for the specific system you enumerate all the ratings and then look for the ones that have a SystemID that matches the RatingSystem we requested in the first place.  The Level is used to order the ratings, so that when they are displayed to the user they are displayed in Level order.  The rest of the fields are self explanatory.

Each rating also contains a bunch of descriptors, ESRB contains more of these than other systems.  The descriptors are things like 'Comic Violence', etc.  You can see them if you look at the Games Rating page inside Windows Parental Controls.  Under the main section where you can block based on the overall rating is a list of descriptors and Windows Parental Controls allow you to block on these specifically as well.  The descriptors contain mostly the same information as the Ratings, they point back to the specified SystemID.  However there is no level associated with the descriptors, they should be sorted alphabetically based on name.

Here is some javascript to print out the current rating systems available and the ratings and descriptors associated with each one.  Vista ships with a number of different ratings systems, so this list is not small.

 

// Setup some defines for the rest of the script, points to the local machine
// and the parental controls namespace.
strComputer = ".";
strRootNamespace = "\\ROOT\\CIMV2";
strNamespace = strRootNamespace + "\\Applications\\WindowsParentalControls";

// Connect to WMI.
strConnectStr = "winmgmts:\\\\" + strComputer + strNamespace;
wmi_service = GetObject(strConnectStr);

// Get all the instances of the WpcCustomEvent.
systems = wmi_service.InstancesOf("WpcRatingsSystem");
ratings = wmi_service.InstancesOf("WpcRating");
descriptors = wmi_service.InstancesOf("WpcRatingsDescriptor");

// Loop through all the customevents and show them to the user.
str = "";
WScript.Echo("Count: " + systems.Count);
enumer = new Enumerator(systems);
for (; !enumer.atEnd(); enumer.moveNext())
{
   ob = enumer.item();
   str = str + ShowRatingSystem(ob);
}

WScript.Echo(str);

function ShowRatings(guid)
{
   s1 = "";
   enumerator = new Enumerator(ratings);
   for (; !enumerator.atEnd(); enumerator.moveNext())
   {
        ob = enumerator.item(); 
        if (ob.SystemID == guid)
        {
            s1 = s1 + "     " + ob.ShortName + " {Min Age: " + ob.MinAge + " Level: " + ob.Level;
            if (ob.IsDeprecated != 0)
            {
                s1 = s1 + " [Depreciated: " + ob.UpdatedRating + "]";
            }
            s1 = s1 + "}\n         " + ob.LongName + "\n";
        }
   }
   return s1;
}

function ShowDescriptors(guid)
{
   s1 = "";
   enumerator = new Enumerator(descriptors);
   for (; !enumerator.atEnd(); enumerator.moveNext())
   {
        ob = enumerator.item();
        if (ob.SystemID == guid)
        {
            s1 = s1 + "     " + ob.Name + " {Properties: " + ob.Properties;
            if (ob.IsDeprecated != 0)
            {
                s1 = s1 + " [Depreciated: " + ob.UpdatedDescriptor + "]";
            }
            s1 = s1 + "}\n         " + ob.Description + "\n";
        }
   }
   return s1;
}

function ShowRatingSystem(ob)
{
   s = ob.ShortName + " " + ob.Version + " (" + ob.ID + ") " + ob.Type + "\n " + ob.LongName + "\n " + ob.WebAddress + "\n";
   s = s + "\n Ratings:\n" + ShowRatings(ob.ID);
   s = s + "\n Descriptors:\n" + ShowDescriptors(ob.ID);
   return s;
}
Comments
  • Hi David,

    I'm interested in using the WPC WMI interface for a Windows Home Server addin.  Specifically, I'd like to use Home Server to centrally manage WPC settings for users on my home network.  My idea is to use WMI to update settings for the affected user on each computer on the network.

    Now the rub: I can't find any documentation on WPC WMI.  As you are the only person I've found on the web with any significant information on the subject I was hoping you could point me in the right direction.  Any help would be appreciated.

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment