Chromium Code Reviews| Index: base/native_library_win.cc |
| diff --git a/base/native_library_win.cc b/base/native_library_win.cc |
| index bcea485a1d10582016622738f1081fde471cd567..3a35fd0ff786996ca2c1859ad918550bb12348d0 100644 |
| --- a/base/native_library_win.cc |
| +++ b/base/native_library_win.cc |
| @@ -17,7 +17,8 @@ typedef HMODULE (WINAPI* LoadLibraryFunction)(const wchar_t* file_name); |
| NativeLibrary LoadNativeLibraryHelper(const FilePath& library_path, |
|
ddorwin
2014/03/21 17:24:59
Not related to this CL, but this should be static/
xhwang
2014/03/21 19:00:54
Done.
|
| LoadLibraryFunction load_library_api, |
| - std::string* error) { |
| + std::string* error_message, |
| + uint32* error_code) { |
| // LoadLibrary() opens the file off disk. |
| ThreadRestrictions::AssertIOAllowed(); |
| @@ -34,10 +35,11 @@ NativeLibrary LoadNativeLibraryHelper(const FilePath& library_path, |
| } |
| HMODULE module = (*load_library_api)(library_path.value().c_str()); |
| - if (!module && error) { |
| + if (!module && error_code) { |
|
ddorwin
2014/03/21 17:24:59
This should be "...&& (error_code || error_message
xhwang
2014/03/21 19:00:54
Now this is obsolete.
|
| // GetLastError() needs to be called immediately after |load_library_api|. |
| DWORD last_error = GetLastError(); |
| - *error = StringPrintf("%u", last_error); |
| + *error_message = StringPrintf("%u", last_error); |
|
ddorwin
2014/03/21 17:24:59
You need to check for a NULL error_message.
Actua
xhwang
2014/03/21 19:00:54
I think the new NativeLibraryLoadError helps avoid
|
| + *error_code = last_error; |
| } |
| if (restore_directory) |
| @@ -48,8 +50,10 @@ NativeLibrary LoadNativeLibraryHelper(const FilePath& library_path, |
| // static |
| NativeLibrary LoadNativeLibrary(const FilePath& library_path, |
| - std::string* error) { |
| - return LoadNativeLibraryHelper(library_path, LoadLibraryW, error); |
| + std::string* error_message, |
| + uint32* error_code) { |
| + return LoadNativeLibraryHelper( |
| + library_path, LoadLibraryW, error_message, error_code); |
| } |
| NativeLibrary LoadNativeLibraryDynamically(const FilePath& library_path) { |
| @@ -59,7 +63,7 @@ NativeLibrary LoadNativeLibraryDynamically(const FilePath& library_path) { |
| load_library = reinterpret_cast<LoadLibraryFunction>( |
| GetProcAddress(GetModuleHandle(L"kernel32.dll"), "LoadLibraryW")); |
| - return LoadNativeLibraryHelper(library_path, load_library, NULL); |
| + return LoadNativeLibraryHelper(library_path, load_library, NULL, NULL); |
| } |
| // static |