25 typedef struct _COMMON_PAGE_CONTEXT
33 _In_opt_ PVOID Context,
41 _In_ LPPROPSHEETPAGE ppsp
88 _In_opt_ PVOID Context,
93 HPROPSHEETPAGE propSheetPageHandle;
94 PROPSHEETPAGE propSheetPage;
99 pageContext->OpenObject = OpenObject;
100 pageContext->Context = Context;
102 memset(&propSheetPage, 0,
sizeof(PROPSHEETPAGE));
103 propSheetPage.dwSize =
sizeof(PROPSHEETPAGE);
104 propSheetPage.dwFlags = PSP_USECALLBACK;
105 propSheetPage.pszTemplate = Template;
106 propSheetPage.pfnDlgProc = DlgProc;
107 propSheetPage.lParam = (LPARAM)pageContext;
110 propSheetPageHandle = CreatePropertySheetPage(&propSheetPage);
115 return propSheetPageHandle;
121 _In_ LPPROPSHEETPAGE ppsp
128 if (uMsg == PSPCB_ADDREF)
132 else if (uMsg == PSPCB_RELEASE)
148 hwndDlg, uMsg, wParam, lParam, L
"PageContext");
153 _In_opt_ PVOID Context
164 static VOID PhpRefreshEventPageInfo(
177 EVENT_BASIC_INFORMATION basicInfo;
178 PWSTR eventType = L
"Unknown";
179 PWSTR eventState = L
"Unknown";
183 switch (basicInfo.EventType)
186 eventType = L
"Notification";
189 eventType = L
"Synchronization";
193 eventState = basicInfo.EventState > 0 ? L
"True" : L
"False";
196 SetDlgItemText(hwndDlg,
IDC_TYPE, eventType);
199 NtClose(eventHandle);
221 PhpRefreshEventPageInfo(hwndDlg, pageContext);
226 switch (LOWORD(wParam))
235 if (
NT_SUCCESS(status = pageContext->OpenObject(
241 switch (LOWORD(wParam))
244 NtSetEvent(eventHandle, NULL);
247 NtResetEvent(eventHandle, NULL);
250 NtPulseEvent(eventHandle, NULL);
254 NtClose(eventHandle);
257 PhpRefreshEventPageInfo(hwndDlg, pageContext);
260 PhShowStatus(hwndDlg, L
"Unable to open the event", status, 0);
273 _In_opt_ PVOID Context
307 switch (LOWORD(wParam))
313 HANDLE eventPairHandle;
315 if (
NT_SUCCESS(status = pageContext->OpenObject(
317 EVENT_PAIR_ALL_ACCESS,
321 switch (LOWORD(wParam))
324 NtSetLowEventPair(eventPairHandle);
327 NtSetHighEventPair(eventPairHandle);
331 NtClose(eventPairHandle);
335 PhShowStatus(hwndDlg, L
"Unable to open the event pair", status, 0);
348 _In_opt_ PVOID Context
359 static VOID PhpRefreshMutantPageInfo(
368 SEMAPHORE_QUERY_STATE,
372 MUTANT_BASIC_INFORMATION basicInfo;
373 MUTANT_OWNER_INFORMATION ownerInfo;
377 SetDlgItemInt(hwndDlg,
IDC_COUNT, basicInfo.CurrentCount,
TRUE);
378 SetDlgItemText(hwndDlg,
IDC_ABANDONED, basicInfo.AbandonedState ? L
"True" : L
"False");
382 SetDlgItemText(hwndDlg,
IDC_COUNT, L
"Unknown");
393 if (ownerInfo.ClientId.UniqueProcess != NULL)
401 SetDlgItemText(hwndDlg,
IDC_OWNER, L
"N/A");
406 SetDlgItemText(hwndDlg,
IDC_OWNER, L
"Unknown");
409 NtClose(mutantHandle);
437 PhpRefreshMutantPageInfo(hwndDlg, pageContext);
447 _In_opt_ PVOID Context
458 static VOID PhpRefreshSectionPageInfo(
463 HANDLE sectionHandle;
465 PWSTR sectionType = L
"Unknown";
471 SECTION_QUERY | SECTION_MAP_READ,
477 SECTION_QUERY | SECTION_MAP_READ,
488 sectionType = L
"Commit";
490 sectionType = L
"File";
492 sectionType = L
"Image";
494 sectionType = L
"Reserve";
509 SetDlgItemText(hwndDlg,
IDC_TYPE, sectionType);
513 NtClose(sectionHandle);
534 PhpRefreshSectionPageInfo(hwndDlg, pageContext);
544 _In_opt_ PVOID Context
555 static VOID PhpRefreshSemaphorePageInfo(
560 HANDLE semaphoreHandle;
564 SEMAPHORE_QUERY_STATE,
568 SEMAPHORE_BASIC_INFORMATION basicInfo;
581 NtClose(semaphoreHandle);
603 PhpRefreshSemaphorePageInfo(hwndDlg, pageContext);
608 switch (LOWORD(wParam))
614 HANDLE semaphoreHandle;
616 if (
NT_SUCCESS(status = pageContext->OpenObject(
618 LOWORD(wParam) ==
IDC_ACQUIRE ? SYNCHRONIZE : SEMAPHORE_MODIFY_STATE,
622 switch (LOWORD(wParam))
626 LARGE_INTEGER timeout;
628 timeout.QuadPart = 0;
629 NtWaitForSingleObject(semaphoreHandle,
FALSE, &timeout);
633 NtReleaseSemaphore(semaphoreHandle, 1, NULL);
637 NtClose(semaphoreHandle);
640 PhpRefreshSemaphorePageInfo(hwndDlg, pageContext);
643 PhShowStatus(hwndDlg, L
"Unable to open the semaphore", status, 0);
656 _In_opt_ PVOID Context
667 static VOID PhpRefreshTimerPageInfo(
680 TIMER_BASIC_INFORMATION basicInfo;
684 SetDlgItemText(hwndDlg,
IDC_SIGNALED, basicInfo.TimerState ? L
"True" : L
"False");
691 NtClose(timerHandle);
713 PhpRefreshTimerPageInfo(hwndDlg, pageContext);
718 switch (LOWORD(wParam))
725 if (
NT_SUCCESS(status = pageContext->OpenObject(
731 switch (LOWORD(wParam))
734 NtCancelTimer(timerHandle, NULL);
738 NtClose(timerHandle);
741 PhpRefreshTimerPageInfo(hwndDlg, pageContext);
744 PhShowStatus(hwndDlg, L
"Unable to open the timer", status, 0);