Ejemplo n.º 1
0
        // Retrieve information about runtimes that are currently loaded into the target process.
        public IEnumerable <CLRRuntimeInfo> EnumerateLoadedRuntimes(int processId)
        {
            List <CLRRuntimeInfo> runtimes = new List <CLRRuntimeInfo>();
            IEnumUnknown          enumRuntimes;

            using (ProcessSafeHandle hProcess = NativeMethods.OpenProcess(

                       /*
                        * (int)(NativeMethods.ProcessAccessOptions.ProcessVMRead |
                        *                                                      NativeMethods.ProcessAccessOptions.ProcessQueryInformation |
                        *                                                      NativeMethods.ProcessAccessOptions.ProcessDupHandle |
                        *                                                      NativeMethods.ProcessAccessOptions.Synchronize),
                        **/
                       // TODO FIX NOW for debugging.
                       0x1FFFFF, // PROCESS_ALL_ACCESS
                       false,    // inherit handle
                       processId))
            {
                if (hProcess.IsInvalid)
                {
                    throw new Win32Exception(Marshal.GetLastWin32Error());
                }

                enumRuntimes = m_metaHost.EnumerateLoadedRuntimes(hProcess);
            }

            // Since we're only getting one at a time, we can pass NULL for count.
            // S_OK also means we got the single element we asked for.
            for (object oIUnknown; enumRuntimes.Next(1, out oIUnknown, IntPtr.Zero) == 0; /* empty */)
            {
                runtimes.Add(new CLRRuntimeInfo(oIUnknown));
            }

            return(runtimes);
        }
Ejemplo n.º 2
0
 public static extern void GetVersionFromProcess(ProcessSafeHandle hProcess, StringBuilder versionString,
                                                 Int32 bufferSize, out Int32 dwLength);
Ejemplo n.º 3
0
 public static extern bool QueryFullProcessImageName(ProcessSafeHandle hProcess,
                                                     int dwFlags,
                                                     StringBuilder lpExeName,
                                                     ref int lpdwSize);
Ejemplo n.º 4
0
 public static extern void GetVersionFromProcess(ProcessSafeHandle hProcess, StringBuilder versionString,
                                                 Int32 bufferSize, out Int32 dwLength);
Ejemplo n.º 5
0
 public static extern bool QueryFullProcessImageName(ProcessSafeHandle hProcess,
                                                     int dwFlags,
                                                     StringBuilder lpExeName,
                                                     ref int lpdwSize);