From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juanma Barranquero Newsgroups: gmane.emacs.devel Subject: Re: GnuTLS for W32 Date: Wed, 4 Jan 2012 16:15:56 +0100 Message-ID: References: <87boqmlrma.fsf@wanadoo.es> <87ty4e9j19.fsf@lifelogs.com> <83obumqa0v.fsf@gnu.org> <87ipktag2e.fsf@lifelogs.com> <87fwfxtxuz.fsf@wanadoo.es> <87aa64ubg9.fsf@wanadoo.es> <83boqkr9bp.fsf@gnu.org> <874nwcu17i.fsf@wanadoo.es> <834nwcr6un.fsf@gnu.org> <87vcosskhc.fsf@wanadoo.es> <831urgr2yr.fsf@gnu.org> <87r4zgsh2w.fsf@wanadoo.es> <87ipks3zbo.fsf@uwakimon.sk.tsukuba.ac.jp> <87boqk3q69.fsf@uwakimon.sk.tsukuba.ac.jp> <87aa634st8.fsf@uwakimon.sk.tsukuba.ac.jp> <87fwfvsgfv.fsf@wanadoo.es> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1325690214 15757 80.91.229.12 (4 Jan 2012 15:16:54 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 4 Jan 2012 15:16:54 +0000 (UTC) Cc: emacs-devel@gnu.org To: =?UTF-8?Q?=C3=93scar_Fuentes?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jan 04 16:16:49 2012 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RiSa9-00042O-6H for ged-emacs-devel@m.gmane.org; Wed, 04 Jan 2012 16:16:49 +0100 Original-Received: from localhost ([::1]:35846 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RiSa8-0005z1-Bc for ged-emacs-devel@m.gmane.org; Wed, 04 Jan 2012 10:16:48 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:44889) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RiSa5-0005yR-9e for emacs-devel@gnu.org; Wed, 04 Jan 2012 10:16:46 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RiSZz-0003gi-C7 for emacs-devel@gnu.org; Wed, 04 Jan 2012 10:16:45 -0500 Original-Received: from mail-pz0-f41.google.com ([209.85.210.41]:59539) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RiSZz-0003gV-7D for emacs-devel@gnu.org; Wed, 04 Jan 2012 10:16:39 -0500 Original-Received: by dakl33 with SMTP id l33so14569938dak.0 for ; Wed, 04 Jan 2012 07:16:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=TGr/S9QlxQt2t9uOR9HGceiYlfPI7w8EayHBJ/OKXx0=; b=dRCsdX6SAX9h3i0Q8eRhW7m+NzS/D41qoKFcLP8lLtaa70yia9eK4FqfMvsaIFJHH2 qIHjWru+cdDQEcDfMJDtKwornQpIPEzBKe4UqIlpKlJ3QZN00EhHZo4DTG4MLIkebMG/ 8HDG0tU0VAb+L0hzm6Vl+kQj9rqqLfH4DVxR4= Original-Received: by 10.68.74.233 with SMTP id x9mr114232735pbv.74.1325690198295; Wed, 04 Jan 2012 07:16:38 -0800 (PST) Original-Received: by 10.142.247.28 with HTTP; Wed, 4 Jan 2012 07:15:56 -0800 (PST) In-Reply-To: <87fwfvsgfv.fsf@wanadoo.es> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.210.41 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:147273 Archived-At: On Wed, Jan 4, 2012 at 15:14, =C3=93scar Fuentes wrote: > On the topic of how hard is to load a dll from an arbitrary location, > that is what I found on the Emacs sources: And BTW, I prefer the patched version from bug#10424, which records the full pathname too, and which I'll commit after 24.1 (at least this change, the one in misc.el could be circumvented with better customizability of tabulated-list-mode). > /* The argument LIBRARIES is an alist that associates a symbol > =C2=A0 LIBRARY_ID, identifying an external DLL library known to Emacs, to > =C2=A0 a list of filenames under which the library is usually found. =C2= =A0In > =C2=A0 most cases, the argument passed as LIBRARIES is the variable > =C2=A0 `dynamic-library-alist', which is initialized to a list of common > =C2=A0 library names. =C2=A0If the function loads the library successfull= y, it > =C2=A0 returns the handle of the DLL, and records the filename in the > =C2=A0 property :loaded-from of LIBRARY_ID; it returns NULL if the librar= y > =C2=A0 could not be found, or when it was already loaded (because the > =C2=A0 handle is not recorded anywhere, and so is lost after use). =C2=A0= It > =C2=A0 would be trivial to save the handle too in :loaded-from, but > =C2=A0 currently there's no use case for it. =C2=A0*/ > HMODULE > w32_delayed_load (Lisp_Object libraries, Lisp_Object library_id) > { > =C2=A0HMODULE library_dll =3D NULL; > > =C2=A0CHECK_SYMBOL (library_id); > > =C2=A0if (CONSP (libraries) && NILP (Fassq (library_id, Vlibrary_cache))) > =C2=A0 =C2=A0{ > =C2=A0 =C2=A0 =C2=A0Lisp_Object found =3D Qnil; > =C2=A0 =C2=A0 =C2=A0Lisp_Object dlls =3D Fassq (library_id, libraries); > > =C2=A0 =C2=A0 =C2=A0if (CONSP (dlls)) > =C2=A0 =C2=A0 =C2=A0 =C2=A0for (dlls =3D XCDR (dlls); CONSP (dlls); dlls = =3D XCDR (dlls)) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0{ > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0CHECK_STRING_CAR (dlls); > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if ((library_dll =3D LoadLibrary= (SDATA (XCAR (dlls))))) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0{ - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0found =3D XCAR (dl= ls); + char name[MAX_PATH]; + DWORD len; + + len =3D GetModuleFileNameA (library_dll, name, sizeof (nam= e)); + found =3D Fcons (XCAR (dlls), + (len > 0) + /* Possibly truncated */ + ? make_specified_string (name, -1, len, 1) + : Qnil); > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0break; > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0} > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0} > > =C2=A0 =C2=A0 =C2=A0Fput (library_id, QCloaded_from, found); > =C2=A0 =C2=A0} > > =C2=A0return library_dll; > } =C2=A0 =C2=A0 Juanma