Index: chrome/chrome_dll.gypi |
diff --git a/chrome/chrome_dll.gypi b/chrome/chrome_dll.gypi |
index 818f01b60f1cc39d5d23c258f5ec8d43b652cb83..cee633bd8e3ca6cbe80729ba67e2b8ae1c3f8b12 100644 |
--- a/chrome/chrome_dll.gypi |
+++ b/chrome/chrome_dll.gypi |
@@ -96,6 +96,7 @@ |
'chrome_dll_pdb_workaround', |
'chrome_resources.gyp:chrome_resources', |
'chrome_version_resources', |
+ 'user32_import_libs', |
'../chrome/chrome_resources.gyp:chrome_unscaled_resources', |
'../content/content.gyp:content_worker', |
'../crypto/crypto.gyp:crypto', |
@@ -112,6 +113,8 @@ |
'app/chrome_main.cc', |
'app/chrome_main_delegate.cc', |
'app/chrome_main_delegate.h', |
+ 'app/delay_load_hook.cc', |
+ 'app/delay_load_hook.h', |
'<(SHARED_INTERMEDIATE_DIR)/chrome_version/chrome_dll_version.rc', |
'../base/win/dllmain.cc', |
@@ -287,6 +290,65 @@ |
}], |
], |
}, |
+ { |
+ # This target builds import libraries for user32, to allow separating |
+ # the few post Win-XP imports we use as delay imports, from the |
+ # XP-level imports we bind explictly. |
+ 'target_name': 'user32_import_libs', |
+ 'type': 'none', |
+ 'sources': [ |
+ 'imports/build_import_libraries.py', |
+ 'imports/user32.imports.json', |
+ ], |
+ 'outputs': [ |
+ '<(PRODUCT_DIR)/lib/user32-imports.lib', |
+ '<(PRODUCT_DIR)/lib/user32-delay.lib', |
+ ], |
+ 'actions': [ |
+ { |
+ 'action_name': 'user32_imports', |
+ 'message': 'Building import libraries for user32.dll', |
+ 'inputs': [ |
+ 'imports/user32.imports.json', |
+ ], |
+ 'outputs': [ |
+ '<(PRODUCT_DIR)/lib/user32-imports.lib', |
+ '<(PRODUCT_DIR)/lib/user32-delay.lib', |
+ ], |
+ 'action': [ |
+ 'python', |
+ 'imports/build_import_libraries.py', |
+ '--verbose', |
+ '<@(_inputs)', |
+ '--output-dir', '<(PRODUCT_DIR)/lib/', |
+ ], |
+ 'msvs_cygwin_shell': 0, |
+ }, |
+ ], |
+ # TODO(siggi): This should be happening only for release builds, |
+ # how to wrangle that? DO NOT SUBMIT. |
+ 'direct_dependent_settings': { |
+ 'msvs_settings': { |
+ 'VCLinkerTool': { |
+ # Ignore the user32.dll import library. |
+ 'IgnoreDefaultLibraryNames': ['user32.lib'], |
+ # Add our custom-made import libraries. |
+ 'AdditionalDependencies': [ |
+ '<(PRODUCT_DIR)/lib/user32-imports.lib', |
+ '<(PRODUCT_DIR)/lib/user32-delay.lib', |
+ ], |
+ # Delay load only the latter of the import libs above. |
+ 'DelayLoadDLLs': [ |
+ 'user32-delay.dll', |
+ ], |
+ # Make sure the delay load hook is linked into the image. |
+ # This will ensure that the delay hook pointer is also linked |
+ # from the corresponding .obj file. |
+ 'ForceSymbolReferences': [ 'ChromeDelayLoadHook' ], |
+ }, |
+ }, |
+ }, |
+ }, |
], |
}], |
], |