// EnumModules is called by the debugger when it needs to enumerate the modules in the program. public int EnumModules(out IEnumDebugModules2 ppEnum) { Debug.Assert(Worker.MainThreadId == Worker.CurrentThreadId); DebuggedModule[] modules = m_debuggedProcess.GetModules(); AD7Module[] moduleObjects = new AD7Module[modules.Length]; for (int i = 0; i < modules.Length; i++) { moduleObjects[i] = new AD7Module(modules[i]); } ppEnum = new Microsoft.VisualStudio.Debugger.SampleEngine.AD7ModuleEnum(moduleObjects); return(Constants.S_OK); }