Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

[Win32] SymGetModuleInfo - The parameter is incorrect

  • 14-07-2004 05:21PM
    #1
    Registered Users, Registered Users 2 Posts: 1,430 ✭✭✭


    OK - I am putting together a debugger in VB (just for the craic) and am having problems with "SymGetModuleInfo" which is returning zero and setting the Err.LastDllError to The parameter is incorrect.

    This error only started occuring after I updated DbgHelp.dll to version 6.3.0017.0 (DbgBuild.040415-1850) - by downloading from http://msdl.microsoft.com/download/...bg_x86_6.3.17.0

    I think this indicates that the structure IMAGEHLP_MODULE may have changed but do not have an up to date dbghelp.h file for this version.
    Can anyone tell me if the following is correct:-

    Public Type IMAGEHLP_MODULE
        SizeOfStruct As Long '// set to sizeof(IMAGEHLP_MODULE)
        BaseOfImage As Long '// base load address of module
        ImageSize As Long '// virtual size of the loaded module
        TimeDateStamp As Long '// date/time stamp from pe header
        CheckSum    As Long '// checksum from the pe header
        NumSyms As Long '// number of symbols in the symbol table
        SymType As CV_SymbolTypes '// type of symbols loaded
        ModuleName(32) As Byte  '// module name
        ImageName(256) As Byte '// image name
        LoadedImageName(256) As Byte '// symbol file name
    End Type
    
    ' SymGetModuleInfo(
    '     IN  HANDLE              hProcess,
    '     IN  DWORD               dwAddr,
    '     OUT PIMAGEHLP_MODULE  ModuleInfo     );
    Public Declare Function SymGetModuleInfo Lib "dbghelp.dll" ( _
                    ByVal hProcess As Long, _
                    ByVal dwAddr As Long, _
                    ModuleInfo As IMAGEHLP_MODULE) As Long
    
    


    Thanks in advance,
    Duncan Jones


Comments

  • Registered Users, Registered Users 2 Posts: 1,430 ✭✭✭Merrion


    No sooner had I posted it than the obvious was pointed out to me: VB arrays are zero based whereas C++ are 1 based so the correct declaration is:
    Public Type IMAGEHLP_MODULE
        SizeOfStruct As Long '// set to sizeof(IMAGEHLP_MODULE)
        BaseOfImage As Long '// base load address of module
        ImageSize As Long '// virtual size of the loaded module
        TimeDateStamp As Long '// date/time stamp from pe header
        CheckSum    As Long '// checksum from the pe header
        NumSyms As Long '// number of symbols in the symbol table
        SymType As CV_SymbolTypes '// type of symbols loaded
        ModuleName(31) As Byte  '// module name
        ImageName(255) As Byte '// image name
        LoadedImageName(255) As Byte '// symbol file name
    End Type
    


  • Registered Users, Registered Users 2 Posts: 15,443 ✭✭✭✭bonkey


    Strange that the "wrong" definition worked in the earlier DLL version, though....

    jc


  • Registered Users, Registered Users 2 Posts: 1,430 ✭✭✭Merrion


    I'm guessing buffer overrun testing was added to the current version as part of the trusted computing / security thing that's going on at M$


Advertisement