Ratings.h
上传用户:dzyhzl
上传日期:2019-04-29
资源大小:56270k
文件大小:3k
源码类别:

模拟服务器

开发平台:

C/C++

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