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.

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