[PATCH 6/4] libbacktrace: Add loaded dlls after initialize

Eli Zaretskii eliz@gnu.org
Mon Jul 29 17:58:02 GMT 2024


> From: Ian Lance Taylor <iant@google.com>
> Date: Mon, 29 Jul 2024 09:46:46 -0700
> Cc: Eli Zaretskii <eliz@gnu.org>, gcc-patches@gcc.gnu.org, gcc@gcc.gnu.org
> 
> On Fri, Mar 15, 2024 at 1:41 PM Björn Schäpers <gcc@hazardy.de> wrote:
> >
> > Am 10.01.2024 um 13:34 schrieb Eli Zaretskii:
> > >> Date: Tue, 9 Jan 2024 21:02:44 +0100
> > >> Cc: iant@google.com, gcc-patches@gcc.gnu.org, gcc@gcc.gnu.org
> > >> From: Björn Schäpers <gcc@hazardy.de>
> > >>
> > >> Am 07.01.2024 um 18:03 schrieb Eli Zaretskii:
> > >>> In that case, you an call either GetModuleHandeExA or
> > >>> GetModuleHandeExW, the difference is minor.
> > >>
> > >> Here an updated version without relying on TEXT or TCHAR, directly calling
> > >> GetModuleHandleExW.
> > >
> > > Thanks, this LGTM (but I couldn't test it, I just looked at the
> > > sour ce code).
> >
> > Here an updated version. It is rebased on the combined approach of getting the
> > loaded DLLs and two minor changes to suppress warnings.
> 
> This bug report was filed about this patch:
> 
> https://github.com/ianlancetaylor/libbacktrace/issues/131
> 
> > src\pecoff.c(86): error C2059: syntax error: '('
> > src\pecoff.c(89): error C2059: syntax error: '('
> >
> > It works fine if deleting CALLBACK and NTAPI.
> 
> Any ideas?

Instead of deleting those, move them inside the parentheses:

typedef VOID (CALLBACK *LDR_DLL_NOTIFICATION)(ULONG,
					      struct dll_notification_data*,
					      PVOID);
typedef NTSTATUS (NTAPI *LDR_REGISTER_FUNCTION)(ULONG,
						LDR_DLL_NOTIFICATION, PVOID,
						PVOID*);

and also I think you need to include <ntdef.h>, for the definition
of the NTSTATUS type.

Caveat: I don't have MSVC, so I couldn't verify that these measures
fix the problem, sorry.


More information about the Gcc mailing list