This section contains detailed reference information about the functions in the Microsoft Internet Ratings API.
HRESULT RatingAccessDeniedDialog( HWND hwndParent, LPCTSTR pszUsername, LPCTSTR pszContentDescription, LPVOID pRatingDetails );
Displays a modal dialog box telling the user that access to the requested content is denied. The supervisor can set an option that adds controls to the dialog box; these controls would allow a supervisor to enter a user name and password to override the rating and allow access.
S_OK | The supervisor entered the password. Access should be allowed. |
S_FALSE | The user is still denied access to the content. |
Error values | An error occurred. |
See also RatingCheckUserAccess
HRESULT RatingFreeDetails( LPVOID pRatingDetails );
Frees the detail information returned by the RatingCheckUserAccess function.
See also RatingCheckUserAccess
HRESULT RatingCheckUserAccess( LPCTSTR pszUsername, LPCTSTR pszURL, LPCTSTR pszRatingInfo, LPBYTE pData, DWORD cbData, LPVOID *ppRatingDetails );
Determines whether the user is allowed to view the given content based on the associated rating label. An application calls this function when it finds a rating label.
S_OK | Access is allowed. |
S_FALSE | Access is denied. |
Error values | Content should be considered unrated. |
This function allows ratings of any content type, including CD-ROMs, news groups, Web sites, and so on, provided the client application can find the rating information. The RatingObtainQuery function makes an internal call to the RatingCheckUserAccess function before calling the application's callback function.
See also RatingAccessDeniedDialog, RatingFreeDetails, RatingObtainQuery
HRESULT RatingEnabledQuery(void)
Reports whether ratings should be enforced or not. If the supervisor has not configured any restrictions or has temporarily disabled them, the application may allow access to all content and need not call any other rating functions.
S_OK | Ratings are enabled and should be enforced. |
S_FALSE | Ratings are disabled and should be ignored. |
HRESULT RatingObtainCancel( HANDLE hRatingObtainQuery );
Allows a browser to cancel its request to obtain the rating for a URL.
See also RatingObtainQuery
HRESULT RatingObtainQuery( LPCTSTR pszTargetUrl, DWORD dwUserData, void (*fCallback)( DWORD dwUserData, HRESULT hres, LPCTSTR pszRating, LPVOID lpvRatingDetails ), HANDLE *phRatingObtainQuery );
Encapsulates the process of checking ratings that appear on a local list, third-party PICS server, or future third-party add-on rating services.
The callback function has the following parameters:
hres | Result of the query. Can be one of the following values:
| ||||||
pszRating | Rating information for the document if it is available. (Note that the application can choose to ignore this parameter because RatingCheckUserAccess has already been called to generate the hres parameter). | ||||||
lpvRatingDetails | Token that can be used in the RatingAccessDeniedDialog dialog box. This must be freed with a call to RatingFreeDetails. |
A browser obtains the URL from the user and calls this function. Asynchronously, this function searches for a rating for the specified document. When the search ends, the function calls the application's callback function, on a different thread than the one that called RatingObtainQuery. While waiting for the callback to be called, browsers may choose to download the content but prevent the user from accessing it until the query is resolved.
If RatingObtainQuery returns an error, the application should assume the site is unrated by local and third-party ratings, and look for the HTML/HTTP-level ratings itself.
HRESULT RatingSetupUI( HWND hwndParent, LPCSTR pszUsername );
Displays a modal dialog box that allows a supervising parent to set levels of restrictions. The RatingCheckUserAccess function uses these settings to compare against rating labels.
This function ensures that the current user is a supervisor before allowing access to the configuration user interface.