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 (EndsWith(dll_name, kDelaySuffix, false)) { | 31 if (base::EndsWith(dll_name, kDelaySuffix, false)) { |
32 // Trim the "-delay.dll" suffix from the string. | 32 // Trim the "-delay.dll" suffix from the string. |
33 dll_name.resize(dll_name.length() - (sizeof(kDelaySuffix) - 1)); | 33 dll_name.resize(dll_name.length() - (sizeof(kDelaySuffix) - 1)); |
34 dll_name.append(".dll"); | 34 dll_name.append(".dll"); |
35 | 35 |
36 return reinterpret_cast<FARPROC>(::LoadLibraryA(dll_name.c_str())); | 36 return reinterpret_cast<FARPROC>(::LoadLibraryA(dll_name.c_str())); |
37 } | 37 } |
38 | 38 |
39 return NULL; | 39 return NULL; |
40 } | 40 } |
41 | 41 |
(...skipping 29 matching lines...) Expand all Loading... |
71 | 71 |
72 default: | 72 default: |
73 NOTREACHED() << "Impossible delay load notification."; | 73 NOTREACHED() << "Impossible delay load notification."; |
74 break; | 74 break; |
75 } | 75 } |
76 | 76 |
77 // Returning NULL causes the delay load machinery to perform default | 77 // Returning NULL causes the delay load machinery to perform default |
78 // processing for this notification. | 78 // processing for this notification. |
79 return NULL; | 79 return NULL; |
80 } | 80 } |
OLD | NEW |