Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

68 lines
3.4 KiB

  1. This DLL is an example of how to write a component which obtains ratings for
  2. URLs from some external source. The sample is quite primitive and merely
  3. reads the ratings from a file, RATINGS.INI. Obviously a real product would
  4. have more work to do.
  5. To use this component, copy SAMPLE.DLL into the system directory (usually
  6. C:\WINDOWS\SYSTEM). Then run "regsvr32 sample.dll" from there; this will
  7. install the appropriate registry keys. Finally, create RATINGS.INI in the
  8. Windows directory, with contents something like this:
  9. [Ratings]
  10. http://www.microsoft.com=l 0 n 0 s 0 v 0
  11. http://www.playboy.com=l 4 n 4 s 3 v 0
  12. [Allow]
  13. http://www.playboy.com/allowme.htm=1
  14. [Deny]
  15. http://www.disney.com/denyanyway.htm=1
  16. Then, when you browse to any sites listed in RATINGS.INI, the ratings provided
  17. there will override any ratings found at the site itself. The [Allow] and
  18. [Deny] sections list URLs which should have access explicitly allowed or
  19. denied, no matter what the user's rating restrictions are. This simulates
  20. an inclusion/exclusion list.
  21. To modify this DLL for your own purposes:
  22. The source is packaged as a Microsoft Developer Studio project.
  23. Change the name of the component to something other than SAMPLE.DLL (this
  24. should be done in the build environment, in the resource file version stamps,
  25. in the .DEF file, and the string szDLLNAME in comobj.cpp).
  26. Run the GUIDGEN utility (supplied with Microsoft Developer Studio, or the
  27. Win32 SDK) to generate a CLSID for your component. Replace the definitions
  28. of CLSID_Sample and szOurGUID with this GUID. Do not omit this step and just
  29. use the GUID provided, otherwise your component may collide with that of
  30. another ISV if they also omit this step.
  31. Modify the code in getlabel.cpp, CSampleObtainRating::ObtainRating to retrieve
  32. the rating for a URL from the source of your choosing. Memory for the rating
  33. label should be allocated using the IMalloc interface provided.
  34. If WaitForSingleObject(hAbortEvent, 0) returns WAIT_OBJECT_0, then the user
  35. has cancelled the download and any attempt to obtain a rating should also be
  36. cancelled. If obtaining the rating is a relatively quick operation (such as
  37. reading from a local file) and is not easily divided into substeps for polling
  38. the event, then this event can be ignored.
  39. Also modify CSampleObtainRating::GetSortOrder to determine the priority of
  40. your rating obtainer's ratings relative to other installable rating obtainers.
  41. Rating obtainers with lower sort orders are called before those with higher
  42. sort orders. Thus, if Microsoft's label bureau obtainer (whose sort order
  43. is 0x80000000) is called and obtains a rating for a site, then any obtainer
  44. with a higher sort order will not even be called for that site. If the bureau
  45. was unable to obtain a rating, then further obtainers would be called until
  46. a rating was found.
  47. Microsoft's label bureau obtainer's sort order is 0x80000000. If Microsoft
  48. produces an obtainer which fetches from a local exclusion list, its sort order
  49. will be 0xC0000000. Note that a rating obtained from an installable DLL will
  50. always override any rating found in the HTML document itself.
  51. Install your DLL in the Windows system directory. Run "regsvr32 <yourdll>.DLL"
  52. or load it and call its DllRegisterServer entrypoint to install its registry
  53. keys. Currently the user must log off and back on (or restart the system) for
  54. the installation of this component to take effect.