Am 25.01.2024 um 23:04 schrieb Ian Lance Taylor: > On Thu, Jan 25, 2024 at 11:53 AM Björn Schäpers wrote: >> >> Am 23.01.2024 um 23:37 schrieb Ian Lance Taylor: >>> On Thu, Jan 4, 2024 at 2:33 PM Björn Schäpers wrote: >>>> >>>> Am 03.01.2024 um 00:12 schrieb Björn Schäpers: >>>>> Am 30.11.2023 um 20:53 schrieb Ian Lance Taylor: >>>>>> On Fri, Jan 20, 2023 at 2:55 AM Björn Schäpers wrote: >>>>>>> >>>>>>> From: Björn Schäpers >>>>>>> >>>>>>> Fixes https://github.com/ianlancetaylor/libbacktrace/issues/53, except >>>>>>> that libraries loaded after the backtrace_initialize are not handled. >>>>>>> But as far as I can see that's the same for elf. >>>>>> >>>>>> Thanks, but I don't want a patch that loops using goto statements. >>>>>> Please rewrite to avoid that. It may be simpler to call a function. >>>>>> >>>>>> Also starting with a module count of 1000 seems like a lot. Do >>>>>> typical Windows programs load that many modules? >>>>>> >>>>>> Ian >>>>>> >>>>>> >>>>> >>>>> Rewritten using a function. >>>>> >>>>> If that is commited, could you attribute that commit to me (--author="Björn >>>>> Schäpers ")? >>>>> >>>>> Thanks and kind regards, >>>>> Björn. >>>> >>>> I noticed that under 64 bit libraries loaded with LoadLibrary were missing. >>>> EnumProcessModules stated the correct number of modules, but did not fill the >>>> the HMODULEs, but set them to 0. While trying to investigate I noticed if I do >>>> the very same thing from main (in C++) I even got fewer module HMODULEs. >>>> >>>> So I went a different way. This detects all libraries correctly, in 32 and 64 >>>> bit. The question is, if it should be a patch on top of the previous, or should >>>> they be merged, or even only this solution and drop the EnumProcessModules variant? >>> >>> Is there any reason to use both patches? Seems simpler to just use >>> this one if it works. Thanks. >>> >>> Ian >> >> This one needs the tlhelp32 header and its functions, which are (accoridng to >> the microsoft documentation) are only available since Windows XP rsp. Windows >> Server 2003. >> >> If that's no problem, and in my opinion it shouldn't be, then I can basically >> drop patch 4 and rebase this one. > > I don't see that as a problem. It seems like the patch will fall back > cleanly on ancient Windows and simply fail to pick up other loaded > DLLs. I think that is fine. I'll look for an updated patch. Thanks. > > Ian Attached is the combined version of the two patches, only implementing the variant with the tlhelp32 API. Tested on x86 and x86_64 windows. Kind regards, Björn.