Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2010-08-28 12:51:21 +0400
committerCorinna Vinschen <corinna@vinschen.de>2010-08-28 12:51:21 +0400
commit893a8b78fca52a5474fbca9a0b881b622afc5044 (patch)
tree28ecddfa7addcab1469a9ae6d6694fdb12dda97d /winsup/cygwin/autoload.cc
parent657f0e4a1417f0ce12b6d017c700ff35b1fcba80 (diff)
* autoload.cc (LoadDLLprime): Change dllname storage to string16.
(struct dll_info): Convert name to WCHAR. (std_dll_init): Load DLLs with full path to windows system directory. Add hint to Microsoft security advisory. * dcrt0.cc (init_windows_system_directory): New function. (dll_crt0_0): Call init_windows_system_directory first. * exceptions.cc (windows_system_directory): Move to globals.cc. (windows_system_directory_length): Ditto. (events_init): Drop code fetching windows_system_directory. * globals.cc (windows_system_directory): New global variable. (windows_system_directory_length): Ditto. * net.cc (load_ipv6_funcs): Use windows_system_directory rather than GetSystemDirectoryW. * netdb.cc (open_system_file): Ditto. Simplify debug output.
Diffstat (limited to 'winsup/cygwin/autoload.cc')
-rw-r--r--winsup/cygwin/autoload.cc9
1 files changed, 6 insertions, 3 deletions
diff --git a/winsup/cygwin/autoload.cc b/winsup/cygwin/autoload.cc
index cbd2751c8..30bbec702 100644
--- a/winsup/cygwin/autoload.cc
+++ b/winsup/cygwin/autoload.cc
@@ -68,7 +68,7 @@ bool NO_COPY wsock_started;
.long 0 \n\
.long -1 \n\
.long " #init_also " \n\
- .asciz \"" #dllname "\" \n\
+ .string16 \"" #dllname ".dll\" \n\
.text \n\
.set " #dllname "_primed, 1 \n\
.endif \n\
@@ -186,7 +186,7 @@ struct dll_info
HANDLE handle;
LONG here;
void (*init) ();
- char name[];
+ WCHAR name[];
};
struct func_info
@@ -211,6 +211,7 @@ std_dll_init ()
struct func_info *func = (struct func_info *) __builtin_return_address (0);
struct dll_info *dll = func->dll;
retchain ret;
+ WCHAR dll_path[MAX_PATH];
if (InterlockedIncrement (&dll->here))
do
@@ -223,7 +224,9 @@ std_dll_init ()
{
unsigned fpu_control = 0;
__asm__ __volatile__ ("fnstcw %0": "=m" (fpu_control));
- if ((h = LoadLibrary (dll->name)) != NULL)
+ /* http://www.microsoft.com/technet/security/advisory/2269637.mspx */
+ wcpcpy (wcpcpy (dll_path, windows_system_directory), dll->name);
+ if ((h = LoadLibraryW (dll_path)) != NULL)
{
__asm__ __volatile__ ("fldcw %0": : "m" (fpu_control));
dll->handle = h;