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

Issue 977003003: win: Add implementation of ProcessInfo (Closed)

Created:
5 years, 9 months ago by scottmg
Modified:
5 years, 9 months ago
Reviewers:
Mark Mentovai
CC:
crashpad-dev_chromium.org
Base URL:
https://chromium.googlesource.com/crashpad/crashpad@master
Target Ref:
refs/heads/master
Project:
crashpad
Visibility:
Public.

Description

win: Add implementation of ProcessInfo This is as a precursor to ProcessReader. Some basic functionality is included for now, with more to be added later as necessary. The PEB code is pretty icky -- walking the doubly-linked list in the target's address space is cumbersome. The alternative is to use EnumProcessModules. That would work but: 1) needs different APIs for XP and Vista 64+ 2) retrieves modules in memory-location order, rather than initialization order. I felt retrieving them in initialization order might be useful when detecting third party DLL injections. In the end, we may want to make both orders available. R=mark@chromium.org BUG=crashpad:1 Committed: https://chromium.googlesource.com/crashpad/crashpad/+/bed7a543c058b29bae1f24ab49799ff3d7198c73

Patch Set 1 #

Patch Set 2 : . #

Patch Set 3 : . #

Total comments: 75

Patch Set 4 : fixes #

Total comments: 25

Patch Set 5 : fixes2 #

Total comments: 6

Patch Set 6 : fixes3 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+599 lines, -0 lines) Patch
M util/util.gyp View 1 2 3 4 5 4 chunks +34 lines, -0 lines 0 comments Download
A util/win/process_info.h View 1 2 3 4 5 1 chunk +99 lines, -0 lines 0 comments Download
A util/win/process_info.cc View 1 2 3 4 1 chunk +287 lines, -0 lines 0 comments Download
A util/win/process_info_test.cc View 1 2 3 4 5 1 chunk +134 lines, -0 lines 0 comments Download
A util/win/process_info_test_child.cc View 1 2 3 4 1 chunk +45 lines, -0 lines 0 comments Download

Messages

Total messages: 13 (3 generated)
scottmg
5 years, 9 months ago (2015-03-04 19:28:52 UTC) #3
Mark Mentovai
This is way less icky than your message led me to believe. https://codereview.chromium.org/977003003/diff/80001/util/win/process_info.cc File util/win/process_info.cc ...
5 years, 9 months ago (2015-03-05 17:32:24 UTC) #4
scottmg
Thanks! https://codereview.chromium.org/977003003/diff/80001/util/win/process_info.cc File util/win/process_info.cc (right): https://codereview.chromium.org/977003003/diff/80001/util/win/process_info.cc#newcode21 util/win/process_info.cc:21: std::wstring ReadUnicodeString(HANDLE process, const UNICODE_STRING& us) { On ...
5 years, 9 months ago (2015-03-05 20:31:08 UTC) #6
Mark Mentovai
https://codereview.chromium.org/977003003/diff/80001/util/win/process_info.h File util/win/process_info.h (right): https://codereview.chromium.org/977003003/diff/80001/util/win/process_info.h#newcode48 util/win/process_info.h:48: bool IsWow64() const; scottmg wrote: > On 2015/03/05 17:32:23, ...
5 years, 9 months ago (2015-03-05 21:53:37 UTC) #7
scottmg
https://codereview.chromium.org/977003003/diff/80001/util/win/process_info.h File util/win/process_info.h (right): https://codereview.chromium.org/977003003/diff/80001/util/win/process_info.h#newcode63 util/win/process_info.h:63: //! Process Environment Block. On 2015/03/05 21:53:36, Mark Mentovai ...
5 years, 9 months ago (2015-03-06 00:42:52 UTC) #8
Mark Mentovai
Nice, LGTM. https://codereview.chromium.org/977003003/diff/140001/util/win/process_info.cc File util/win/process_info.cc (right): https://codereview.chromium.org/977003003/diff/140001/util/win/process_info.cc#newcode203 util/win/process_info.cc:203: // Include the first module in the ...
5 years, 9 months ago (2015-03-06 03:40:24 UTC) #9
scottmg
https://codereview.chromium.org/977003003/diff/140001/util/win/process_info.cc File util/win/process_info.cc (right): https://codereview.chromium.org/977003003/diff/140001/util/win/process_info.cc#newcode203 util/win/process_info.cc:203: // Include the first module in the memory order ...
5 years, 9 months ago (2015-03-06 06:04:08 UTC) #10
scottmg
Committed patchset #6 (id:160001) manually as bed7a543c058b29bae1f24ab49799ff3d7198c73 (presubmit successful).
5 years, 9 months ago (2015-03-06 06:07:44 UTC) #11
Mark Mentovai
This is a huge step forward! The following is just a small post-facto thought. https://codereview.chromium.org/977003003/diff/80001/util/win/process_info.h ...
5 years, 9 months ago (2015-03-06 14:33:30 UTC) #12
scottmg
5 years, 9 months ago (2015-03-06 17:49:38 UTC) #13
Message was sent while issue was closed.
On 2015/03/06 14:33:30, Mark Mentovai wrote:
> This is a huge step forward!
> 
> The following is just a small post-facto thought.
> 
> https://codereview.chromium.org/977003003/diff/80001/util/win/process_info.h
> File util/win/process_info.h (right):
> 
>
https://codereview.chromium.org/977003003/diff/80001/util/win/process_info.h#...
> util/win/process_info.h:63: //!     Process Environment Block.
> scottmg wrote:
> > Unfortunately, one drawback of InitializationOrder is that the main
executable
> > doesn't appear in the list. In MemoryOrder it would always be at index 0.
> 
> Since this is kind of quirky, I was thinking that we should test that the main
> executable really doesn’t show up in the list twice. An easy way to do this is
> to remember its load address from the first module in the memory-order list
and
> then check that each module in the initialization-order list doesn’t match the
> main executable’s load address. That should be faster and more robust than
> filename comparisons or anything else, but since you’re not tracking load
> addresses yet, maybe it can wait for that.

Sounds good. I'm going to switch to x64, then get back at the snapshot level.
Once ProcessInfo gathers more module information I'll bulk up the tests.

Powered by Google App Engine
This is Rietveld 408576698