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.

552 lines
14 KiB

  1. /*****************************************************************************
  2. *
  3. * (C) Copyright MICROSOFT Corp., 1993
  4. *
  5. * Title: VMMREG.H - Include file for VMM/Loader Registry Services
  6. *
  7. * Version: 1.00
  8. *
  9. * Date: 03-June-1993
  10. *
  11. * Author: Nagara
  12. *
  13. *-----------------------------------------------------------------------------
  14. *
  15. * Change log:
  16. *
  17. ******************************************************************************
  18. */
  19. #ifndef _VMMREG_H
  20. #define _VMMREG_H
  21. typedef DWORD VMMHKEY;
  22. typedef VMMHKEY *PVMMHKEY;
  23. typedef DWORD VMMREGRET; // return type for the REG Functions
  24. #define MAX_VMM_REG_KEY_LEN 256 // includes the \0 terminator
  25. #ifndef REG_SZ // define only if not there already
  26. #define REG_SZ 0x0001
  27. #endif
  28. #ifndef REG_BINARY // define only if not there already
  29. #define REG_BINARY 0x0003
  30. #endif
  31. #ifndef REG_DWORD // define only if not there already
  32. #define REG_DWORD 0x0004
  33. #endif
  34. #ifndef HKEY_LOCAL_MACHINE // define only if not there already
  35. #define HKEY_CLASSES_ROOT 0x80000000
  36. #define HKEY_CURRENT_USER 0x80000001
  37. #define HKEY_LOCAL_MACHINE 0x80000002
  38. #define HKEY_USERS 0x80000003
  39. #define HKEY_PERFORMANCE_DATA 0x80000004
  40. #define HKEY_CURRENT_CONFIG 0x80000005
  41. #define HKEY_DYN_DATA 0x80000006
  42. #endif
  43. // ERROR CODES returned by Registry
  44. // NOTE THAT THESE ARE ALSO DEFINED IN WINERROR.H
  45. // and so VMMREG.H should be included after WINERROR.H
  46. #ifndef ERROR_FILE_NOT_FOUND
  47. #define ERROR_FILE_NOT_FOUND 2L
  48. #endif
  49. #ifndef ERROR_BADDB
  50. #define ERROR_BADDB 1009L
  51. #endif
  52. #ifndef ERROR_MORE_DATA
  53. #define ERROR_MORE_DATA 234L
  54. #endif
  55. #ifndef ERROR_BADKEY
  56. #define ERROR_BADKEY 1010L
  57. #endif
  58. #ifndef ERROR_CANTOPEN
  59. #define ERROR_CANTOPEN 1011L
  60. #endif
  61. #ifndef ERROR_CANTREAD
  62. #define ERROR_CANTREAD 1012L
  63. #define ERROR_CANTWRITE 1013L
  64. #endif
  65. #ifndef ERROR_REGISTRY_CORRUPT
  66. #define ERROR_REGISTRY_CORRUPT 1015L
  67. #endif
  68. #ifndef ERROR_REGISTRY_IO_FAILED
  69. #define ERROR_REGISTRY_IO_FAILED 1016L
  70. #endif
  71. #ifndef ERROR_KEY_DELETED
  72. #define ERROR_KEY_DELETED 1018L
  73. #endif
  74. #ifndef ERROR_OUTOFMEMORY
  75. #define ERROR_OUTOFMEMORY 14L
  76. #endif
  77. #ifndef ERROR_INVALID_PARAMETER
  78. #define ERROR_INVALID_PARAMETER 87L
  79. #endif
  80. #ifndef ERROR_LOCK_FAILED
  81. #define ERROR_LOCK_FAILED 167L
  82. #endif
  83. #ifndef ERROR_NO_MORE_ITEMS
  84. #define ERROR_NO_MORE_ITEMS 259L
  85. #endif
  86. #ifndef ERROR_SUCCESS
  87. #define ERROR_SUCCESS 0L
  88. #endif
  89. // END ERROR CODES
  90. /*XLATOFF*/
  91. #ifndef Not_VxD
  92. /*NOINC*/
  93. #ifndef _PROVIDER_STRUCTS_DEFINED
  94. #define _PROVIDER_STRUCTS_DEFINED
  95. struct val_context {
  96. int valuelen; // the total length of this value
  97. PVOID value_context; // provider's context
  98. PVOID val_buff_ptr; // where in the ouput buffer the value is.
  99. };
  100. typedef struct val_context *PVALCONTEXT;
  101. typedef struct pvalue { // Provider supplied value/context.
  102. PCHAR pv_valuename; // The value name pointer
  103. DWORD pv_valuelen;
  104. PVOID pv_value_context;
  105. DWORD pv_type;
  106. }PVALUE;
  107. typedef struct pvalue *PPVALUE;
  108. typedef VMMREGRET (_cdecl *PQUERYHANDLER)(PVOID pvKeyContext, PVALCONTEXT pvalcontextValues, DWORD cvalcontextValues, PVOID pbData, DWORD * pcbData, DWORD dwReserved);
  109. #define PROVIDER_KEEPS_VALUE_LENGTH 0x1
  110. typedef struct provider_info {
  111. PQUERYHANDLER pi_R0_1val;
  112. PQUERYHANDLER pi_R0_allvals;
  113. PQUERYHANDLER pi_R3_1val;
  114. PQUERYHANDLER pi_R3_allvals;
  115. DWORD pi_flags; // Only PROVIDER_KEEPS_VALUE_LENGTH for now.
  116. }PROVIDER;
  117. typedef PROVIDER *PPROVIDER;
  118. struct value_ent {
  119. PCHAR ve_valuename;
  120. DWORD ve_valuelen;
  121. DWORD ve_valueptr;
  122. DWORD ve_type;
  123. };
  124. typedef struct value_ent VALENT;
  125. typedef VALENT *PVALENT;
  126. #endif // not(_PROVIDER_STRUCTS_DEFINED)
  127. /*INC*/
  128. #ifndef WIN31COMPAT
  129. #pragma warning (disable:4035) // turn off no return code warning
  130. #ifndef WANTVXDWRAPS
  131. VMMREGRET VXDINLINE
  132. VMM_RegOpenKey(VMMHKEY hkey, PCHAR lpszSubKey, PVMMHKEY phkResult)
  133. {
  134. _asm push phkResult
  135. _asm push lpszSubKey
  136. _asm push hkey
  137. Touch_Register(eax)
  138. Touch_Register(ecx)
  139. Touch_Register(edx)
  140. VMMCall(_RegOpenKey);
  141. _asm add esp, 3*4
  142. }
  143. VMMREGRET VXDINLINE
  144. VMM_RegCloseKey(VMMHKEY hkey)
  145. {
  146. _asm push hkey
  147. Touch_Register(eax)
  148. Touch_Register(ecx)
  149. Touch_Register(edx)
  150. VMMCall(_RegCloseKey);
  151. _asm add esp, 1*4
  152. }
  153. VMMREGRET VXDINLINE
  154. VMM_RegCreateKey(VMMHKEY hkey, PCHAR lpszSubKey, PVMMHKEY phkResult)
  155. {
  156. _asm push phkResult
  157. _asm push lpszSubKey
  158. _asm push hkey
  159. Touch_Register(eax)
  160. Touch_Register(ecx)
  161. Touch_Register(edx)
  162. VMMCall(_RegCreateKey);
  163. _asm add esp, 3*4
  164. }
  165. VMMREGRET VXDINLINE
  166. VMM_RegCreateDynKey(PCHAR lpszSubKey, PVOID pvKeyContext, PVOID pprovHandlerInfo, PVOID ppvalueValueInfo, DWORD cpvalueValueInfo, PVMMHKEY phkResult)
  167. {
  168. _asm push phkResult
  169. _asm push cpvalueValueInfo
  170. _asm push ppvalueValueInfo
  171. _asm push pprovHandlerInfo
  172. _asm push pvKeyContext
  173. _asm push lpszSubKey
  174. Touch_Register(eax)
  175. Touch_Register(ecx)
  176. Touch_Register(edx)
  177. VMMCall(_RegCreateDynKey);
  178. _asm add esp, 6*4
  179. }
  180. VMMREGRET VXDINLINE
  181. VMM_RegQueryMultipleValues (VMMHKEY hKey, PVOID val_list, DWORD num_vals, PCHAR lpValueBuf, DWORD *ldwTotsize)
  182. {
  183. _asm push ldwTotsize
  184. _asm push lpValueBuf
  185. _asm push num_vals
  186. _asm push val_list
  187. _asm push hKey
  188. Touch_Register(eax)
  189. Touch_Register(ecx)
  190. Touch_Register(edx)
  191. VMMCall(_RegQueryMultipleValues);
  192. _asm add esp, 5*4
  193. }
  194. VMMREGRET VXDINLINE
  195. VMM_RegDeleteKey(VMMHKEY hkey, PCHAR lpszSubKey)
  196. {
  197. _asm push lpszSubKey
  198. _asm push hkey
  199. Touch_Register(eax)
  200. Touch_Register(ecx)
  201. Touch_Register(edx)
  202. VMMCall(_RegDeleteKey);
  203. _asm add esp, 2*4
  204. }
  205. VMMREGRET VXDINLINE
  206. VMM_RegEnumKey(VMMHKEY hkey, DWORD iSubKey, PCHAR lpszName, DWORD cchName)
  207. {
  208. _asm push cchName
  209. _asm push lpszName
  210. _asm push iSubKey
  211. _asm push hkey
  212. Touch_Register(eax)
  213. Touch_Register(ecx)
  214. Touch_Register(edx)
  215. VMMCall(_RegEnumKey);
  216. _asm add esp, 4*4
  217. }
  218. VMMREGRET VXDINLINE
  219. VMM_RegQueryValue(VMMHKEY hkey, PCHAR lpszSubKey, PCHAR lpszValue, PDWORD lpcbValue)
  220. {
  221. _asm push lpcbValue
  222. _asm push lpszValue
  223. _asm push lpszSubKey
  224. _asm push hkey
  225. Touch_Register(eax)
  226. Touch_Register(ecx)
  227. Touch_Register(edx)
  228. VMMCall(_RegQueryValue);
  229. _asm add esp, 4*4
  230. }
  231. VMMREGRET VXDINLINE
  232. VMM_RegSetValue(VMMHKEY hkey, PCHAR lpszSubKey, DWORD fdwType, PCHAR lpszData, DWORD cbData)
  233. {
  234. _asm push cbData
  235. _asm push lpszData
  236. _asm push fdwType
  237. _asm push lpszSubKey
  238. _asm push hkey
  239. Touch_Register(eax)
  240. Touch_Register(ecx)
  241. Touch_Register(edx)
  242. VMMCall(_RegSetValue);
  243. _asm add esp, 5*4
  244. }
  245. VMMREGRET VXDINLINE
  246. VMM_RegDeleteValue(VMMHKEY hkey, PCHAR lpszValue)
  247. {
  248. _asm push lpszValue
  249. _asm push hkey
  250. Touch_Register(eax)
  251. Touch_Register(ecx)
  252. Touch_Register(edx)
  253. VMMCall(_RegDeleteValue);
  254. _asm add esp, 2*4
  255. }
  256. VMMREGRET VXDINLINE
  257. VMM_RegEnumValue(VMMHKEY hkey, DWORD iValue, PCHAR lpszValue, PDWORD lpcbValue, PDWORD lpdwReserved, PDWORD lpdwType, PBYTE lpbData, PDWORD lpcbData)
  258. {
  259. _asm push lpcbData
  260. _asm push lpbData
  261. _asm push lpdwType
  262. _asm push lpdwReserved
  263. _asm push lpcbValue
  264. _asm push lpszValue
  265. _asm push iValue
  266. _asm push hkey
  267. Touch_Register(eax)
  268. Touch_Register(ecx)
  269. Touch_Register(edx)
  270. VMMCall(_RegEnumValue);
  271. _asm add esp, 8*4
  272. }
  273. VMMREGRET VXDINLINE
  274. VMM_RegQueryValueEx(VMMHKEY hkey, PCHAR lpszValueName, PDWORD lpdwReserved, PDWORD lpdwType, PBYTE lpbData, PDWORD lpcbData)
  275. {
  276. _asm push lpcbData
  277. _asm push lpbData
  278. _asm push lpdwType
  279. _asm push lpdwReserved
  280. _asm push lpszValueName
  281. _asm push hkey
  282. Touch_Register(eax)
  283. Touch_Register(ecx)
  284. Touch_Register(edx)
  285. VMMCall(_RegQueryValueEx);
  286. _asm add esp, 6*4
  287. }
  288. VMMREGRET VXDINLINE
  289. VMM_RegSetValueEx(VMMHKEY hkey, PCHAR lpszValueName, DWORD dwReserved, DWORD fdwType, PBYTE lpbData, DWORD cbData)
  290. {
  291. _asm push cbData
  292. _asm push lpbData
  293. _asm push fdwType
  294. _asm push dwReserved
  295. _asm push lpszValueName
  296. _asm push hkey
  297. Touch_Register(eax)
  298. Touch_Register(ecx)
  299. Touch_Register(edx)
  300. VMMCall(_RegSetValueEx);
  301. _asm add esp, 6*4
  302. }
  303. VMMREGRET VXDINLINE
  304. VMM_RegFlushKey(VMMHKEY hkey)
  305. {
  306. _asm push hkey
  307. Touch_Register(eax)
  308. Touch_Register(ecx)
  309. Touch_Register(edx)
  310. VMMCall(_RegFlushKey);
  311. _asm add esp, 1*4
  312. }
  313. VMMREGRET VXDINLINE
  314. VMM_RegQueryInfoKey(VMMHKEY hkey, PCHAR lpszClass, PDWORD lpcchClass,PDWORD lpdwReserved, PDWORD lpcSubKeys, PDWORD lpcchMaxSubKey, PDWORD lpcchMaxClass,
  315. PDWORD lpcValues, PDWORD lpcchMaxValueName, PDWORD lpcbMaxValueData,PDWORD lpcbSecurityDesc, PDWORD lpftLastWriteTime)
  316. {
  317. _asm push lpftLastWriteTime
  318. _asm push lpcbSecurityDesc
  319. _asm push lpcbMaxValueData
  320. _asm push lpcchMaxValueName
  321. _asm push lpcValues
  322. _asm push lpcchMaxClass
  323. _asm push lpcchMaxSubKey
  324. _asm push lpcSubKeys
  325. _asm push lpdwReserved
  326. _asm push lpcchClass
  327. _asm push lpszClass
  328. _asm push hkey
  329. Touch_Register(eax)
  330. Touch_Register(ecx)
  331. Touch_Register(edx)
  332. VMMCall(_RegQueryInfoKey);
  333. _asm add esp, 12*4
  334. }
  335. #endif // WANTVXDWRAPS
  336. #pragma warning (default:4035) // turn on no return code warning
  337. #endif // WIN31COMPAT
  338. #endif // Not_VxD
  339. /*XLATON*/
  340. /* ASM
  341. ;**************************************************************
  342. ; Macros for Realmode loader registry Services
  343. ;
  344. ;**************************************************************
  345. LDR_RegOpenKey Macro hKey,OffSubKey,SegSubKey,OffphKey,SegphKey
  346. push SegphKey
  347. push OffphKey ; lphKey
  348. push SegSubKey
  349. push OffSubKey ; lpszSubKey
  350. push dword ptr hKey ; hKey
  351. mov ax,LDRSRV_RegOpenKey
  352. call dword ptr [_ServiceEntry]
  353. add sp,3*4 ; for 3 parameters on stack
  354. ENDM
  355. ;**************************************************************
  356. LDR_RegCloseKey Macro hKey
  357. push dword ptr hKey
  358. mov ax,LDRSRV_RegCloseKey
  359. call dword ptr [_ServiceEntry]
  360. add sp,1*4 ; for 1 parameter on stack
  361. ENDM
  362. ;**************************************************************
  363. LDR_RegCreateKey Macro hKey,OffSubKey,SegSubKey,OffphKey,SegphKey
  364. push SegphKey
  365. push OffphKey ; lphKey
  366. push SegSubKey
  367. push OffSubKey ; lpszSubKey
  368. push dword ptr hKey ; hKey
  369. mov ax,LDRSRV_RegCreateKey
  370. call dword ptr [_ServiceEntry]
  371. add sp,3*4 ; for 3 parameters on stack
  372. ENDM
  373. ;**************************************************************
  374. LDR_RegDeleteKey Macro hKey,OffSubKey,SegSubKey
  375. push SegSubKey
  376. push OffSubKey ; lpszSubKey
  377. push dword ptr hKey ; hKey
  378. mov ax,LDRSRV_RegDeleteKey
  379. call dword ptr [_ServiceEntry]
  380. add sp,2*4 ; for 2 parameters on stack
  381. ENDM
  382. ;**************************************************************
  383. LDR_RegEnumKey Macro hKey,iSubKey,OffszName,SegszName,BufLen
  384. push dword ptr BufLen
  385. push SegszName
  386. push OffszName
  387. push dword ptr iSubKey
  388. push dword ptr hKey
  389. mov ax,LDRSRV_RegEnumKey
  390. call dword ptr [_ServiceEntry]
  391. add sp,4*4 ; for 4 parameters on stack
  392. ENDM
  393. ;**************************************************************
  394. LDR_RegQueryValue Macro hKey,OffSubKey,SegSubKey,OffValue,SegValue,OffcbValue,SegcbValue
  395. push SegcbValue
  396. push OffcbValue
  397. push SegValue
  398. push OffValue
  399. push SegSubKey
  400. push OffSubKey
  401. push dword ptr hKey
  402. mov ax,LDRSRV_RegQueryValue
  403. call dword ptr [_ServiceEntry]
  404. add sp,4*4 ; for 4 parameters on stack
  405. ENDM
  406. ;**************************************************************
  407. LDR_RegSetValue Macro hKey,OffSubKey,SegSubKey,dwType,OffData,SegData,cbData
  408. push dword ptr cbData
  409. push SegData
  410. push OffData
  411. push dword ptr dwType
  412. push SegSubKey
  413. push OffSubKey
  414. push dword ptr hKey
  415. mov ax,LDRSRV_RegSetValue
  416. call dword ptr [_ServiceEntry]
  417. add sp,5*4 ; for 4 parameters on stack
  418. ENDM
  419. ;**************************************************************
  420. LDR_RegDeleteValue Macro hKey,OffValue,SegValue
  421. push SegValue
  422. push OffValue ; lpszValue
  423. push dword ptr hKey ; hKey
  424. mov ax,LDRSRV_RegDeleteValue
  425. call dword ptr [_ServiceEntry]
  426. add sp,2*4 ; for 2 parameters on stack
  427. ENDM
  428. ;**************************************************************
  429. LDR_RegEnumValue Macro hKey,iValue,OffValue,SegValue,OffcbValue,SegcbValue,RegReserved,OffdwType,SegdwType,OffData,SegData,OffcbData,SegcbData
  430. push SegcbData
  431. push OffcbData
  432. push SegData
  433. push OffData
  434. push SegdwType
  435. push OffdwType
  436. push dword ptr RegReserved
  437. push SegcbValue
  438. push OffcbValue
  439. push SegValue
  440. push OffValue
  441. push dword ptr iValue
  442. push dword ptr hKey ; hKey
  443. mov ax,LDRSRV_RegEnumValue
  444. call dword ptr [_ServiceEntry]
  445. add sp,8*4 ; for 8 parameters on stack
  446. ENDM
  447. ;**************************************************************
  448. LDR_RegQueryValueEx Macro hKey,OffValue,SegValue,RegReserved,OffdwType,SegdwType,OffData,SegData,OffcbData,SegcbData
  449. push SegcbData
  450. push OffcbData
  451. push SegData
  452. push OffData
  453. push SegdwType
  454. push OffdwType
  455. push dword ptr RegReserved
  456. push SegValue
  457. push OffValue
  458. push dword ptr hKey
  459. mov ax,LDRSRV_RegQueryValueEx
  460. call dword ptr [_ServiceEntry]
  461. add sp,6*4 ; for 6 parameters on stack
  462. ENDM
  463. ;**************************************************************
  464. LDR_RegSetValueEx Macro hKey,OffValue,SegValue,RegReserved,dwType,OffData,SegData,cbData
  465. push dword ptr cbData
  466. push SegData
  467. push OffData
  468. push dword ptr dwType
  469. push dword ptr RegReserved
  470. push SegValue
  471. push OffValue
  472. push dword ptr hKey
  473. mov ax,LDRSRV_RegSetValueEx
  474. call dword ptr [_ServiceEntry]
  475. add sp,6*4 ; for 6 parameters on stack
  476. ENDM
  477. ;**************************************************************
  478. LDR_RegFlushKey Macro hKey
  479. push dword ptr hKey
  480. mov ax,LDRSRV_RegFlushKey
  481. call dword ptr [_ServiceEntry]
  482. add sp,1*4 ; for 1 parameter on stack
  483. ENDM
  484. ;**************************************************************
  485. */
  486. #endif /* _VMMREG_H */