Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

[Win32] SymGetModuleInfo - The parameter is incorrect

Options
  • 14-07-2004 5:21pm
    #1
    Registered Users Posts: 1,421 ✭✭✭


    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 Posts: 1,421 ✭✭✭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 Posts: 15,443 ✭✭✭✭bonkey


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

    jc


  • Registered Users Posts: 1,421 ✭✭✭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