Windows NT 4.0 source code leak
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.

545 lines
13 KiB

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