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.

1492 lines
34 KiB

  1. /*++
  2. Copyright (c) Microsoft Corporation. All rights reserved.
  3. Module Name:
  4. RegistryChecks.cpp
  5. Abstract:
  6. Warn the app when it's trying to read from or write to inappropriate
  7. places in the registry.
  8. Notes:
  9. This is a general purpose shim.
  10. History:
  11. 03/09/2001 maonis Created
  12. 09/04/2001 maonis Since none of the paths we compare with exceed MAX_PATH - 1
  13. characters, we only examine at most that many characters of
  14. the key paths to make sure there's no buffer overflow in
  15. the paths of open keys.
  16. 02/20/2002 rparsons Implemented strsafe functions.
  17. 02/25/2002 rparsons Modified critical section code to be thread safe.
  18. --*/
  19. #include "precomp.h"
  20. IMPLEMENT_SHIM_BEGIN(RegistryChecks)
  21. #include "ShimHookMacro.h"
  22. #include "RegistryChecks.h"
  23. //
  24. // verifier log entries
  25. //
  26. BEGIN_DEFINE_VERIFIER_LOG(RegistryChecks)
  27. VERIFIER_LOG_ENTRY(VLOG_HKCU_Console_READ)
  28. VERIFIER_LOG_ENTRY(VLOG_HKCU_ControlPanel_READ)
  29. VERIFIER_LOG_ENTRY(VLOG_HKCU_Environment_READ)
  30. VERIFIER_LOG_ENTRY(VLOG_HKCU_Identities_READ)
  31. VERIFIER_LOG_ENTRY(VLOG_HKCU_KeyboardLayout_READ)
  32. VERIFIER_LOG_ENTRY(VLOG_HKCU_Printers_READ)
  33. VERIFIER_LOG_ENTRY(VLOG_HKCU_RemoteAccess_READ)
  34. VERIFIER_LOG_ENTRY(VLOG_HKCU_SessionInformation_READ)
  35. VERIFIER_LOG_ENTRY(VLOG_HKCU_UNICODEProgramGroups_READ)
  36. VERIFIER_LOG_ENTRY(VLOG_HKCU_VolatileEnvironment_READ)
  37. VERIFIER_LOG_ENTRY(VLOG_HKCU_Windows31MigrationStatus_READ)
  38. VERIFIER_LOG_ENTRY(VLOG_HKLM_HARDWARE_READ)
  39. VERIFIER_LOG_ENTRY(VLOG_HKLM_SAM_READ)
  40. VERIFIER_LOG_ENTRY(VLOG_HKLM_SECURITY_READ)
  41. VERIFIER_LOG_ENTRY(VLOG_HKLM_SYSTEM_READ)
  42. VERIFIER_LOG_ENTRY(VLOG_HKCC_READ)
  43. VERIFIER_LOG_ENTRY(VLOG_HKUS_READ)
  44. VERIFIER_LOG_ENTRY(VLOG_NON_HKCU_WRITE)
  45. END_DEFINE_VERIFIER_LOG(RegistryChecks)
  46. INIT_VERIFIER_LOG(RegistryChecks);
  47. const RCWARNING g_warnNoDirectRead[] =
  48. {
  49. {HKCU_Console_STR, VLOG_HKCU_Console_READ, NUM_OF_CHAR(HKCU_Console_STR)},
  50. {HKCU_ControlPanel_STR, VLOG_HKCU_ControlPanel_READ, NUM_OF_CHAR(HKCU_ControlPanel_STR)},
  51. {HKCU_Environment_STR, VLOG_HKCU_Environment_READ, NUM_OF_CHAR(HKCU_Environment_STR)},
  52. {HKCU_Identities_STR, VLOG_HKCU_Identities_READ, NUM_OF_CHAR(HKCU_Identities_STR)},
  53. {HKCU_KeyboardLayout_STR, VLOG_HKCU_KeyboardLayout_READ, NUM_OF_CHAR(HKCU_KeyboardLayout_STR)},
  54. {HKCU_Printers_STR, VLOG_HKCU_Printers_READ, NUM_OF_CHAR(HKCU_Printers_STR)},
  55. {HKCU_RemoteAccess_STR, VLOG_HKCU_RemoteAccess_READ, NUM_OF_CHAR(HKCU_RemoteAccess_STR)},
  56. {HKCU_SessionInformation_STR, VLOG_HKCU_SessionInformation_READ, NUM_OF_CHAR(HKCU_SessionInformation_STR)},
  57. {HKCU_UNICODEProgramGroups_STR, VLOG_HKCU_UNICODEProgramGroups_READ, NUM_OF_CHAR(HKCU_UNICODEProgramGroups_STR)},
  58. {HKCU_VolatileEnvironment_STR, VLOG_HKCU_VolatileEnvironment_READ, NUM_OF_CHAR(HKCU_VolatileEnvironment_STR)},
  59. {HKCU_Windows31MigrationStatus_STR, VLOG_HKCU_Windows31MigrationStatus_READ,NUM_OF_CHAR(HKCU_Windows31MigrationStatus_STR)},
  60. {HKLM_HARDWARE_STR, VLOG_HKLM_HARDWARE_READ, NUM_OF_CHAR(HKLM_HARDWARE_STR)},
  61. {HKLM_SAM_STR, VLOG_HKLM_SAM_READ, NUM_OF_CHAR(HKLM_SAM_STR)},
  62. {HKLM_SECURITY_STR, VLOG_HKLM_SECURITY_READ, NUM_OF_CHAR(HKLM_SECURITY_STR)},
  63. {HKLM_SYSTEM_STR, VLOG_HKLM_SYSTEM_READ, NUM_OF_CHAR(HKLM_SYSTEM_STR)},
  64. {HKCC_STR, VLOG_HKCC_READ, NUM_OF_CHAR(HKCC_STR)},
  65. {HKUS_STR, VLOG_HKUS_READ, NUM_OF_CHAR(HKUS_STR)},
  66. };
  67. const UINT g_cWarnNDirectRead = sizeof(g_warnNoDirectRead) / sizeof(RCWARNING);
  68. //
  69. // Critical section that keeps us safe while using linked-lists, etc.
  70. //
  71. CCriticalSection g_csCritSec;
  72. VOID
  73. MakePathW(
  74. IN RCOPENKEY* key,
  75. IN HKEY hKey,
  76. IN LPCWSTR lpSubKey,
  77. IN OUT LPWSTR lpPath
  78. )
  79. {
  80. if (key) {
  81. if (key->wszPath[0]) {
  82. //
  83. // We only care about at most MAX_PATH - 1 characters.
  84. //
  85. wcsncpy(lpPath, key->wszPath, MAX_PATH - 1);
  86. }
  87. } else {
  88. if (hKey == HKEY_CLASSES_ROOT) {
  89. StringCchCopy(lpPath, MAX_PATH - 1, L"HKCR");
  90. } else if (hKey == HKEY_CURRENT_CONFIG) {
  91. StringCchCopy(lpPath, MAX_PATH - 1, L"HKCC");
  92. } else if (hKey == HKEY_CURRENT_USER) {
  93. StringCchCopy(lpPath, MAX_PATH - 1, L"HKCU");
  94. } else if (hKey == HKEY_LOCAL_MACHINE) {
  95. StringCchCopy(lpPath, MAX_PATH - 1, L"HKLM");
  96. } else if (hKey == HKEY_USERS) {
  97. StringCchCopy(lpPath, MAX_PATH - 1, L"HKUS");
  98. } else {
  99. StringCchCopy(lpPath, MAX_PATH - 1, L"Not recongized");
  100. }
  101. }
  102. if (lpSubKey && *lpSubKey) {
  103. DWORD cLen = wcslen(lpPath);
  104. //
  105. // We only care about at most MAX_PATH - 1 characters.
  106. //
  107. if (cLen < MAX_PATH - 1) {
  108. lpPath[cLen] = L'\\';
  109. wcsncpy(lpPath + cLen + 1, lpSubKey, MAX_PATH - cLen - 2);
  110. }
  111. }
  112. lpPath[MAX_PATH - 1] = L'\0';
  113. }
  114. VOID CheckReading(
  115. IN LPCWSTR pwszPath
  116. )
  117. {
  118. RCWARNING warn;
  119. for (UINT ui = 0; ui < g_cWarnNDirectRead; ++ui) {
  120. warn = g_warnNoDirectRead[ui];
  121. if (!_wcsnicmp(pwszPath, warn.wszPath, warn.cLen)) {
  122. VLOG(VLOG_LEVEL_ERROR, warn.dwAVStatus,
  123. "Read from dangerous registry entry '%ls'.",
  124. pwszPath);
  125. }
  126. }
  127. }
  128. // We warn for every tempt of writing to anything besides keys under HKCU.
  129. // Note this applies to both Users and Admins/Power Users because when an
  130. // app is running it shouldn't write anything to non HKCU keys, which should
  131. // be done during the installation time.
  132. VOID CheckWriting(
  133. IN REGSAM samDesired,
  134. IN LPCWSTR pwszPath
  135. )
  136. {
  137. if ((samDesired &~ STANDARD_RIGHTS_WRITE) & KEY_WRITE) {
  138. if (_wcsnicmp(pwszPath, L"HKCU", 4)) {
  139. VLOG(VLOG_LEVEL_ERROR, VLOG_NON_HKCU_WRITE, "Write to non-HKCU registry entry '%ls'.", pwszPath);
  140. }
  141. }
  142. }
  143. //
  144. // Implementation of the CRegistryChecks class.
  145. //
  146. RCOPENKEY*
  147. CRegistryChecks::FindKey(
  148. HKEY hKey
  149. )
  150. {
  151. RCOPENKEY* key = keys;
  152. while (key) {
  153. if (key->hkBase == hKey) {
  154. return key;
  155. }
  156. key = key->next;
  157. }
  158. return NULL;
  159. }
  160. // We add the key to the front of the list because the most
  161. // recently added keys are usually used/deleted first.
  162. BOOL
  163. CRegistryChecks::AddKey(
  164. HKEY hKey,
  165. LPCWSTR pwszPath
  166. )
  167. {
  168. RCOPENKEY* key = new RCOPENKEY;
  169. if (!key) {
  170. return FALSE;
  171. }
  172. key->hkBase = hKey;
  173. //
  174. // None of the key paths we need to check exceed MAX_PATH - 1 characters so
  175. // we only need to copy at most that many characters.
  176. //
  177. wcsncpy(key->wszPath, pwszPath, MAX_PATH - 1);
  178. key->wszPath[MAX_PATH - 1] = L'\0';
  179. key->next = keys;
  180. keys = key;
  181. return TRUE;
  182. }
  183. VOID
  184. CRegistryChecks::Check(
  185. HKEY hKey,
  186. LPCSTR lpSubKey,
  187. BOOL fCheckRead,
  188. BOOL fCheckWrite,
  189. REGSAM samDesired
  190. )
  191. {
  192. LPWSTR pwszSubKey = NULL;
  193. if (pwszSubKey = ToUnicode(lpSubKey)) {
  194. Check(hKey, pwszSubKey, fCheckRead, fCheckWrite);
  195. free(pwszSubKey);
  196. } else {
  197. DPFN(eDbgLevelError, "Failed to convert %s to unicode", lpSubKey);
  198. }
  199. }
  200. VOID
  201. CRegistryChecks::Check(
  202. HKEY hKey,
  203. LPCWSTR lpSubKey,
  204. BOOL fCheckRead,
  205. BOOL fCheckWrite,
  206. REGSAM samDesired
  207. )
  208. {
  209. RCOPENKEY* key = FindKey(hKey);
  210. WCHAR wszPath[MAX_PATH] = L"";
  211. MakePathW(key, hKey, lpSubKey, wszPath);
  212. if (fCheckRead) {
  213. CheckReading(wszPath);
  214. }
  215. if (fCheckWrite) {
  216. CheckWriting(samDesired, wszPath);
  217. }
  218. }
  219. LONG
  220. CRegistryChecks::OpenKeyExOriginalW(
  221. HKEY hKey,
  222. LPCWSTR lpSubKey,
  223. LPWSTR lpClass,
  224. DWORD dwOptions,
  225. REGSAM samDesired,
  226. LPSECURITY_ATTRIBUTES lpSecurityAttributes,
  227. PHKEY phkResult,
  228. LPDWORD lpdwDisposition,
  229. BOOL bCreate
  230. )
  231. {
  232. if (bCreate) {
  233. return ORIGINAL_API(RegCreateKeyExW)(
  234. hKey,
  235. lpSubKey,
  236. 0,
  237. lpClass,
  238. dwOptions,
  239. samDesired,
  240. lpSecurityAttributes,
  241. phkResult,
  242. lpdwDisposition);
  243. } else {
  244. return ORIGINAL_API(RegOpenKeyExW)(
  245. hKey,
  246. lpSubKey,
  247. 0,
  248. samDesired,
  249. phkResult);
  250. }
  251. }
  252. LONG
  253. CRegistryChecks::OpenKeyExA(
  254. HKEY hKey,
  255. LPCSTR lpSubKey,
  256. LPSTR lpClass,
  257. DWORD dwOptions,
  258. REGSAM samDesired,
  259. LPSECURITY_ATTRIBUTES lpSecurityAttributes,
  260. PHKEY phkResult,
  261. LPDWORD lpdwDisposition,
  262. BOOL bCreate
  263. )
  264. {
  265. LONG lRet;
  266. LPWSTR pwszSubKey = NULL;
  267. LPWSTR pwszClass = NULL;
  268. if (lpSubKey) {
  269. if (!(pwszSubKey = ToUnicode(lpSubKey))) {
  270. DPFN(eDbgLevelError, "Failed to convert %s to unicode", lpSubKey);
  271. return ERROR_NOT_ENOUGH_MEMORY;
  272. }
  273. }
  274. if (lpClass) {
  275. if (!(pwszClass = ToUnicode(lpClass)))
  276. {
  277. free(pwszSubKey);
  278. DPFN(eDbgLevelError, "Failed to convert %s to unicode", lpClass);
  279. return ERROR_NOT_ENOUGH_MEMORY;
  280. }
  281. }
  282. lRet = OpenKeyExW(
  283. hKey,
  284. pwszSubKey,
  285. pwszClass,
  286. dwOptions,
  287. samDesired,
  288. lpSecurityAttributes,
  289. phkResult,
  290. lpdwDisposition,
  291. bCreate);
  292. free(pwszSubKey);
  293. free(pwszClass);
  294. return lRet;
  295. }
  296. LONG
  297. CRegistryChecks::OpenKeyExW(
  298. HKEY hKey,
  299. LPCWSTR lpSubKey,
  300. LPWSTR lpClass,
  301. DWORD dwOptions,
  302. REGSAM samDesired,
  303. LPSECURITY_ATTRIBUTES lpSecurityAttributes,
  304. PHKEY phkResult,
  305. LPDWORD lpdwDisposition,
  306. BOOL bCreate
  307. )
  308. {
  309. RCOPENKEY* key = FindKey(hKey);
  310. WCHAR wszPath[MAX_PATH] = L"";
  311. MakePathW(key, hKey, lpSubKey, wszPath);
  312. CheckReading(wszPath);
  313. CheckWriting(samDesired, wszPath);
  314. LONG lRes = OpenKeyExOriginalW(
  315. hKey,
  316. lpSubKey,
  317. lpClass,
  318. dwOptions,
  319. samDesired,
  320. lpSecurityAttributes,
  321. phkResult,
  322. lpdwDisposition,
  323. bCreate);
  324. if (lRes == ERROR_SUCCESS) {
  325. if (AddKey(*phkResult, wszPath)) {
  326. DPFN(eDbgLevelInfo, "[OpenKeyExW] success - adding key 0x%08X", *phkResult);
  327. } else {
  328. lRes = ERROR_INVALID_HANDLE;
  329. }
  330. }
  331. return lRes;
  332. }
  333. LONG
  334. CRegistryChecks::QueryValueA(
  335. HKEY hKey,
  336. LPCSTR lpSubKey,
  337. LPSTR lpValue,
  338. PLONG lpcbValue
  339. )
  340. {
  341. Check(hKey, lpSubKey, TRUE, FALSE);
  342. return ORIGINAL_API(RegQueryValueA)(
  343. hKey,
  344. lpSubKey,
  345. lpValue,
  346. lpcbValue);
  347. }
  348. LONG
  349. CRegistryChecks::QueryValueW(
  350. HKEY hKey,
  351. LPCWSTR lpSubKey,
  352. LPWSTR lpValue,
  353. PLONG lpcbValue
  354. )
  355. {
  356. Check(hKey, lpSubKey, TRUE, FALSE);
  357. return ORIGINAL_API(RegQueryValueW)(
  358. hKey,
  359. lpSubKey,
  360. lpValue,
  361. lpcbValue);
  362. }
  363. LONG
  364. CRegistryChecks::QueryValueExA(
  365. HKEY hKey,
  366. LPCSTR lpValueName,
  367. LPDWORD lpReserved,
  368. LPDWORD lpType,
  369. LPBYTE lpData,
  370. LPDWORD lpcbData
  371. )
  372. {
  373. Check(hKey, L"", TRUE, FALSE);
  374. return ORIGINAL_API(RegQueryValueExA)(
  375. hKey,
  376. lpValueName,
  377. lpReserved,
  378. lpType,
  379. lpData,
  380. lpcbData);
  381. }
  382. LONG
  383. CRegistryChecks::QueryValueExW(
  384. HKEY hKey,
  385. LPCWSTR lpValueName,
  386. LPDWORD lpReserved,
  387. LPDWORD lpType,
  388. LPBYTE lpData,
  389. LPDWORD lpcbData
  390. )
  391. {
  392. Check(hKey, L"", TRUE, FALSE);
  393. return ORIGINAL_API(RegQueryValueExW)(
  394. hKey,
  395. lpValueName,
  396. lpReserved,
  397. lpType,
  398. lpData,
  399. lpcbData);
  400. }
  401. LONG
  402. CRegistryChecks::QueryInfoKeyA(
  403. HKEY hKey,
  404. LPSTR lpClass,
  405. LPDWORD lpcbClass,
  406. LPDWORD lpReserved,
  407. LPDWORD lpcSubKeys,
  408. LPDWORD lpcbMaxSubKeyLen,
  409. LPDWORD lpcbMaxClassLen,
  410. LPDWORD lpcValues,
  411. LPDWORD lpcbMaxValueNameLen,
  412. LPDWORD lpcbMaxValueLen,
  413. LPDWORD lpcbSecurityDescriptor,
  414. PFILETIME lpftLastWriteTime
  415. )
  416. {
  417. Check(hKey, L"", TRUE, FALSE);
  418. return ORIGINAL_API(RegQueryInfoKeyA)(
  419. hKey,
  420. lpClass,
  421. lpcbClass,
  422. lpReserved,
  423. lpcSubKeys,
  424. lpcbMaxSubKeyLen,
  425. lpcbMaxClassLen,
  426. lpcValues,
  427. lpcbMaxValueNameLen,
  428. lpcbMaxValueLen,
  429. lpcbSecurityDescriptor,
  430. lpftLastWriteTime);
  431. }
  432. LONG
  433. CRegistryChecks::QueryInfoKeyW(
  434. HKEY hKey,
  435. LPWSTR lpClass,
  436. LPDWORD lpcbClass,
  437. LPDWORD lpReserved,
  438. LPDWORD lpcSubKeys,
  439. LPDWORD lpcbMaxSubKeyLen,
  440. LPDWORD lpcbMaxClassLen,
  441. LPDWORD lpcValues,
  442. LPDWORD lpcbMaxValueNameLen,
  443. LPDWORD lpcbMaxValueLen,
  444. LPDWORD lpcbSecurityDescriptor,
  445. PFILETIME lpftLastWriteTime
  446. )
  447. {
  448. Check(hKey, L"", TRUE, FALSE);
  449. return ORIGINAL_API(RegQueryInfoKeyW)(
  450. hKey,
  451. lpClass,
  452. lpcbClass,
  453. lpReserved,
  454. lpcSubKeys,
  455. lpcbMaxSubKeyLen,
  456. lpcbMaxClassLen,
  457. lpcValues,
  458. lpcbMaxValueNameLen,
  459. lpcbMaxValueLen,
  460. lpcbSecurityDescriptor,
  461. lpftLastWriteTime);
  462. }
  463. LONG
  464. CRegistryChecks::SetValueA(
  465. HKEY hKey,
  466. LPCSTR lpSubKey,
  467. DWORD dwType,
  468. LPCSTR lpData,
  469. DWORD cbData
  470. )
  471. {
  472. Check(hKey, lpSubKey, FALSE, TRUE, KEY_WRITE);
  473. return ORIGINAL_API(RegSetValueA)(
  474. hKey,
  475. lpSubKey,
  476. dwType,
  477. lpData,
  478. cbData);
  479. }
  480. LONG
  481. CRegistryChecks::SetValueW(
  482. HKEY hKey,
  483. LPCWSTR lpSubKey,
  484. DWORD dwType,
  485. LPCWSTR lpData,
  486. DWORD cbData
  487. )
  488. {
  489. Check(hKey, lpSubKey, FALSE, TRUE, KEY_WRITE);
  490. return ORIGINAL_API(RegSetValueW)(
  491. hKey,
  492. lpSubKey,
  493. dwType,
  494. lpData,
  495. cbData);
  496. }
  497. LONG
  498. CRegistryChecks::SetValueExA(
  499. HKEY hKey,
  500. LPCSTR lpValueName,
  501. DWORD Reserved,
  502. DWORD dwType,
  503. CONST BYTE * lpData,
  504. DWORD cbData
  505. )
  506. {
  507. Check(hKey, L"", FALSE, TRUE, KEY_WRITE);
  508. return ORIGINAL_API(RegSetValueExA)(
  509. hKey,
  510. lpValueName,
  511. Reserved,
  512. dwType,
  513. lpData,
  514. cbData);
  515. }
  516. LONG
  517. CRegistryChecks::SetValueExW(
  518. HKEY hKey,
  519. LPCWSTR lpValueName,
  520. DWORD Reserved,
  521. DWORD dwType,
  522. CONST BYTE * lpData,
  523. DWORD cbData
  524. )
  525. {
  526. Check(hKey, L"", FALSE, TRUE, KEY_WRITE);
  527. return ORIGINAL_API(RegSetValueExW)(
  528. hKey,
  529. lpValueName,
  530. Reserved,
  531. dwType,
  532. lpData,
  533. cbData);
  534. }
  535. LONG
  536. CRegistryChecks::EnumValueA(
  537. HKEY hKey,
  538. DWORD dwIndex,
  539. LPSTR lpValueName,
  540. LPDWORD lpcbValueName,
  541. LPDWORD lpReserved,
  542. LPDWORD lpType,
  543. LPBYTE lpData,
  544. LPDWORD lpcbData
  545. )
  546. {
  547. Check(hKey, L"", TRUE, FALSE);
  548. return ORIGINAL_API(RegEnumValueA)(
  549. hKey,
  550. dwIndex,
  551. lpValueName,
  552. lpcbValueName,
  553. lpReserved,
  554. lpType,
  555. lpData,
  556. lpcbData);
  557. }
  558. // If the key was not originated from HKCU,
  559. // we enum at the original location.
  560. LONG
  561. CRegistryChecks::EnumValueW(
  562. HKEY hKey,
  563. DWORD dwIndex,
  564. LPWSTR lpValueName,
  565. LPDWORD lpcbValueName,
  566. LPDWORD lpReserved,
  567. LPDWORD lpType,
  568. LPBYTE lpData,
  569. LPDWORD lpcbData
  570. )
  571. {
  572. Check(hKey, L"", TRUE, FALSE);
  573. return ORIGINAL_API(RegEnumValueW)(
  574. hKey,
  575. dwIndex,
  576. lpValueName,
  577. lpcbValueName,
  578. lpReserved,
  579. lpType,
  580. lpData,
  581. lpcbData);
  582. }
  583. LONG
  584. CRegistryChecks::EnumKeyExA(
  585. HKEY hKey,
  586. DWORD dwIndex,
  587. LPSTR lpName,
  588. LPDWORD lpcbName,
  589. LPDWORD lpReserved,
  590. LPSTR lpClass,
  591. LPDWORD lpcbClass,
  592. PFILETIME lpftLastWriteTime
  593. )
  594. {
  595. Check(hKey, L"", TRUE, FALSE);
  596. return ORIGINAL_API(RegEnumKeyExA)(
  597. hKey,
  598. dwIndex,
  599. lpName,
  600. lpcbName,
  601. lpReserved,
  602. lpClass,
  603. lpcbClass,
  604. lpftLastWriteTime);
  605. }
  606. // If the key was not originated from HKCU,
  607. // we enum at the original location.
  608. LONG
  609. CRegistryChecks::EnumKeyExW(
  610. HKEY hKey,
  611. DWORD dwIndex,
  612. LPWSTR lpName,
  613. LPDWORD lpcbName,
  614. LPDWORD lpReserved,
  615. LPWSTR lpClass,
  616. LPDWORD lpcbClass,
  617. PFILETIME lpftLastWriteTime
  618. )
  619. {
  620. Check(hKey, L"", TRUE, FALSE);
  621. return ORIGINAL_API(RegEnumKeyExW)(
  622. hKey,
  623. dwIndex,
  624. lpName,
  625. lpcbName,
  626. lpReserved,
  627. lpClass,
  628. lpcbClass,
  629. lpftLastWriteTime);
  630. }
  631. // Remove the key from the list.
  632. LONG
  633. CRegistryChecks::CloseKey(
  634. HKEY hKey
  635. )
  636. {
  637. RCOPENKEY* key = keys;
  638. RCOPENKEY* last = NULL;
  639. while (key) {
  640. if (key->hkBase == hKey) {
  641. if (last) {
  642. last->next = key->next;
  643. } else {
  644. keys = key->next;
  645. }
  646. delete key;
  647. break;
  648. }
  649. last = key;
  650. key = key->next;
  651. }
  652. DPFN(eDbgLevelInfo, "[CloseKey] closing key 0x%08X", hKey);
  653. return ORIGINAL_API(RegCloseKey)(hKey);
  654. }
  655. LONG
  656. CRegistryChecks::DeleteKeyA(
  657. HKEY hKey,
  658. LPCSTR lpSubKey
  659. )
  660. {
  661. Check(hKey, lpSubKey, FALSE, TRUE, KEY_WRITE);
  662. return ORIGINAL_API(RegDeleteKeyA)(
  663. hKey,
  664. lpSubKey);
  665. }
  666. LONG
  667. CRegistryChecks::DeleteKeyW(
  668. HKEY hKey,
  669. LPCWSTR lpSubKey
  670. )
  671. {
  672. Check(hKey, lpSubKey, FALSE, TRUE, KEY_WRITE);
  673. return ORIGINAL_API(RegDeleteKeyW)(
  674. hKey,
  675. lpSubKey);
  676. }
  677. CRegistryChecks RRegistry;
  678. //
  679. // Hook APIs.
  680. //
  681. LONG
  682. APIHOOK(RegOpenKeyA)(
  683. HKEY hKey,
  684. LPSTR lpSubKey,
  685. PHKEY phkResult
  686. )
  687. {
  688. CLock cLock(g_csCritSec);
  689. return RRegistry.OpenKeyExA(
  690. hKey,
  691. lpSubKey,
  692. 0,
  693. REG_OPTION_NON_VOLATILE,
  694. MAXIMUM_ALLOWED,
  695. NULL,
  696. phkResult,
  697. NULL,
  698. FALSE);
  699. }
  700. LONG
  701. APIHOOK(RegOpenKeyW)(
  702. HKEY hKey,
  703. LPWSTR lpSubKey,
  704. PHKEY phkResult
  705. )
  706. {
  707. CLock cLock(g_csCritSec);
  708. return RRegistry.OpenKeyExW(
  709. hKey,
  710. lpSubKey,
  711. 0,
  712. REG_OPTION_NON_VOLATILE,
  713. MAXIMUM_ALLOWED,
  714. NULL,
  715. phkResult,
  716. NULL,
  717. FALSE);
  718. }
  719. LONG
  720. APIHOOK(RegOpenKeyExA)(
  721. HKEY hKey,
  722. LPCSTR lpSubKey,
  723. DWORD ulOptions,
  724. REGSAM samDesired,
  725. PHKEY phkResult
  726. )
  727. {
  728. CLock cLock(g_csCritSec);
  729. return RRegistry.OpenKeyExA(
  730. hKey,
  731. lpSubKey,
  732. 0,
  733. REG_OPTION_NON_VOLATILE,
  734. samDesired,
  735. NULL,
  736. phkResult,
  737. NULL,
  738. FALSE);
  739. }
  740. LONG
  741. APIHOOK(RegOpenKeyExW)(
  742. HKEY hKey,
  743. LPCWSTR lpSubKey,
  744. DWORD ulOptions,
  745. REGSAM samDesired,
  746. PHKEY phkResult
  747. )
  748. {
  749. CLock cLock(g_csCritSec);
  750. return RRegistry.OpenKeyExW(
  751. hKey,
  752. lpSubKey,
  753. 0,
  754. REG_OPTION_NON_VOLATILE,
  755. samDesired,
  756. NULL,
  757. phkResult,
  758. NULL,
  759. FALSE);
  760. }
  761. LONG
  762. APIHOOK(RegCreateKeyA)(
  763. HKEY hKey,
  764. LPCSTR lpSubKey,
  765. PHKEY phkResult
  766. )
  767. {
  768. CLock cLock(g_csCritSec);
  769. return RRegistry.OpenKeyExA(
  770. hKey,
  771. lpSubKey,
  772. 0,
  773. REG_OPTION_NON_VOLATILE,
  774. MAXIMUM_ALLOWED,
  775. NULL,
  776. phkResult,
  777. NULL,
  778. TRUE);
  779. }
  780. LONG
  781. APIHOOK(RegCreateKeyW)(
  782. HKEY hKey,
  783. LPCWSTR lpSubKey,
  784. PHKEY phkResult
  785. )
  786. {
  787. CLock cLock(g_csCritSec);
  788. return RRegistry.OpenKeyExW(
  789. hKey,
  790. lpSubKey,
  791. 0,
  792. REG_OPTION_NON_VOLATILE,
  793. MAXIMUM_ALLOWED,
  794. NULL,
  795. phkResult,
  796. NULL,
  797. TRUE);
  798. }
  799. LONG
  800. APIHOOK(RegCreateKeyExA)(
  801. HKEY hKey,
  802. LPCSTR lpSubKey,
  803. DWORD Reserved,
  804. LPSTR lpClass,
  805. DWORD dwOptions,
  806. REGSAM samDesired,
  807. LPSECURITY_ATTRIBUTES lpSecurityAttributes,
  808. PHKEY phkResult,
  809. LPDWORD lpdwDisposition
  810. )
  811. {
  812. CLock cLock(g_csCritSec);
  813. return RRegistry.OpenKeyExA(
  814. hKey,
  815. lpSubKey,
  816. lpClass,
  817. dwOptions,
  818. samDesired,
  819. lpSecurityAttributes,
  820. phkResult,
  821. lpdwDisposition,
  822. TRUE);
  823. }
  824. LONG
  825. APIHOOK(RegCreateKeyExW)(
  826. HKEY hKey,
  827. LPCWSTR lpSubKey,
  828. DWORD Reserved,
  829. LPWSTR lpClass,
  830. DWORD dwOptions,
  831. REGSAM samDesired,
  832. LPSECURITY_ATTRIBUTES lpSecurityAttributes,
  833. PHKEY phkResult,
  834. LPDWORD lpdwDisposition
  835. )
  836. {
  837. CLock cLock(g_csCritSec);
  838. return RRegistry.OpenKeyExW(
  839. hKey,
  840. lpSubKey,
  841. lpClass,
  842. dwOptions,
  843. samDesired,
  844. lpSecurityAttributes,
  845. phkResult,
  846. lpdwDisposition,
  847. TRUE);
  848. }
  849. LONG
  850. APIHOOK(RegQueryValueA)(
  851. HKEY hKey,
  852. LPCSTR lpSubKey,
  853. LPSTR lpValue,
  854. PLONG lpcbValue
  855. )
  856. {
  857. CLock cLock(g_csCritSec);
  858. return RRegistry.QueryValueA(
  859. hKey,
  860. lpSubKey,
  861. lpValue,
  862. lpcbValue);
  863. }
  864. LONG
  865. APIHOOK(RegQueryValueW)(
  866. HKEY hKey,
  867. LPCWSTR lpSubKey,
  868. LPWSTR lpValue,
  869. PLONG lpcbValue
  870. )
  871. {
  872. CLock cLock(g_csCritSec);
  873. return RRegistry.QueryValueW(
  874. hKey,
  875. lpSubKey,
  876. lpValue,
  877. lpcbValue);
  878. }
  879. LONG
  880. APIHOOK(RegQueryValueExA)(
  881. HKEY hKey,
  882. LPCSTR lpValueName,
  883. LPDWORD lpReserved,
  884. LPDWORD lpType,
  885. LPBYTE lpData,
  886. LPDWORD lpcbData
  887. )
  888. {
  889. CLock cLock(g_csCritSec);
  890. return RRegistry.QueryValueExA(
  891. hKey,
  892. lpValueName,
  893. lpReserved,
  894. lpType,
  895. lpData,
  896. lpcbData);
  897. }
  898. LONG
  899. APIHOOK(RegQueryValueExW)(
  900. HKEY hKey,
  901. LPCWSTR lpValueName,
  902. LPDWORD lpReserved,
  903. LPDWORD lpType,
  904. LPBYTE lpData,
  905. LPDWORD lpcbData
  906. )
  907. {
  908. CLock cLock(g_csCritSec);
  909. return RRegistry.QueryValueExW(
  910. hKey,
  911. lpValueName,
  912. lpReserved,
  913. lpType,
  914. lpData,
  915. lpcbData);
  916. }
  917. LONG
  918. APIHOOK(RegQueryInfoKeyA)(
  919. HKEY hKey,
  920. LPSTR lpClass,
  921. LPDWORD lpcbClass,
  922. LPDWORD lpReserved,
  923. LPDWORD lpcSubKeys,
  924. LPDWORD lpcbMaxSubKeyLen,
  925. LPDWORD lpcbMaxClassLen,
  926. LPDWORD lpcValues,
  927. LPDWORD lpcbMaxValueNameLen,
  928. LPDWORD lpcbMaxValueLen,
  929. LPDWORD lpcbSecurityDescriptor,
  930. PFILETIME lpftLastWriteTime
  931. )
  932. {
  933. CLock cLock(g_csCritSec);
  934. return RRegistry.QueryInfoKeyA(
  935. hKey,
  936. lpClass,
  937. lpcbClass,
  938. lpReserved,
  939. lpcSubKeys,
  940. lpcbMaxSubKeyLen,
  941. lpcbMaxClassLen,
  942. lpcValues,
  943. lpcbMaxValueNameLen,
  944. lpcbMaxValueLen,
  945. lpcbSecurityDescriptor,
  946. lpftLastWriteTime);
  947. }
  948. LONG
  949. APIHOOK(RegQueryInfoKeyW)(
  950. HKEY hKey,
  951. LPWSTR lpClass,
  952. LPDWORD lpcbClass,
  953. LPDWORD lpReserved,
  954. LPDWORD lpcSubKeys,
  955. LPDWORD lpcbMaxSubKeyLen,
  956. LPDWORD lpcbMaxClassLen,
  957. LPDWORD lpcValues,
  958. LPDWORD lpcbMaxValueNameLen,
  959. LPDWORD lpcbMaxValueLen,
  960. LPDWORD lpcbSecurityDescriptor,
  961. PFILETIME lpftLastWriteTime
  962. )
  963. {
  964. CLock cLock(g_csCritSec);
  965. return RRegistry.QueryInfoKeyW(
  966. hKey,
  967. lpClass,
  968. lpcbClass,
  969. lpReserved,
  970. lpcSubKeys,
  971. lpcbMaxSubKeyLen,
  972. lpcbMaxClassLen,
  973. lpcValues,
  974. lpcbMaxValueNameLen,
  975. lpcbMaxValueLen,
  976. lpcbSecurityDescriptor,
  977. lpftLastWriteTime);
  978. }
  979. LONG
  980. APIHOOK(RegSetValueA)(
  981. HKEY hKey,
  982. LPCSTR lpSubKey,
  983. DWORD dwType,
  984. LPCSTR lpData,
  985. DWORD cbData
  986. )
  987. {
  988. CLock cLock(g_csCritSec);
  989. return RRegistry.SetValueA(
  990. hKey,
  991. lpSubKey,
  992. dwType,
  993. lpData,
  994. cbData);
  995. }
  996. LONG
  997. APIHOOK(RegSetValueW)(
  998. HKEY hKey,
  999. LPCWSTR lpSubKey,
  1000. DWORD dwType,
  1001. LPCWSTR lpData,
  1002. DWORD cbData
  1003. )
  1004. {
  1005. CLock cLock(g_csCritSec);
  1006. return RRegistry.SetValueW(
  1007. hKey,
  1008. lpSubKey,
  1009. dwType,
  1010. lpData,
  1011. cbData);
  1012. }
  1013. LONG
  1014. APIHOOK(RegSetValueExA)(
  1015. HKEY hKey,
  1016. LPCSTR lpSubKey,
  1017. DWORD Reserved,
  1018. DWORD dwType,
  1019. CONST BYTE * lpData,
  1020. DWORD cbData
  1021. )
  1022. {
  1023. CLock cLock(g_csCritSec);
  1024. return RRegistry.SetValueExA(
  1025. hKey,
  1026. lpSubKey,
  1027. Reserved,
  1028. dwType,
  1029. lpData,
  1030. cbData);
  1031. }
  1032. LONG
  1033. APIHOOK(RegSetValueExW)(
  1034. HKEY hKey,
  1035. LPCWSTR lpSubKey,
  1036. DWORD Reserved,
  1037. DWORD dwType,
  1038. CONST BYTE * lpData,
  1039. DWORD cbData
  1040. )
  1041. {
  1042. CLock cLock(g_csCritSec);
  1043. return RRegistry.SetValueExW(
  1044. hKey,
  1045. lpSubKey,
  1046. Reserved,
  1047. dwType,
  1048. lpData,
  1049. cbData);
  1050. }
  1051. LONG
  1052. APIHOOK(RegEnumValueA)(
  1053. HKEY hKey,
  1054. DWORD dwIndex,
  1055. LPSTR lpValueName,
  1056. LPDWORD lpcbValueName,
  1057. LPDWORD lpReserved,
  1058. LPDWORD lpType,
  1059. LPBYTE lpData,
  1060. LPDWORD lpcbData
  1061. )
  1062. {
  1063. CLock cLock(g_csCritSec);
  1064. return RRegistry.EnumValueA(
  1065. hKey,
  1066. dwIndex,
  1067. lpValueName,
  1068. lpcbValueName,
  1069. lpReserved,
  1070. lpType,
  1071. lpData,
  1072. lpcbData);
  1073. }
  1074. LONG
  1075. APIHOOK(RegEnumValueW)(
  1076. HKEY hKey,
  1077. DWORD dwIndex,
  1078. LPWSTR lpValueName,
  1079. LPDWORD lpcbValueName,
  1080. LPDWORD lpReserved,
  1081. LPDWORD lpType,
  1082. LPBYTE lpData,
  1083. LPDWORD lpcbData
  1084. )
  1085. {
  1086. CLock cLock(g_csCritSec);
  1087. return RRegistry.EnumValueW(
  1088. hKey,
  1089. dwIndex,
  1090. lpValueName,
  1091. lpcbValueName,
  1092. lpReserved,
  1093. lpType,
  1094. lpData,
  1095. lpcbData);
  1096. }
  1097. LONG
  1098. APIHOOK(RegEnumKeyA)(
  1099. HKEY hKey,
  1100. DWORD dwIndex,
  1101. LPSTR lpName,
  1102. DWORD cbName
  1103. )
  1104. {
  1105. CLock cLock(g_csCritSec);
  1106. return RRegistry.EnumKeyExA(
  1107. hKey,
  1108. dwIndex,
  1109. lpName,
  1110. &cbName,
  1111. NULL,
  1112. NULL,
  1113. NULL,
  1114. NULL); // can this be null???
  1115. }
  1116. LONG
  1117. APIHOOK(RegEnumKeyW)(
  1118. HKEY hKey,
  1119. DWORD dwIndex,
  1120. LPWSTR lpName,
  1121. DWORD cbName
  1122. )
  1123. {
  1124. CLock cLock(g_csCritSec);
  1125. return RRegistry.EnumKeyExW(
  1126. hKey,
  1127. dwIndex,
  1128. lpName,
  1129. &cbName,
  1130. NULL,
  1131. NULL,
  1132. NULL,
  1133. NULL);
  1134. }
  1135. LONG
  1136. APIHOOK(RegEnumKeyExA)(
  1137. HKEY hKey,
  1138. DWORD dwIndex,
  1139. LPSTR lpName,
  1140. LPDWORD lpcbName,
  1141. LPDWORD lpReserved,
  1142. LPSTR lpClass,
  1143. LPDWORD lpcbClass,
  1144. PFILETIME lpftLastWriteTime
  1145. )
  1146. {
  1147. CLock cLock(g_csCritSec);
  1148. return RRegistry.EnumKeyExA(
  1149. hKey,
  1150. dwIndex,
  1151. lpName,
  1152. lpcbName,
  1153. lpReserved,
  1154. lpClass,
  1155. lpcbClass,
  1156. lpftLastWriteTime);
  1157. }
  1158. LONG
  1159. APIHOOK(RegEnumKeyExW)(
  1160. HKEY hKey,
  1161. DWORD dwIndex,
  1162. LPWSTR lpName,
  1163. LPDWORD lpcbName,
  1164. LPDWORD lpReserved,
  1165. LPWSTR lpClass,
  1166. LPDWORD lpcbClass,
  1167. PFILETIME lpftLastWriteTime
  1168. )
  1169. {
  1170. CLock cLock(g_csCritSec);
  1171. return RRegistry.EnumKeyExW(
  1172. hKey,
  1173. dwIndex,
  1174. lpName,
  1175. lpcbName,
  1176. lpReserved,
  1177. lpClass,
  1178. lpcbClass,
  1179. lpftLastWriteTime);
  1180. }
  1181. LONG
  1182. APIHOOK(RegCloseKey)(HKEY hKey)
  1183. {
  1184. CLock cLock(g_csCritSec);
  1185. return RRegistry.CloseKey(hKey);
  1186. }
  1187. LONG
  1188. APIHOOK(RegDeleteKeyA)(
  1189. HKEY hKey,
  1190. LPCSTR lpSubKey
  1191. )
  1192. {
  1193. CLock cLock(g_csCritSec);
  1194. return RRegistry.DeleteKeyA(hKey, lpSubKey);
  1195. }
  1196. LONG
  1197. APIHOOK(RegDeleteKeyW)(
  1198. HKEY hKey,
  1199. LPCWSTR lpSubKey
  1200. )
  1201. {
  1202. CLock cLock(g_csCritSec);
  1203. return RRegistry.DeleteKeyW(hKey, lpSubKey);
  1204. }
  1205. SHIM_INFO_BEGIN()
  1206. SHIM_INFO_DESCRIPTION(AVS_REGISTRYCHECKS_DESC)
  1207. SHIM_INFO_FRIENDLY_NAME(AVS_REGISTRYCHECKS_FRIENDLY)
  1208. SHIM_INFO_VERSION(1, 3)
  1209. SHIM_INFO_FLAGS(AVRF_FLAG_EXTERNAL_ONLY)
  1210. SHIM_INFO_INCLUDE_EXCLUDE("E:msi.dll sxs.dll comctl32.dll ole32.dll oleaut32.dll")
  1211. SHIM_INFO_END()
  1212. /*++
  1213. Register hooked functions
  1214. Note we purposely ignore the cleanup because some apps call registry functions
  1215. during process detach.
  1216. --*/
  1217. HOOK_BEGIN
  1218. DUMP_VERIFIER_LOG_ENTRY(VLOG_HKCU_Console_READ,
  1219. AVS_HKCU_Console_READ,
  1220. AVS_HKCU_Console_READ_R,
  1221. AVS_HKCU_Console_READ_URL)
  1222. DUMP_VERIFIER_LOG_ENTRY(VLOG_HKCU_ControlPanel_READ,
  1223. AVS_HKCU_ControlPanel_READ,
  1224. AVS_HKCU_ControlPanel_READ_R,
  1225. AVS_HKCU_ControlPanel_READ_URL)
  1226. DUMP_VERIFIER_LOG_ENTRY(VLOG_HKCU_Environment_READ,
  1227. AVS_HKCU_Environment_READ,
  1228. AVS_HKCU_Environment_READ_R,
  1229. AVS_HKCU_Environment_READ_URL)
  1230. DUMP_VERIFIER_LOG_ENTRY(VLOG_HKCU_Identities_READ,
  1231. AVS_HKCU_Identities_READ,
  1232. AVS_HKCU_Identities_READ_R,
  1233. AVS_HKCU_Identities_READ_URL)
  1234. DUMP_VERIFIER_LOG_ENTRY(VLOG_HKCU_KeyboardLayout_READ,
  1235. AVS_HKCU_KeyboardLayout_READ,
  1236. AVS_HKCU_KeyboardLayout_READ_R,
  1237. AVS_HKCU_KeyboardLayout_READ_URL)
  1238. DUMP_VERIFIER_LOG_ENTRY(VLOG_HKCU_Printers_READ,
  1239. AVS_HKCU_Printers_READ,
  1240. AVS_HKCU_Printers_READ_R,
  1241. AVS_HKCU_Printers_READ_URL)
  1242. DUMP_VERIFIER_LOG_ENTRY(VLOG_HKCU_RemoteAccess_READ,
  1243. AVS_HKCU_RemoteAccess_READ,
  1244. AVS_HKCU_RemoteAccess_READ_R,
  1245. AVS_HKCU_RemoteAccess_READ_URL)
  1246. DUMP_VERIFIER_LOG_ENTRY(VLOG_HKCU_SessionInformation_READ,
  1247. AVS_HKCU_SessionInformation_READ,
  1248. AVS_HKCU_SessionInformation_READ_R,
  1249. AVS_HKCU_SessionInformation_READ_URL)
  1250. DUMP_VERIFIER_LOG_ENTRY(VLOG_HKCU_UNICODEProgramGroups_READ,
  1251. AVS_HKCU_UNICODEProgramGroups_READ,
  1252. AVS_HKCU_UNICODEProgramGroups_READ_R,
  1253. AVS_HKCU_UNICODEProgramGroups_READ_URL)
  1254. DUMP_VERIFIER_LOG_ENTRY(VLOG_HKCU_VolatileEnvironment_READ,
  1255. AVS_HKCU_VolatileEnvironment_READ,
  1256. AVS_HKCU_VolatileEnvironment_READ_R,
  1257. AVS_HKCU_VolatileEnvironment_READ_URL)
  1258. DUMP_VERIFIER_LOG_ENTRY(VLOG_HKCU_Windows31MigrationStatus_READ,
  1259. AVS_HKCU_Windows31MigrationStatus_READ,
  1260. AVS_HKCU_Windows31MigrationStatus_READ_R,
  1261. AVS_HKCU_Windows31MigrationStatus_READ_URL)
  1262. DUMP_VERIFIER_LOG_ENTRY(VLOG_HKLM_HARDWARE_READ,
  1263. AVS_HKLM_HARDWARE_READ,
  1264. AVS_HKLM_HARDWARE_READ_R,
  1265. AVS_HKLM_HARDWARE_READ_URL)
  1266. DUMP_VERIFIER_LOG_ENTRY(VLOG_HKLM_SAM_READ,
  1267. AVS_HKLM_SAM_READ,
  1268. AVS_HKLM_SAM_READ_R,
  1269. AVS_HKLM_SAM_READ_URL)
  1270. DUMP_VERIFIER_LOG_ENTRY(VLOG_HKLM_SECURITY_READ,
  1271. AVS_HKLM_SECURITY_READ,
  1272. AVS_HKLM_SECURITY_READ_R,
  1273. AVS_HKLM_SECURITY_READ_URL)
  1274. DUMP_VERIFIER_LOG_ENTRY(VLOG_HKLM_SYSTEM_READ,
  1275. AVS_HKLM_SYSTEM_READ,
  1276. AVS_HKLM_SYSTEM_READ_R,
  1277. AVS_HKLM_SYSTEM_READ_URL)
  1278. DUMP_VERIFIER_LOG_ENTRY(VLOG_HKCC_READ,
  1279. AVS_HKCC_READ,
  1280. AVS_HKCC_READ_R,
  1281. AVS_HKCC_READ_URL)
  1282. DUMP_VERIFIER_LOG_ENTRY(VLOG_HKUS_READ,
  1283. AVS_HKUS_READ,
  1284. AVS_HKUS_READ_R,
  1285. AVS_HKUS_READ_URL)
  1286. DUMP_VERIFIER_LOG_ENTRY(VLOG_NON_HKCU_WRITE,
  1287. AVS_NON_HKCU_WRITE,
  1288. AVS_NON_HKCU_WRITE_R,
  1289. AVS_NON_HKCU_WRITE_URL)
  1290. APIHOOK_ENTRY(ADVAPI32.DLL, RegOpenKeyA)
  1291. APIHOOK_ENTRY(ADVAPI32.DLL, RegOpenKeyW)
  1292. APIHOOK_ENTRY(ADVAPI32.DLL, RegOpenKeyExA)
  1293. APIHOOK_ENTRY(ADVAPI32.DLL, RegOpenKeyExW)
  1294. APIHOOK_ENTRY(ADVAPI32.DLL, RegCreateKeyA)
  1295. APIHOOK_ENTRY(ADVAPI32.DLL, RegCreateKeyW)
  1296. APIHOOK_ENTRY(ADVAPI32.DLL, RegCreateKeyExA)
  1297. APIHOOK_ENTRY(ADVAPI32.DLL, RegCreateKeyExW)
  1298. APIHOOK_ENTRY(ADVAPI32.DLL, RegCloseKey)
  1299. APIHOOK_ENTRY(ADVAPI32.DLL, RegQueryValueA)
  1300. APIHOOK_ENTRY(ADVAPI32.DLL, RegQueryValueW)
  1301. APIHOOK_ENTRY(ADVAPI32.DLL, RegQueryValueExA)
  1302. APIHOOK_ENTRY(ADVAPI32.DLL, RegQueryValueExW)
  1303. APIHOOK_ENTRY(ADVAPI32.DLL, RegQueryInfoKeyA)
  1304. APIHOOK_ENTRY(ADVAPI32.DLL, RegQueryInfoKeyW)
  1305. APIHOOK_ENTRY(ADVAPI32.DLL, RegSetValueA)
  1306. APIHOOK_ENTRY(ADVAPI32.DLL, RegSetValueW)
  1307. APIHOOK_ENTRY(ADVAPI32.DLL, RegSetValueExA)
  1308. APIHOOK_ENTRY(ADVAPI32.DLL, RegSetValueExW)
  1309. APIHOOK_ENTRY(ADVAPI32.DLL, RegEnumValueA)
  1310. APIHOOK_ENTRY(ADVAPI32.DLL, RegEnumValueW)
  1311. APIHOOK_ENTRY(ADVAPI32.DLL, RegEnumKeyA)
  1312. APIHOOK_ENTRY(ADVAPI32.DLL, RegEnumKeyW)
  1313. APIHOOK_ENTRY(ADVAPI32.DLL, RegEnumKeyExA)
  1314. APIHOOK_ENTRY(ADVAPI32.DLL, RegEnumKeyExW)
  1315. APIHOOK_ENTRY(ADVAPI32.DLL, RegDeleteKeyA)
  1316. APIHOOK_ENTRY(ADVAPI32.DLL, RegDeleteKeyW)
  1317. HOOK_END
  1318. IMPLEMENT_SHIM_END