OSDN Git Service

* hookapi.cc (ld_preload): Call LoadLibraryW.
authorcorinna <corinna>
Mon, 20 Aug 2007 15:41:08 +0000 (15:41 +0000)
committercorinna <corinna>
Mon, 20 Aug 2007 15:41:08 +0000 (15:41 +0000)
* path.h (path_conv::get_wide_win32_path_len): Define.

winsup/cygwin/ChangeLog
winsup/cygwin/hookapi.cc
winsup/cygwin/path.h

index 38b6d7c..fc8646e 100644 (file)
@@ -1,5 +1,10 @@
 2007-08-20  Corinna Vinschen  <corinna@vinschen.de>
 
+       * hookapi.cc (ld_preload): Call LoadLibraryW.
+       * path.h (path_conv::get_wide_win32_path_len): Define.
+
+2007-08-20  Corinna Vinschen  <corinna@vinschen.de>
+
        * fhandler.cc (rootdir): Delete.
        * winsup.h (rootdir): Drop declaration.
 
index 552b8bb..76271ef 100644 (file)
@@ -219,7 +219,8 @@ ld_preload ()
   for (p = strtok_r (s, ":\t\n", &here); p; p = strtok_r (NULL, ":\t\n", &here))
     {
       path_conv lib (p);
-      if (!LoadLibrary (lib.get_win32 ()))
+      WCHAR libname[lib.get_wide_win32_path_len () + 1];
+      if (!LoadLibraryW (lib.get_wide_win32_path (libname)))
        {
          __seterrno ();
          api_fatal ("error while loading shared libraries: %s: "
index fb654d0..b258ac9 100644 (file)
@@ -240,6 +240,12 @@ class path_conv
   PUNICODE_STRING get_nt_native_path ();
   POBJECT_ATTRIBUTES get_object_attr (OBJECT_ATTRIBUTES &attr,
                                      SECURITY_ATTRIBUTES &sa);
+  inline size_t get_wide_win32_path_len ()
+  {
+    get_nt_native_path ();
+    return uni_path.Length / sizeof (WCHAR);
+  }
+
   PWCHAR get_wide_win32_path (PWCHAR wc);
   operator DWORD &() {return fileattr;}
   operator int () {return fileattr; }