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.

365 lines
15 KiB

  1. #ifndef __ISDMAPI2_H__
  2. #define __ISDMAPI2_H__
  3. /****************************************************************************
  4. *
  5. * $Archive: S:/STURGEON/SRC/INCLUDE/VCS/isdmapi2.h_v $
  6. *
  7. * INTEL Corporation Prorietary Information
  8. *
  9. * This listing is supplied under the terms of a license agreement
  10. * with INTEL Corporation and may not be copied nor disclosed except
  11. * in accordance with the terms of that agreement.
  12. *
  13. * Copyright (c) 1993-1994 Intel Corporation.
  14. *
  15. * $Revision: 1.10 $
  16. * $Date: 08 Oct 1996 17:29:42 $
  17. * $Author: MANDREWS $
  18. *
  19. * Deliverable:
  20. *
  21. * Abstract:
  22. *
  23. * Notes:
  24. *
  25. ***************************************************************************/
  26. #ifdef __cplusplus
  27. extern "C" { // Assume C declarations for C++.
  28. #endif // __cplusplus
  29. #ifndef DllExport
  30. #define DllExport __declspec( dllexport )
  31. #endif // DllExport
  32. //reserved key define for backwards compatability with old API
  33. //all ISDM1 data falls under this key
  34. #define BACKCOMP_KEY "BackCompatability"
  35. //value type defines
  36. #define DWORD_VALUE 2
  37. #define STRING_VALUE 3
  38. #define BINARY_VALUE 4
  39. //handle prefix bit codes(these get appended to the actual memmap offset to generate a handle)
  40. #define KEYBITCODE 0x6900
  41. #define VALUEBITCODE 0xAB00
  42. #define ROOTBITCODE 0x1234
  43. //in case we want multiple roots, this can expand
  44. #define ROOT_MAIN 0x0000
  45. //this is the main root keys handle define
  46. #define MAIN_ROOT_KEY MAKELONG(ROOT_MAIN,ROOTBITCODE)
  47. //typedefs for each kind of handle
  48. typedef DWORD KEY_HANDLE,*LPKEY_HANDLE;
  49. typedef DWORD VALUE_HANDLE,*LPVALUE_HANDLE;
  50. typedef DWORD EVENT_HANDLE,*LPEVENT_HANDLE;
  51. //this structure is an internal status structure
  52. //my test app accesses this for debug. You should never need this.
  53. typedef struct INFODATASTRUCT
  54. {
  55. UINT uBindCount;
  56. UINT uNumKeys;
  57. UINT uMaxKeys;
  58. UINT uNumValues;
  59. UINT uMaxValues;
  60. UINT uNumTableEntries;
  61. UINT uMaxTableEntries;
  62. UINT uNumEvents;
  63. UINT uMaxEvents;
  64. DWORD dwBytesFree;
  65. DWORD dwMaxChars;
  66. } INFO_DATA, *LPINFO_DATA;
  67. //function typedefs
  68. //supplier
  69. typedef HRESULT (*ISD_CREATEKEY) (KEY_HANDLE, LPCSTR, LPKEY_HANDLE);
  70. typedef HRESULT (*ISD_CREATEVALUE) (KEY_HANDLE, LPCSTR, DWORD,CONST BYTE *,DWORD,LPVALUE_HANDLE);
  71. typedef HRESULT (*ISD_SETVALUE) (KEY_HANDLE, VALUE_HANDLE, LPCSTR, DWORD, CONST BYTE *, DWORD);
  72. //consumer
  73. typedef HRESULT (*ISD_OPENKEY) (KEY_HANDLE, LPCSTR, LPKEY_HANDLE);
  74. typedef HRESULT (*ISD_OPENVALUE) (KEY_HANDLE, LPCSTR, LPVALUE_HANDLE);
  75. typedef HRESULT (*ISD_ENUMKEY) (KEY_HANDLE, DWORD, LPSTR, LPDWORD, LPKEY_HANDLE);
  76. typedef HRESULT (*ISD_ENUMVALUE) (KEY_HANDLE, DWORD, LPDWORD, LPDWORD, LPBYTE, LPDWORD, LPDWORD, LPVALUE_HANDLE);
  77. typedef HRESULT (*ISD_QUERYINFOKEY) (KEY_HANDLE, LPSTR, LPDWORD, LPDWORD, LPDWORD);
  78. typedef HRESULT (*ISD_QUERYINFOVALUE) (VALUE_HANDLE, LPSTR, LPDWORD, LPDWORD, LPBYTE, LPDWORD, LPDWORD, LPKEY_HANDLE);
  79. typedef HRESULT (*ISD_NOTIFYCHANGEVALUE) (VALUE_HANDLE, HANDLE);
  80. //used by either
  81. typedef HRESULT (*ISD_DELETEKEY) (KEY_HANDLE);
  82. typedef HRESULT (*ISD_DELETEVALUE) (KEY_HANDLE, VALUE_HANDLE, LPCSTR);
  83. typedef BOOL (*ISD_GETSTRUCTDATA) (LPINFO_DATA);
  84. typedef BOOL (*ISD_ISVALIDKEYHANDLE) (KEY_HANDLE);
  85. typedef BOOL (*ISD_ISVALIDVALUEHANDLE) (VALUE_HANDLE);
  86. typedef HRESULT (*ISD_COMPACTMEMORY) ();
  87. //structure for ISDM entry points
  88. typedef struct _ISDM2API
  89. {
  90. ISD_CREATEKEY ISD_CreateKey;
  91. ISD_CREATEVALUE ISD_CreateValue;
  92. ISD_SETVALUE ISD_SetValue;
  93. ISD_OPENKEY ISD_OpenKey;
  94. ISD_OPENVALUE ISD_OpenValue;
  95. ISD_ENUMKEY ISD_EnumKey;
  96. ISD_ENUMVALUE ISD_EnumValue;
  97. ISD_QUERYINFOKEY ISD_QueryInfoKey;
  98. ISD_QUERYINFOVALUE ISD_QueryInfoValue;
  99. ISD_NOTIFYCHANGEVALUE ISD_NotifyChangeValue;
  100. ISD_DELETEKEY ISD_DeleteKey;
  101. ISD_DELETEVALUE ISD_DeleteValue;
  102. ISD_GETSTRUCTDATA ISD_GetStructData;
  103. ISD_ISVALIDKEYHANDLE ISD_IsValidKeyHandle;
  104. ISD_ISVALIDVALUEHANDLE ISD_IsValidValueHandle;
  105. ISD_COMPACTMEMORY ISD_CompactMemory;
  106. }
  107. ISDM2API, *LPISDM2API;
  108. //HRESULT error defines
  109. #define ISDM_ERROR_BASEB 0x8000
  110. #define ERROR_INVALID_KEY_HANDLE ISDM_ERROR_BASEB + 1
  111. #define ERROR_MORE_DATA_AVAILABLE ISDM_ERROR_BASEB + 2
  112. #define ERROR_INVALID_STRING_POINTER ISDM_ERROR_BASEB + 3
  113. #define ERROR_KEY_NOT_FOUND ISDM_ERROR_BASEB + 4
  114. #define ERROR_VALUE_NOT_FOUND ISDM_ERROR_BASEB + 5
  115. #define ERROR_NO_MORE_SESSIONS ISDM_ERROR_BASEB + 6
  116. #define ERROR_INVALID_VALUE_HANDLE ISDM_ERROR_BASEB + 7
  117. #define ERROR_FAILED_TO_GET_MEM_KEY ISDM_ERROR_BASEB + 8
  118. #define ERROR_NO_PARENT ISDM_ERROR_BASEB + 9
  119. #define ERROR_NO_PREV_SIBLING ISDM_ERROR_BASEB + 10
  120. #define ERROR_NO_NEXT_SIBLING ISDM_ERROR_BASEB + 11
  121. #define ERROR_NO_CHILD ISDM_ERROR_BASEB + 12
  122. #define ERROR_INVALID_VALUE_TYPE ISDM_ERROR_BASEB + 13
  123. #define ERROR_MALLOC_FAILURE ISDM_ERROR_BASEB + 14
  124. #define ERROR_CREATE_KEY_FAILURE ISDM_ERROR_BASEB + 15
  125. #define ERROR_NULL_PARAM ISDM_ERROR_BASEB + 16
  126. #define ERROR_VALUE_EXISTS ISDM_ERROR_BASEB + 17
  127. #define ERROR_FAILED_TO_GET_MEM_VALUE ISDM_ERROR_BASEB + 18
  128. #define ERROR_NO_MORE_STR_SPACE ISDM_ERROR_BASEB + 19
  129. #define ERROR_KEY_EXISTS ISDM_ERROR_BASEB + 20
  130. #define ERROR_NO_MORE_KEY_SPACE ISDM_ERROR_BASEB + 21
  131. #define ERROR_NO_MORE_VALUE_SPACE ISDM_ERROR_BASEB + 22
  132. #define ERROR_INVALID_PARAM ISDM_ERROR_BASEB + 23
  133. #define ERROR_ROOT_DELETE ISDM_ERROR_BASEB + 24
  134. #define ERROR_NULL_STRING_TABLE_ENTRY ISDM_ERROR_BASEB + 25
  135. #define ERROR_NO_MORE_TABLE_ENTRIES ISDM_ERROR_BASEB + 26
  136. #define ERROR_ISDM_UNKNOWN ISDM_ERROR_BASEB + 27
  137. #define ERROR_NOT_IMPLEMENTED ISDM_ERROR_BASEB + 28
  138. #define ERROR_MALLOC_FAILED ISDM_ERROR_BASEB + 29
  139. #define ERROR_FAILED_TO_GET_MEM_TABLE ISDM_ERROR_BASEB + 30
  140. #define ERROR_SEMAPHORE_WAIT_FAIL ISDM_ERROR_BASEB + 31
  141. #define ERROR_NO_MORE_EVENTS ISDM_ERROR_BASEB + 32
  142. #define ERROR_INVALID_EVENT ISDM_ERROR_BASEB + 33
  143. #define ERROR_INVALID_EVENT_HANDLE ISDM_ERROR_BASEB + 34
  144. #define ERROR_EVENT_NONEXISTANT ISDM_ERROR_BASEB + 35
  145. #define ERROR_VALUE_DOES_NOT_EXIST ISDM_ERROR_BASEB + 36
  146. #define ERROR_BUFFER_TOO_SMALL ISDM_ERROR_BASEB + 37
  147. //token defines..these may just disappear
  148. //RRCM
  149. #define RRCM_LOCAL_STREAM 1
  150. #define RRCM_REMOTE_STREAM 2
  151. #define ISDM_RRCM_BASE 0x1000
  152. #define ISDM_SSRC ISDM_RRCM_BASE + 1
  153. #define ISDM_NUM_PCKT_SENT ISDM_RRCM_BASE + 2
  154. #define ISDM_NUM_BYTES_SENT ISDM_RRCM_BASE + 3
  155. #define ISDM_FRACTION_LOST ISDM_RRCM_BASE + 4
  156. #define ISDM_CUM_NUM_PCKT_LOST ISDM_RRCM_BASE + 5
  157. #define ISDM_XTEND_HIGHEST_SEQ_NUM ISDM_RRCM_BASE + 6
  158. #define ISDM_INTERARRIVAL_JITTER ISDM_RRCM_BASE + 7
  159. #define ISDM_LAST_SR ISDM_RRCM_BASE + 8
  160. #define ISDM_DLSR ISDM_RRCM_BASE + 9
  161. #define ISDM_NUM_BYTES_RCVD ISDM_RRCM_BASE + 10
  162. #define ISDM_NUM_PCKT_RCVD ISDM_RRCM_BASE + 11
  163. #define ISDM_NTP_FRAC ISDM_RRCM_BASE + 12
  164. #define ISDM_NTP_SEC ISDM_RRCM_BASE + 13
  165. #define ISDM_WHO_AM_I ISDM_RRCM_BASE + 14
  166. //
  167. //Supplier API
  168. //
  169. //NOTE: always refer to the Win32 Registry equivalent call for more information on the functionality of the call
  170. //The create key call is similar to the RegCreateKeyEx call from Win32 in functionality
  171. //NOTE: This call will create the new key or simply return the handle of the key if it already
  172. //exists
  173. extern DllExport HRESULT ISD_CreateKey
  174. (
  175. KEY_HANDLE hParentKey, //The key from which to create the new key(can be MAIN_ROOT_KEY)
  176. LPCSTR lpSubKey, //the subkey to create.(see RegCreateKeyEx for details)
  177. LPKEY_HANDLE lphReturnKey//the handle of the newly created key
  178. );
  179. //The create value call is not part of the Win32 reg calls. It is here for symmetry in my API
  180. //I prefer to use CreateValue then SetValue for my values, you can simply use SetValue and ignore
  181. //CreateValue if you wish. The reason the registry has no such call is because they don't have
  182. //a notion of a handle to a value. I felt it was very useful to have direct handles to the values for
  183. //subsequent supplier or consumer calls.
  184. //NOTE: If the type is STRING, you need to include the null terminator for the string in the size(cbData).
  185. extern DllExport HRESULT ISD_CreateValue
  186. (
  187. KEY_HANDLE hKey, //handle to the key that will own the new value
  188. LPCSTR lpName, //string ID of the value to be create
  189. DWORD dwType, //type of value to create(DWORD,STRING,BINARY)
  190. CONST BYTE *lpData, //pointer to value data
  191. DWORD cbData, //size of the value data buffer
  192. LPVALUE_HANDLE lphReturnValue //return handle to the newly created value
  193. );
  194. //SetValue is similar to the Win32 RegSetValueEx call
  195. //Note: If you have the value handle, you don't need to pass the key handle or lpName
  196. //NOTE: If the type is STRING, you need to include the null terminator for the string in the size(cbData).
  197. DllExport HRESULT ISD_SetValue
  198. (
  199. KEY_HANDLE hKey, //handle of valid key(can be NULL if hValue is known)
  200. VALUE_HANDLE hValue, //handle of value to set(can be NULL)
  201. LPCSTR lpName, //address of value name of value to set(can be NULL if hkey is null)
  202. DWORD dwType, //flag for value type
  203. CONST BYTE *lpData, //address of value data
  204. DWORD cbData //size of value data
  205. );
  206. //
  207. //Consumer API
  208. //
  209. //The OpenKey call is similar to the Win32 RegOpenKeyEx call
  210. DllExport HRESULT ISD_OpenKey
  211. (
  212. KEY_HANDLE hKey, //handle of a valid key(can be MAIN_ROOT_KEY)
  213. LPCSTR lpSubKey, //name of subkey to open
  214. LPKEY_HANDLE lphReturnKey //handle of the opened key
  215. );
  216. //The OpenValue call is new to ISDM because the registry doesn't have a concept of value handles
  217. DllExport HRESULT ISD_OpenValue
  218. (
  219. KEY_HANDLE hKey, //handle of a valid key(can NOT be MAIN_ROOT_KEY)
  220. LPCSTR lpValueName, //Name of value to open
  221. LPVALUE_HANDLE lphReturnValue //handle of the opened value
  222. );
  223. //The EnumKey call is similar to the Win32 RegEnumKey call
  224. //NOTES:
  225. // If lpName is null the size of the name is returned into lpcbName and NOERROR is returned
  226. DllExport HRESULT ISD_EnumKey
  227. (
  228. KEY_HANDLE hKey, //key to enumerate
  229. DWORD dwIndex, //index of subkey to enumerate
  230. LPSTR lpName, //address of buffer for subkey name(can be NULL)
  231. LPDWORD lpcbName, //address for size of subkey buffer (acts like the RegEnumKeyEx version of this param)
  232. LPKEY_HANDLE lphReturnKey //handle of subkey(can be NULL)
  233. );
  234. //The EnumValue call is similar to the Win32 RegEnumValue call
  235. DllExport HRESULT ISD_EnumValue
  236. (
  237. KEY_HANDLE hKey, //handle of key where value resides
  238. DWORD dwIndex, //index of value to enum
  239. LPSTR lpName, //address of buffer for value name(can be NULL)
  240. LPDWORD lpcbName, //address for size of value name buffer(can be NULL only if lpName is NULL)
  241. LPDWORD lpType, //address for type of value(can be NULL if you don't care about type)
  242. LPBYTE lpData, //address of buffer to receive the value data(can be NULL)
  243. LPDWORD lpcbData, //address of size of buffer to receive the value data(can be NULL only if lpData is NULL)
  244. LPDWORD lpTimeStamp, //address for timestamp on value(when last updated)(can be NULL)
  245. LPVALUE_HANDLE lphReturnValue //address for handle of value(can be NULL)
  246. );
  247. //The QueryKeyInfo call is similar to the RegQueryInfoKey
  248. DllExport HRESULT ISD_QueryInfoKey
  249. (
  250. KEY_HANDLE hKey, //handle of a valid key(can be MAIN_ROOT_KEY)
  251. LPSTR lpKeyName, //buffer to receive the name of the key(can be NULL)
  252. LPDWORD lpcbKeyName, //address of size of name buffer(can be null only if lpKeyName is NULL)
  253. LPDWORD lpcNumKeys, //address for number of direct children of the key(can be NULL)
  254. LPDWORD lpcNumValues //address for number of values under the key(can be NULL)
  255. );
  256. //The QueryValueInfo call is NOT similar to the Win32 RegQueryValueEx call
  257. //you must supply a value handle, the Win32 call doesn't have a notion of such a thing
  258. //You can get the handle with subsequent calls to EnumKey
  259. //This is my consumer call to retrieve statistical data
  260. //NOTES:
  261. // If lpData is NULL and lpcbData is not, the function will return NOERROR with
  262. // lpcbData containing the buffer size needed for the value
  263. // If lpName is NULL and lpcbName is not, the function will return NOERROR with
  264. // lpcbName containing the buffer size needed for the value
  265. DllExport HRESULT ISD_QueryInfoValue
  266. (
  267. VALUE_HANDLE hValue, //handle of value to query
  268. LPSTR lpName, //buffer to receive the name of the value(can be NULL)
  269. LPDWORD lpcbName, //size of the name buffer(can only be NULL if lpName is NULL)
  270. LPDWORD lpValueType, //address to receive the value type
  271. LPBYTE lpData, //buffer to receive the value data(can be NULL)
  272. LPDWORD lpcbData, //size of the value data buffer(can only be NULL if lpData is NULL)
  273. LPDWORD lpTime, //address for timestamp on value(when last updated)(can be NULL)
  274. LPKEY_HANDLE lphParentKey //return handle of the key that owns the value(can be NULL)
  275. );
  276. //NotifyChangeValue is somewhat similar to the Win32 RegNotifyChangeValue call
  277. //I limit you to async notification and also to value notification(no key level notify..yet)
  278. DllExport HRESULT ISD_NotifyChangeValue
  279. (
  280. VALUE_HANDLE hValue, //handle of the value to trigger an event from
  281. HANDLE hEvent //handle to the event you want triggered when value changes
  282. );
  283. //
  284. //shared API
  285. //
  286. //The DeleteKey call is similar to RegDeleteKey
  287. DllExport HRESULT ISD_DeleteKey
  288. (
  289. KEY_HANDLE hKey //handle of key to delete
  290. );
  291. //The DeleteValue call is similar to the RegDeleteValue call
  292. //NOTE: You must supply either hValue or lpValueName. If you have the hValue, use it
  293. //and pass NULL for the value name.
  294. DllExport HRESULT ISD_DeleteValue
  295. (
  296. KEY_HANDLE hKey, //handle of key that owns the value..if you have the value handle..pass NULL
  297. VALUE_HANDLE hValue, //handle of value to delete(if known)..if known..pass NULL for key handle and name value
  298. LPCSTR lpValueName //buffer holding name of value to delete(if known) pass NULL when hValue is known
  299. );
  300. //The GetStructData call is for retrieving structural info on ISDM itself. This is exposed so
  301. //my test app can check the data structs. You should not need to call this.
  302. DllExport BOOL ISD_GetStructData
  303. (
  304. LPINFO_DATA pInfo //structure holding ISDM structural info
  305. );
  306. //
  307. //Handle validation calls
  308. //
  309. //use these anytime you want to check the validity of a handle to an ISDM object
  310. DllExport BOOL ISD_IsValidKeyHandle
  311. (
  312. KEY_HANDLE hKey //handle to key
  313. );
  314. DllExport BOOL ISD_IsValidValueHandle
  315. (
  316. VALUE_HANDLE hValue //handle to value
  317. );
  318. //CompactMemory is my garbage collection function for ISDM. It is exported for
  319. //test purposes with my browser app. You don't ever need to call this.
  320. DllExport HRESULT ISD_CompactMemory
  321. (
  322. );
  323. #ifdef __cplusplus
  324. } // End of extern "C" {
  325. #endif // __cplusplus
  326. #endif // __ISDMAPI2_H__