* 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.
This commit is contained in:
Corinna Vinschen
2010-08-28 11:22:37 +00:00
parent 893a8b78fc
commit 71d8f118da
13 changed files with 95 additions and 15 deletions

View File

@@ -1,7 +1,7 @@
/* ps.cc
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
2008, 2009 Red Hat, Inc.
2008, 2009, 2010 Red Hat, Inc.
This file is part of Cygwin.
@@ -23,6 +23,7 @@ details. */
#include <psapi.h>
#include <ddk/ntapi.h>
#include <ddk/winddk.h>
#include "loadlib.h"
/* Maximum possible path length under NT. There's no official define
for that value. Note that PATH_MAX is only 4K. */