public inbox for cygwin-patches@cygwin.com
 help / color / mirror / Atom feed
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin-patches@cygwin.com
Subject: Re: [PATCH 0/2] Drop pointless loadlib.h use in utilities
Date: Mon, 28 Feb 2022 10:39:34 +0100	[thread overview]
Message-ID: <YhyYVvO7bV0sGZbX@calimero.vinschen.de> (raw)
In-Reply-To: <20220226164054.26698-1-jon.turney@dronecode.org.uk>

On Feb 26 16:40, Jon Turney wrote:
> The only remaining uses of loadlib.h are in cygcheck and strace, where it's
> used to load cygwin1.dll in both.
> 
> Things could be further simplified, but it's probably worth keeping it
> around in it's present form since it's quite likely that
> LoadLibrary()/GetProcAddress() might be used again in future.
> 
> Jon Turney (2):
>   Cygwin: Drop pointless loadlib.h includes in utilities
>   Cygwin: Drop use of loadlib.h in regtool
> 
>  winsup/utils/cygpath.cc     |  1 -
>  winsup/utils/module_info.cc |  1 -
>  winsup/utils/path.cc        |  1 -
>  winsup/utils/ps.cc          |  1 -
>  winsup/utils/regtool.cc     | 13 +------------
>  5 files changed, 1 insertion(+), 16 deletions(-)
> 
> -- 
> 2.35.1

Good idea!

Shouldn't we actually remove loadlib.h as well?  What this code does is
to provide a safety measure to make sure the files are not stealthy
loaded from another dir.  This should not be necessary anymore, because
Windows itself provides matching functionality.

First of all, the system has an internal list of DLLs it always
loads from the system32 dir.  In Cygwin, see the content of
/proc/sys/KnownDlls/ and /proc/sys/KnownDlls32/

And for all other cases we can use LoadLibraryEx flags introduced a
couple of years ago, e. g.  LOAD_LIBRARY_SEARCH_SYSTEM32.  See
https://docs.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-loadlibraryexa


Thanks,
Corinna

      parent reply	other threads:[~2022-02-28  9:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-26 16:40 Jon Turney
2022-02-26 16:40 ` [PATCH 1/2] Cygwin: Drop pointless loadlib.h includes " Jon Turney
2022-02-26 16:40 ` [PATCH 2/2] Cygwin: Drop use of loadlib.h in regtool Jon Turney
2022-02-28  9:44   ` Corinna Vinschen
2022-02-28  9:39 ` Corinna Vinschen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YhyYVvO7bV0sGZbX@calimero.vinschen.de \
    --to=corinna-cygwin@cygwin.com \
    --cc=cygwin-patches@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).