Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3974)

Unified Diff: chrome_elf/nt_registry/nt_registry.h

Issue 2345913003: [chrome_elf] NTRegistry - added wow64 redirection support. (Closed)
Patch Set: Code review fixes, part 2. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome_elf/nt_registry/nt_registry.h
diff --git a/chrome_elf/nt_registry/nt_registry.h b/chrome_elf/nt_registry/nt_registry.h
index 0451fc536ec4fe4c266ccbb88b05f91f8f4c8104..3872b50bd2ec13fbac8f2696b000fdee420b6646 100644
--- a/chrome_elf/nt_registry/nt_registry.h
+++ b/chrome_elf/nt_registry/nt_registry.h
@@ -38,6 +38,18 @@ extern wchar_t HKCU_override[];
// Use HKLM or HKCU to override.
typedef enum _ROOT_KEY { AUTO = 0, HKLM, HKCU } ROOT_KEY;
robertshield 2016/09/28 23:49:23 thoughts re: AUTO: it seems to be used in only onc
penny 2016/10/01 01:44:25 Wow. Way to swoop in with the profound thinking R
robertshield 2016/10/04 05:22:09 Ok. My line of reasoning was based on separation o
penny 2016/10/04 17:55:53 Thank you! I hear you.
+// Used with wrapper functions to request registry redirection override.
+// Maps to KEY_WOW64_32KEY and KEY_WOW64_64KEY access flags.
+enum WOW64_OVERRIDE {
+ NONE = 0L,
+ WOW6432 = KEY_WOW64_32KEY,
+ WOW6464 = KEY_WOW64_64KEY
+};
+
+//------------------------------------------------------------------------------
+// Create, open, delete, close functions
+//------------------------------------------------------------------------------
+
// Create and/or open a registry key.
// - This function will recursively create multiple sub-keys if required for
// |key_path|.
@@ -66,7 +78,10 @@ bool DeleteRegKey(HANDLE key);
// Delete a registry key.
// - WRAPPER: Function opens and closes the target key for caller.
-bool DeleteRegKey(ROOT_KEY root, const wchar_t* key_path);
+// - Use |wow64_override| to force redirection behaviour, or pass 0/nt::NONE.
+bool DeleteRegKey(ROOT_KEY root,
+ WOW64_OVERRIDE wow64_override,
+ const wchar_t* key_path);
// Close a registry key handle that was opened with CreateRegKey or OpenRegKey.
void CloseRegKey(HANDLE key);
@@ -96,7 +111,9 @@ bool QueryRegValueDWORD(HANDLE key,
// Query DWORD value.
// - WRAPPER: Function opens and closes the target key for caller, and works
// with DWORD data type.
+// - Use |wow64_override| to force redirection behaviour, or pass 0/nt::NONE.
robertshield 2016/09/28 23:49:23 nit: figure we should express a stronger opinion t
grt (UTC plus 2) 2016/09/29 10:30:22 yes, please
penny 2016/10/01 01:44:25 Done.
bool QueryRegValueDWORD(ROOT_KEY root,
+ WOW64_OVERRIDE wow64_override,
const wchar_t* key_path,
const wchar_t* value_name,
DWORD* out_dword);
@@ -112,7 +129,9 @@ bool QueryRegValueSZ(HANDLE key,
// Query SZ (string) value.
// - WRAPPER: Function opens and closes the target key for caller, and works
// with SZ data type.
+// - Use |wow64_override| to force redirection behaviour, or pass 0/nt::NONE.
bool QueryRegValueSZ(ROOT_KEY root,
+ WOW64_OVERRIDE wow64_override,
const wchar_t* key_path,
const wchar_t* value_name,
std::wstring* out_sz);
@@ -128,7 +147,9 @@ bool QueryRegValueMULTISZ(HANDLE key,
// Query MULTI_SZ (multiple strings) value.
// - WRAPPER: Function opens and closes the target key for caller, and works
// with MULTI_SZ data type.
+// - Use |wow64_override| to force redirection behaviour, or pass 0/nt::NONE.
bool QueryRegValueMULTISZ(ROOT_KEY root,
+ WOW64_OVERRIDE wow64_override,
const wchar_t* key_path,
const wchar_t* value_name,
std::vector<std::wstring>* out_multi_sz);
@@ -155,7 +176,9 @@ bool SetRegValueDWORD(HANDLE key, const wchar_t* value_name, DWORD value);
// Set DWORD value.
// - WRAPPER: Function opens and closes the target key for caller, and works
// with DWORD data type.
+// - Use |wow64_override| to force redirection behaviour, or pass 0/nt::NONE.
bool SetRegValueDWORD(ROOT_KEY root,
+ WOW64_OVERRIDE wow64_override,
const wchar_t* key_path,
const wchar_t* value_name,
DWORD value);
@@ -171,7 +194,9 @@ bool SetRegValueSZ(HANDLE key,
// Set SZ (string) value.
// - WRAPPER: Function opens and closes the target key for caller, and works
// with SZ data type.
+// - Use |wow64_override| to force redirection behaviour, or pass 0/nt::NONE.
bool SetRegValueSZ(ROOT_KEY root,
+ WOW64_OVERRIDE wow64_override,
const wchar_t* key_path,
const wchar_t* value_name,
const std::wstring& value);
@@ -187,7 +212,9 @@ bool SetRegValueMULTISZ(HANDLE key,
// Set MULTI_SZ (multiple strings) value.
// - WRAPPER: Function opens and closes the target key for caller, and works
// with MULTI_SZ data type.
+// - Use |wow64_override| to force redirection behaviour, or pass 0/nt::NONE.
bool SetRegValueMULTISZ(ROOT_KEY root,
+ WOW64_OVERRIDE wow64_override,
const wchar_t* key_path,
const wchar_t* value_name,
const std::vector<std::wstring>& values);

Powered by Google App Engine
This is Rietveld 408576698