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

Unified Diff: handler/main.cc

Issue 1422503015: win: Add HandleToInt() and IntToHandle() (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Add a comment about the choice of int over unsigned int Created 5 years, 1 month 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 | « client/crashpad_client_win.cc ('k') | test/win/win_child_process.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: handler/main.cc
diff --git a/handler/main.cc b/handler/main.cc
index 7b1f730438304280979e39e86a136f6ed4195c7c..fcc3f71ce1d0cb2317edc0bce2ce41d16802ab1c 100644
--- a/handler/main.cc
+++ b/handler/main.cc
@@ -46,6 +46,7 @@
#include <windows.h>
#include "handler/win/crash_report_exception_handler.h"
#include "util/win/exception_handler_server.h"
+#include "util/win/handle.h"
#endif // OS_MACOSX
namespace crashpad {
@@ -181,18 +182,14 @@ int HandlerMain(int argc, char* argv[]) {
}
#elif defined(OS_WIN)
case kOptionHandshakeHandle: {
- // According to
- // https://msdn.microsoft.com/en-us/library/windows/desktop/aa384203,
- // HANDLEs are always 32 bits. This construction is used to read a full
- // 32-bit number presented by the client, which uses 0x%x format, and
- // sign-extend it.
+ // Use unsigned int, because the handle was presented by the client in
+ // 0x%x format.
unsigned int handle_uint;
if (!StringToNumber(optarg, &handle_uint) ||
- (options.handshake_handle = reinterpret_cast<HANDLE>(
- static_cast<int>(handle_uint))) == INVALID_HANDLE_VALUE) {
+ (options.handshake_handle = IntToHandle(handle_uint)) ==
+ INVALID_HANDLE_VALUE) {
ToolSupport::UsageHint(me, "--handshake-handle requires a HANDLE");
return EXIT_FAILURE;
- }
break;
}
case kOptionPipeName: {
« no previous file with comments | « client/crashpad_client_win.cc ('k') | test/win/win_child_process.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698