Microsoft DirectX 9.0

IEvalRat::TestRating

This topic applies to Windows XP Service Pack 1 only.

The TestRating method determines whether a program with the specified rating should be blocked.

Syntax

HRESULT TestRating(
  EnTvRat_System  enShowSystem,
  EnTvRat_GenericLevel  enShowLevel,
  LONG  lbfEnShowAttributes
);

Parameters

enShowSystem

[in]  Specifies the rating system, as an EnTvRat_System enumeration type.

enShowLevel

[in]  Specifies the rating level, as an EnTvRat_GenericLevel enumeration type. The meaning of this value depends on the rating system.

lbfEnShowAttributes

[in]  Bitwise combination of zero or more flags from the BfEnTvRat_GenericAttributes enumeration. The flags specify content attributes, such as violence or adult language. Content attributes do not apply to all rating systems.

Return Values

The method returns an HRESULT. Possible values include those in the following table.

Value Description
E_INVALIDARG Invalid argument.
S_FALSE This program is restricted and should be blocked.
S_OK This program is allowed and should not be blocked.

Remarks

The application sets viewing permissions through the IEvalRat::put_BlockedRatingAttributes method. Whenever the Decrypter/Detagger filter receives a new rating in a program, it calls TestRating to determine whether to block the program. If TestRating returns S_OK, the rating is restricted under the current set of viewing permissions, and the Decrypter/Tagger filter blocks the program.

Implementation Note:

For each supported rating system, store a table that contains bitmasks for each level within that system. On object creation, initialize each bitmask to zero. Update the bitmasks in the put_BlockedRatingAttributes method.

In the TestRating method, use the enShowSystem and enShowLevel parameters to perform a table lookup and get the corresponding bitmask. If the BfIsBlocked flag is set in the bitmask, return S_OK. Otherwise, return S_OK if any of the attribute flags in lbfEnShowAttributes are also in the bitmask. Use a bitwise AND to test the bitmask.

The following code shows a possible implementation of this test. It assumes that the object stores the bitmasks in a two-dimensional array named Mask:

if ((0 != Mask[system][level] & BfIsBlocked) || 
    (0 != Mask[system][level] & attributes))
{
    return S_OK; // Blocked.
}
else
{
    return S_FALSE; // Not blocked.
}

See Also