Skip to content

Commit 451eb95

Browse files
committed
Update to latest SDK, Update status messages
1 parent e1943d2 commit 451eb95

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+330
-226
lines changed

SystemInformer/SystemInformer.def

+1
Original file line numberDiff line numberDiff line change
@@ -622,6 +622,7 @@ EXPORTS
622622
PhQuerySymbolicLinkObject
623623
PhQueryTokenVariableSize
624624
PhQueryValueKey
625+
PhQueueUserWorkItem
625626
PhReadFile
626627
PhResolveDevicePrefix
627628
PhRevertImpersonationToken

SystemInformer/actions.c

+18-9
Original file line numberDiff line numberDiff line change
@@ -2314,16 +2314,21 @@ BOOLEAN PhUiRestartProcess(
23142314
{
23152315
if (Process->ProcessId == shellClientId.UniqueProcess)
23162316
{
2317-
status = PhOpenProcess(
2317+
if (NT_SUCCESS(PhOpenProcess(
23182318
&processHandle,
23192319
PROCESS_TERMINATE,
23202320
Process->ProcessId
2321-
);
2322-
2323-
if (NT_SUCCESS(status))
2321+
)))
23242322
{
2325-
PhTerminateProcess(processHandle, STATUS_SUCCESS);
2323+
status = PhTerminateProcess(
2324+
processHandle,
2325+
STATUS_SUCCESS
2326+
);
2327+
23262328
NtClose(processHandle);
2329+
2330+
if (NT_SUCCESS(status))
2331+
goto CleanupExit;
23272332
}
23282333
}
23292334
}
@@ -2361,7 +2366,7 @@ BOOLEAN PhUiRestartProcess(
23612366

23622367
if (!NT_SUCCESS(status = PhGetProcessEnvironment(
23632368
processHandle,
2364-
Process->IsWow64Process ? PH_GET_PROCESS_ENVIRONMENT_WOW64 : 0,
2369+
!!Process->IsWow64Process,
23652370
&environmentBuffer,
23662371
&environmentLength
23672372
)))
@@ -5112,18 +5117,22 @@ BOOLEAN PhUiCloseConnections(
51125117
_In_ ULONG NumberOfConnections
51135118
)
51145119
{
5115-
ULONG (WINAPI* SetTcpEntry_I)(_In_ PMIB_TCPROW pTcpRow) = NULL;
5120+
static ULONG (WINAPI* SetTcpEntry_I)(_In_ PMIB_TCPROW pTcpRow) = NULL;
51165121
BOOLEAN success = TRUE;
51175122
BOOLEAN cancelled = FALSE;
51185123
ULONG result;
51195124
ULONG i;
51205125
MIB_TCPROW tcpRow;
51215126

5122-
SetTcpEntry_I = PhGetDllProcedureAddress(L"iphlpapi.dll", "SetTcpEntry", 0);
5127+
if (!SetTcpEntry_I)
5128+
{
5129+
SetTcpEntry_I = PhGetDllProcedureAddress(L"iphlpapi.dll", "SetTcpEntry", 0);
5130+
}
51235131

51245132
if (!SetTcpEntry_I)
51255133
{
51265134
PhShowError2(WindowHandle, L"This feature is not supported by your operating system.", L"%s", L"");
5135+
PhShowStatus(WindowHandle, L"Unable to close the TCP connection", STATUS_NOT_SUPPORTED, 0);
51275136
return FALSE;
51285137
}
51295138

@@ -5807,7 +5816,7 @@ BOOLEAN PhUiUnloadModule(
58075816

58085817
if (status == STATUS_DLL_NOT_FOUND)
58095818
{
5810-
PhShowError2(WindowHandle, L"Unable to find the module to unload.", L"%s", L"");
5819+
PhShowStatus(WindowHandle, L"Unable to unload the module", 0, ERROR_MOD_NOT_FOUND);
58115820
return FALSE;
58125821
}
58135822

SystemInformer/findobj.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1777,7 +1777,7 @@ VOID PhShowFindObjectsDialog(
17771777
{
17781778
if (!NT_SUCCESS(PhCreateThreadEx(&PhFindObjectsThreadHandle, PhpFindObjectsDialogThreadStart, NULL)))
17791779
{
1780-
PhShowError2(PhMainWndHandle, L"Unable to create the window.", L"%s", L"");
1780+
PhShowStatus(PhMainWndHandle, L"Unable to create the window.", 0, ERROR_OUTOFMEMORY);
17811781
return;
17821782
}
17831783

SystemInformer/hidnproc.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ INT_PTR CALLBACK PhpZombieProcessesDlgProc(
230230
if (NT_SUCCESS(status))
231231
{
232232
PhSetDialogItemText(hwndDlg, IDC_DESCRIPTION,
233-
PhaFormatString(L"%u Zombie process(es), %u terminated process(es).",
233+
PhaFormatString(L"%u zombie process(es), %u terminated process(es).",
234234
NumberOfZombieProcesses, NumberOfTerminatedProcesses)->Buffer
235235
);
236236
InvalidateRect(GetDlgItem(hwndDlg, IDC_DESCRIPTION), NULL, TRUE);

SystemInformer/include/phplug.h

+15-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ typedef enum _PH_GENERAL_CALLBACK
6363
GeneralCallbackProcessProviderAddedEvent, // [process provider thread]
6464
GeneralCallbackProcessProviderModifiedEvent, // [process provider thread]
6565
GeneralCallbackProcessProviderRemovedEvent, // [process provider thread]
66-
GeneralCallbackProcessProviderUpdatedEvent, // [process provider thread]
66+
GeneralCallbackProcessProviderUpdatedEvent, // PPH_PROCESS_PROVIDER_UPDATED_EVENT [process provider thread]
6767
GeneralCallbackServiceProviderAddedEvent, // [service provider thread]
6868
GeneralCallbackServiceProviderModifiedEvent, // [service provider thread]
6969
GeneralCallbackServiceProviderRemovedEvent, // [service provider thread]
@@ -78,6 +78,8 @@ typedef enum _PH_GENERAL_CALLBACK
7878
GeneralCallbackDeviceNotificationEvent, // [device provider thread]
7979

8080
GeneralCallbackTrayIconsInitializing, // [work queue thread]
81+
GeneralCallbackTrayIconsUpdatedEvent,
82+
8183
GeneralCallbackWindowNotifyEvent,
8284
GeneralCallbackProcessStatsNotifyEvent,
8385
GeneralCallbackSettingsUpdated,
@@ -99,6 +101,18 @@ typedef enum _PH_PLUGIN_CALLBACK
99101
PluginCallbackMaximum
100102
} PH_PLUGIN_CALLBACK, *PPH_PLUGIN_CALLBACK;
101103

104+
// Provider events
105+
106+
typedef struct _PH_PROCESS_PROVIDER_UPDATED_EVENT
107+
{
108+
ULONG RunCount;
109+
} PH_PROCESS_PROVIDER_UPDATED_EVENT, *PPH_PROCESS_PROVIDER_UPDATED_EVENT;
110+
111+
#define PH_PROCESS_PROVIDER_UPDATED_EVENT_PTR(RunCount) \
112+
&(PH_PROCESS_PROVIDER_UPDATED_EVENT){ (RunCount) }
113+
114+
// Plugin events
115+
102116
typedef struct _PH_PLUGIN_GET_HIGHLIGHTING_COLOR
103117
{
104118
// Parameter is:

SystemInformer/include/procprpp.h

+4
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,10 @@ typedef struct _PH_STATISTICS_CONTEXT
428428
ULONG64 IoOtherCountDelta; ULONG64 IoOtherCountDeltaMin; ULONG64 IoOtherCountDeltaMax; ULONG64 IoOtherCountDeltaDiff;
429429
ULONG64 OtherTransferCount; ULONG64 OtherTransferCountMin; ULONG64 OtherTransferCountMax; ULONG64 OtherTransferCountDiff;
430430
ULONG64 IoOtherDelta; ULONG64 IoOtherDeltaMin; ULONG64 IoOtherDeltaMax; ULONG64 IoOtherDeltaDiff;
431+
432+
ULONG64 IoTotal; ULONG64 IoTotalMin; ULONG64 IoTotalMax; ULONG64 IoTotalDiff;
433+
ULONG64 IoTotalDelta; ULONG64 IoTotalDeltaMin; ULONG64 IoTotalDeltaMax; ULONG64 IoTotalDeltaDiff;
434+
431435
} PH_STATISTICS_CONTEXT, *PPH_STATISTICS_CONTEXT;
432436

433437
#define WM_PH_PERFORMANCE_UPDATE (WM_APP + 241)

SystemInformer/itemtips.c

+1-7
Original file line numberDiff line numberDiff line change
@@ -518,15 +518,9 @@ VOID PhpFillUmdfDrivers(
518518
)))
519519
return;
520520

521-
#ifdef _WIN64
522-
// Just in case.
523-
if (Process->IsWow64Process)
524-
flags |= PH_GET_PROCESS_ENVIRONMENT_WOW64;
525-
#endif
526-
527521
if (NT_SUCCESS(PhGetProcessEnvironment(
528522
processHandle,
529-
flags,
523+
!!Process->IsWow64Process,
530524
&environment,
531525
&environmentLength
532526
)))

SystemInformer/memedit.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -195,15 +195,15 @@ INT_PTR CALLBACK PhpMemoryEditorDlgProc(
195195

196196
if (context->RegionSize > 1024 * 1024 * 1024) // 1 GB
197197
{
198-
PhShowError2(context->OwnerHandle, L"Unable to edit the memory region because it is too large.", L"%s", L"");
198+
PhShowStatus(context->OwnerHandle, L"Unable to edit the memory region.", 0, MEM_E_INVALID_SIZE);
199199
return TRUE;
200200
}
201201

202202
context->Buffer = PhAllocatePage(context->RegionSize, NULL);
203203

204204
if (!context->Buffer)
205205
{
206-
PhShowError2(context->OwnerHandle, L"Unable to allocate memory for the buffer.", L"%s", L"");
206+
PhShowStatus(context->OwnerHandle, L"Unable to edit the memory region.", 0, ERROR_OUTOFMEMORY);
207207
return TRUE;
208208
}
209209

@@ -442,7 +442,7 @@ INT_PTR CALLBACK PhpMemoryEditorDlgProc(
442442
{
443443
if (offset >= context->RegionSize)
444444
{
445-
PhShowError2(hwndDlg, L"The offset is too large.", L"%s", L"");
445+
PhShowStatus(hwndDlg, L"Unable to edit the memory region.", 0, MEM_E_INVALID_SIZE);
446446
continue;
447447
}
448448

SystemInformer/memlists.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ VOID PhShowMemoryListCommand(
569569
}
570570
else if (!PhGetOwnTokenAttributes().Elevated)
571571
{
572-
PhShowError2(ParentWindow, L"Memory Command", L"System Informer must run elevated to empty all.");
572+
PhShowStatus(ParentWindow, L"Unable to empty the memory list.", 0, ERROR_ELEVATION_REQUIRED);
573573
}
574574
else
575575
{

SystemInformer/memsrch.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ INT_PTR CALLBACK PhpMemoryStringDlgProc(
447447

448448
if (minimumLength < 4)
449449
{
450-
PhShowError2(hwndDlg, L"The minimum length must be at least 4.", L"%s", L"");
450+
PhShowError2(hwndDlg, L"Unable to search for strings.", L"%s", L"The minimum length must be at least 4.");
451451
break;
452452
}
453453

SystemInformer/memsrcht.c

+4-3
Original file line numberDiff line numberDiff line change
@@ -977,7 +977,7 @@ INT_PTR CALLBACK PhpMemoryStringsMinimumLengthDlgProc(
977977

978978
if (!minimumLength || minimumLength > MAXULONG32)
979979
{
980-
PhShowError2(hwndDlg, L"Invalid minimum length.", L"%s", L"");
980+
PhShowError2(hwndDlg, L"Unable to update the length.", L"%s", L"The minimum length is invalid.");
981981
break;
982982
}
983983

@@ -1579,12 +1579,13 @@ BOOLEAN PhpShowMemoryStringTreeDialog(
15791579
context->UseClone = UseClone;
15801580
context->PrevNodeList = PrevNodeList;
15811581

1582-
if (!NT_SUCCESS(PhCreateThread2(PhpShowMemoryStringDialogThreadStart, context)))
1582+
if (!NT_SUCCESS(status = PhCreateThread2(PhpShowMemoryStringDialogThreadStart, context)))
15831583
{
1584-
PhShowError2(ParentWindowHandle, L"Unable to create the window.", L"%s", L"");
15851584
PhDereferenceObject(context->ProcessItem);
15861585
NtClose(context->ProcessHandle);
15871586
PhFree(context);
1587+
1588+
PhShowStatus(ParentWindowHandle, L"Unable to create the window.", status, 0);
15881589
return FALSE;
15891590
}
15901591

SystemInformer/procprv.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -3225,7 +3225,7 @@ VOID PhProcessProviderUpdate(
32253225
}
32263226
}
32273227

3228-
PhInvokeCallback(PhGetGeneralCallback(GeneralCallbackProcessProviderUpdatedEvent), UlongToPtr(runCount));
3228+
PhInvokeCallback(PhGetGeneralCallback(GeneralCallbackProcessProviderUpdatedEvent), PH_PROCESS_PROVIDER_UPDATED_EVENT_PTR(runCount));
32293229
runCount++;
32303230
}
32313231

SystemInformer/procrec.c

+6-1
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,12 @@ INT_PTR CALLBACK PhpProcessRecordDlgProc(
253253
}
254254
else
255255
{
256-
PhShowError2(hwndDlg, L"The process has already terminated; only the process record is available.", L"%s", L"");
256+
PhShowError2(
257+
hwndDlg,
258+
L"Unable to show the process properties.",
259+
L"%s",
260+
L"The process has already terminated; only the process record is available."
261+
);
257262
}
258263
}
259264
break;

SystemInformer/prpgenv.c

+2-8
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,6 @@ VOID PhpRefreshEnvironmentList(
230230
if (NT_SUCCESS(status))
231231
{
232232
HANDLE tokenHandle;
233-
ULONG flags = 0;
234233

235234
PhCreateEnvironmentBlock(&systemDefaultEnvironment, NULL, FALSE);
236235

@@ -244,14 +243,9 @@ VOID PhpRefreshEnvironmentList(
244243
NtClose(tokenHandle);
245244
}
246245

247-
#ifdef _WIN64
248-
if (ProcessItem->IsWow64Process)
249-
flags |= PH_GET_PROCESS_ENVIRONMENT_WOW64;
250-
#endif
251-
252246
status = PhGetProcessEnvironment(
253247
processHandle,
254-
flags,
248+
!!ProcessItem->IsWow64Process,
255249
&environment,
256250
&environmentLength
257251
);
@@ -360,7 +354,6 @@ VOID PhpRefreshEnvironmentList(
360354
}
361355
}
362356

363-
PhApplyTreeNewFilters(&Context->TreeFilterSupport);
364357
TreeNew_NodesStructured(Context->TreeNewHandle);
365358

366359
if (systemDefaultEnvironment)
@@ -1452,6 +1445,7 @@ INT_PTR CALLBACK PhpProcessEnvironmentDlgProc(
14521445
PhLoadSettingsEnvironmentList(context);
14531446

14541447
PhpRefreshEnvironmentList(context, processItem);
1448+
PhApplyTreeNewFilters(&context->TreeFilterSupport);
14551449

14561450
PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
14571451
}

SystemInformer/prpggen.c

+1
Original file line numberDiff line numberDiff line change
@@ -718,6 +718,7 @@ INT_PTR CALLBACK PhpProcessGeneralDlgProc(
718718
else
719719
{
720720
PhShowError2(hwndDlg, L"The process does not exist.", L"%s", L"");
721+
PhShowStatus(hwndDlg, L"The process does not exist.", STATUS_NOT_FOUND, 0);
721722
}
722723
}
723724
break;

SystemInformer/prpgvdm.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ INT_PTR CALLBACK PhpProcessVdmHostProcessDlgProc(
393393
{
394394
if (!PhpTerminateVdmTask(processItem, entry->Task16))
395395
{
396-
PhShowError2(hwndDlg, L"Unable to terminate the task.", L"%s", L"");
396+
PhShowStats(hwndDlg, L"Unable to terminate the task.", 0, PhGetLastError());
397397
}
398398
}
399399
break;

SystemInformer/prpgwmi.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -1027,11 +1027,11 @@ VOID PhpShowWmiProviderStatus(
10271027
{
10281028
if (Message)
10291029
{
1030-
PhShowError2(hWnd, Message, L"%s", statusMessage->Buffer);
1030+
PhShowError2(hWnd, Message, L"%s", PhGetString(statusMessage));
10311031
}
10321032
else
10331033
{
1034-
PhShowError2(hWnd, statusMessage->Buffer, L"%s", L"");
1034+
PhShowError2(hWnd, L"Unable to perform the operation.", L"%s", PhGetString(statusMessage));
10351035
}
10361036

10371037
PhDereferenceObject(statusMessage);
@@ -1040,11 +1040,11 @@ VOID PhpShowWmiProviderStatus(
10401040
{
10411041
if (Message)
10421042
{
1043-
PhShowError2(hWnd, Message, L"%s", L"");
1043+
PhShowError2(hWnd, L"Unable to perform the operation.", L"%s", Message);
10441044
}
10451045
else
10461046
{
1047-
PhShowError2(hWnd, L"Unable to perform the operation.", L"%s", L"");
1047+
PhShowStatus(hWnd, L"Unable to perform the operation.", STATUS_UNSUCCESSFUL, 0);
10481048
}
10491049
}
10501050
}

0 commit comments

Comments
 (0)