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 15:22:37 +0400
committerCorinna Vinschen <corinna@vinschen.de>2010-08-28 15:22:37 +0400
commit71d8f118da24bb5a31f406e5fba222a324913b05 (patch)
tree093f51ed610d7333e4a933f68a1ee8900f5438bb /winsup/utils/cygcheck.cc
parent893a8b78fca52a5474fbca9a0b881b622afc5044 (diff)
* loadlib.h: New header implementing safe LoadLibrary calls.
Include throughout files using LoadLibrary function. * cygcheck.cc (dump_sysinfo): Retrieve kernel32.dll handle via GetModuleHandle, rather than using LoadLibrary. * cygpath.cc (get_long_name): Ditto. (do_sysfolders): Append .dll suffix in LoadLibrary call. * ldh.cc (WinMain): Use LoadLibraryExW with DONT_RESOLVE_DLL_REFERENCES to avoid loading malicious library code. * locale.cc (print_locale_with_codeset): Change way to retrieve kernel32.dll path.
Diffstat (limited to 'winsup/utils/cygcheck.cc')
-rw-r--r--winsup/utils/cygcheck.cc7
1 files changed, 3 insertions, 4 deletions
diff --git a/winsup/utils/cygcheck.cc b/winsup/utils/cygcheck.cc
index 5b15cdfb2..9eb8c5653 100644
--- a/winsup/utils/cygcheck.cc
+++ b/winsup/utils/cygcheck.cc
@@ -1,7 +1,7 @@
/* cygcheck.cc
Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
- 2006, 2007, 2008, 2009 Red Hat, Inc.
+ 2006, 2007, 2008, 2009, 2010 Red Hat, Inc.
This file is part of Cygwin.
@@ -26,6 +26,7 @@
#include "cygwin/include/mntent.h"
#include "cygwin/cygprops.h"
#undef cygwin_internal
+#include "loadlib.h"
#define alloca __builtin_alloca
@@ -1409,7 +1410,7 @@ dump_sysinfo ()
display_error ("dump_sysinfo: GetVersionEx()");
}
- HMODULE k32 = LoadLibrary ("kernel32.dll");
+ HMODULE k32 = GetModuleHandleW (L"kernel32.dll");
switch (osversion.dwPlatformId)
{
@@ -1838,8 +1839,6 @@ dump_sysinfo ()
name);
}
- if (!FreeLibrary (k32))
- display_error ("dump_sysinfo: FreeLibrary()");
SetErrorMode (prev_mode);
if (givehelp)
{