Skip to content

Commit a10c25c

Browse files
committed
Removed creation time order.
1 parent f4dde4d commit a10c25c

File tree

1 file changed

+1
-37
lines changed

1 file changed

+1
-37
lines changed

Forms/ProcessBrowserForm.cs

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ private void RefreshProcessList()
117117
dt.Columns.Add("name", typeof(string));
118118
dt.Columns.Add("id", typeof(int));
119119
dt.Columns.Add("path", typeof(string));
120-
dt.Columns.Add("create", typeof(DateTime));
121120

122121
nativeHelper.EnumerateProcesses((pid, path) =>
123122
{
@@ -129,52 +128,17 @@ private void RefreshProcessList()
129128
row["name"] = moduleName;
130129
row["id"] = pid;
131130
row["path"] = path;
132-
row["create"] = GetProcessCreateTime((int)pid);
133131
dt.Rows.Add(row);
134132
}
135133
});
136134

137-
dt.DefaultView.Sort = "create DESC";
135+
dt.DefaultView.Sort = "name ASC";
138136

139137
processDataGridView.DataSource = dt;
140138

141139
ApplyFilter();
142140
}
143141

144-
/// <summary>Query the time the process was created.</summary>
145-
/// <param name="pid">The process id.</param>
146-
/// <returns>The time the process was created or <see cref="DateTime.MinValue"/> if an error occurs.</returns>
147-
private DateTime GetProcessCreateTime(int pid)
148-
{
149-
IntPtr handle = IntPtr.Zero;
150-
try
151-
{
152-
handle = nativeHelper.OpenRemoteProcess((int)pid, NativeMethods.PROCESS_QUERY_LIMITED_INFORMATION);
153-
if (!handle.IsNull())
154-
{
155-
long dummy;
156-
long create;
157-
if (NativeMethods.GetProcessTimes(handle, out create, out dummy, out dummy, out dummy))
158-
{
159-
return DateTime.FromFileTime(create);
160-
}
161-
}
162-
}
163-
catch
164-
{
165-
166-
}
167-
finally
168-
{
169-
if (!handle.IsNull())
170-
{
171-
nativeHelper.CloseRemoteProcess(handle);
172-
}
173-
}
174-
175-
return DateTime.MinValue;
176-
}
177-
178142
private void ApplyFilter()
179143
{
180144
var filter = filterTextBox.Text;

0 commit comments

Comments
 (0)