/* * addKERNEL - add the KERNEL module to the library load (WOW) */ static void addKERNEL( void ) { #if 0 /* * there are bugs in the way VDMDBG.DLL implements some of this * stuff, so this is currently disabled */ MODULEENTRY me; thread_info *ti; IMAGE_NOTE im; int rc; ti = FindThread( DebugeeTid ); me.dwSize = sizeof( MODULEENTRY ); for( rc = pVDMModuleFirst( ProcessInfo.process_handle, ti->thread_handle, &me, NULL, 0 ); rc != 0; rc = pVDMModuleNext( ProcessInfo.process_handle, ti->thread_handle, &me, NULL, 0 ) ) { if( !memicmp( me.szModule, "KERNEL", 6 ) ) { memcpy( &im.Module, &me.szModule, sizeof( me.szModule ) ); memcpy( &im.FileName, &me.szExePath, sizeof( me.szExePath ) ); AddLib( TRUE, &im ); break; } me.dwSize = sizeof( MODULEENTRY ); } #else IMAGE_NOTE im; /* * this is a giant kludge, but it works. Since KERNEL is already * loaded in the WOW , we never get a DLL load notification, so * we can't show any symbols. This fakes up the necessary information */ strcpy( im.Module, "KERNEL" ); GetSystemDirectory( im.FileName, sizeof( im.FileName ) ); strcat( im.FileName, "\\KRNL386.EXE" ); AddLib( TRUE, &im ); #endif }
/* * AddInitialLibs - called the first time we can get information * about loaded shared libs. */ int AddInitialLibs( struct link_map *first_lmap ) { struct link_map lmap; struct link_map *dbg_lmap; int count = 0; dbg_lmap = first_lmap; while( dbg_lmap != NULL ) { if( !GetLinkMap( pid, dbg_lmap, &lmap ) ) break; AddLib( &lmap ); ++count; dbg_lmap = lmap.l_next; } return( count ); }
/* * AddOneLib - called when dynamic linker is adding a library. Unfortunately * we don't get told which library, so we just have to zip through the list * until we find one we don't know about yet. */ int AddOneLib( struct link_map *first_lmap ) { struct link_map lmap; struct link_map *dbg_lmap; int count = 0; lib_load_info *lli; dbg_lmap = first_lmap; while( dbg_lmap != NULL ) { if( !GetLinkMap( pid, dbg_lmap, &lmap ) ) break; lli = FindLib( (addr_off)lmap.l_ld ); if( lli == NULL ) { AddLib( &lmap ); ++count; } dbg_lmap = lmap.l_next; } return( count ); }
/* * addAllWOWModules - add all modules as libraries. This is invoked if * WOW was already running, since we will get no * lib load notifications if it was. */ static void addAllWOWModules( void ) { MODULEENTRY me; thread_info *ti; IMAGE_NOTE im; int rc; ti = FindThread( DebugeeTid ); me.dwSize = sizeof( MODULEENTRY ); for( rc = pVDMModuleFirst( ProcessInfo.process_handle, ti->thread_handle, &me, NULL, 0 ); rc != 0 && strcmp( me.szModule, WOWAppInfo.modname ) != 0; rc = pVDMModuleNext( ProcessInfo.process_handle, ti->thread_handle, &me, NULL, 0 ) ) { memcpy( &im.Module, &me.szModule, sizeof( me.szModule ) ); memcpy( &im.FileName, &me.szExePath, sizeof( me.szExePath ) ); AddLib( TRUE, &im ); me.dwSize = sizeof( MODULEENTRY ); } }