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.

457 lines
9.4 KiB

  1. //
  2. // REGAPIX.H
  3. //
  4. // Copyright (C) Microsoft Corporation, 1995-1999
  5. //
  6. // Public definitions for the VMM registry library (all modes).
  7. //
  8. #ifndef _REGAPIX_
  9. #define _REGAPIX_
  10. #if _MSC_VER > 1000
  11. #pragma once
  12. #endif
  13. /*XLATOFF*/
  14. #ifdef __cplusplus
  15. extern "C" {
  16. #endif
  17. /*XLATON*/
  18. /*XLATOFF*/
  19. #if defined(_INC_WINDOWS) && !defined(VXD) && !defined(REALMODE)
  20. #define REGAPI WINAPI
  21. #else
  22. #if defined(IS_32)
  23. #ifndef FAR
  24. #define FAR
  25. #endif
  26. #define REGAPI __cdecl
  27. #else
  28. #ifndef FAR
  29. #define FAR _far
  30. #endif
  31. #define REGAPI _far _cdecl
  32. #endif // defined(IS_32)
  33. #endif // defined(_INC_WINDOWS) && !defined(VXD) && !defined(REALMODE)
  34. /*XLATON*/
  35. #ifndef _REGPRIV_
  36. #ifndef _INC_WINDOWS
  37. typedef DWORD HKEY;
  38. #endif
  39. #endif
  40. typedef HKEY FAR* LPHKEY;
  41. //
  42. // Predefined key handles.
  43. //
  44. #ifndef HKEY_LOCAL_MACHINE
  45. #define HKEY_CLASSES_ROOT ((HKEY) 0x80000000)
  46. #define HKEY_CURRENT_USER ((HKEY) 0x80000001)
  47. #define HKEY_LOCAL_MACHINE ((HKEY) 0x80000002)
  48. #define HKEY_USERS ((HKEY) 0x80000003)
  49. #define HKEY_PERFORMANCE_DATA ((HKEY) 0x80000004)
  50. #define HKEY_CURRENT_CONFIG ((HKEY) 0x80000005)
  51. #define HKEY_DYN_DATA ((HKEY) 0x80000006)
  52. #define HKEY_PREDEF_KEYS 7
  53. #endif
  54. //
  55. // Maximum size of registry data elements.
  56. //
  57. #define MAXIMUM_SUB_KEY_LENGTH 256
  58. #define MAXIMUM_VALUE_NAME_LENGTH 256
  59. #define MAXIMUM_DATA_LENGTH 16384
  60. //
  61. // Standard data types.
  62. //
  63. #ifndef REG_SZ
  64. #define REG_SZ 1
  65. #endif
  66. #ifndef REG_BINARY
  67. #define REG_BINARY 3
  68. #endif
  69. #ifndef REG_DWORD
  70. #define REG_DWORD 4
  71. #endif
  72. //
  73. // Registry error codes.
  74. //
  75. #ifndef ERROR_SUCCESS
  76. #define ERROR_SUCCESS 0
  77. #endif
  78. #ifndef ERROR_INVALID_FUNCTION
  79. #define ERROR_INVALID_FUNCTION 1
  80. #endif
  81. #ifndef ERROR_FILE_NOT_FOUND
  82. #define ERROR_FILE_NOT_FOUND 2
  83. #endif
  84. #ifndef ERROR_ACCESS_DENIED
  85. #define ERROR_ACCESS_DENIED 5
  86. #endif
  87. #ifndef ERROR_OUTOFMEMORY
  88. #define ERROR_OUTOFMEMORY 14
  89. #endif
  90. #ifndef ERROR_INVALID_PARAMETER
  91. #define ERROR_INVALID_PARAMETER 87
  92. #endif
  93. #ifndef ERROR_LOCK_FAILED
  94. #define ERROR_LOCK_FAILED 167
  95. #endif
  96. #ifndef ERROR_MORE_DATA
  97. #define ERROR_MORE_DATA 234
  98. #endif
  99. #ifndef ERROR_NO_MORE_ITEMS
  100. #define ERROR_NO_MORE_ITEMS 259
  101. #endif
  102. #ifndef ERROR_BADDB
  103. #define ERROR_BADDB 1009
  104. #endif
  105. #ifndef ERROR_BADKEY
  106. #define ERROR_BADKEY 1010
  107. #endif
  108. #ifndef ERROR_CANTOPEN
  109. #define ERROR_CANTOPEN 1011
  110. #endif
  111. #ifndef ERROR_CANTREAD
  112. #define ERROR_CANTREAD 1012
  113. #endif
  114. #ifndef ERROR_CANTWRITE
  115. #define ERROR_CANTWRITE 1013
  116. #endif
  117. #ifndef ERROR_REGISTRY_IO_FAILED
  118. #define ERROR_REGISTRY_IO_FAILED 1016
  119. #endif
  120. #ifndef ERROR_KEY_DELETED
  121. #define ERROR_KEY_DELETED 1018
  122. #endif
  123. // Internal registry error codes. Not exposed to most clients.
  124. #if defined(VXD)
  125. #define ERROR_CANTOPEN16_FILENOTFOUND32 ((ERROR_CANTOPEN << 16) | ERROR_FILE_NOT_FOUND)
  126. #define ERROR_CANTREAD16_FILENOTFOUND32 ((ERROR_CANTREAD << 16) | ERROR_FILE_NOT_FOUND)
  127. #else
  128. #if defined(WIN32)
  129. #define ERROR_CANTOPEN16_FILENOTFOUND32 ERROR_FILE_NOT_FOUND
  130. #define ERROR_CANTREAD16_FILENOTFOUND32 ERROR_FILE_NOT_FOUND
  131. #else
  132. #define ERROR_CANTOPEN16_FILENOTFOUND32 ERROR_CANTOPEN
  133. #define ERROR_CANTREAD16_FILENOTFOUND32 ERROR_CANTREAD
  134. #endif
  135. #endif
  136. //
  137. // Registry application interfaces.
  138. //
  139. /*XLATOFF*/
  140. LONG
  141. REGAPI
  142. VMMRegLibAttach(
  143. UINT Flags
  144. );
  145. VOID
  146. REGAPI
  147. VMMRegLibDetach(
  148. VOID
  149. );
  150. /*XLATON*/
  151. #define GRFT_SYSTEM 0 // SYSTEM.DAT
  152. #define GRFT_USER 1 // USER.DAT
  153. /*XLATOFF*/
  154. BOOL
  155. REGAPI
  156. VMMRegGetRegistryFile(
  157. char FAR* lpBuffer,
  158. UINT BufferSize,
  159. UINT FileType
  160. );
  161. // Creates a new registry file. Fails if the specified file already exists.
  162. #define MPKF_CREATENEW 0x0001
  163. // If MPKF_VERSION20 is specified, create the file using compact keynodes.
  164. // Such a file will only be readable by users of this library, not Win95
  165. // clients. Use only for system registries (SYSTEM.DAT, USER.DAT).
  166. #define MPKF_VERSION20 0x0002
  167. LONG
  168. REGAPI
  169. VMMRegMapPredefKeyToFile(
  170. HKEY hKey,
  171. const char FAR* lpFileName,
  172. UINT Flags
  173. );
  174. LONG
  175. REGAPI
  176. VMMRegMapPredefKeyToKey(
  177. HKEY hSourceKey,
  178. HKEY hPredefKey
  179. );
  180. LONG
  181. REGAPI
  182. VMMRegCreateKey(
  183. HKEY hKey,
  184. const char FAR* lpSubKey,
  185. LPHKEY lphSubKey
  186. );
  187. LONG
  188. REGAPI
  189. VMMRegOpenKey(
  190. HKEY hKey,
  191. const char FAR* lpSubKey,
  192. LPHKEY lphSubKey
  193. );
  194. LONG
  195. REGAPI
  196. VMMRegCloseKey(
  197. HKEY hKey
  198. );
  199. LONG
  200. REGAPI
  201. VMMRegFlushKey(
  202. HKEY hKey
  203. );
  204. LONG
  205. REGAPI
  206. VMMRegQueryValue(
  207. HKEY hKey,
  208. const char FAR* lpSubKey,
  209. BYTE FAR* lpData,
  210. DWORD FAR* lpcbData
  211. );
  212. LONG
  213. REGAPI
  214. VMMRegQueryValueEx(
  215. HKEY hKey,
  216. const char FAR* lpValueName,
  217. DWORD FAR* lpReserved,
  218. DWORD FAR* lpType,
  219. BYTE FAR* lpData,
  220. DWORD FAR* lpcbData
  221. );
  222. LONG
  223. REGAPI
  224. VMMRegQueryMultipleValues(
  225. HKEY hKey,
  226. void FAR* val_list,
  227. DWORD num_vals,
  228. char FAR* lpValueBuffer,
  229. DWORD FAR* lpdwTotalSize
  230. );
  231. LONG
  232. REGAPI
  233. VMMRegSetValue(
  234. HKEY hKey,
  235. const char FAR* lpSubKey,
  236. DWORD Type,
  237. BYTE FAR* lpData,
  238. DWORD cbData
  239. );
  240. LONG
  241. REGAPI
  242. VMMRegSetValueEx(
  243. HKEY hKey,
  244. const char FAR* lpValueName,
  245. DWORD Reserved,
  246. DWORD Type,
  247. BYTE FAR* lpData,
  248. DWORD cbData
  249. );
  250. LONG
  251. REGAPI
  252. VMMRegDeleteKey(
  253. HKEY hKey,
  254. const char FAR* lpSubKey
  255. );
  256. LONG
  257. REGAPI
  258. VMMRegDeleteValue(
  259. HKEY hKey,
  260. const char FAR* lpValueName
  261. );
  262. LONG
  263. REGAPI
  264. VMMRegEnumKey(
  265. HKEY hKey,
  266. DWORD Index,
  267. char FAR* lpKeyName,
  268. DWORD cbKeyName
  269. );
  270. LONG
  271. REGAPI
  272. VMMRegEnumValue(
  273. HKEY hKey,
  274. DWORD Index,
  275. char FAR* lpValueName,
  276. DWORD FAR* lpcbValueName,
  277. DWORD FAR* lpReserved,
  278. DWORD FAR* lpType,
  279. BYTE FAR* lpData,
  280. DWORD FAR* lpcbData
  281. );
  282. #ifdef VXD
  283. LONG
  284. REGAPI
  285. VMMRegQueryInfoKey(
  286. HKEY hKey,
  287. DWORD FAR* lpcSubKeys,
  288. DWORD FAR* lpcbMaxSubKeyLen,
  289. DWORD FAR* lpcValues,
  290. DWORD FAR* lpcbMaxValueName,
  291. DWORD FAR* lpcbMaxValueData
  292. );
  293. #else
  294. LONG
  295. REGAPI
  296. VMMRegQueryInfoKey(
  297. HKEY hKey,
  298. char FAR* lpClass,
  299. DWORD FAR* lpcbClass,
  300. DWORD FAR* lpReserved,
  301. DWORD FAR* lpcSubKeys,
  302. DWORD FAR* lpcbMaxSubKeyLen,
  303. DWORD FAR* lpcbMaxClassLen,
  304. DWORD FAR* lpcValues,
  305. DWORD FAR* lpcbMaxValueName,
  306. DWORD FAR* lpcbMaxValueData,
  307. void FAR* lpcbSecurityDescriptor,
  308. void FAR* lpftLastWriteTime
  309. );
  310. #endif
  311. LONG
  312. REGAPI
  313. VMMRegLoadKey(
  314. HKEY hKey,
  315. const char FAR* lpSubKey,
  316. const char FAR* lpFileName
  317. );
  318. LONG
  319. REGAPI
  320. VMMRegUnLoadKey(
  321. HKEY hKey,
  322. const char FAR* lpSubKey
  323. );
  324. LONG
  325. REGAPI
  326. VMMRegSaveKey(
  327. HKEY hKey,
  328. const char FAR* lpFileName,
  329. void FAR* lpSecurityAttributes
  330. );
  331. LONG
  332. REGAPI
  333. VMMRegReplaceKey(
  334. HKEY hKey,
  335. const char FAR* lpSubKey,
  336. const char FAR* lpNewFileName,
  337. const char FAR* lpOldFileName
  338. );
  339. //
  340. // Optional macros for callers (typically 16-bit) that map the registry APIs
  341. // to the equivalent Win32 API name.
  342. //
  343. #if defined(IS_16) || defined(WANTREGAPIMACROS)
  344. #if !defined(NOREGAPIMACROS) && !defined(SETUPX_INC)
  345. #define RegCreateKey VMMRegCreateKey
  346. #define RegOpenKey VMMRegOpenKey
  347. #define RegCloseKey VMMRegCloseKey
  348. #define RegFlushKey VMMRegFlushKey
  349. #define RegQueryValue VMMRegQueryValue
  350. #define RegQueryValueEx VMMRegQueryValueEx
  351. #define RegQueryMultipleValues VMMRegQueryMultipleValues
  352. #define RegSetValue VMMRegSetValue
  353. #define RegSetValueEx VMMRegSetValueEx
  354. #define RegDeleteKey VMMRegDeleteKey
  355. #define RegDeleteValue VMMRegDeleteValue
  356. #define RegEnumKey VMMRegEnumKey
  357. #define RegEnumValue VMMRegEnumValue
  358. #define RegQueryInfoKey VMMRegQueryInfoKey
  359. #define RegLoadKey VMMRegLoadKey
  360. #define RegUnLoadKey VMMRegUnLoadKey
  361. #define RegSaveKey VMMRegSaveKey
  362. #define RegReplaceKey VMMRegReplaceKey
  363. #endif
  364. #endif
  365. /*XLATON*/
  366. //
  367. // Registry services available via VMM's interrupt 2Fh handler.
  368. //
  369. #define RegOpenKey_Idx 0x0100
  370. #define RegCreateKey_Idx 0x0101
  371. #define RegCloseKey_Idx 0x0102
  372. #define RegDeleteKey_Idx 0x0103
  373. #define RegSetValue_Idx 0x0104
  374. #define RegQueryValue_Idx 0x0105
  375. #define RegEnumKey_Idx 0x0106
  376. #define RegDeleteValue_Idx 0x0107
  377. #define RegEnumValue_Idx 0x0108
  378. #define RegQueryValueEx_Idx 0x0109
  379. #define RegSetValueEx_Idx 0x010A
  380. #define RegFlushKey_Idx 0x010B
  381. #define RegLoadKey_Idx 0x010C
  382. #define RegUnLoadKey_Idx 0x010D
  383. #define RegSaveKey_Idx 0x010E
  384. #define RegRestore_Idx 0x010F
  385. #define RegRemapPreDefKey_Idx 0x0110
  386. /*XLATOFF*/
  387. #ifdef __cplusplus
  388. }
  389. #endif
  390. /*XLATON*/
  391. #endif // _REGAPIX_