Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid IMAGEHLP_MODULE64_V3 structure ending with error 87 #30

Open
SoLaRGit opened this issue Aug 20, 2018 · 2 comments
Open

Invalid IMAGEHLP_MODULE64_V3 structure ending with error 87 #30

SoLaRGit opened this issue Aug 20, 2018 · 2 comments

Comments

@SoLaRGit
Copy link

Last version of dbghelp.dll is 6.12.2.633 (released 02/01/2010 | Debugging Tools for Windows 6.12)

https://docs.microsoft.com/en-us/windows/desktop/debug/dbghelp-versions

and current code missing two last fields in IMAGEHLP_MODULE64_V3 structure

    // new element: 15-Jul-2009
    DWORD    MachineType;            // IMAGE_FILE_MACHINE_XXX from ntimage.h and winnt.h
    DWORD    Reserved;               // Padding - don't remove.

When we call this version of dbghelp.dll it fails with error 87.
If we extend structure IMAGEHLP_MODULE64_V3 with this two fields code works.

This code assumes there are only 3 versions of this structure, which is not the case.

Also one question, why try to auto detect version available on the system when there is
C:\Program Files (x86)\Debugging Tools for Windows (x86)\sdk
which could be used directly with provided dbghelp.dll, and without any overhead or dynamic instantiation of library, as this topic suggests:
https://docs.microsoft.com/en-us/windows/desktop/debug/calling-the-dbghelp-library

@JochenKalmbach
Copy link
Owner

if this is the case, then this is a bug in the dbghelp.dll... The dbghelp.dll must be able to support all versions of the "IMAGEHLP_MODULE64" structure. This is done by setting the "SizeOfStruct" member before calling any API.
See also:
https://docs.microsoft.com/de-de/windows/desktop/api/dbghelp/ns-dbghelp-_imagehlp_module64

Can you open a support case at MS?

@SoLaRGit
Copy link
Author

Well yes for some structure, and no for the other - that is my experience with Microsoft over 2 decades.
I guess that was the main reason behind the article that we should distribute dbghelp.dll with our application, instead of relaying on ones provided on OS.

So can't really report a bug since there is no document explicitly saying that it should work without any ambiguity (without any doubt).

Sure that newer OS will probably have all versions of dbghelp.dll in SxS (Side by Side assemblies) and our applications will work. But older versions of OS will not, so our apps might not work on them. True Microsoft have been dropping support for those old OS's recently more faster, than in years before. But since release of Debugging Tools for Windows 6.12 which I think came with windows 7 sdk, and VS2010, Microsoft has dropped support for Windows 7. So even this version is also outdated and obsolete. I managed to find newer headers on net, still got no chance to look trough Windows 10 SDK's (6 of them) and annotate what version they do have, and how do they work on older OS's need to check this OS cross version support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants