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

Unified Diff: remoting/host/daemon_process_win.cc

Issue 2963783002: Remove unsafe registry APIs from base::win::RegKey
Patch Set: half-fix remoting Created 3 years, 6 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: remoting/host/daemon_process_win.cc
diff --git a/remoting/host/daemon_process_win.cc b/remoting/host/daemon_process_win.cc
index ee6a99ae4f7c970f6c04a48bd1943658fd6cd097..0e6e2bf89c6150738b4a36f0552558956ff6b2f7 100644
--- a/remoting/host/daemon_process_win.cc
+++ b/remoting/host/daemon_process_win.cc
@@ -363,7 +363,11 @@ bool DaemonProcessWin::OpenPairingRegistry() {
result = ::RegCreateKeyEx(
root.Handle(), kPairingRegistrySecretsKeyName, 0, nullptr, 0,
KEY_READ | KEY_WRITE, &security_attributes, &key, &disposition);
- privileged.Set(key);
+ if (result == ERROR_SUCCESS) {
+ RegCloseKey(key);
+ privileged.Open(root.Handle(), kPairingRegistrySecretsKeyName,
+ KEY_READ | KEY_WRITE);
+ }
}
if (result != ERROR_SUCCESS) {
@@ -373,8 +377,8 @@ bool DaemonProcessWin::OpenPairingRegistry() {
return false;
}
- pairing_registry_privileged_key_.Set(privileged.Take());
- pairing_registry_unprivileged_key_.Set(unprivileged.Take());
+ pairing_registry_privileged_key_ = std::move(privileged);
+ pairing_registry_unprivileged_key_ = std::move(unprivileged);
return true;
}

Powered by Google App Engine
This is Rietveld 408576698