Make vboot_reference build in MSVC command line environment.

This is a mostly NOOP change which modifies the source code
to compile cleanly in the MSVC command line build
environment.

A new makefile is introduced (msc/nmakefile) along with a
README.txt in the same directory explaining how to build
the code in the DOS window. As of this submission the build
is running in a 32 bit environment, the intention is to use
the same makefile for 64 bit builds in the future.

Enabling high compilation warnings level allowed to
identify a couple of bugs in the code which are being fixed.

Not all sources are being compiled in the MSVC environment,
only those in firmware/ and most of those in test/
subdirectories. The benchmark calculations require porting
of the timer facilities and are being postponed.

TEST

Built in DOS and linux environments. Ran unit tests in
linux environment.

Review URL: http://codereview.chromium.org/2809037
diff --git a/tests/cgptlib_test.c b/tests/cgptlib_test.c
index 29f91d8..5b0b9b4 100644
--- a/tests/cgptlib_test.c
+++ b/tests/cgptlib_test.c
@@ -11,6 +11,7 @@
 #include "crc32.h"
 #include "crc32_test.h"
 #include "gpt.h"
+#include "test_common.h"
 #include "utility.h"
 
 /* Testing partition layout (sector_bytes=512)
@@ -560,12 +561,12 @@
 
   /* Modify the first byte of primary entries, and expect the CRC is wrong. */
   BuildTestGptData(gpt);
-  EXPECT(0 == CheckEntries(e1, h1, gpt->drive_sectors));
-  EXPECT(0 == CheckEntries(e2, h1, gpt->drive_sectors));
+  EXPECT(0 == CheckEntries(e1, h1));
+  EXPECT(0 == CheckEntries(e2, h1));
   gpt->primary_entries[0] ^= 0xa5;  /* just XOR a non-zero value */
   gpt->secondary_entries[TOTAL_ENTRIES_SIZE-1] ^= 0x5a;
-  EXPECT(1 == CheckEntries(e1, h1, gpt->drive_sectors));
-  EXPECT(1 == CheckEntries(e2, h1, gpt->drive_sectors));
+  EXPECT(1 == CheckEntries(e1, h1));
+  EXPECT(1 == CheckEntries(e2, h1));
 
   return TEST_OK;
 }
@@ -586,26 +587,26 @@
   BuildTestGptData(gpt);
   e1[0].starting_lba = h1->first_usable_lba - 1;
   RefreshCrc32(gpt);
-  EXPECT(1 == CheckEntries(e1, h1, gpt->drive_sectors));
+  EXPECT(1 == CheckEntries(e1, h1));
 
   /* error case: entry.EndingLBA > header.LastUsableLBA */
   BuildTestGptData(gpt);
   e1[2].ending_lba = h1->last_usable_lba + 1;
   RefreshCrc32(gpt);
-  EXPECT(1 == CheckEntries(e1, h1, gpt->drive_sectors));
+  EXPECT(1 == CheckEntries(e1, h1));
 
   /* error case: entry.StartingLBA > entry.EndingLBA */
   BuildTestGptData(gpt);
   e1[3].starting_lba = e1[3].ending_lba + 1;
   RefreshCrc32(gpt);
-  EXPECT(1 == CheckEntries(e1, h1, gpt->drive_sectors));
+  EXPECT(1 == CheckEntries(e1, h1));
 
   /* case: non active entry should be ignored. */
   BuildTestGptData(gpt);
   Memset(&e1[1].type, 0, sizeof(e1[1].type));
   e1[1].starting_lba = e1[1].ending_lba + 1;
   RefreshCrc32(gpt);
-  EXPECT(0 == CheckEntries(e1, h1, gpt->drive_sectors));
+  EXPECT(0 == CheckEntries(e1, h1));
 
   return TEST_OK;
 }
@@ -667,7 +668,7 @@
     }
     RefreshCrc32(gpt);
 
-    EXPECT(cases[i].overlapped == CheckEntries(e, h, gpt->drive_sectors));
+    EXPECT(cases[i].overlapped == CheckEntries(e, h));
   }
   return TEST_OK;
 }
@@ -823,39 +824,39 @@
   GptData* gpt = GetEmptyGptData();
   GptEntry* e = (GptEntry*)(gpt->primary_entries);
 
-  e->attrs.whole = 0x0000000000000000LLU;
+  e->attrs.whole = 0x0000000000000000ULL;
   SetEntrySuccessful(e, 1);
-  EXPECT(0x0100000000000000LLU == e->attrs.whole);
+  EXPECT(0x0100000000000000ULL == e->attrs.whole);
   EXPECT(1 == GetEntrySuccessful(e));
-  e->attrs.whole = 0xFFFFFFFFFFFFFFFFLLU;
+  e->attrs.whole = 0xFFFFFFFFFFFFFFFFULL;
   SetEntrySuccessful(e, 0);
-  EXPECT(0xFEFFFFFFFFFFFFFFLLU == e->attrs.whole);
+  EXPECT(0xFEFFFFFFFFFFFFFFULL == e->attrs.whole);
   EXPECT(0 == GetEntrySuccessful(e));
 
-  e->attrs.whole = 0x0000000000000000LLU;
+  e->attrs.whole = 0x0000000000000000ULL;
   SetEntryTries(e, 15);
   EXPECT(15 == GetEntryTries(e));
-  EXPECT(0x00F0000000000000LLU == e->attrs.whole);
-  e->attrs.whole = 0xFFFFFFFFFFFFFFFFLLU;
+  EXPECT(0x00F0000000000000ULL == e->attrs.whole);
+  e->attrs.whole = 0xFFFFFFFFFFFFFFFFULL;
   SetEntryTries(e, 0);
-  EXPECT(0xFF0FFFFFFFFFFFFFLLU == e->attrs.whole);
+  EXPECT(0xFF0FFFFFFFFFFFFFULL == e->attrs.whole);
   EXPECT(0 == GetEntryTries(e));
 
-  e->attrs.whole = 0x0000000000000000LLU;
+  e->attrs.whole = 0x0000000000000000ULL;
   SetEntryPriority(e, 15);
-  EXPECT(0x000F000000000000LLU == e->attrs.whole);
+  EXPECT(0x000F000000000000ULL == e->attrs.whole);
   EXPECT(15 == GetEntryPriority(e));
-  e->attrs.whole = 0xFFFFFFFFFFFFFFFFLLU;
+  e->attrs.whole = 0xFFFFFFFFFFFFFFFFULL;
   SetEntryPriority(e, 0);
-  EXPECT(0xFFF0FFFFFFFFFFFFLLU == e->attrs.whole);
+  EXPECT(0xFFF0FFFFFFFFFFFFULL == e->attrs.whole);
   EXPECT(0 == GetEntryPriority(e));
 
-  e->attrs.whole = 0xFFFFFFFFFFFFFFFFLLU;
+  e->attrs.whole = 0xFFFFFFFFFFFFFFFFULL;
   EXPECT(1 == GetEntrySuccessful(e));
   EXPECT(15 == GetEntryPriority(e));
   EXPECT(15 == GetEntryTries(e));
 
-  e->attrs.whole = 0x0123000000000000LLU;
+  e->attrs.whole = 0x0123000000000000ULL;
   EXPECT(1 == GetEntrySuccessful(e));
   EXPECT(2 == GetEntryTries(e));
   EXPECT(3 == GetEntryPriority(e));
@@ -1091,6 +1092,8 @@
   return TEST_OK;
 }
 
+/* disable MSVC warnings on unused arguments */
+__pragma(warning (disable: 4100))
 
 int main(int argc, char *argv[]) {
   int i;