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.

466 lines
9.1 KiB

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