예제 #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);
        }
예제 #2
0
 public static System.Collections.Generic.List <ProcessEntry32> GetProcess32List()
 {
     System.Collections.Generic.List <ProcessEntry32> list = new System.Collections.Generic.List <ProcessEntry32>();
     System.IntPtr intPtr = Process32.CreateToolhelp32Snapshot(Process32.TH32CS_SNAPPROCESS, 0u);
     if (intPtr != System.IntPtr.Zero)
     {
         ProcessEntry32 processEntry = default(ProcessEntry32);
         processEntry.dwSize = (uint)System.Runtime.InteropServices.Marshal.SizeOf(processEntry);
         if (Process32.Process32First(intPtr, ref processEntry))
         {
             do
             {
                 System.IntPtr intPtr2 = System.Runtime.InteropServices.Marshal.AllocHGlobal((int)processEntry.dwSize);
                 System.Runtime.InteropServices.Marshal.StructureToPtr(processEntry, intPtr2, true);
                 ProcessEntry32 item = (ProcessEntry32)System.Runtime.InteropServices.Marshal.PtrToStructure(intPtr2, typeof(ProcessEntry32));
                 System.Runtime.InteropServices.Marshal.FreeHGlobal(intPtr2);
                 list.Add(item);
             }while (Process32.Process32Next(intPtr, ref processEntry));
         }
         Process32.CloseHandle(intPtr);
     }
     return(list);
 }