예제 #1
0
	//*************************************************************************
	// Method:		enumAndLoadModuleSymbols
	// Description: Enumerates and loads the module symbols in a given process
	//
	// Parameters:
	//	hProcess - the handle to the process
	//	pid - the ID of the process
	//
	// Return Value: (none)
	//*************************************************************************
	void StackWalker::enumAndLoadModuleSymbols( HANDLE hProcess, DWORD pid )
	{
		ModuleList modules;
		ModuleListIter it;
		char *img, *mod;

		// fill in module list
		fillModuleList( modules, pid, hProcess );

		for ( it = modules.begin(); it != modules.end(); ++ it )
		{
			// unfortunately, SymLoadModule() wants writeable strings
			img = new char[(*it).imageName.size() + 1];
			strcpy( img, (*it).imageName.c_str() );
			mod = new char[(*it).moduleName.size() + 1];
			strcpy( mod, (*it).moduleName.c_str() );

			SymLoadModule( hProcess, 0, img, mod, (*it).baseAddress, (*it).size );
			/*if ( SymLoadModule( hProcess, 0, img, mod, (*it).baseAddress, (*it).size ) == 0 )
				printf( "Error %lu loading symbols for \"%s\"\n",
					GetLastError(), (*it).moduleName.c_str() );
			else
				printf( "Symbols loaded: \"%s\"\n", (*it).moduleName.c_str() );*/

			delete [] img;
			delete [] mod;
		}
	}
예제 #2
0
void enumAndLoadModuleSymbols( HANDLE hProcess, DWORD pid )
{
	ModuleList modules;
	ModuleListIter it;
	char *img, *mod;

	// fill in module list
	fillModuleList( modules, pid, hProcess );

	for ( it = modules.begin(); it != modules.end(); ++ it )
	{
		// unfortunately, SymLoadModule() wants writeable strings
		img = new char[(*it).imageName.size() + 1];
		strcpy( img, (*it).imageName.c_str() );
		mod = new char[(*it).moduleName.size() + 1];
		strcpy( mod, (*it).moduleName.c_str() );

		SymLoadModule64( hProcess, 0, img, mod, (*it).baseAddress, (*it).size );

		delete [] img;
		delete [] mod;
	}
}