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.

95 lines
4.0 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) 1998-1999 Microsoft Corporation. All Rights Reserved.
  9. //
  10. // Sample Name: ChgState - Sample Indexing Service Admin Application
  11. //
  12. //--------------------------------------------------------------------------
  13. Description
  14. ===========
  15. The ChgState sample is a command-line application written in C++ that can
  16. either report the current state of a catalog or change the state of the
  17. catalog using the SetCatalogState function of the OLE DB Helper API.
  18. Path
  19. ====
  20. Source: mssdk\samples\winbase\indexing\ChgState\
  21. User's Guide
  22. ============
  23. * To build the example
  24. 1. Set the Lib environment variable to "D:\mssdk\Lib;%Lib%" and the
  25. Include environment variable to "D:\mssdk\Include;%Include%",
  26. where D: is the drive on which you installed the Platform SDK.
  27. 2. Correctly set the CPU environment variable to, for example, "i386".
  28. 3. Open a command window and change the directory to the source path
  29. of the sample.
  30. 4. Build the example by entering, at the command-line prompt, "nmake".
  31. * To find or change the catalog state using the example
  32. 1. Open a command window and change the directory to the path of the
  33. built sample.
  34. 2. Submit a catalog state command by entering, at the command-line
  35. prompt,
  36. chgstate /a:<action> [/c:<catalog>] [/m:<machine>]
  37. where
  38. <action> is a catalog state action; one of
  39. RO Set read-only (queries only)
  40. RW Set read/write (queries and indexing)
  41. Stop Set stopped (no queries or indexing)
  42. GetState Get current state only
  43. <catalog> is the name of the catalog (default is "system")
  44. <machine> is the name of the machine (default is ".")
  45. Programming Notes
  46. =================
  47. The previous state of the specified catalog is always returned in the
  48. dwOldState parameter of the SetCatalogState function and printed by the
  49. sample.
  50. The state of the catalog will change to the new, specified state if that
  51. state does not violate read-only constraints on the catalog. If the
  52. catalog resides on a read-only medium, the catalog is specified as
  53. read-only in the registry, or the file cicat.hsh is set read-only, the
  54. catalog is set to read-only even when the read/write state is requested.
  55. Parameters
  56. ----------
  57. The <action> parameter is the action desired. Four actions are possible:
  58. * RO (Read-only): queries are allowed, but no indexing occurs.
  59. * RW (Read/write): queries are allowed and indexing occurs.
  60. * Stop (Stopped): stop catalog completely (no queries, no indexing).
  61. * GetState (Get state): get the current state of a catalog only. The
  62. catalog state prior to any specified action is always returned.
  63. The <catalog> parameter is the name of the catalog on which to perform
  64. the action. The default is "system", which is the default catalog
  65. installed with Windows 2000. Additional catalogs can be created with
  66. the Indexing Service snap-in of the Microsoft Management Console (MMC).
  67. The <machine> parameter is the name of the machine on which the request
  68. is executed. The default is ".", which is the local machine. Machine
  69. names should not be preceeded with two backslashes.
  70. Examples
  71. --------
  72. chgstate /a:RW /c:system
  73. Change the "system" catalog on the local machine to the
  74. Read/write state.
  75. chgstate /a:GetState /m:SERVERNAME
  76. Get the current state of the "system" catalog on machine SERVERNAME.
  77. chgstate /a:RO /c:CATALOGNAME /m:SERVERNAME
  78. Set the catalog CATALOGNAME on machine SERVERNAME to the Read-only
  79. state. (The catalog can be queried, but indexing is stopped.)