Recuce DLL hijack risk on Windows
authorTor Lillqvist <tml@iki.fi>
Thu, 2 Sep 2010 18:56:02 +0000 (21:56 +0300)
committerTor Lillqvist <tml@iki.fi>
Thu, 2 Sep 2010 19:36:47 +0000 (22:36 +0300)
commit6ddef375c8eb41da3160ac6984f707a19f1da63b
tree379ed3ed6728927532169e300eb886b52eb3805c
parent54c51c73c60008868f6718a23b4b00a5db61c167
Recuce DLL hijack risk on Windows

Don't call LoadLibrary() on shell32.dll or kernel32.dll. kernel32.dll
is always loaded. Shell32.dll is also already loaded as glib links to
functions in it. So just call GetModuleHandle() on them.

For mlang.dll in win_iconv.c and winhttp.dll in gwinhttpvfs.c, always
try loading them from a complete path, from the Windows system
directory.

Use the "tool help" API to enumerate modules in gmodule-win32.c. It is
present in all Windows versions since Windows 2000, which is all we
support anyway. Thus no need to look that API up dynamically. Just
link to it normally. We can bin the fallback code that attempts to use
the psapi API.
gio/win32/gwinhttpvfs.c
glib/gutils.c
glib/win_iconv.c
gmodule/gmodule-win32.c