OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/app/delay_load_hook_win.h" | 5 #include "chrome/app/delay_load_hook_win.h" |
6 | 6 |
7 #include <DelayIMP.h> | 7 #include <DelayIMP.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 | 21 |
22 | 22 |
23 namespace { | 23 namespace { |
24 | 24 |
25 FARPROC OnPreLoadLibrary(DelayLoadInfo* info) { | 25 FARPROC OnPreLoadLibrary(DelayLoadInfo* info) { |
26 // If the DLL name ends with "-delay.dll", this call is about one of our | 26 // If the DLL name ends with "-delay.dll", this call is about one of our |
27 // custom import libraries. In this case we need to snip the suffix off, | 27 // custom import libraries. In this case we need to snip the suffix off, |
28 // and bind to the real DLL. | 28 // and bind to the real DLL. |
29 std::string dll_name(info->szDll); | 29 std::string dll_name(info->szDll); |
30 const char kDelaySuffix[] = "-delay.dll"; | 30 const char kDelaySuffix[] = "-delay.dll"; |
31 if (base::EndsWith(dll_name, kDelaySuffix, false)) { | 31 if (base::EndsWith(dll_name, kDelaySuffix, |
| 32 base::CompareCase::INSENSITIVE_ASCII)) { |
32 // Trim the "-delay.dll" suffix from the string. | 33 // Trim the "-delay.dll" suffix from the string. |
33 dll_name.resize(dll_name.length() - (sizeof(kDelaySuffix) - 1)); | 34 dll_name.resize(dll_name.length() - (sizeof(kDelaySuffix) - 1)); |
34 dll_name.append(".dll"); | 35 dll_name.append(".dll"); |
35 | 36 |
36 return reinterpret_cast<FARPROC>(::LoadLibraryA(dll_name.c_str())); | 37 return reinterpret_cast<FARPROC>(::LoadLibraryA(dll_name.c_str())); |
37 } | 38 } |
38 | 39 |
39 return NULL; | 40 return NULL; |
40 } | 41 } |
41 | 42 |
(...skipping 29 matching lines...) Expand all Loading... |
71 | 72 |
72 default: | 73 default: |
73 NOTREACHED() << "Impossible delay load notification."; | 74 NOTREACHED() << "Impossible delay load notification."; |
74 break; | 75 break; |
75 } | 76 } |
76 | 77 |
77 // Returning NULL causes the delay load machinery to perform default | 78 // Returning NULL causes the delay load machinery to perform default |
78 // processing for this notification. | 79 // processing for this notification. |
79 return NULL; | 80 return NULL; |
80 } | 81 } |
OLD | NEW |