| Index: base/native_library_win.cc
|
| diff --git a/base/native_library_win.cc b/base/native_library_win.cc
|
| index bcea485a1d10582016622738f1081fde471cd567..77a5502cce8cdaa11926eb3ff758d99ad041858e 100644
|
| --- a/base/native_library_win.cc
|
| +++ b/base/native_library_win.cc
|
| @@ -4,6 +4,8 @@
|
|
|
| #include "base/native_library.h"
|
|
|
| +#include <ostream>
|
| +
|
| #include <windows.h>
|
|
|
| #include "base/file_util.h"
|
| @@ -15,9 +17,11 @@ namespace base {
|
|
|
| typedef HMODULE (WINAPI* LoadLibraryFunction)(const wchar_t* file_name);
|
|
|
| +namespace {
|
| +
|
| NativeLibrary LoadNativeLibraryHelper(const FilePath& library_path,
|
| LoadLibraryFunction load_library_api,
|
| - std::string* error) {
|
| + NativeLibraryLoadError* error) {
|
| // LoadLibrary() opens the file off disk.
|
| ThreadRestrictions::AssertIOAllowed();
|
|
|
| @@ -36,8 +40,7 @@ NativeLibrary LoadNativeLibraryHelper(const FilePath& library_path,
|
| HMODULE module = (*load_library_api)(library_path.value().c_str());
|
| if (!module && error) {
|
| // GetLastError() needs to be called immediately after |load_library_api|.
|
| - DWORD last_error = GetLastError();
|
| - *error = StringPrintf("%u", last_error);
|
| + error->code = GetLastError();
|
| }
|
|
|
| if (restore_directory)
|
| @@ -46,9 +49,11 @@ NativeLibrary LoadNativeLibraryHelper(const FilePath& library_path,
|
| return module;
|
| }
|
|
|
| +} // namespace
|
| +
|
| // static
|
| NativeLibrary LoadNativeLibrary(const FilePath& library_path,
|
| - std::string* error) {
|
| + NativeLibraryLoadError* error) {
|
| return LoadNativeLibraryHelper(library_path, LoadLibraryW, error);
|
| }
|
|
|
| @@ -78,4 +83,10 @@ string16 GetNativeLibraryName(const string16& name) {
|
| return name + ASCIIToUTF16(".dll");
|
| }
|
|
|
| +// static
|
| +std::ostream& operator<<(std::ostream& out,
|
| + const NativeLibraryLoadError& error) {
|
| + return out << error.code;
|
| +}
|
| +
|
| } // namespace base
|
|
|