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.

1098 lines
28 KiB

  1. #include <urlmon.hxx>
  2. #include "wreg.hxx"
  3. #define DEB_REG DEB_ERROR
  4. CRegistryA g_Reg;
  5. CRegistryA *g_vpReg = &g_Reg;
  6. //+---------------------------------------------------------------------------
  7. //
  8. // Method: CRegistryW::QueryInterface
  9. //
  10. // Synopsis:
  11. //
  12. // Arguments: [riid] --
  13. // [ppv] --
  14. //
  15. // Returns:
  16. //
  17. // History: 11-11-95 JohannP (Johann Posch) Created
  18. //
  19. // Notes:
  20. //
  21. //----------------------------------------------------------------------------
  22. STDMETHODIMP CRegistryW::QueryInterface( REFIID riid, void **ppv )
  23. {
  24. HRESULT hr = NOERROR;
  25. UrlMkDebugOut((DEB_REG, "%p _IN CRegistryW::QueryInterface (%lx, %p)\n", this, riid, ppv));
  26. if ((riid == IID_IUnknown) || (riid == IID_IRegistryW))
  27. {
  28. *ppv = (void FAR *)this;
  29. AddRef();
  30. }
  31. else
  32. {
  33. *ppv = NULL;
  34. hr = E_NOINTERFACE;
  35. }
  36. UrlMkDebugOut((DEB_REG, "%p OUT CRegistryW::QueryInterface (%lx)[%p]\n", this, hr, *ppv));
  37. return hr;
  38. }
  39. //+---------------------------------------------------------------------------
  40. //
  41. // Method: CRegistryW::AddRef
  42. //
  43. // Synopsis:
  44. //
  45. // Arguments: [void] --
  46. //
  47. // Returns:
  48. //
  49. // History: 11-11-95 JohannP (Johann Posch) Created
  50. //
  51. // Notes:
  52. //
  53. //----------------------------------------------------------------------------
  54. STDMETHODIMP_(ULONG) CRegistryW::AddRef( void )
  55. {
  56. UrlMkDebugOut((DEB_REG, "%p _IN CRegistryW::AddRef\n", this));
  57. LONG lRet = _CRefs++;
  58. UrlMkDebugOut((DEB_REG, "%p OUT CRegistryW::AddRef (%ld)\n", this, lRet));
  59. return lRet;
  60. }
  61. //+---------------------------------------------------------------------------
  62. //
  63. // Method: CRegistryW::Release
  64. //
  65. // Synopsis:
  66. //
  67. // Arguments: [void] --
  68. //
  69. // Returns:
  70. //
  71. // History: 11-11-95 JohannP (Johann Posch) Created
  72. //
  73. // Notes:
  74. //
  75. //----------------------------------------------------------------------------
  76. STDMETHODIMP_(ULONG) CRegistryW::Release( void )
  77. {
  78. UrlMkDebugOut((DEB_REG, "%p _IN CRegistryW::Release\n", this));
  79. LONG lRet = --_CRefs;
  80. if (_CRefs == 0)
  81. {
  82. delete this;
  83. }
  84. UrlMkDebugOut((DEB_REG, "%p OUT CRegistryW::Release (%ld)\n", this, lRet));
  85. return lRet;
  86. }
  87. // can this method be supported
  88. STDMETHODIMP_(LONG) CRegistryW::ConnectRegistry (
  89. LPWSTR lpMachineName,
  90. HKEY hKey,
  91. IRegistryW **ppReg
  92. )
  93. {
  94. UrlMkDebugOut((DEB_REG, "%p _IN CRegistryW::ConnectRegistry\n", this));
  95. HKEY hKeyLoc = 0;
  96. LONG lRet;
  97. lRet = RegConnectRegistryW(lpMachineName, hKey, &hKeyLoc);
  98. UrlMkDebugOut((DEB_REG, "%p OUT CRegistryW::ConnectRegistry (%ld)\n", this, lRet));
  99. return lRet;
  100. }
  101. STDMETHODIMP_(LONG) CRegistryW::CloseKey (
  102. HKEY hKey
  103. )
  104. {
  105. UrlMkDebugOut((DEB_REG, "%p _IN CRegistryW::CloseKey\n", this));
  106. LONG lRet = 0;
  107. lRet = RegCloseKey( hKey );
  108. UrlMkDebugOut((DEB_REG, "%p OUT CRegistryW::CloseKey (%ld)\n", this, lRet));
  109. return lRet;
  110. }
  111. STDMETHODIMP_(LONG) CRegistryW::CreateKey (
  112. HKEY hKey,
  113. LPCWSTR lpSubKey,
  114. PHKEY phkResult
  115. )
  116. {
  117. UrlMkDebugOut((DEB_REG, "%p _IN CRegistryW::CreateKey\n", this));
  118. LONG lRet = 0;
  119. lRet = RegCreateKeyW(hKey, lpSubKey, phkResult);
  120. UrlMkDebugOut((DEB_REG, "%p OUT CRegistryW::CreateKey (%ld)\n", this, lRet));
  121. return lRet;
  122. }
  123. STDMETHODIMP_(LONG) CRegistryW::CreateKeyEx (
  124. HKEY hKey,
  125. LPCWSTR lpSubKey,
  126. DWORD Reserved,
  127. LPWSTR lpClass,
  128. DWORD dwOptions,
  129. REGSAM samDesired,
  130. LPSECURITY_ATTRIBUTES lpSecurityAttributes,
  131. PHKEY phkResult,
  132. LPDWORD lpdwDisposition
  133. )
  134. {
  135. UrlMkDebugOut((DEB_REG, "%p _IN CRegistryW::CreateKeyEx\n", this));
  136. LONG lRet = 0;
  137. lRet = RegCreateKeyExW (
  138. hKey,
  139. lpSubKey,
  140. Reserved,
  141. lpClass,
  142. dwOptions,
  143. samDesired,
  144. lpSecurityAttributes,
  145. phkResult,
  146. lpdwDisposition
  147. );
  148. UrlMkDebugOut((DEB_REG, "%p OUT CRegistryW::CreateKeyEx (%ld)\n", this, lRet));
  149. return lRet;
  150. }
  151. STDMETHODIMP_(LONG) CRegistryW::DeleteKey (
  152. HKEY hKey,
  153. LPCWSTR lpSubKey
  154. )
  155. {
  156. UrlMkDebugOut((DEB_REG, "%p _IN CRegistryW::DeleteKey\n", this));
  157. LONG lRet = 0;
  158. lRet = RegDeleteKeyW(hKey, lpSubKey);
  159. UrlMkDebugOut((DEB_REG, "%p OUT CRegistryW::DeleteKey (%ld)\n", this, lRet));
  160. return lRet;
  161. }
  162. STDMETHODIMP_(LONG) CRegistryW::DeleteValue (
  163. HKEY hKey,
  164. LPCWSTR lpValueName
  165. )
  166. {
  167. UrlMkDebugOut((DEB_REG, "%p _IN CRegistryW::DeleteValue\n", this));
  168. LONG lRet = 0;
  169. lRet = RegDeleteValueW(hKey, lpValueName);
  170. UrlMkDebugOut((DEB_REG, "%p OUT CRegistryW::DeleteValue (%ld)\n", this, lRet));
  171. return lRet;
  172. }
  173. STDMETHODIMP_(LONG) CRegistryW::EnumKey (
  174. HKEY hKey,
  175. DWORD dwIndex,
  176. LPWSTR lpName,
  177. DWORD cbName
  178. )
  179. {
  180. UrlMkDebugOut((DEB_REG, "%p _IN CRegistryW::EnumKey\n", this));
  181. LONG lRet = 0;
  182. lRet = RegEnumKeyW (hKey, dwIndex, lpName, cbName);
  183. UrlMkDebugOut((DEB_REG, "%p OUT CRegistryW::EnumKey (%ld)\n", this, lRet));
  184. return lRet;
  185. }
  186. STDMETHODIMP_(LONG) CRegistryW::EnumKeyEx (
  187. HKEY hKey,
  188. DWORD dwIndex,
  189. LPWSTR lpName,
  190. LPDWORD lpcbName,
  191. LPDWORD lpReserved,
  192. LPWSTR lpClass,
  193. LPDWORD lpcbClass,
  194. PFILETIME lpftLastWriteTime
  195. )
  196. {
  197. UrlMkDebugOut((DEB_REG, "%p _IN CRegistryW::EnumKeyEx\n", this));
  198. LONG lRet = 0;
  199. lRet = RegEnumKeyExW(hKey,dwIndex,lpName,lpcbName,lpReserved,
  200. lpClass,lpcbClass,lpftLastWriteTime);
  201. UrlMkDebugOut((DEB_REG, "%p OUT CRegistryW::EnumKeyEx (%ld)\n", this, lRet));
  202. return lRet;
  203. }
  204. STDMETHODIMP_(LONG) CRegistryW::EnumValue (
  205. HKEY hKey,
  206. DWORD dwIndex,
  207. LPWSTR lpValueName,
  208. LPDWORD lpcbValueName,
  209. LPDWORD lpReserved,
  210. LPDWORD lpType,
  211. LPBYTE lpData,
  212. LPDWORD lpcbData
  213. )
  214. {
  215. UrlMkDebugOut((DEB_REG, "%p _IN CRegistryW::EnumValue\n", this));
  216. LONG lRet = 0;
  217. lRet = RegEnumValueW(hKey,dwIndex,lpValueName,
  218. lpcbValueName,lpReserved,lpType,lpData,lpcbData);
  219. UrlMkDebugOut((DEB_REG, "%p OUT CRegistryW::EnumValue (%ld)\n", this, lRet));
  220. return lRet;
  221. }
  222. STDMETHODIMP_(LONG) CRegistryW::FlushKey (HKEY hKey)
  223. {
  224. UrlMkDebugOut((DEB_REG, "%p _IN CRegistryW::FlushKey\n", this));
  225. LONG lRet = 0;
  226. lRet = RegFlushKey(hKey);
  227. UrlMkDebugOut((DEB_REG, "%p OUT CRegistryW::FlushKey (%ld)\n", this, lRet));
  228. return lRet;
  229. }
  230. STDMETHODIMP_(LONG) CRegistryW::GetKeySecurity (
  231. HKEY hKey,
  232. SECURITY_INFORMATION SecurityInformation,
  233. PSECURITY_DESCRIPTOR pSecurityDescriptor,
  234. LPDWORD lpcbSecurityDescriptor)
  235. {
  236. UrlMkDebugOut((DEB_REG, "%p _IN CRegistryW::GetKeySecurity\n", this));
  237. LONG lRet = 0;
  238. lRet = RegGetKeySecurity (hKey,SecurityInformation, pSecurityDescriptor,lpcbSecurityDescriptor);
  239. UrlMkDebugOut((DEB_REG, "%p OUT CRegistryW::GetKeySecurity (%ld)\n", this, lRet));
  240. return lRet;
  241. }
  242. STDMETHODIMP_(LONG) CRegistryW::LoadKey (
  243. HKEY hKey,
  244. LPCWSTR lpSubKey,
  245. LPCWSTR lpFile
  246. )
  247. {
  248. UrlMkDebugOut((DEB_REG, "%p _IN CRegistryW::LoadKey\n", this));
  249. LONG lRet = 0;
  250. lRet = RegLoadKeyW(hKey, lpSubKey, lpFile);
  251. UrlMkDebugOut((DEB_REG, "%p OUT CRegistryW::LoadKey (%ld)\n", this, lRet));
  252. return lRet;
  253. }
  254. STDMETHODIMP_(LONG) CRegistryW::NotifyChangeKeyValue (
  255. HKEY hKey,
  256. BOOL bWatchSubtree,
  257. DWORD dwNotifyFilter,
  258. HANDLE hEvent,
  259. BOOL fAsynchronus
  260. )
  261. {
  262. UrlMkDebugOut((DEB_REG, "%p _IN CRegistryW::NotifyChangeKeyValue\n", this));
  263. LONG lRet = 0;
  264. lRet = RegNotifyChangeKeyValue(hKey, bWatchSubtree, dwNotifyFilter, hEvent,fAsynchronus);
  265. UrlMkDebugOut((DEB_REG, "%p OUT CRegistryW::NotifyChangeKeyValue (%ld)\n", this, lRet));
  266. return lRet;
  267. }
  268. STDMETHODIMP_(LONG) CRegistryW::OpenKey (
  269. HKEY hKey,
  270. LPCWSTR lpSubKey,
  271. PHKEY phkResult
  272. )
  273. {
  274. UrlMkDebugOut((DEB_REG, "%p _IN CRegistryW::OpenKey\n", this));
  275. LONG lRet = 0;
  276. lRet = RegOpenKeyW(hKey, lpSubKey, phkResult);
  277. UrlMkDebugOut((DEB_REG, "%p OUT CRegistryW::OpenKey (%ld)\n", this, lRet));
  278. return lRet;
  279. }
  280. STDMETHODIMP_(LONG) CRegistryW::OpenKeyEx (
  281. HKEY hKey,
  282. LPCWSTR lpSubKey,
  283. DWORD ulOptions,
  284. REGSAM samDesired,
  285. PHKEY phkResult
  286. )
  287. {
  288. UrlMkDebugOut((DEB_REG, "%p _IN CRegistryW::OpenKeyEx\n", this));
  289. LONG lRet = 0;
  290. lRet = RegOpenKeyExW(hKey,lpSubKey,ulOptions,samDesired,phkResult);
  291. UrlMkDebugOut((DEB_REG, "%p OUT CRegistryW::OpenKeyEx (%ld)\n", this, lRet));
  292. return lRet;
  293. }
  294. STDMETHODIMP_(LONG) CRegistryW::QueryInfoKey (
  295. HKEY hKey,
  296. LPWSTR lpClass,
  297. LPDWORD lpcbClass,
  298. LPDWORD lpReserved,
  299. LPDWORD lpcSubKeys,
  300. LPDWORD lpcbMaxSubKeyLen,
  301. LPDWORD lpcbMaxClassLen,
  302. LPDWORD lpcValues,
  303. LPDWORD lpcbMaxValueNameLen,
  304. LPDWORD lpcbMaxValueLen,
  305. LPDWORD lpcbSecurityDescriptor,
  306. PFILETIME lpftLastWriteTime
  307. )
  308. {
  309. UrlMkDebugOut((DEB_REG, "%p _IN CRegistryW::QueryInfoKey\n", this));
  310. LONG lRet = 0;
  311. lRet = RegQueryInfoKeyW (
  312. hKey,
  313. lpClass,
  314. lpcbClass,
  315. lpReserved,
  316. lpcSubKeys,
  317. lpcbMaxSubKeyLen,
  318. lpcbMaxClassLen,
  319. lpcValues,
  320. lpcbMaxValueNameLen,
  321. lpcbMaxValueLen,
  322. lpcbSecurityDescriptor,
  323. lpftLastWriteTime);
  324. UrlMkDebugOut((DEB_REG, "%p OUT CRegistryW::QueryInfoKey (%ld)\n", this, lRet));
  325. return lRet;
  326. }
  327. STDMETHODIMP_(LONG) CRegistryW::QueryValue (
  328. HKEY hKey,
  329. LPCWSTR lpSubKey,
  330. LPWSTR lpValue,
  331. LONG *lpcbValue
  332. )
  333. {
  334. UrlMkDebugOut((DEB_REG, "%p _IN CRegistryW::QueryValue\n", this));
  335. LONG lRet = 0;
  336. lRet = RegQueryValueW(hKey,lpSubKey,lpValue,lpcbValue);
  337. UrlMkDebugOut((DEB_REG, "%p OUT CRegistryW::QueryValue (%ld)\n", this, lRet));
  338. return lRet;
  339. }
  340. STDMETHODIMP_(LONG) CRegistryW::QueryMultipleValues (
  341. HKEY hKey,
  342. PVALENTXW val_list,
  343. DWORD num_vals,
  344. LPWSTR lpValueBuf,
  345. LPDWORD ldwTotsize
  346. )
  347. {
  348. UrlMkDebugOut((DEB_REG, "%p _IN CRegistryW::QueryMultipleValues\n", this));
  349. LONG lRet = 0;
  350. lRet = RegQueryMultipleValuesW(hKey,(PVALENTW) val_list, num_vals, lpValueBuf, ldwTotsize);
  351. UrlMkDebugOut((DEB_REG, "%p OUT CRegistryW::QueryMultipleValues (%ld)\n", this, lRet));
  352. return lRet;
  353. }
  354. STDMETHODIMP_(LONG) CRegistryW::QueryValueEx (
  355. HKEY hKey,
  356. LPCWSTR lpValueName,
  357. LPDWORD lpReserved,
  358. LPDWORD lpType,
  359. LPBYTE lpData,
  360. LPDWORD lpcbData
  361. )
  362. {
  363. UrlMkDebugOut((DEB_REG, "%p _IN CRegistryW::QueryValueEx\n", this));
  364. LONG lRet = 0;
  365. lRet = RegQueryValueExW(hKey, lpValueName, lpReserved, lpType, lpData, lpcbData);
  366. UrlMkDebugOut((DEB_REG, "%p OUT CRegistryW::QueryValueEx (%ld)\n", this, lRet));
  367. return lRet;
  368. }
  369. STDMETHODIMP_(LONG) CRegistryW::ReplaceKey (
  370. HKEY hKey,
  371. LPCWSTR lpSubKey,
  372. LPCWSTR lpNewFile,
  373. LPCWSTR lpOldFile
  374. )
  375. {
  376. UrlMkDebugOut((DEB_REG, "%p _IN CRegistryW::ReplaceKey\n", this));
  377. LONG lRet = 0;
  378. lRet = RegReplaceKeyW(hKey, lpSubKey, lpNewFile, lpOldFile);
  379. UrlMkDebugOut((DEB_REG, "%p OUT CRegistryW::ReplaceKey (%ld)\n", this, lRet));
  380. return lRet;
  381. }
  382. STDMETHODIMP_(LONG) CRegistryW::RestoreKey (
  383. HKEY hKey,
  384. LPCWSTR lpFile,
  385. DWORD dwFlags
  386. )
  387. {
  388. UrlMkDebugOut((DEB_REG, "%p _IN CRegistryW::RestoreKey\n", this));
  389. LONG lRet = 0;
  390. lRet = RegRestoreKeyW(hKey, lpFile, dwFlags);
  391. UrlMkDebugOut((DEB_REG, "%p OUT CRegistryW::RestoreKey (%ld)\n", this, lRet));
  392. return lRet;
  393. }
  394. STDMETHODIMP_(LONG) CRegistryW::SaveKey (
  395. HKEY hKey,
  396. LPCWSTR lpFile,
  397. LPSECURITY_ATTRIBUTES lpSecurityAttributes
  398. )
  399. {
  400. UrlMkDebugOut((DEB_REG, "%p _IN CRegistryW::SaveKey\n", this));
  401. LONG lRet = 0;
  402. lRet = RegSaveKeyW(hKey, lpFile, lpSecurityAttributes);
  403. UrlMkDebugOut((DEB_REG, "%p OUT CRegistryW::SaveKey (%ld)\n", this, lRet));
  404. return lRet;
  405. }
  406. STDMETHODIMP_(LONG) CRegistryW::SetKeySecurity (
  407. HKEY hKey,
  408. SECURITY_INFORMATION SecurityInformation,
  409. PSECURITY_DESCRIPTOR pSecurityDescriptor
  410. )
  411. {
  412. UrlMkDebugOut((DEB_REG, "%p _IN CRegistryW::SetKeySecurity\n", this));
  413. LONG lRet = 0;
  414. lRet = RegSetKeySecurity(hKey, SecurityInformation, pSecurityDescriptor);
  415. UrlMkDebugOut((DEB_REG, "%p OUT CRegistryW::SetKeySecurity (%ld)\n", this, lRet));
  416. return lRet;
  417. }
  418. STDMETHODIMP_(LONG) CRegistryW::SetValue (
  419. HKEY hKey,
  420. LPCWSTR lpSubKey,
  421. DWORD dwType,
  422. LPCWSTR lpData,
  423. DWORD cbData
  424. )
  425. {
  426. UrlMkDebugOut((DEB_REG, "%p _IN CRegistryW::SetValue\n", this));
  427. LONG lRet = 0;
  428. lRet = RegSetValueW(hKey, lpSubKey, dwType,lpData, cbData );
  429. UrlMkDebugOut((DEB_REG, "%p OUT CRegistryW::SetValue (%ld)\n", this, lRet));
  430. return lRet;
  431. }
  432. STDMETHODIMP_(LONG) CRegistryW::SetValueEx (
  433. HKEY hKey,
  434. LPCWSTR lpValueName,
  435. DWORD Reserved,
  436. DWORD dwType,
  437. const BYTE* lpData,
  438. DWORD cbData
  439. )
  440. {
  441. UrlMkDebugOut((DEB_REG, "%p _IN CRegistryW::SetValueEx\n", this));
  442. LONG lRet = 0;
  443. lRet = RegSetValueExW(hKey, lpValueName, Reserved, dwType,lpData, cbData);
  444. UrlMkDebugOut((DEB_REG, "%p OUT CRegistryW::SetValueEx (%ld)\n", this, lRet));
  445. return lRet;
  446. }
  447. STDMETHODIMP_(LONG) CRegistryW::UnLoadKey (
  448. HKEY hKey,
  449. LPCWSTR lpSubKey
  450. )
  451. {
  452. UrlMkDebugOut((DEB_REG, "%p _IN CRegistryW::UnLoadKey\n", this));
  453. LONG lRet = 0;
  454. lRet = RegUnLoadKeyW(hKey, lpSubKey);
  455. UrlMkDebugOut((DEB_REG, "%p OUT CRegistryW::UnLoadKey (%ld)\n", this, lRet));
  456. return lRet;
  457. }
  458. //+---------------------------------------------------------------------------
  459. //
  460. // Method: CRegistryW::QueryInterface
  461. //
  462. // Synopsis:
  463. //
  464. // Arguments: [riid] --
  465. // [ppv] --
  466. //
  467. // Returns:
  468. //
  469. // History: 11-11-95 JohannP (Johann Posch) Created
  470. //
  471. // Notes:
  472. //
  473. //----------------------------------------------------------------------------
  474. STDMETHODIMP CRegistryA::QueryInterface( REFIID riid, void **ppv )
  475. {
  476. HRESULT hr = NOERROR;
  477. UrlMkDebugOut((DEB_REG, "%p _IN CRegistryA::QueryInterface (%lx, %p)\n", this, riid, ppv));
  478. if ((riid == IID_IUnknown) || (riid == IID_IRegistryA))
  479. {
  480. *ppv = (void FAR *)this;
  481. AddRef();
  482. }
  483. else
  484. {
  485. *ppv = NULL;
  486. hr = E_NOINTERFACE;
  487. }
  488. UrlMkDebugOut((DEB_REG, "%p OUT CRegistryA::QueryInterface (%lx)[%p]\n", this, hr, *ppv));
  489. return hr;
  490. }
  491. //+---------------------------------------------------------------------------
  492. //
  493. // Method: CRegistryA::AddRef
  494. //
  495. // Synopsis:
  496. //
  497. // Arguments: [void] --
  498. //
  499. // Returns:
  500. //
  501. // History: 11-11-95 JohannP (Johann Posch) Created
  502. //
  503. // Notes:
  504. //
  505. //----------------------------------------------------------------------------
  506. STDMETHODIMP_(ULONG) CRegistryA::AddRef( void )
  507. {
  508. UrlMkDebugOut((DEB_REG, "%p _IN CRegistryA::AddRef\n", this));
  509. LONG lRet = _CRefs++;
  510. UrlMkDebugOut((DEB_REG, "%p OUT CRegistryA::AddRef (%ld)\n", this, lRet));
  511. return lRet;
  512. }
  513. //+---------------------------------------------------------------------------
  514. //
  515. // Method: CRegistryA::Release
  516. //
  517. // Synopsis:
  518. //
  519. // Arguments: [void] --
  520. //
  521. // Returns:
  522. //
  523. // History: 11-11-95 JohannP (Johann Posch) Created
  524. //
  525. // Notes:
  526. //
  527. //----------------------------------------------------------------------------
  528. STDMETHODIMP_(ULONG) CRegistryA::Release( void )
  529. {
  530. UrlMkDebugOut((DEB_REG, "%p _IN CRegistryA::Release\n", this));
  531. LONG lRet = --_CRefs;
  532. if (_CRefs == 0)
  533. {
  534. delete this;
  535. }
  536. UrlMkDebugOut((DEB_REG, "%p OUT CRegistryA::Release (%ld)\n", this, lRet));
  537. return lRet;
  538. }
  539. // can this method be supported
  540. STDMETHODIMP_(LONG) CRegistryA::ConnectRegistry (
  541. LPSTR lpMachineName,
  542. HKEY hKey,
  543. IRegistryA **ppReg
  544. )
  545. {
  546. UrlMkDebugOut((DEB_REG, "%p _IN CRegistryA::ConnectRegistry\n", this));
  547. HKEY hKeyLoc = 0;
  548. LONG lRet;
  549. lRet = RegConnectRegistryA(lpMachineName, hKey, &hKeyLoc);
  550. UrlMkDebugOut((DEB_REG, "%p OUT CRegistryA::ConnectRegistry (%ld)\n", this, lRet));
  551. return lRet;
  552. }
  553. STDMETHODIMP_(LONG) CRegistryA::CloseKey (
  554. HKEY hKey
  555. )
  556. {
  557. UrlMkDebugOut((DEB_REG, "%p _IN CRegistryA::CloseKey\n", this));
  558. LONG lRet = 0;
  559. lRet = RegCloseKey( hKey );
  560. UrlMkDebugOut((DEB_REG, "%p OUT CRegistryA::CloseKey (%ld)\n", this, lRet));
  561. return lRet;
  562. }
  563. STDMETHODIMP_(LONG) CRegistryA::CreateKey (
  564. HKEY hKey,
  565. LPCSTR lpSubKey,
  566. PHKEY phkResult
  567. )
  568. {
  569. UrlMkDebugOut((DEB_REG, "%p _IN CRegistryA::CreateKey\n", this));
  570. LONG lRet = 0;
  571. lRet = RegCreateKeyA(hKey, lpSubKey, phkResult);
  572. UrlMkDebugOut((DEB_REG, "%p OUT CRegistryA::CreateKey (%ld)\n", this, lRet));
  573. return lRet;
  574. }
  575. STDMETHODIMP_(LONG) CRegistryA::CreateKeyEx (
  576. HKEY hKey,
  577. LPCSTR lpSubKey,
  578. DWORD Reserved,
  579. LPSTR lpClass,
  580. DWORD dwOptions,
  581. REGSAM samDesired,
  582. LPSECURITY_ATTRIBUTES lpSecurityAttributes,
  583. PHKEY phkResult,
  584. LPDWORD lpdwDisposition
  585. )
  586. {
  587. UrlMkDebugOut((DEB_REG, "%p _IN CRegistryA::CreateKeyEx\n", this));
  588. LONG lRet = 0;
  589. lRet = RegCreateKeyExA (
  590. hKey,
  591. lpSubKey,
  592. Reserved,
  593. lpClass,
  594. dwOptions,
  595. samDesired,
  596. lpSecurityAttributes,
  597. phkResult,
  598. lpdwDisposition
  599. );
  600. UrlMkDebugOut((DEB_REG, "%p OUT CRegistryA::CreateKeyEx (%ld)\n", this, lRet));
  601. return lRet;
  602. }
  603. STDMETHODIMP_(LONG) CRegistryA::DeleteKey (
  604. HKEY hKey,
  605. LPCSTR lpSubKey
  606. )
  607. {
  608. UrlMkDebugOut((DEB_REG, "%p _IN CRegistryA::DeleteKey\n", this));
  609. LONG lRet = 0;
  610. lRet = RegDeleteKeyA(hKey, lpSubKey);
  611. UrlMkDebugOut((DEB_REG, "%p OUT CRegistryA::DeleteKey (%ld)\n", this, lRet));
  612. return lRet;
  613. }
  614. STDMETHODIMP_(LONG) CRegistryA::DeleteValue (
  615. HKEY hKey,
  616. LPCSTR lpValueName
  617. )
  618. {
  619. UrlMkDebugOut((DEB_REG, "%p _IN CRegistryA::DeleteValue\n", this));
  620. LONG lRet = 0;
  621. lRet = RegDeleteValueA(hKey, lpValueName);
  622. UrlMkDebugOut((DEB_REG, "%p OUT CRegistryA::DeleteValue (%ld)\n", this, lRet));
  623. return lRet;
  624. }
  625. STDMETHODIMP_(LONG) CRegistryA::EnumKey (
  626. HKEY hKey,
  627. DWORD dwIndex,
  628. LPSTR lpName,
  629. DWORD cbName
  630. )
  631. {
  632. UrlMkDebugOut((DEB_REG, "%p _IN CRegistryA::EnumKey\n", this));
  633. LONG lRet = 0;
  634. lRet = RegEnumKeyA (hKey, dwIndex, lpName, cbName);
  635. UrlMkDebugOut((DEB_REG, "%p OUT CRegistryA::EnumKey (%ld)\n", this, lRet));
  636. return lRet;
  637. }
  638. STDMETHODIMP_(LONG) CRegistryA::EnumKeyEx (
  639. HKEY hKey,
  640. DWORD dwIndex,
  641. LPSTR lpName,
  642. LPDWORD lpcbName,
  643. LPDWORD lpReserved,
  644. LPSTR lpClass,
  645. LPDWORD lpcbClass,
  646. PFILETIME lpftLastWriteTime
  647. )
  648. {
  649. UrlMkDebugOut((DEB_REG, "%p _IN CRegistryA::EnumKeyEx\n", this));
  650. LONG lRet = 0;
  651. lRet = RegEnumKeyExA(hKey,dwIndex,lpName,lpcbName,lpReserved,
  652. lpClass,lpcbClass,lpftLastWriteTime);
  653. UrlMkDebugOut((DEB_REG, "%p OUT CRegistryA::EnumKeyEx (%ld)\n", this, lRet));
  654. return lRet;
  655. }
  656. STDMETHODIMP_(LONG) CRegistryA::EnumValue (
  657. HKEY hKey,
  658. DWORD dwIndex,
  659. LPSTR lpValueName,
  660. LPDWORD lpcbValueName,
  661. LPDWORD lpReserved,
  662. LPDWORD lpType,
  663. LPBYTE lpData,
  664. LPDWORD lpcbData
  665. )
  666. {
  667. UrlMkDebugOut((DEB_REG, "%p _IN CRegistryA::EnumValue\n", this));
  668. LONG lRet = 0;
  669. lRet = RegEnumValueA(hKey,dwIndex,lpValueName,
  670. lpcbValueName,lpReserved,lpType,lpData,lpcbData);
  671. UrlMkDebugOut((DEB_REG, "%p OUT CRegistryA::EnumValue (%ld)\n", this, lRet));
  672. return lRet;
  673. }
  674. STDMETHODIMP_(LONG) CRegistryA::FlushKey (HKEY hKey)
  675. {
  676. UrlMkDebugOut((DEB_REG, "%p _IN CRegistryA::FlushKey\n", this));
  677. LONG lRet = 0;
  678. lRet = RegFlushKey(hKey);
  679. UrlMkDebugOut((DEB_REG, "%p OUT CRegistryA::FlushKey (%ld)\n", this, lRet));
  680. return lRet;
  681. }
  682. STDMETHODIMP_(LONG) CRegistryA::GetKeySecurity (
  683. HKEY hKey,
  684. SECURITY_INFORMATION SecurityInformation,
  685. PSECURITY_DESCRIPTOR pSecurityDescriptor,
  686. LPDWORD lpcbSecurityDescriptor)
  687. {
  688. UrlMkDebugOut((DEB_REG, "%p _IN CRegistryA::GetKeySecurity\n", this));
  689. LONG lRet = 0;
  690. lRet = RegGetKeySecurity (hKey,SecurityInformation, pSecurityDescriptor,lpcbSecurityDescriptor);
  691. UrlMkDebugOut((DEB_REG, "%p OUT CRegistryA::GetKeySecurity (%ld)\n", this, lRet));
  692. return lRet;
  693. }
  694. STDMETHODIMP_(LONG) CRegistryA::LoadKey (
  695. HKEY hKey,
  696. LPCSTR lpSubKey,
  697. LPCSTR lpFile
  698. )
  699. {
  700. UrlMkDebugOut((DEB_REG, "%p _IN CRegistryA::LoadKey\n", this));
  701. LONG lRet = 0;
  702. lRet = RegLoadKeyA(hKey, lpSubKey, lpFile);
  703. UrlMkDebugOut((DEB_REG, "%p OUT CRegistryA::LoadKey (%ld)\n", this, lRet));
  704. return lRet;
  705. }
  706. STDMETHODIMP_(LONG) CRegistryA::NotifyChangeKeyValue (
  707. HKEY hKey,
  708. BOOL bWatchSubtree,
  709. DWORD dwNotifyFilter,
  710. HANDLE hEvent,
  711. BOOL fAsynchronus
  712. )
  713. {
  714. UrlMkDebugOut((DEB_REG, "%p _IN CRegistryA::NotifyChangeKeyValue\n", this));
  715. LONG lRet = 0;
  716. lRet = RegNotifyChangeKeyValue(hKey, bWatchSubtree, dwNotifyFilter, hEvent,fAsynchronus);
  717. UrlMkDebugOut((DEB_REG, "%p OUT CRegistryA::NotifyChangeKeyValue (%ld)\n", this, lRet));
  718. return lRet;
  719. }
  720. STDMETHODIMP_(LONG) CRegistryA::OpenKey (
  721. HKEY hKey,
  722. LPCSTR lpSubKey,
  723. PHKEY phkResult
  724. )
  725. {
  726. UrlMkDebugOut((DEB_REG, "%p _IN CRegistryA::OpenKey (lpSubKey:%s)\n", this,lpSubKey));
  727. LONG lRet = 0;
  728. lRet = RegOpenKeyA(hKey, lpSubKey, phkResult);
  729. UrlMkDebugOut((DEB_REG, "%p OUT CRegistryA::OpenKey (%ld)\n", this, lRet));
  730. return lRet;
  731. }
  732. STDMETHODIMP_(LONG) CRegistryA::OpenKeyEx (
  733. HKEY hKey,
  734. LPCSTR lpSubKey,
  735. DWORD ulOptions,
  736. REGSAM samDesired,
  737. PHKEY phkResult
  738. )
  739. {
  740. UrlMkDebugOut((DEB_REG, "%p _IN CRegistryA::OpenKeyEx\n", this));
  741. LONG lRet = 0;
  742. lRet = RegOpenKeyExA(hKey,lpSubKey,ulOptions,samDesired,phkResult);
  743. UrlMkDebugOut((DEB_REG, "%p OUT CRegistryA::OpenKeyEx (%ld)\n", this, lRet));
  744. return lRet;
  745. }
  746. STDMETHODIMP_(LONG) CRegistryA::QueryInfoKey (
  747. HKEY hKey,
  748. LPSTR lpClass,
  749. LPDWORD lpcbClass,
  750. LPDWORD lpReserved,
  751. LPDWORD lpcSubKeys,
  752. LPDWORD lpcbMaxSubKeyLen,
  753. LPDWORD lpcbMaxClassLen,
  754. LPDWORD lpcValues,
  755. LPDWORD lpcbMaxValueNameLen,
  756. LPDWORD lpcbMaxValueLen,
  757. LPDWORD lpcbSecurityDescriptor,
  758. PFILETIME lpftLastWriteTime
  759. )
  760. {
  761. UrlMkDebugOut((DEB_REG, "%p _IN CRegistryA::QueryInfoKey\n", this));
  762. LONG lRet = 0;
  763. lRet = RegQueryInfoKeyA (
  764. hKey,
  765. lpClass,
  766. lpcbClass,
  767. lpReserved,
  768. lpcSubKeys,
  769. lpcbMaxSubKeyLen,
  770. lpcbMaxClassLen,
  771. lpcValues,
  772. lpcbMaxValueNameLen,
  773. lpcbMaxValueLen,
  774. lpcbSecurityDescriptor,
  775. lpftLastWriteTime);
  776. UrlMkDebugOut((DEB_REG, "%p OUT CRegistryA::QueryInfoKey (%ld)\n", this, lRet));
  777. return lRet;
  778. }
  779. STDMETHODIMP_(LONG) CRegistryA::QueryValue (
  780. HKEY hKey,
  781. LPCSTR lpSubKey,
  782. LPSTR lpValue,
  783. LONG *lpcbValue
  784. )
  785. {
  786. UrlMkDebugOut((DEB_REG, "%p _IN CRegistryA::QueryValue (szValue:%s)\n", this,lpSubKey));
  787. LONG lRet = 0;
  788. lRet = RegQueryValueA(hKey,lpSubKey,lpValue,lpcbValue);
  789. UrlMkDebugOut((DEB_REG, "%p OUT CRegistryA::QueryValue (%ld)\n", this, lRet));
  790. return lRet;
  791. }
  792. STDMETHODIMP_(LONG) CRegistryA::QueryMultipleValues (
  793. HKEY hKey,
  794. PVALENTXA val_list,
  795. DWORD num_vals,
  796. LPSTR lpValueBuf,
  797. LPDWORD ldwTotsize
  798. )
  799. {
  800. UrlMkDebugOut((DEB_REG, "%p _IN CRegistryA::QueryMultipleValues\n", this));
  801. LONG lRet = 0;
  802. lRet = RegQueryMultipleValuesA(hKey,(PVALENTA) val_list, num_vals, lpValueBuf, ldwTotsize);
  803. UrlMkDebugOut((DEB_REG, "%p OUT CRegistryA::QueryMultipleValues (%ld)\n", this, lRet));
  804. return lRet;
  805. }
  806. STDMETHODIMP_(LONG) CRegistryA::QueryValueEx (
  807. HKEY hKey,
  808. LPCSTR lpValueName,
  809. LPDWORD lpReserved,
  810. LPDWORD lpType,
  811. LPBYTE lpData,
  812. LPDWORD lpcbData
  813. )
  814. {
  815. UrlMkDebugOut((DEB_REG, "%p _IN CRegistryA::QueryValueEx\n", this));
  816. LONG lRet = 0;
  817. lRet = RegQueryValueExA(hKey, lpValueName, lpReserved, lpType, lpData, lpcbData);
  818. UrlMkDebugOut((DEB_REG, "%p OUT CRegistryA::QueryValueEx (%ld)\n", this, lRet));
  819. return lRet;
  820. }
  821. STDMETHODIMP_(LONG) CRegistryA::ReplaceKey (
  822. HKEY hKey,
  823. LPCSTR lpSubKey,
  824. LPCSTR lpNewFile,
  825. LPCSTR lpOldFile
  826. )
  827. {
  828. UrlMkDebugOut((DEB_REG, "%p _IN CRegistryA::ReplaceKey\n", this));
  829. LONG lRet = 0;
  830. lRet = RegReplaceKeyA(hKey, lpSubKey, lpNewFile, lpOldFile);
  831. UrlMkDebugOut((DEB_REG, "%p OUT CRegistryA::ReplaceKey (%ld)\n", this, lRet));
  832. return lRet;
  833. }
  834. STDMETHODIMP_(LONG) CRegistryA::RestoreKey (
  835. HKEY hKey,
  836. LPCSTR lpFile,
  837. DWORD dwFlags
  838. )
  839. {
  840. UrlMkDebugOut((DEB_REG, "%p _IN CRegistryA::RestoreKey\n", this));
  841. LONG lRet = 0;
  842. lRet = RegRestoreKeyA(hKey, lpFile, dwFlags);
  843. UrlMkDebugOut((DEB_REG, "%p OUT CRegistryA::RestoreKey (%ld)\n", this, lRet));
  844. return lRet;
  845. }
  846. STDMETHODIMP_(LONG) CRegistryA::SaveKey (
  847. HKEY hKey,
  848. LPCSTR lpFile,
  849. LPSECURITY_ATTRIBUTES lpSecurityAttributes
  850. )
  851. {
  852. UrlMkDebugOut((DEB_REG, "%p _IN CRegistryA::SaveKey\n", this));
  853. LONG lRet = 0;
  854. lRet = RegSaveKeyA(hKey, lpFile, lpSecurityAttributes);
  855. UrlMkDebugOut((DEB_REG, "%p OUT CRegistryA::SaveKey (%ld)\n", this, lRet));
  856. return lRet;
  857. }
  858. STDMETHODIMP_(LONG) CRegistryA::SetKeySecurity (
  859. HKEY hKey,
  860. SECURITY_INFORMATION SecurityInformation,
  861. PSECURITY_DESCRIPTOR pSecurityDescriptor
  862. )
  863. {
  864. UrlMkDebugOut((DEB_REG, "%p _IN CRegistryA::SetKeySecurity\n", this));
  865. LONG lRet = 0;
  866. lRet = RegSetKeySecurity(hKey, SecurityInformation, pSecurityDescriptor);
  867. UrlMkDebugOut((DEB_REG, "%p OUT CRegistryA::SetKeySecurity (%ld)\n", this, lRet));
  868. return lRet;
  869. }
  870. STDMETHODIMP_(LONG) CRegistryA::SetValue (
  871. HKEY hKey,
  872. LPCSTR lpSubKey,
  873. DWORD dwType,
  874. LPCSTR lpData,
  875. DWORD cbData
  876. )
  877. {
  878. UrlMkDebugOut((DEB_REG, "%p _IN CRegistryA::SetValue\n", this));
  879. LONG lRet = 0;
  880. lRet = RegSetValueA(hKey, lpSubKey, dwType,lpData, cbData );
  881. UrlMkDebugOut((DEB_REG, "%p OUT CRegistryA::SetValue (%ld)\n", this, lRet));
  882. return lRet;
  883. }
  884. STDMETHODIMP_(LONG) CRegistryA::SetValueEx (
  885. HKEY hKey,
  886. LPCSTR lpValueName,
  887. DWORD Reserved,
  888. DWORD dwType,
  889. const BYTE* lpData,
  890. DWORD cbData
  891. )
  892. {
  893. UrlMkDebugOut((DEB_REG, "%p _IN CRegistryA::SetValueEx\n", this));
  894. LONG lRet = 0;
  895. lRet = RegSetValueExA(hKey, lpValueName, Reserved, dwType,lpData, cbData);
  896. UrlMkDebugOut((DEB_REG, "%p OUT CRegistryA::SetValueEx (%ld)\n", this, lRet));
  897. return lRet;
  898. }
  899. STDMETHODIMP_(LONG) CRegistryA::UnLoadKey (
  900. HKEY hKey,
  901. LPCSTR lpSubKey
  902. )
  903. {
  904. UrlMkDebugOut((DEB_REG, "%p _IN CRegistryA::UnLoadKey\n", this));
  905. LONG lRet = 0;
  906. lRet = RegUnLoadKeyA(hKey, lpSubKey);
  907. UrlMkDebugOut((DEB_REG, "%p OUT CRegistryA::UnLoadKey (%ld)\n", this, lRet));
  908. return lRet;
  909. }