OLD | NEW |
1 // Copyright 2015 The Crashpad Authors. All rights reserved. | 1 // Copyright 2015 The Crashpad Authors. All rights reserved. |
2 // | 2 // |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
6 // | 6 // |
7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
8 // | 8 // |
9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
(...skipping 21 matching lines...) Expand all Loading... |
32 if (argc != 2) { | 32 if (argc != 2) { |
33 fprintf(stderr, "Usage: %ls <server_pipe_name>\n", argv[0]); | 33 fprintf(stderr, "Usage: %ls <server_pipe_name>\n", argv[0]); |
34 return EXIT_FAILURE; | 34 return EXIT_FAILURE; |
35 } | 35 } |
36 | 36 |
37 CrashpadClient client; | 37 CrashpadClient client; |
38 if (!client.SetHandlerIPCPipe(argv[1])) { | 38 if (!client.SetHandlerIPCPipe(argv[1])) { |
39 LOG(ERROR) << "SetHandler"; | 39 LOG(ERROR) << "SetHandler"; |
40 return EXIT_FAILURE; | 40 return EXIT_FAILURE; |
41 } | 41 } |
42 if (!client.UseHandler()) { | |
43 LOG(ERROR) << "UseHandler"; | |
44 return EXIT_FAILURE; | |
45 } | |
46 | 42 |
47 // The DLL has /Z7 symbols embedded in the binary (rather than in a .pdb). | 43 // The DLL has /Z7 symbols embedded in the binary (rather than in a .pdb). |
48 // There's only an x86 version of this dll as newer x64 toolchains can't | 44 // There's only an x86 version of this dll as newer x64 toolchains can't |
49 // generate this format any more. | 45 // generate this format any more. |
50 base::FilePath z7_path = test::Paths::TestDataRoot().Append( | 46 base::FilePath z7_path = test::Paths::TestDataRoot().Append( |
51 FILE_PATH_LITERAL("handler/win/z7_test.dll")); | 47 FILE_PATH_LITERAL("handler/win/z7_test.dll")); |
52 HMODULE z7_test = LoadLibrary(z7_path.value().c_str()); | 48 HMODULE z7_test = LoadLibrary(z7_path.value().c_str()); |
53 if (!z7_test) { | 49 if (!z7_test) { |
54 PLOG(ERROR) << "LoadLibrary"; | 50 PLOG(ERROR) << "LoadLibrary"; |
55 return EXIT_FAILURE; | 51 return EXIT_FAILURE; |
56 } | 52 } |
57 FARPROC crash_me = GetProcAddress(z7_test, "CrashMe"); | 53 FARPROC crash_me = GetProcAddress(z7_test, "CrashMe"); |
58 if (!crash_me) { | 54 if (!crash_me) { |
59 PLOG(ERROR) << "GetProcAddress"; | 55 PLOG(ERROR) << "GetProcAddress"; |
60 return EXIT_FAILURE; | 56 return EXIT_FAILURE; |
61 } | 57 } |
62 reinterpret_cast<void(*)()>(crash_me)(); | 58 reinterpret_cast<void(*)()>(crash_me)(); |
63 | 59 |
64 return EXIT_SUCCESS; | 60 return EXIT_SUCCESS; |
65 } | 61 } |
66 | 62 |
67 } // namespace | 63 } // namespace |
68 } // namespace crashpad | 64 } // namespace crashpad |
69 | 65 |
70 int wmain(int argc, wchar_t* argv[]) { | 66 int wmain(int argc, wchar_t* argv[]) { |
71 return crashpad::CrashyLoadZ7Main(argc, argv); | 67 return crashpad::CrashyLoadZ7Main(argc, argv); |
72 } | 68 } |
OLD | NEW |