Enable the IAT patcher unittests in x64.

Review-Url: https://chromiumcodereview.appspot.com/2427043003
diff --git a/syzygy/agent/asan/asan.gyp b/syzygy/agent/asan/asan.gyp
index 0d3cdf3..85acfc0 100644
--- a/syzygy/agent/asan/asan.gyp
+++ b/syzygy/agent/asan/asan.gyp
@@ -217,6 +217,9 @@
               'LargeAddressAware': 1,
             },
           },
+          'dependencies': [
+            '<(src)/syzygy/pe/pe.gyp:test_dll',
+          ],
         }, {
           'sources!': [
             # Static shadow doesn't work for large address spaces.
@@ -225,13 +228,13 @@
             'memory_interceptors_patcher_unittest.cc',
             # Relies on full set of probes.
             'memory_interceptors_unittest.cc',
-            # PE lib for win64 is sort of stub, so there's nothing
-            # to test there.
-            'iat_patcher_unittest.cc',
             # Uses 32bit assembler.
             'heap_managers/block_heap_manager_unittest.cc',
           ],
-          'sources': ['dummy_shadow.cc']
+          'sources': ['dummy_shadow.cc'],
+          'dependencies': [
+            '<(src)/syzygy/pe/pe.gyp:test_dll_x64',
+          ],
         }],
       ],
       'dependencies': [
diff --git a/syzygy/agent/asan/iat_patcher_unittest.cc b/syzygy/agent/asan/iat_patcher_unittest.cc
index 6b6b989..294c726 100644
--- a/syzygy/agent/asan/iat_patcher_unittest.cc
+++ b/syzygy/agent/asan/iat_patcher_unittest.cc
@@ -38,7 +38,11 @@
 
   void SetUp() override {
     base::FilePath path =
+#ifndef _WIN64
         testing::GetExeRelativePath(L"test_dll.dll");
+#else
+        testing::GetExeRelativePath(L"test_dll_x64.dll");
+#endif
     test_dll_ = ::LoadLibrary(path.value().c_str());
     ASSERT_NE(nullptr, test_dll_);
   }
diff --git a/syzygy/pe/export_dll_x64.def b/syzygy/pe/export_dll_x64.def
new file mode 100644
index 0000000..eeebd42
--- /dev/null
+++ b/syzygy/pe/export_dll_x64.def
@@ -0,0 +1,23 @@
+; Copyright 2016 Google Inc. All Rights Reserved.
+;
+; Licensed under the Apache License, Version 2.0 (the "License");
+; you may not use this file except in compliance with the License.
+; You may obtain a copy of the License at
+;
+;     http://www.apache.org/licenses/LICENSE-2.0
+;
+; Unless required by applicable law or agreed to in writing, software
+; distributed under the License is distributed on an "AS IS" BASIS,
+; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+; See the License for the specific language governing permissions and
+; limitations under the License.
+;
+; Export declarations for the export DLL 64-bit build.
+LIBRARY export_dll_x64.dll
+
+EXPORTS
+  ; Export some functions to make sure the DLL has an exports section.
+  kExportedData
+  function1
+  function2 @7 NONAME
+  function3
diff --git a/syzygy/pe/pe.gyp b/syzygy/pe/pe.gyp
index 201b2fa..2b2fb3f 100644
--- a/syzygy/pe/pe.gyp
+++ b/syzygy/pe/pe.gyp
@@ -378,6 +378,7 @@
         'test_dll_x64.rc',
       ],
       'dependencies': [
+        'export_dll_x64',
         '<(src)/syzygy/version/version.gyp:syzygy_version',
       ],
       'msvs_settings': {
@@ -505,6 +506,30 @@
       },
     },
     {
+      'target_name': 'export_dll_x64',
+      'type': 'shared_library',
+      'sources': [
+        'export_dll.cc',
+        'export_dll_x64.def',
+      ],
+      'msvs_settings': {
+      },
+      'configurations': {
+        'Common_Base': {
+          'msvs_settings': {
+            'VCLinkerTool': {
+              'VCLinkerTool': {
+                # Force MSVS to produce the same output name as Ninja.
+                'ImportLibrary': '$(OutDir)lib\$(TargetFileName).lib'
+              },
+            },
+          },
+          'msvs_target_platform': 'x64',
+          'msvs_configuration_platform': 'x64',
+        },
+      },
+    },
+    {
       'target_name': 'decompose_image_to_text',
       'type': 'executable',
       'sources': [
diff --git a/syzygy/pe/test_dll_x64.def b/syzygy/pe/test_dll_x64.def
index 06ac835..b34ca98 100644
--- a/syzygy/pe/test_dll_x64.def
+++ b/syzygy/pe/test_dll_x64.def
@@ -19,3 +19,7 @@
   ; Export some functions to make sure the DLL has an exports section.
   DllMain @7 PRIVATE
   Hello
+  function1 @17 PRIVATE
+  ; Export by ordinal only.
+  function2 @1 NONAME PRIVATE
+  function3 @9 PRIVATE