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.

354 lines
9.9 KiB

  1. /*
  2. * regitem.h
  3. *
  4. * Copyright (c) 1995 by DataBeam Corporation, Lexington, KY
  5. *
  6. * Abstract:
  7. * This is the interface file for the class CRegItem. This class
  8. * manages the data associated with a Registry Item. Registry Items are
  9. * used to identify a particular entry in the application registry and
  10. * may exist in the form of a Channel ID, a Token ID, or an octet string
  11. * parameter. A CRegItem object holds the data for the first two
  12. * forms in a ChannelID and a TokeID, respectively. When the registry item
  13. * assumes the octet string parameter form, the data is held internally in
  14. * a Rogue Wave string object.
  15. *
  16. * Caveats:
  17. * None.
  18. *
  19. * Author:
  20. * blp/jbo
  21. */
  22. #ifndef _REGISTRY_ITEM_
  23. #define _REGISTRY_ITEM_
  24. /*
  25. * Class definition:
  26. */
  27. class CRegItem : public CRefCount
  28. {
  29. public:
  30. CRegItem(PGCCRegistryItem, PGCCError);
  31. CRegItem(PRegistryItem, PGCCError);
  32. CRegItem(CRegItem *, PGCCError);
  33. ~CRegItem(void);
  34. UINT GetGCCRegistryItemData(PGCCRegistryItem, LPBYTE memory);
  35. UINT LockRegistryItemData(void);
  36. void UnLockRegistryItemData(void);
  37. void GetRegistryItemDataPDU(PRegistryItem);
  38. void FreeRegistryItemDataPDU(void);
  39. GCCError CreateRegistryItemData(PGCCRegistryItem *);
  40. BOOL IsThisYourTokenID(TokenID nTokenID)
  41. {
  42. return ((m_eItemType == GCC_REGISTRY_TOKEN_ID) && (nTokenID == m_nTokenID));
  43. }
  44. void operator= (const CRegItem&);
  45. protected:
  46. GCCRegistryItemType m_eItemType;
  47. ChannelID m_nChannelID;
  48. TokenID m_nTokenID;
  49. LPOSTR m_poszParameter;
  50. UINT m_cbDataSize;
  51. RegistryItem m_RegItemPDU;
  52. BOOL m_fValidRegItemPDU;
  53. };
  54. /*
  55. * Comments explaining the public and protected class member functions
  56. */
  57. /*
  58. * CRegItem ( PGCCRegistryItem registry_item,
  59. * PGCCError return_value);
  60. *
  61. * Public member function of CRegItem.
  62. *
  63. * Function Description:
  64. * This is the constructor for the CRegItem class which takes as
  65. * input the "API" version of registry item data, GCCRegistryItem.
  66. *
  67. * Formal Parameters:
  68. * registry_item (i) The registry item data to store.
  69. * return_value (o) The output parameter used to indicate errors.
  70. *
  71. * Return Value:
  72. * GCC_NO_ERROR - No error.
  73. *
  74. * Side Effects:
  75. * None.
  76. *
  77. * Caveats:
  78. * None.
  79. */
  80. /*
  81. * CRegItem ( PRegistryItem registry_item,
  82. * PGCCError return_value);
  83. *
  84. * Public member function of CRegItem.
  85. *
  86. * Function Description:
  87. * This is the constructor for the CRegItem class which takes as
  88. * input the "PDU" version of registry item data, RegistryItem.
  89. *
  90. * Formal Parameters:
  91. * registry_item (i) The registry item data to store.
  92. * return_value (o) The output parameter used to indicate errors.
  93. *
  94. * Return Value:
  95. * GCC_NO_ERROR - No error.
  96. *
  97. * Side Effects:
  98. * None.
  99. *
  100. * Caveats:
  101. * None.
  102. */
  103. /*
  104. * CRegItem(CRegItem *registry_item,
  105. * PGCCError return_value);
  106. *
  107. * Public member function of CRegItem.
  108. *
  109. * Function Description:
  110. * This is the copy constructor for the CRegItem class which takes
  111. * as input another CRegItem object.
  112. *
  113. * Formal Parameters:
  114. * registry_item (i) The CRegItem object to copy.
  115. * return_value (o) The output parameter used to indicate errors.
  116. *
  117. * Return Value:
  118. * GCC_NO_ERROR - No error.
  119. *
  120. * Side Effects:
  121. * None.
  122. *
  123. * Caveats:
  124. * None.
  125. */
  126. /*
  127. * ~CRegItem();
  128. *
  129. * Public member function of CRegItem.
  130. *
  131. * Function Description:
  132. * This is the destructor for the CRegItem class. Since all data
  133. * maintained by this class is held in automatic private instance
  134. * variables, there is no cleanup needed in this destructor.
  135. *
  136. * Formal Parameters:
  137. * None.
  138. *
  139. * Return Value:
  140. * None.
  141. *
  142. * Side Effects:
  143. * None.
  144. *
  145. * Caveats:
  146. * None.
  147. */
  148. /*
  149. * UINT GetGCCRegistryItemData (
  150. * PGCCRegistryItem registry_item,
  151. * LPSTR memory);
  152. *
  153. * Public member function of CRegItem.
  154. *
  155. * Function Description:
  156. * This routine is used to retrieve the registry item data from the
  157. * CRegItem object in the "API" form of a GCCRegistryItem.
  158. *
  159. * Formal Parameters:
  160. * registry_item (o) The GCCRegistryItem structure to fill in.
  161. * memory (o) The memory used to hold any data referenced by,
  162. * but not held in, the output structure.
  163. *
  164. * Return Value:
  165. * The amount of data, if any, written into the bulk memory block provided.
  166. *
  167. * Side Effects:
  168. * None.
  169. *
  170. * Caveats:
  171. * None.
  172. */
  173. /*
  174. * UINT LockRegistryItemData ();
  175. *
  176. * Public member function of CRegItem.
  177. *
  178. * Function Description:
  179. * This routine is used to "lock" the "API" data for this object. This
  180. * results in the lock count for this object being incremented. When the
  181. * lock count transitions from 0 to 1, a calculation is made to determine
  182. * how much memory, if any, will be needed to hold any "API" data which
  183. * will be referenced by, but not held in, the GCCRegistryItem structure
  184. * which is filled in on a call to GetGCCRegistryItemData. This is the
  185. * value returned by this routine in order to allow the calling object to
  186. * allocate that amount of memory in preparation for the call to
  187. * GetGCCRegistryItemData.
  188. *
  189. * Formal Parameters:
  190. * None.
  191. *
  192. * Return Value:
  193. * The amount of memory, if any, which will be needed to hold "API" data
  194. * which is referenced by, but not held in, the GCCRegistryItem structure
  195. * provided as an output parameter to the GetGCCRegistryItemData call.
  196. *
  197. * Side Effects:
  198. * The internal lock count is incremented.
  199. *
  200. * Caveats:
  201. * The internal lock count is used in conjuction with an internal "free"
  202. * flag as a mechanism for ensuring that this object remains in existance
  203. * until all interested parties are through with it. The object remains
  204. * valid (unless explicity deleted) until the lock count is zero and the
  205. * "free" flag is set through a call to FreeRegistryItemData. This allows
  206. * other objects to lock this object and be sure that it remains valid
  207. * until they call UnLock which will decrement the internal lock count. A
  208. * typical usage scenerio for this object would be: A CRegItem
  209. * object is constructed and then passed off to any interested parties
  210. * through a function call. On return from the function call, the
  211. * FreeRegistryItemData call is made which will set the internal "free"
  212. * flag. If no other parties have locked the object with a Lock call,
  213. * then the CRegItem object will automatically delete itself when
  214. * the FreeRegistryItemData call is made. If, however, any number of
  215. * other parties has locked the object, it will remain in existence until
  216. * each of them has unlocked the object through a call to UnLock.
  217. */
  218. /*
  219. * void UnLockRegistryItemData ();
  220. *
  221. * Public member function of CRegItem.
  222. *
  223. * Function Description:
  224. * This routine is used to "unlock" the "API" data for this object. This
  225. * results in the lock count for this object being decremented. When the
  226. * lock count transitions from 1 to 0, a check is made to determine
  227. * whether the object has been freed through a call to
  228. * FreeRegistryItemData. If so, the object will automatically delete
  229. * itself.
  230. *
  231. * Formal Parameters:
  232. * None.
  233. *
  234. * Return Value:
  235. * None.
  236. *
  237. * Side Effects:
  238. * The internal lock count is decremented.
  239. *
  240. * Caveats:
  241. * It is the responsibility of any party which locks a CRegItem
  242. * object by calling Lock to also unlock the object with a call to UnLock.
  243. * If the party calling UnLock did not construct the CRegItem
  244. * object, it should assume the object to be invalid thereafter.
  245. */
  246. /*
  247. * void GetRegistryItemDataPDU (
  248. * PRegistryItem registry_item);
  249. *
  250. * Public member function of CRegItem.
  251. *
  252. * Function Description:
  253. * This routine is used to retrieve the registry item data from the
  254. * CRegItem object in the "PDU" form of a RegistryItem.
  255. *
  256. * Formal Parameters:
  257. * registry_item (o) The RegistryItem structure to fill in.
  258. *
  259. * Return Value:
  260. * GCC_NO_ERROR - No error.
  261. *
  262. * Side Effects:
  263. * None.
  264. *
  265. * Caveats:
  266. * None.
  267. */
  268. /*
  269. * void FreeRegistryItemDataPDU ();
  270. *
  271. * Public member function of CRegItem.
  272. *
  273. * Function Description:
  274. * This routine is used to "free" the "PDU" data for this object. For
  275. * this object, this means setting a flag to indicate that the "PDU" data
  276. * for this object is no longer valid.
  277. *
  278. * Formal Parameters:
  279. * None.
  280. *
  281. * Return Value:
  282. * None.
  283. *
  284. * Side Effects:
  285. * The internal "free" flag is set.
  286. *
  287. * Caveats:
  288. * This object should be assumed invalid after a call to
  289. * FreeRegistryItemData has been made.
  290. */
  291. /*
  292. * BOOL IsThisYourTokenID (
  293. * TokenID token_id);
  294. *
  295. * Public member function of CRegItem.
  296. *
  297. * Function Description:
  298. * This routine is used to determine whether the specified token ID is
  299. * held within this registry item object.
  300. *
  301. * Formal Parameters:
  302. * token_id (i) The token ID to use for comparison.
  303. *
  304. * Return Value:
  305. * TRUE - The specified token ID is contained within this
  306. * registry item object.
  307. * FALSE - The specified token ID is not contained within
  308. * this registry item object.
  309. *
  310. * Side Effects:
  311. * None.
  312. *
  313. * Caveats:
  314. * None.
  315. */
  316. /*
  317. * void operator= (
  318. * const CRegItem& registry_item_data);
  319. *
  320. * Public member function of CRegItem.
  321. *
  322. * Function Description:
  323. * This routine is used to set this CRegItem object to be equal
  324. * in value to the specified CRegItem object.
  325. *
  326. * Formal Parameters:
  327. * registry_item_data (i) The CRegItem object to copy.
  328. *
  329. * Return Value:
  330. * None.
  331. *
  332. * Side Effects:
  333. * The registry item data values for this object are modified by this call.
  334. *
  335. * Caveats:
  336. * The "lock" and "free" states for this object are not affected by
  337. * this call.
  338. */
  339. #endif