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.

421 lines
9.7 KiB

  1. #include "wreg.h"
  2. class CRegistryW : public IRegistryW
  3. {
  4. public:
  5. // IUnknown methods
  6. STDMETHODIMP QueryInterface(REFIID iid, void **ppvObj);
  7. STDMETHODIMP_(ULONG) AddRef(void);
  8. STDMETHODIMP_(ULONG) Release(void);
  9. // can this method be supported
  10. STDMETHODIMP_(LONG) ConnectRegistry (
  11. LPWSTR lpMachineName,
  12. HKEY hKey,
  13. IRegistryW **ppReg
  14. );
  15. STDMETHODIMP_(LONG) CloseKey (
  16. HKEY hKey
  17. );
  18. STDMETHODIMP_(LONG) CreateKey (
  19. HKEY hKey,
  20. LPCWSTR lpSubKey,
  21. PHKEY phkResult
  22. );
  23. STDMETHODIMP_(LONG) CreateKeyEx (
  24. HKEY hKey,
  25. LPCWSTR lpSubKey,
  26. DWORD Reserved,
  27. LPWSTR lpClass,
  28. DWORD dwOptions,
  29. REGSAM samDesired,
  30. LPSECURITY_ATTRIBUTES lpSecurityAttributes,
  31. PHKEY phkResult,
  32. LPDWORD lpdwDisposition
  33. );
  34. STDMETHODIMP_(LONG) DeleteKey (
  35. HKEY hKey,
  36. LPCWSTR lpSubKey
  37. );
  38. STDMETHODIMP_(LONG) DeleteValue (
  39. HKEY hKey,
  40. LPCWSTR lpValueName
  41. );
  42. STDMETHODIMP_(LONG) EnumKey (
  43. HKEY hKey,
  44. DWORD dwIndex,
  45. LPWSTR lpName,
  46. DWORD cbName
  47. );
  48. STDMETHODIMP_(LONG) EnumKeyEx (
  49. HKEY hKey,
  50. DWORD dwIndex,
  51. LPWSTR lpName,
  52. LPDWORD lpcbName,
  53. LPDWORD lpReserved,
  54. LPWSTR lpClass,
  55. LPDWORD lpcbClass,
  56. PFILETIME lpftLastWriteTime
  57. );
  58. STDMETHODIMP_(LONG) EnumValue (
  59. HKEY hKey,
  60. DWORD dwIndex,
  61. LPWSTR lpValueName,
  62. LPDWORD lpcbValueName,
  63. LPDWORD lpReserved,
  64. LPDWORD lpType,
  65. LPBYTE lpData,
  66. LPDWORD lpcbData
  67. );
  68. STDMETHODIMP_(LONG) FlushKey (
  69. HKEY hKey
  70. );
  71. STDMETHODIMP_(LONG) GetKeySecurity (
  72. HKEY hKey,
  73. SECURITY_INFORMATION SecurityInformation,
  74. PSECURITY_DESCRIPTOR pSecurityDescriptor,
  75. LPDWORD lpcbSecurityDescriptor
  76. );
  77. STDMETHODIMP_(LONG) LoadKey (
  78. HKEY hKey,
  79. LPCWSTR lpSubKey,
  80. LPCWSTR lpFile
  81. );
  82. STDMETHODIMP_(LONG) NotifyChangeKeyValue (
  83. HKEY hKey,
  84. BOOL bWatchSubtree,
  85. DWORD dwNotifyFilter,
  86. HANDLE hEvent,
  87. BOOL fAsynchronus
  88. );
  89. STDMETHODIMP_(LONG) OpenKey (
  90. HKEY hKey,
  91. LPCWSTR lpSubKey,
  92. PHKEY phkResult
  93. );
  94. STDMETHODIMP_(LONG) OpenKeyEx (
  95. HKEY hKey,
  96. LPCWSTR lpSubKey,
  97. DWORD ulOptions,
  98. REGSAM samDesired,
  99. PHKEY phkResult
  100. );
  101. STDMETHODIMP_(LONG) QueryInfoKey (
  102. HKEY hKey,
  103. LPWSTR lpClass,
  104. LPDWORD lpcbClass,
  105. LPDWORD lpReserved,
  106. LPDWORD lpcSubKeys,
  107. LPDWORD lpcbMaxSubKeyLen,
  108. LPDWORD lpcbMaxClassLen,
  109. LPDWORD lpcValues,
  110. LPDWORD lpcbMaxValueNameLen,
  111. LPDWORD lpcbMaxValueLen,
  112. LPDWORD lpcbSecurityDescriptor,
  113. PFILETIME lpftLastWriteTime
  114. );
  115. STDMETHODIMP_(LONG) QueryValue (
  116. HKEY hKey,
  117. LPCWSTR lpSubKey,
  118. LPWSTR lpValue,
  119. LONG *lpcbValue
  120. );
  121. STDMETHODIMP_(LONG) QueryMultipleValues (
  122. HKEY hKey,
  123. PVALENTXW val_list,
  124. DWORD num_vals,
  125. LPWSTR lpValueBuf,
  126. LPDWORD ldwTotsize
  127. );
  128. STDMETHODIMP_(LONG) QueryValueEx (
  129. HKEY hKey,
  130. LPCWSTR lpValueName,
  131. LPDWORD lpReserved,
  132. LPDWORD lpType,
  133. LPBYTE lpData,
  134. LPDWORD lpcbData
  135. );
  136. STDMETHODIMP_(LONG) ReplaceKey (
  137. HKEY hKey,
  138. LPCWSTR lpSubKey,
  139. LPCWSTR lpNewFile,
  140. LPCWSTR lpOldFile
  141. );
  142. STDMETHODIMP_(LONG) RestoreKey (
  143. HKEY hKey,
  144. LPCWSTR lpFile,
  145. DWORD dwFlags
  146. );
  147. STDMETHODIMP_(LONG) SaveKey (
  148. HKEY hKey,
  149. LPCWSTR lpFile,
  150. LPSECURITY_ATTRIBUTES lpSecurityAttributes
  151. );
  152. STDMETHODIMP_(LONG) SetKeySecurity (
  153. HKEY hKey,
  154. SECURITY_INFORMATION SecurityInformation,
  155. PSECURITY_DESCRIPTOR pSecurityDescriptor
  156. );
  157. STDMETHODIMP_(LONG) SetValue (
  158. HKEY hKey,
  159. LPCWSTR lpSubKey,
  160. DWORD dwType,
  161. LPCWSTR lpData,
  162. DWORD cbData
  163. );
  164. STDMETHODIMP_(LONG) SetValueEx (
  165. HKEY hKey,
  166. LPCWSTR lpValueName,
  167. DWORD Reserved,
  168. DWORD dwType,
  169. const BYTE* lpData,
  170. DWORD cbData
  171. );
  172. STDMETHODIMP_(LONG) UnLoadKey (
  173. HKEY hKey,
  174. LPCWSTR lpSubKey
  175. );
  176. public:
  177. private:
  178. CRefCount _CRefs; // the total refcount of this object
  179. };
  180. class CRegistryA : public IRegistryA
  181. {
  182. public:
  183. // IUnknown methods
  184. STDMETHODIMP QueryInterface(REFIID iid, void **ppvObj);
  185. STDMETHODIMP_(ULONG) AddRef(void);
  186. STDMETHODIMP_(ULONG) Release(void);
  187. // can this method be supported
  188. STDMETHODIMP_(LONG) ConnectRegistry (
  189. LPSTR lpMachineName,
  190. HKEY hKey,
  191. IRegistryA **ppReg
  192. );
  193. STDMETHODIMP_(LONG) CloseKey (
  194. HKEY hKey
  195. );
  196. STDMETHODIMP_(LONG) CreateKey (
  197. HKEY hKey,
  198. LPCSTR lpSubKey,
  199. PHKEY phkResult
  200. );
  201. STDMETHODIMP_(LONG) CreateKeyEx (
  202. HKEY hKey,
  203. LPCSTR lpSubKey,
  204. DWORD Reserved,
  205. LPSTR lpClass,
  206. DWORD dwOptions,
  207. REGSAM samDesired,
  208. LPSECURITY_ATTRIBUTES lpSecurityAttributes,
  209. PHKEY phkResult,
  210. LPDWORD lpdwDisposition
  211. );
  212. STDMETHODIMP_(LONG) DeleteKey (
  213. HKEY hKey,
  214. LPCSTR lpSubKey
  215. );
  216. STDMETHODIMP_(LONG) DeleteValue (
  217. HKEY hKey,
  218. LPCSTR lpValueName
  219. );
  220. STDMETHODIMP_(LONG) EnumKey (
  221. HKEY hKey,
  222. DWORD dwIndex,
  223. LPSTR lpName,
  224. DWORD cbName
  225. );
  226. STDMETHODIMP_(LONG) EnumKeyEx (
  227. HKEY hKey,
  228. DWORD dwIndex,
  229. LPSTR lpName,
  230. LPDWORD lpcbName,
  231. LPDWORD lpReserved,
  232. LPSTR lpClass,
  233. LPDWORD lpcbClass,
  234. PFILETIME lpftLastWriteTime
  235. );
  236. STDMETHODIMP_(LONG) EnumValue (
  237. HKEY hKey,
  238. DWORD dwIndex,
  239. LPSTR lpValueName,
  240. LPDWORD lpcbValueName,
  241. LPDWORD lpReserved,
  242. LPDWORD lpType,
  243. LPBYTE lpData,
  244. LPDWORD lpcbData
  245. );
  246. STDMETHODIMP_(LONG) FlushKey (
  247. HKEY hKey
  248. );
  249. STDMETHODIMP_(LONG) GetKeySecurity (
  250. HKEY hKey,
  251. SECURITY_INFORMATION SecurityInformation,
  252. PSECURITY_DESCRIPTOR pSecurityDescriptor,
  253. LPDWORD lpcbSecurityDescriptor
  254. );
  255. STDMETHODIMP_(LONG) LoadKey (
  256. HKEY hKey,
  257. LPCSTR lpSubKey,
  258. LPCSTR lpFile
  259. );
  260. STDMETHODIMP_(LONG) NotifyChangeKeyValue (
  261. HKEY hKey,
  262. BOOL bWatchSubtree,
  263. DWORD dwNotifyFilter,
  264. HANDLE hEvent,
  265. BOOL fAsynchronus
  266. );
  267. STDMETHODIMP_(LONG) OpenKey (
  268. HKEY hKey,
  269. LPCSTR lpSubKey,
  270. PHKEY phkResult
  271. );
  272. STDMETHODIMP_(LONG) OpenKeyEx (
  273. HKEY hKey,
  274. LPCSTR lpSubKey,
  275. DWORD ulOptions,
  276. REGSAM samDesired,
  277. PHKEY phkResult
  278. );
  279. STDMETHODIMP_(LONG) QueryInfoKey (
  280. HKEY hKey,
  281. LPSTR lpClass,
  282. LPDWORD lpcbClass,
  283. LPDWORD lpReserved,
  284. LPDWORD lpcSubKeys,
  285. LPDWORD lpcbMaxSubKeyLen,
  286. LPDWORD lpcbMaxClassLen,
  287. LPDWORD lpcValues,
  288. LPDWORD lpcbMaxValueNameLen,
  289. LPDWORD lpcbMaxValueLen,
  290. LPDWORD lpcbSecurityDescriptor,
  291. PFILETIME lpftLastWriteTime
  292. );
  293. STDMETHODIMP_(LONG) QueryValue (
  294. HKEY hKey,
  295. LPCSTR lpSubKey,
  296. LPSTR lpValue,
  297. LONG *lpcbValue
  298. );
  299. STDMETHODIMP_(LONG) QueryMultipleValues (
  300. HKEY hKey,
  301. PVALENTXA val_list,
  302. DWORD num_vals,
  303. LPSTR lpValueBuf,
  304. LPDWORD ldwTotsize
  305. );
  306. STDMETHODIMP_(LONG) QueryValueEx (
  307. HKEY hKey,
  308. LPCSTR lpValueName,
  309. LPDWORD lpReserved,
  310. LPDWORD lpType,
  311. LPBYTE lpData,
  312. LPDWORD lpcbData
  313. );
  314. STDMETHODIMP_(LONG) ReplaceKey (
  315. HKEY hKey,
  316. LPCSTR lpSubKey,
  317. LPCSTR lpNewFile,
  318. LPCSTR lpOldFile
  319. );
  320. STDMETHODIMP_(LONG) RestoreKey (
  321. HKEY hKey,
  322. LPCSTR lpFile,
  323. DWORD dwFlags
  324. );
  325. STDMETHODIMP_(LONG) SaveKey (
  326. HKEY hKey,
  327. LPCSTR lpFile,
  328. LPSECURITY_ATTRIBUTES lpSecurityAttributes
  329. );
  330. STDMETHODIMP_(LONG) SetKeySecurity (
  331. HKEY hKey,
  332. SECURITY_INFORMATION SecurityInformation,
  333. PSECURITY_DESCRIPTOR pSecurityDescriptor
  334. );
  335. STDMETHODIMP_(LONG) SetValue (
  336. HKEY hKey,
  337. LPCSTR lpSubKey,
  338. DWORD dwType,
  339. LPCSTR lpData,
  340. DWORD cbData
  341. );
  342. STDMETHODIMP_(LONG) SetValueEx (
  343. HKEY hKey,
  344. LPCSTR lpValueName,
  345. DWORD Reserved,
  346. DWORD dwType,
  347. const BYTE* lpData,
  348. DWORD cbData
  349. );
  350. STDMETHODIMP_(LONG) UnLoadKey (
  351. HKEY hKey,
  352. LPCSTR lpSubKey
  353. );
  354. public:
  355. private:
  356. CRefCount _CRefs; // the total refcount of this object
  357. };