Ejemplo n.º 1
0
        public static List <ProcessEntry32> GetProcess32List()
        {
            Process32.SetPrivilege(Class3.smethod_10(538), true);
            Process.EnterDebugMode();
            List <ProcessEntry32> list = new List <ProcessEntry32>();
            IntPtr intPtr = Process32.CreateToolhelp32Snapshot(Process32.TH32CS_SNAPPROCESS, 0u);

            if (intPtr != IntPtr.Zero)
            {
                ProcessEntry32 processEntry = default(ProcessEntry32);
                processEntry.dwSize = (uint)Marshal.SizeOf(processEntry);
                if (Process32.Process32First(intPtr, ref processEntry))
                {
                    do
                    {
                        IntPtr intPtr2 = Marshal.AllocHGlobal((int)processEntry.dwSize);
                        Marshal.StructureToPtr(processEntry, intPtr2, true);
                        ProcessEntry32 item = (ProcessEntry32)Marshal.PtrToStructure(intPtr2, typeof(ProcessEntry32));
                        Marshal.FreeHGlobal(intPtr2);
                        list.Add(item);
                    }while (Process32.Process32Next(intPtr, ref processEntry));
                }
                Process32.CloseHandle(intPtr);
            }
            return(list);
        }