Print Windows crash codes in hex

Failure codes such as STATUS_ACCESS_VIOLATION are easily recognizable
and easily differentiated when printed in hex (0xC0000005) but are
cryptic and conflated when printed as decimal (-1073741819). This change
teaches two of our wrapper scripts to print large negative numbers as
hex so that those skilled in the Windows arts can automatically say
"access violation" or "not access violation."

I also removed an inelegant trailing period, for consistency.

In testing with artificially inserted error codes the output is:
  Protoc has returned non-zero status: -99
  Protoc has returned non-zero status: 0xC0000005
  genperf.exe failed with exit code -99
  re2c.exe failed with exit code 0xC0000005

Bug: 803617,644525
Change-Id: I627754976ff04e334010d36e5734d73421523e47
Reviewed-on: https://chromium-review.googlesource.com/917101
Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#536899}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 8c50b3ed049c736406943ac24dc40fc8ac1e782c
diff --git a/protoc_wrapper.py b/protoc_wrapper.py
index 6a25de0..d6e127f 100755
--- a/protoc_wrapper.py
+++ b/protoc_wrapper.py
@@ -130,8 +130,15 @@
 
   ret = subprocess.call(protoc_cmd)
   if ret != 0:
+    if ret <= -100:
+      # Windows error codes such as 0xC0000005 and 0xC0000409 are much easier to
+      # recognize and differentiate in hex. In order to print them as unsigned
+      # hex we need to add 4 Gig to them.
+      error_number = "0x%08X" % (ret + (1 << 32))
+    else:
+      error_number = "%d" % ret
     raise RuntimeError("Protoc has returned non-zero status: "
-                       "{0} .".format(ret))
+                       "{0}".format(error_number))
 
   if options.include:
     WriteIncludes(headers, options.include)