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.

316 lines
5.9 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1998 - 1999
  6. //
  7. // File: wmiprop.h
  8. //
  9. //--------------------------------------------------------------------------
  10. #ifndef ___wmiprop_h___
  11. #define ___wmiprop_h___
  12. typedef TCHAR *PTCHAR;
  13. //
  14. // Datablock description
  15. //
  16. //
  17. // Holds a list of valid values for an enumeration type
  18. //
  19. typedef struct _ENUMERATIONITEM
  20. {
  21. ULONG64 Value;
  22. PTCHAR Text;
  23. ULONG Reserved;
  24. } ENUMERATIONITEM, *PENUMERATIONITEM;
  25. typedef struct _ENUMERATIONINFO
  26. {
  27. ULONG Count;
  28. ULONG Reserved;
  29. ENUMERATIONITEM List[1];
  30. } ENUMERATIONINFO, *PENUMERATIONINFO;
  31. //
  32. // Holds a range of values
  33. typedef struct
  34. {
  35. ULONG64 Minimum;
  36. ULONG64 Maximum;
  37. } RANGEINFO, *PRANGEINFO;
  38. //
  39. // Holds a list of ranges of values
  40. //
  41. typedef struct
  42. {
  43. ULONG Count;
  44. RANGEINFO Ranges[1];
  45. } RANGELISTINFO, *PRANGELISTINFO;
  46. typedef enum VALIDATIONFUNC
  47. {
  48. WmiStringValidation,
  49. WmiDateTimeValidation,
  50. WmiRangeValidation,
  51. WmiValueMapValidation,
  52. WmiEmbeddedValidation
  53. } VALIDATIONFUNC, *PVALIDATIONFUNC;
  54. #define WmiMaximumValidation WmiEmbeddedValidation
  55. struct _DATA_BLOCK_DESCRIPTION;
  56. typedef struct _DATA_ITEM_DESCRIPTION
  57. {
  58. // CONSIDER: Make Name a BSTR
  59. PTCHAR Name;
  60. PTCHAR DisplayName;
  61. PTCHAR Description;
  62. CIMTYPE DataType;
  63. ULONG DataSize;
  64. VALIDATIONFUNC ValidationFunc;
  65. union
  66. {
  67. //
  68. // Used for enumeration data types
  69. //
  70. PENUMERATIONINFO EnumerationInfo;
  71. //
  72. // Used for a range of numbers
  73. PRANGELISTINFO RangeListInfo;
  74. //
  75. // Used for embedded classes
  76. struct _DATA_BLOCK_DESCRIPTION *DataBlockDesc;
  77. };
  78. //
  79. // Number of elements in array if this item is an array
  80. //
  81. ULONG ArrayElementCount;
  82. ULONG CurrentArrayIndex;
  83. //
  84. // Flags about property
  85. //
  86. ULONG IsReadOnly : 1;
  87. ULONG IsSignedValue : 1;
  88. ULONG DisplayInHex : 1;
  89. ULONG IsFixedArray : 1;
  90. ULONG IsVariableArray : 1;
  91. //
  92. // Actual value of the property
  93. //
  94. union
  95. {
  96. //
  97. // storage for non array
  98. //
  99. UCHAR Data;
  100. BOOLEAN boolval;
  101. CHAR sint8;
  102. SHORT sint16;
  103. LONG sint32;
  104. LONG64 sint64;
  105. UCHAR uint8;
  106. USHORT uint16;
  107. ULONG uint32;
  108. ULONG64 uint64;
  109. PTCHAR String;
  110. PTCHAR DateTime;
  111. IWbemClassObject *pIWbemClassObject;
  112. //
  113. // pointer for storage to arrays
  114. //
  115. PVOID ArrayPtr;
  116. BOOLEAN *boolArray;
  117. CHAR *sint8Array;
  118. SHORT *sint16Array;
  119. LONG *sint32Array;
  120. LONG64 *sint64Array;
  121. UCHAR *uint8Array;
  122. USHORT *uint16Array;
  123. ULONG *uint32Array;
  124. ULONG64 *uint64Array;
  125. PTCHAR *StringArray;
  126. PTCHAR *DateTimeArray;
  127. IWbemClassObject **pIWbemClassObjectArray;
  128. };
  129. } DATA_ITEM_DESCRIPTION, *PDATA_ITEM_DESCRIPTION;
  130. typedef struct _DATA_BLOCK_DESCRIPTION
  131. {
  132. PTCHAR Name;
  133. PTCHAR DisplayName;
  134. PTCHAR Description;
  135. struct _DATA_BLOCK_DESCRIPTION *ParentDataBlockDesc;
  136. IWbemClassObject *pInstance;
  137. ULONG DataItemCount;
  138. ULONG CurrentDataItem;
  139. BOOLEAN UpdateClass;
  140. DATA_ITEM_DESCRIPTION DataItems[1];
  141. } DATA_BLOCK_DESCRIPTION, *PDATA_BLOCK_DESCRIPTION;
  142. BOOLEAN ValidateEnumeration(
  143. PDATA_ITEM_DESCRIPTION DataItem,
  144. PTCHAR Value
  145. );
  146. BOOLEAN ValidateRangeList(
  147. PDATA_ITEM_DESCRIPTION DataItem,
  148. ULONG64 Value
  149. );
  150. BOOLEAN ValidateDateTime(
  151. PDATA_ITEM_DESCRIPTION DataItem,
  152. PTCHAR DateTime
  153. );
  154. typedef struct
  155. {
  156. PTCHAR MachineName;
  157. PTCHAR RelPath;
  158. PDATA_BLOCK_DESCRIPTION DataBlockDesc;
  159. IWbemServices *pIWbemServices;
  160. } CONFIGCLASS, *PCONFIGCLASS;
  161. //
  162. // PageInfo and Prototypes
  163. //
  164. typedef struct _PAGE_INFO {
  165. HDEVINFO deviceInfoSet;
  166. PSP_DEVINFO_DATA deviceInfoData;
  167. HKEY hKeyDev;
  168. CONFIGCLASS ConfigClass;
  169. } PAGE_INFO, * PPAGE_INFO;
  170. //
  171. // Debug support
  172. //
  173. #ifdef DebugPrint
  174. #undef DebugPrint
  175. #endif
  176. #if DBG
  177. ULONG
  178. _cdecl
  179. DbgPrint(
  180. PCH Format,
  181. ...
  182. );
  183. #define DEBUG_BUFFER_LENGTH 256
  184. #define DebugPrint(x) WmiDebugPrint x
  185. #else
  186. #define DebugPrint(x)
  187. #endif // DBG
  188. VOID
  189. WmiDebugPrint(
  190. ULONG DebugPrintLevel,
  191. PCHAR DebugMessage,
  192. ...
  193. );
  194. //
  195. // function prototype
  196. //
  197. void WmiCleanDataItemDescData(
  198. PDATA_ITEM_DESCRIPTION DataItemDesc
  199. );
  200. void WmiHideAllControls(
  201. HWND hDlg,
  202. BOOLEAN HideEmbeddedControls,
  203. BOOLEAN HideArrayControls
  204. );
  205. BOOLEAN WmiValidateNumber(
  206. struct _DATA_ITEM_DESCRIPTION *DataItemDesc,
  207. PTCHAR Value
  208. );
  209. BOOLEAN WmiValidateDateTime(
  210. struct _DATA_ITEM_DESCRIPTION *DataItemDesc,
  211. PTCHAR Value
  212. );
  213. BOOLEAN WmiValidateRange(
  214. struct _DATA_ITEM_DESCRIPTION *DataItemDesc,
  215. PTCHAR Value
  216. );
  217. PPAGE_INFO
  218. WmiCreatePageInfo(IN HDEVINFO deviceInfoSet,
  219. IN PSP_DEVINFO_DATA deviceInfoData);
  220. void
  221. WmiDestroyPageInfo(PPAGE_INFO * ppPageInfo);
  222. //
  223. // Function Prototypes
  224. //
  225. BOOL APIENTRY
  226. WmiPropPageProvider(LPVOID pinfo,
  227. LPFNADDPROPSHEETPAGE pfnAdd,
  228. LPARAM lParam);
  229. HPROPSHEETPAGE
  230. WmiCreatePropertyPage(PROPSHEETPAGE * ppsp,
  231. PPAGE_INFO ppi);
  232. UINT CALLBACK
  233. WmiDlgCallback(HWND hwnd,
  234. UINT uMsg,
  235. LPPROPSHEETPAGE ppsp);
  236. INT_PTR APIENTRY
  237. WmiDlgProc(IN HWND hDlg,
  238. IN UINT uMessage,
  239. IN WPARAM wParam,
  240. IN LPARAM lParam);
  241. BOOLEAN
  242. WmiApplyChanges(PPAGE_INFO ppi,
  243. HWND hDlg);
  244. void
  245. WmiUpdate (PPAGE_INFO ppi,
  246. HWND hDlg);
  247. BOOL
  248. WmiContextMenu(HWND HwndControl,
  249. WORD Xpos,
  250. WORD Ypos);
  251. void
  252. WmiHelp(HWND ParentHwnd,
  253. LPHELPINFO HelpInfo);
  254. #endif // ___Wmiprop_h___