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

Issue 2963783002: Remove unsafe registry APIs from base::win::RegKey

Created:
3 years, 5 months ago by Will Harris
Modified:
3 years, 5 months ago
Reviewers:
grt (UTC plus 2)
CC:
chromium-reviews, derat+watch_chromium.org, vmpstr+watch_chromium.org, grt+watch_chromium.org, pennymac+watch_chromium.org, wfh+watch_chromium.org, danakj+watch_chromium.org
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Remove unsafe registry APIs from base::win::RegKey Clean up any callers hitting new DCHECKs. BUG=375400

Patch Set 1 #

Patch Set 2 : half-fix remoting #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+50 lines, -32 lines) Patch
M base/win/registry.h View 1 2 chunks +4 lines, -7 lines 0 comments Download
M base/win/registry.cc View 1 13 chunks +30 lines, -16 lines 1 comment Download
M chrome/common/chrome_paths.cc View 1 chunk +2 lines, -0 lines 1 comment Download
M chrome/installer/util/shell_util.cc View 2 chunks +5 lines, -4 lines 0 comments Download
M remoting/host/daemon_process_win.cc View 1 2 chunks +7 lines, -3 lines 0 comments Download
M ui/gfx/font_render_params_win.cc View 1 chunk +2 lines, -2 lines 0 comments Download

Messages

Total messages: 4 (2 generated)
Will Harris
WIP this doesn't work yet. Because remoting is using RegKey::Set and RegKey::Take() all over the ...
3 years, 5 months ago (2017-06-28 15:50:14 UTC) #3
grt (UTC plus 2)
3 years, 5 months ago (2017-06-29 08:49:47 UTC) #4
i've been wanting RegKey to be a movable type for some time. if you have the
time/patience for it, i think it would be awesome to make RegKey more like File.
i think this would be a big enough undertaking that it should be planned and
executed in stages. what do you think, do you have time for it? if not, some
small changes to make it more safe are welcome.

as for pairing_registry_delegate_win, would it help to introduce:

// Returns a new instance with a distinct handle to the same key as |this|.
RegKey RegKey::Duplicate() {
}

if Duplicate were to take a REGSAM, it could use RegOpenKeyEx rather than
DuplicateHandle. i'm not sure if one way is better than the other for any
reason.

fwiw, looks like me2me_native_messaging_host_main.cc is leaking handles when it
calls SetRootKeys. is that what you're trying to fix once and for all with this
change?

https://codereview.chromium.org/2963783002/diff/20001/base/win/registry.cc
File base/win/registry.cc (right):

https://codereview.chromium.org/2963783002/diff/20001/base/win/registry.cc#ne...
base/win/registry.cc:158: DCHECK(key_);
i'm not sure about this. when you don't care about error handling, it's nice to
be able to open a key and try to operate on it. if the open fails, so does
everything else. does RegCreateKeyEx return a reasonable result if key_ is 0?

https://codereview.chromium.org/2963783002/diff/20001/chrome/common/chrome_pa...
File chrome/common/chrome_paths.cc (right):

https://codereview.chromium.org/2963783002/diff/20001/chrome/common/chrome_pa...
chrome/common/chrome_paths.cc:127: if
(FAILED(path_key.ReadValue(kFlashPlayerPathValueName, &path_str)))
ugh, FAILED is wrong

Powered by Google App Engine
This is Rietveld 408576698