Source code of Windows XP (NT5)
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.

72 lines
3.4 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
  4. // ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
  5. // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
  6. // PARTICULAR PURPOSE.
  7. //
  8. // Copyright (c) 1999 Microsoft Corporation. All Rights Reserved.
  9. //
  10. // Sample Name: SmpFilt - Sample Filter Implementation
  11. //
  12. //--------------------------------------------------------------------------
  13. Description
  14. ===========
  15. The SmpFilt sample is an example IFilter implementation that reads an un-
  16. formatted text file (with the extension .smp) using the ANSI code page of
  17. the current thread, and outputs UNICODE text for the current locale. It
  18. accepts as input only single-byte-character text files and not multibyte-
  19. character or UNICODE text files. It is the simplest example of an IFilter
  20. implementation included in the Indexing Service sample code.
  21. Path
  22. ====
  23. Source: mssdk\samples\winbase\indexing\SmpFilt\
  24. User's Guide
  25. ============
  26. * To build the sample
  27. 1. Set the Lib environment variable to "D:\mssdk\Lib;%Lib%" and the
  28. Include environment variable to "D:\mssdk\Include;%Include%",
  29. where D: is the drive on which you installed the Platform SDK.
  30. 2. Correctly set the CPU environment variable to, for example, "i386".
  31. 3. Open a command window and change the directory to the source path
  32. of the sample.
  33. 4. Build the filter DLL by entering, at the command-line prompt, "nmake".
  34. * To register the sample
  35. 1. Copy the filter DLL file SmpFilt.dll to your %windir%\System32
  36. directory.
  37. 2. Self-register the filter by entering, at the command-line prompt,
  38. "regsvr32.exe %windir%\System32\SmpFilt.dll".
  39. 3. Enable automatic registration of the filter by adding it to the
  40. MULTI_SZ value of the DLLsToRegister entry in the registry under the
  41. following key.
  42. HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ContentIndex
  43. * To filter files and submit queries using the sample
  44. 1. Create one or more files to filter. For example, copy the source
  45. file smpfilt.cxx to a file named smpfilt.smp.
  46. 2. Restart the CISVC service. Touch the .SMP files and wait for them
  47. to be filtered.
  48. 3. Formulate queries that you know will succeed on the .SMP files and
  49. submit them using the IS MMC snap-in or one of the sample query
  50. programs in the Platform SDK.
  51. Programming Notes
  52. =================
  53. The SmpFilt sample illustrates the basic structure of a filter. It
  54. minimally implements the methods of the IFilter and IPersistFile interfaces.
  55. Because the SmpFilt sample does not filter any value-type properties, the
  56. implementation of IFilter:GetChunk does not process properties other than
  57. "contents", and IFitler::GetValue always indicates no values. For examples
  58. of how to filter value-type properties as well as text, refer to either the
  59. IFilter sample (HTMLFilt) or the HtmlProp sample in the Platform SDK.
  60. Error handling in the SmpFilt sample is rudimentary. The sample handles
  61. only the most obvious error conditions. Comments in the source code list
  62. all the standard result codes and indicate whether they are implemented or
  63. not. If you use SmpFilt as a basis for your own filter, carefully determine
  64. the additional error conditions that you need to detect and handle.