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

Unified Diff: util/win/process_info_test_child.cc

Issue 1369833002: win: Gather memory information (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@save-peb-stuff
Patch Set: . Created 5 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
« no previous file with comments | « util/win/process_info_test.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: util/win/process_info_test_child.cc
diff --git a/util/win/process_info_test_child.cc b/util/win/process_info_test_child.cc
index a0cf5c403a5f2f3963f4a4f2a87d50a54eaeb33e..c587f5b852de80a609f51cbdec10663321ddca79 100644
--- a/util/win/process_info_test_child.cc
+++ b/util/win/process_info_test_child.cc
@@ -12,19 +12,20 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+#include <intrin.h>
#include <stdlib.h>
+#include <stdint.h>
#include <wchar.h>
#include <windows.h>
// A simple binary to be loaded and inspected by ProcessInfo.
int wmain(int argc, wchar_t** argv) {
- if (argc != 3)
+ if (argc != 2)
abort();
- // Get handles to the events we use to communicate with our parent.
- HANDLE started_event = CreateEvent(nullptr, true, false, argv[1]);
- HANDLE done_event = CreateEvent(nullptr, true, false, argv[2]);
- if (!started_event || !done_event)
+ // Get a handle to the event we use to communicate with our parent.
+ HANDLE done_event = CreateEvent(nullptr, true, false, argv[1]);
+ if (!done_event)
abort();
// Load an unusual module (that we don't depend upon) so we can do an
@@ -32,14 +33,22 @@ int wmain(int argc, wchar_t** argv) {
if (!LoadLibrary(L"lz32.dll"))
abort();
- if (!SetEvent(started_event))
+ HANDLE out = GetStdHandle(STD_OUTPUT_HANDLE);
+ if (out == INVALID_HANDLE_VALUE)
abort();
+ // We just want any valid address that's known to be code.
+ uint64_t code_address = reinterpret_cast<uint64_t>(_ReturnAddress());
+ DWORD bytes_written;
+ if (!WriteFile(
+ out, &code_address, sizeof(code_address), &bytes_written, nullptr) ||
+ bytes_written != sizeof(code_address)) {
+ abort();
+ }
if (WaitForSingleObject(done_event, INFINITE) != WAIT_OBJECT_0)
abort();
CloseHandle(done_event);
- CloseHandle(started_event);
return EXIT_SUCCESS;
}
« no previous file with comments | « util/win/process_info_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698