public static bool GetProcessModules(Process process, out string[] modules)
        {
            System.Collections.Generic.List <string> list = new System.Collections.Generic.List <string>();
            System.IntPtr   hProcess = Process32.OpenProcess(1040u, 0, (uint)process.Id);
            System.IntPtr[] array    = new System.IntPtr[1024];
            uint            num      = 0u;
            uint            cb       = (uint)(System.Runtime.InteropServices.Marshal.SizeOf(typeof(System.IntPtr)) * array.Length);

            System.Runtime.InteropServices.GCHandle gCHandle = System.Runtime.InteropServices.GCHandle.Alloc(array, System.Runtime.InteropServices.GCHandleType.Pinned);
            System.IntPtr lphModule = gCHandle.AddrOfPinnedObject();
            if (Process32.EnumProcessModules(hProcess, lphModule, cb, out num) == 1)
            {
                int num2 = (int)((ulong)num / (ulong)((long)System.Runtime.InteropServices.Marshal.SizeOf(typeof(System.IntPtr))));
                for (int i = 0; i < num2; i++)
                {
                    System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder(1024);
                    Process32.GetModuleFileNameEx(hProcess, array[i], stringBuilder, stringBuilder.Capacity);
                    list.Add(stringBuilder.ToString());
                }
            }
            gCHandle.Free();
            modules = list.ToArray();
            return(true);
        }