about summary refs log tree commit diff
path: root/src/libstd/sys
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2015-01-19 10:19:23 +0000
committerbors <bors@rust-lang.org>2015-01-19 10:19:23 +0000
commit7b87900d72cf53037119e3bac1506a9786ca508a (patch)
tree635a4398d201792e85ac47af162f4c7e9048f284 /src/libstd/sys
parent135cac852822afe822cc1e4eb9546b96eb2cb35d (diff)
parentd053ccb45fafc12a52629f209122c1ce9bbfabed (diff)
downloadrust-7b87900d72cf53037119e3bac1506a9786ca508a.tar.gz
rust-7b87900d72cf53037119e3bac1506a9786ca508a.zip
Auto merge of #20874 - klutzy:windows-dynamic-lib, r=alexcrichton
This is a [breaking-change] since `std::dynamic_lib::dl` is now
private.

When `LoadLibraryW()` fails, original code called `errno()` to get error
code.  However, there was local allocation of `Vec` before
`LoadLibraryW()`, and it drops before `errno()`, and the drop
(deallocation) changed `errno`! Therefore `dynamic_lib::open()` thought
it always succeeded.
This commit fixes the issue.

This commit also sets Windows error mode during `LoadLibrary()` to
prevent "dll load failed" dialog.
Diffstat (limited to 'src/libstd/sys')
-rw-r--r--src/libstd/sys/windows/c.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/libstd/sys/windows/c.rs b/src/libstd/sys/windows/c.rs
index 37ed32fa367..da3b7ee2f2f 100644
--- a/src/libstd/sys/windows/c.rs
+++ b/src/libstd/sys/windows/c.rs
@@ -226,6 +226,7 @@ pub mod compat {
     /// * `CreateSymbolicLinkW`: Windows XP, Windows Server 2003
     /// * `GetFinalPathNameByHandleW`: Windows XP, Windows Server 2003
     pub mod kernel32 {
+        use libc::c_uint;
         use libc::types::os::arch::extra::{DWORD, LPCWSTR, BOOLEAN, HANDLE};
         use libc::consts::os::extra::ERROR_CALL_NOT_IMPLEMENTED;
 
@@ -249,6 +250,12 @@ pub mod compat {
                 unsafe { SetLastError(ERROR_CALL_NOT_IMPLEMENTED as DWORD); 0 }
             }
         }
+
+        compat_fn! {
+            kernel32::SetThreadErrorMode(_dwNewMode: DWORD, _lpOldMode: *mut DWORD) -> c_uint {
+                unsafe { SetLastError(ERROR_CALL_NOT_IMPLEMENTED as DWORD); 0 }
+            }
+        }
     }
 }