home *** CD-ROM | disk | FTP | other *** search
/ PC Format (South-Africa) 2001 May / PCFMay2001.iso / Xenon / C++ / FreeCommandLineTools.exe / Include / ratings.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-01-31  |  3.2 KB  |  86 lines

  1. //*********************************************************************
  2. //*                  Microsoft Windows                               **
  3. //*            Copyright(c) Microsoft Corp., 1996-1999               **
  4. //*********************************************************************
  5.  
  6. #ifndef _RATINGS_H_
  7. #pragma option push -b -a8 -pc -A- /*P_O_Push*/
  8. #define _RATINGS_H_
  9.  
  10. #include <winerror.h>
  11. #include <shlwapi.h>
  12.  
  13. STDAPI RatingEnable(HWND hwndParent, LPCSTR pszUsername, BOOL fEnable);
  14. STDAPI RatingCheckUserAccess(LPCSTR pszUsername, LPCSTR pszURL,
  15.                              LPCSTR pszRatingInfo, LPBYTE pData,
  16.                              DWORD cbData, void **ppRatingDetails);
  17. STDAPI RatingAccessDeniedDialog(HWND hDlg, LPCSTR pszUsername, LPCSTR pszContentDescription, void *pRatingDetails);
  18. STDAPI RatingAccessDeniedDialog2(HWND hDlg, LPCSTR pszUsername, void *pRatingDetails);
  19. STDAPI RatingFreeDetails(void *pRatingDetails);
  20. STDAPI RatingObtainCancel(HANDLE hRatingObtainQuery);
  21. STDAPI RatingObtainQuery(LPCSTR pszTargetUrl, DWORD dwUserData, void (*fCallback)(DWORD dwUserData, HRESULT hr, LPCSTR pszRating, void *lpvRatingDetails), HANDLE *phRatingObtainQuery);
  22. STDAPI RatingSetupUI(HWND hDlg, LPCSTR pszUsername);
  23. #ifdef _INC_COMMCTRL
  24. STDAPI RatingAddPropertyPage(PROPSHEETHEADER *ppsh);
  25. #endif
  26.  
  27. STDAPI RatingEnabledQuery();
  28. STDAPI RatingInit();
  29. STDAPI_(void) RatingTerm();
  30.  
  31. // A way to check if ratings are installed. We still need to calling
  32. // ratings dll to find out for sure but this allows us to delay load ratings.
  33. _inline BOOL IS_RATINGS_ENABLED()
  34. {
  35.     TCHAR szSup[200];
  36.     DWORD dwType;
  37.     DWORD cbSize = sizeof(szSup);
  38.  
  39.     return (SHGetValue(HKEY_LOCAL_MACHINE,
  40.                        TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Ratings"),
  41.                        TEXT("Key"),
  42.                        &dwType, &szSup, &cbSize) == ERROR_SUCCESS);
  43. }
  44.  
  45. #define S_RATING_ALLOW        S_OK
  46. #define S_RATING_DENY        S_FALSE
  47. #define S_RATING_FOUND        0x00000002
  48. #define E_RATING_NOT_FOUND    0x80000001
  49.  
  50. /************************************************************************
  51.  
  52. IObtainRating interface
  53.  
  54. This interface is used to obtain the rating (PICS label) for a URL.
  55. It is entirely up to the server to determine how to come up with the
  56. label.  The ObtainRating call may be synchronous.
  57.  
  58. GetSortOrder returns a ULONG which is used to sort this rating helper
  59. into the list of installed helpers.  The helpers are sorted in ascending
  60. order, so a lower numbered helper will be called before a higher numbered
  61. one.
  62.  
  63. ************************************************************************/
  64.  
  65. DECLARE_INTERFACE_(IObtainRating, IUnknown)
  66. {
  67.     // *** IUnknown methods ***
  68.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **ppvObj) PURE;
  69.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  70.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  71.  
  72.     STDMETHOD(ObtainRating) (THIS_ LPCSTR pszTargetUrl, HANDLE hAbortEvent,
  73.                              IMalloc *pAllocator, LPSTR *ppRatingOut) PURE;
  74.  
  75.     STDMETHOD_(ULONG,GetSortOrder) (THIS) PURE;
  76. };
  77.  
  78. #define RATING_ORDER_REMOTESITE        0x80000000
  79. #define RATING_ORDER_LOCALLIST        0xC0000000
  80.  
  81.  
  82. #pragma option pop /*P_O_Pop*/
  83. #endif
  84. // _RATINGS_H_
  85.  
  86.