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.

350 lines
14 KiB

  1. #ifndef __ISDMAPI2_H__
  2. #define __ISDMAPI2_H__
  3. /****************************************************************************
  4. *
  5. * $Archive: /rtp/RRCM32/rrcminc/ISDMAPI2.H $
  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 $
  16. * $Date: 8/13/96 12:16p $
  17. * $Author: Bnkeany $
  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 0x6969
  41. #define VALUEBITCODE 0xABBA
  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, LPCTSTR, LPKEY_HANDLE);
  70. typedef HRESULT (*ISD_CREATEVALUE) (KEY_HANDLE, LPCTSTR, DWORD,CONST BYTE *,DWORD,LPVALUE_HANDLE);
  71. typedef HRESULT (*ISD_SETVALUE) (KEY_HANDLE, VALUE_HANDLE, LPCTSTR, DWORD, CONST BYTE *, DWORD);
  72. //consumer
  73. typedef HRESULT (*ISD_OPENKEY) (KEY_HANDLE, LPCSTR, LPKEY_HANDLE);
  74. typedef HRESULT (*ISD_ENUMKEY) (KEY_HANDLE, DWORD, LPTSTR, LPDWORD, LPKEY_HANDLE);
  75. typedef HRESULT (*ISD_ENUMVALUE) (KEY_HANDLE, DWORD, LPDWORD, LPDWORD, LPBYTE, LPDWORD, LPDWORD, LPVALUE_HANDLE);
  76. typedef HRESULT (*ISD_QUERYINFOKEY) (KEY_HANDLE, LPSTR, LPDWORD, LPDWORD, LPDWORD);
  77. typedef HRESULT (*ISD_QUERYINFOVALUE) (VALUE_HANDLE, LPSTR, LPDWORD, LPDWORD, LPBYTE, LPDWORD, LPDWORD, LPKEY_HANDLE);
  78. typedef HRESULT (*ISD_NOTIFYCHANGEVALUE) (VALUE_HANDLE, HANDLE);
  79. //used by either
  80. typedef HRESULT (*ISD_DELETEKEY) (KEY_HANDLE);
  81. typedef HRESULT (*ISD_DELETEVALUE) (KEY_HANDLE, VALUE_HANDLE, LPCSTR);
  82. typedef BOOL (*ISD_GETSTRUCTDATA) (LPINFO_DATA);
  83. typedef BOOL (*ISD_ISVALIDKEYHANDLE) (KEY_HANDLE);
  84. typedef BOOL (*ISD_ISVALIDVALUEHANDLE) (VALUE_HANDLE);
  85. typedef HRESULT (*ISD_COMPACTMEMORY) ();
  86. //structure for ISDM entry points
  87. typedef struct _ISDM2API
  88. {
  89. ISD_CREATEKEY ISD_CreateKey;
  90. ISD_CREATEVALUE ISD_CreateValue;
  91. ISD_SETVALUE ISD_SetValue;
  92. ISD_OPENKEY ISD_OpenKey;
  93. ISD_ENUMKEY ISD_EnumKey;
  94. ISD_ENUMVALUE ISD_EnumValue;
  95. ISD_QUERYINFOKEY ISD_QueryInfoKey;
  96. ISD_QUERYINFOVALUE ISD_QueryInfoValue;
  97. ISD_NOTIFYCHANGEVALUE ISD_NotifyChangeValue;
  98. ISD_DELETEKEY ISD_DeleteKey;
  99. ISD_DELETEVALUE ISD_DeleteValue;
  100. ISD_GETSTRUCTDATA ISD_GetStructData;
  101. ISD_ISVALIDKEYHANDLE ISD_IsValidKeyHandle;
  102. ISD_ISVALIDVALUEHANDLE ISD_IsValidValueHandle;
  103. ISD_COMPACTMEMORY ISD_CompactMemory;
  104. }
  105. ISDM2API, *LPISDM2API;
  106. //HRESULT error defines
  107. #define ISDM_ERROR_BASEB 0x8000
  108. #define ERROR_INVALID_KEY_HANDLE ISDM_ERROR_BASEB + 1
  109. #define ERROR_MORE_DATA_AVAILABLE ISDM_ERROR_BASEB + 2
  110. #define ERROR_INVALID_STRING_POINTER ISDM_ERROR_BASEB + 3
  111. #define ERROR_KEY_NOT_FOUND ISDM_ERROR_BASEB + 4
  112. #define ERROR_VALUE_NOT_FOUND ISDM_ERROR_BASEB + 5
  113. #define ERROR_NO_MORE_SESSIONS ISDM_ERROR_BASEB + 6
  114. #define ERROR_INVALID_VALUE_HANDLE ISDM_ERROR_BASEB + 7
  115. #define ERROR_FAILED_TO_GET_MEM_KEY ISDM_ERROR_BASEB + 8
  116. #define ERROR_NO_PARENT ISDM_ERROR_BASEB + 9
  117. #define ERROR_NO_PREV_SIBLING ISDM_ERROR_BASEB + 10
  118. #define ERROR_NO_NEXT_SIBLING ISDM_ERROR_BASEB + 11
  119. #define ERROR_NO_CHILD ISDM_ERROR_BASEB + 12
  120. #define ERROR_INVALID_VALUE_TYPE ISDM_ERROR_BASEB + 13
  121. #define ERROR_MALLOC_FAILURE ISDM_ERROR_BASEB + 14
  122. #define ERROR_CREATE_KEY_FAILURE ISDM_ERROR_BASEB + 15
  123. #define ERROR_NULL_PARAM ISDM_ERROR_BASEB + 16
  124. #define ERROR_VALUE_EXISTS ISDM_ERROR_BASEB + 17
  125. #define ERROR_FAILED_TO_GET_MEM_VALUE ISDM_ERROR_BASEB + 18
  126. #define ERROR_NO_MORE_STR_SPACE ISDM_ERROR_BASEB + 19
  127. #define ERROR_KEY_EXISTS ISDM_ERROR_BASEB + 20
  128. #define ERROR_NO_MORE_KEY_SPACE ISDM_ERROR_BASEB + 21
  129. #define ERROR_NO_MORE_VALUE_SPACE ISDM_ERROR_BASEB + 22
  130. #define ERROR_INVALID_PARAM ISDM_ERROR_BASEB + 23
  131. #define ERROR_ROOT_DELETE ISDM_ERROR_BASEB + 24
  132. #define ERROR_NULL_STRING_TABLE_ENTRY ISDM_ERROR_BASEB + 25
  133. #define ERROR_NO_MORE_TABLE_ENTRIES ISDM_ERROR_BASEB + 26
  134. #define ERROR_ISDM_UNKNOWN ISDM_ERROR_BASEB + 27
  135. #define ERROR_NOT_IMPLEMENTED ISDM_ERROR_BASEB + 28
  136. #define ERROR_MALLOC_FAILED ISDM_ERROR_BASEB + 29
  137. #define ERROR_FAILED_TO_GET_MEM_TABLE ISDM_ERROR_BASEB + 30
  138. #define ERROR_SEMAPHORE_WAIT_FAIL ISDM_ERROR_BASEB + 31
  139. #define ERROR_NO_MORE_EVENTS ISDM_ERROR_BASEB + 32
  140. #define ERROR_INVALID_EVENT ISDM_ERROR_BASEB + 33
  141. #define ERROR_INVALID_EVENT_HANDLE ISDM_ERROR_BASEB + 34
  142. #define ERROR_EVENT_NONEXISTANT ISDM_ERROR_BASEB + 35
  143. //token defines..these may just disappear
  144. //RRCM
  145. #define RRCM_LOCAL_STREAM 1
  146. #define RRCM_REMOTE_STREAM 2
  147. #define ISDM_RRCM_BASE 0x1000
  148. #define ISDM_SSRC ISDM_RRCM_BASE + 1
  149. #define ISDM_NUM_PCKT_SENT ISDM_RRCM_BASE + 2
  150. #define ISDM_NUM_BYTES_SENT ISDM_RRCM_BASE + 3
  151. #define ISDM_FRACTION_LOST ISDM_RRCM_BASE + 4
  152. #define ISDM_CUM_NUM_PCKT_LOST ISDM_RRCM_BASE + 5
  153. #define ISDM_XTEND_HIGHEST_SEQ_NUM ISDM_RRCM_BASE + 6
  154. #define ISDM_INTERARRIVAL_JITTER ISDM_RRCM_BASE + 7
  155. #define ISDM_LAST_SR ISDM_RRCM_BASE + 8
  156. #define ISDM_DLSR ISDM_RRCM_BASE + 9
  157. #define ISDM_NUM_BYTES_RCVD ISDM_RRCM_BASE + 10
  158. #define ISDM_NUM_PCKT_RCVD ISDM_RRCM_BASE + 11
  159. #define ISDM_NTP_FRAC ISDM_RRCM_BASE + 12
  160. #define ISDM_NTP_SEC ISDM_RRCM_BASE + 13
  161. #define ISDM_WHO_AM_I ISDM_RRCM_BASE + 14
  162. //
  163. //Supplier API
  164. //
  165. //NOTE: always refer to the Win32 Registry equivalent call for more information on the functionality of the call
  166. //The create key call is similar to the RegCreateKeyEx call from Win32 in functionality
  167. //NOTE: This call will create the new key or simply return the handle of the key if it already
  168. //exists
  169. extern DllExport HRESULT ISD_CreateKey
  170. (
  171. KEY_HANDLE hParentKey, //The key from which to create the new key(can be MAIN_ROOT_KEY)
  172. LPCTSTR lpSubKey, //the subkey to create.(see RegCreateKeyEx for details)
  173. LPKEY_HANDLE lphReturnKey//the handle of the newly created key
  174. );
  175. //The create value call is not part of the Win32 reg calls. It is here for symmetry in my API
  176. //I prefer to use CreateValue then SetValue for my values, you can simply use SetValue and ignore
  177. //CreateValue if you wish. The reason the registry has no such call is because they don't have
  178. //a notion of a handle to a value. I felt it was very useful to have direct handles to the values for
  179. //subsequent update calls.
  180. extern DllExport HRESULT ISD_CreateValue
  181. (
  182. KEY_HANDLE hKey, //handle to the key that will own the new value
  183. LPCTSTR lpName, //string ID of the value to be create
  184. DWORD dwType, //type of value to create(DWORD,STRING,BINARY)
  185. CONST BYTE *lpData, //pointer to value data
  186. DWORD cbData, //size of the value data buffer
  187. LPVALUE_HANDLE lphReturnValue //return handle to the newly created value
  188. );
  189. //SetValue is similar to the Win32 RegSetValueEx call
  190. DllExport HRESULT ISD_SetValue
  191. (
  192. KEY_HANDLE hKey, //handle of valid key
  193. VALUE_HANDLE hValue, //handle of value to set
  194. LPCTSTR lpName, //address of value name of value to set
  195. DWORD dwType, //flag for value type
  196. CONST BYTE *lpData, //address of value data
  197. DWORD cbData //size of value data
  198. );
  199. //
  200. //Consumer API
  201. //
  202. //The OpenKey call is similar to the Win32 RegOpenKeyEx call
  203. DllExport HRESULT ISD_OpenKey
  204. (
  205. KEY_HANDLE hKey, //handle of a valid key(can be MAIN_ROOT_KEY)
  206. LPCSTR lpSubKey, //name of subkey to open
  207. LPKEY_HANDLE lphReturnKey //handle of the opened key
  208. );
  209. //The EnumKey call is similar to the Win32 RegEnumKey call
  210. //NOTES:
  211. // If lpName is null the size of the name is returned into lpcbName and NOERROR is returned
  212. DllExport HRESULT ISD_EnumKey
  213. (
  214. KEY_HANDLE hKey, //key to enumerate
  215. DWORD dwIndex, //index of subkey to enumerate
  216. LPTSTR lpName, //address of buffer for subkey name(can be NULL)
  217. LPDWORD lpcbName, //address for size of subkey buffer (acts like the RegEnumKeyEx version of this param)
  218. LPKEY_HANDLE lphReturnKey //handle of subkey(can be NULL)
  219. );
  220. //The EnumValue call is similar to the Win32 RegEnumValue call
  221. DllExport HRESULT ISD_EnumValue
  222. (
  223. KEY_HANDLE hKey, //handle of key where value resides
  224. DWORD dwIndex, //index of value to enum
  225. LPTSTR lpName, //address of buffer for value name(can be NULL)
  226. LPDWORD lpcbName, //address for size of value name buffer(can be NULL only if lpName is NULL)
  227. LPDWORD lpType, //address for type of value(can be NULL if you don't care about type)
  228. LPBYTE lpData, //address of buffer to receive the value data(can be NULL)
  229. LPDWORD lpcbData, //address of size of buffer to receive the value data(can be NULL only if lpData is NULL)
  230. LPDWORD lpTimeStamp, //address for timestamp on value(when last updated)(can be NULL)
  231. LPVALUE_HANDLE lphReturnValue //address for handle of value(can be NULL)
  232. );
  233. //The QueryKeyInfo call is similar to the RegQueryInfoKey
  234. DllExport HRESULT ISD_QueryInfoKey
  235. (
  236. KEY_HANDLE hKey, //handle of a valid key(can be MAIN_ROOT_KEY)
  237. LPSTR lpKeyName, //buffer to receive the name of the key(can be NULL)
  238. LPDWORD lpcbKeyName, //address of size of name buffer(can be null only if lpKeyName is NULL)
  239. LPDWORD lpcNumKeys, //address for number of direct children of the key(can be NULL)
  240. LPDWORD lpcNumValues //address for number of values under the key(can be NULL)
  241. );
  242. //The QueryValueInfo call is NOT similar to the Win32 RegQueryValueEx call
  243. //you must supply a value handle, the Win32 call doesn't have a notion of such a thing
  244. //You can get the handle with subsequent calls to EnumKey
  245. //This is my consumer call to retrieve statistical data
  246. //NOTES:
  247. // If lpData is NULL and lpcbData is not, the function will return NOERROR with
  248. // lpcbData containing the buffer size needed for the value
  249. // If lpName is NULL and lpcbName is not, the function will return NOERROR with
  250. // lpcbName containing the buffer size needed for the value
  251. DllExport HRESULT ISD_QueryInfoValue
  252. (
  253. VALUE_HANDLE hValue, //handle of value to query
  254. LPSTR lpName, //buffer to receive the name of the value(can be NULL)
  255. LPDWORD lpcbName, //size of the name buffer(can only be NULL if lpName is NULL)
  256. LPDWORD lpValueType, //address to receive the value type
  257. LPBYTE lpData, //buffer to receive the value data(can be NULL)
  258. LPDWORD lpcbData, //size of the value data buffer(can only be NULL if lpData is NULL)
  259. LPDWORD lpTime, //address for timestamp on value(when last updated)(can be NULL)
  260. LPKEY_HANDLE lphParentKey //return handle of the key that owns the value(can be NULL)
  261. );
  262. //NotifyChangeValue is somewhat similar to the Win32 RegNotifyChangeValue call
  263. //I limit you to async notification and also to value notification(no key level notify..yet)
  264. DllExport HRESULT ISD_NotifyChangeValue
  265. (
  266. VALUE_HANDLE hValue, //handle of the value to trigger an event from
  267. HANDLE hEvent //handle to the event you want triggered when value changes
  268. );
  269. //
  270. //shared API
  271. //
  272. //The DeleteKey call is similar to RegDeleteKey
  273. DllExport HRESULT ISD_DeleteKey
  274. (
  275. KEY_HANDLE hKey //handle of key to delete
  276. );
  277. //The DeleteValue call is similar to the RegDeleteValue call
  278. //NOTE: You must supply either hValue or lpValueName. If you have the hValue, use it
  279. //and pass NULL for the value name.
  280. DllExport HRESULT ISD_DeleteValue
  281. (
  282. KEY_HANDLE hKey, //handle of key that owns the value..if you have the value handle..pass NULL
  283. VALUE_HANDLE hValue, //handle of value to delete(if known)..if known..pass NULL for key handle and name value
  284. LPCSTR lpValueName //buffer holding name of value to delete(if known) pass NULL when hValue is known
  285. );
  286. //The GetStructData call is for retrieving structural info on ISDM itself. This is exposed so
  287. //my test app can check the data structs. You should not need to call this.
  288. DllExport BOOL ISD_GetStructData
  289. (
  290. LPINFO_DATA pInfo //structure holding ISDM structural info
  291. );
  292. //
  293. //Handle validation calls
  294. //
  295. //use these anytime you want to check the validity of a handle to an ISDM object
  296. DllExport BOOL ISD_IsValidKeyHandle
  297. (
  298. KEY_HANDLE hKey //handle to key
  299. );
  300. DllExport BOOL ISD_IsValidValueHandle
  301. (
  302. VALUE_HANDLE hValue //handle to value
  303. );
  304. //CompactMemory is my garbage collection function for ISDM. It is exported for
  305. //test purposes with my browser app. You don't ever need to call this.
  306. DllExport HRESULT ISD_CompactMemory
  307. (
  308. );
  309. #ifdef __cplusplus
  310. } // End of extern "C" {
  311. #endif // __cplusplus
  312. #endif // __ISDMAPI2_H__