[Dev-C++] Win32 C/C++ SplitSymbols Question.
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
From: Frederico M. <the...@ho...> - 2010-03-24 15:10:44
|
Hello All : Long time since I posted anything, but here I am again, hoping that You'll help me out :$ So, I am trying to develop some form of instrumentation for my projects. Since all my projects are win32 oriented, these daysm i turned to the Windows API. I found that Windows has a way to export the symbols contained in a executable, to a .dbg file, by the API "SplitSymbols" ( http://msdn.microsoft.com/en-us/library/ms680644%28VS.85%29.aspx ). As I use mingw as a main compiler suite, I do not have all the necessary header files, or lib files, so I load the DLLs at run-time. ( I do not have the patience to track down the headers and adjust them to mingw. ) So, the problem is : When I do use the "SplitSymbols" Api, the returned value is FALSE, with error set to 0xc0000005 ( Access error, if i am not mistaken. ) Here is how i use the api. // ImageHlp.dll typedef BOOL (*pSplitSymbols)( PSTR, PSTR, PSTR, DWORD ); //... bool Debug::LoadImageHlpMod() { if ( NULL == ( hImagehlpDLL = LoadLibrary("Imagehlp.dll") ) ) return false; if ( NULL == ( SplitSymbols = ( pSplitSymbols ) GetProcAddress( hImagehlpDLL, "SplitSymbols" ) ) ) return false; return true; } // ... char *DebugFile = NULL; DebugFile =(char *) HeapAlloc( hHeapHandle, HEAP_ZERO_MEMORY, MAX_PATH ); if ( NULL == DebugFile ) { std::cerr << "Debug::StartupSymbolSystem - HeapAlloc falhou. Impossivel reservar memoria no heap. Erro : " << GetLastError() << std::endl; return false; } if ( FALSE == SplitSymbols( (PSTR)&("compression++1.exe"), NULL, (PSTR)DebugFile, 0 ) ) { std::cerr << "Debug::StartupSymbolSystem - SplitSymbol falhou. Nao foi criado o ficheiro " << std::hex << DebugFile << ". Erro : " << GetLastError() << std::endl; return false; } ( note : I do know that (PSTR)&("") and std:: are not necessary. I do use them as a mnemonic to fixup later. ) The function returns false, and GetLastError() reports 0xc0000005. I am using Windows Vista x32 Basic. The compiler is Mingw fully patched. The DLL version I do not know, but I may look it up later. Please advise. Thank you all in advance for the help you always provide. _________________________________________________________________ Navegue sem medo: O Internet Explorer 8 te deixa mais protegido. Baixe gratuitamente. http://go.microsoft.com/?linkid=9707132 |