/* * @implemented */ BOOL WINAPI QueryMemoryResourceNotification(IN HANDLE ResourceNotificationHandle, OUT PBOOL ResourceState) { EVENT_BASIC_INFORMATION EventInfo; NTSTATUS Status; if ((ResourceNotificationHandle) && (ResourceNotificationHandle != INVALID_HANDLE_VALUE) && (ResourceState)) { Status = NtQueryEvent(ResourceNotificationHandle, EventBasicInformation, &EventInfo, sizeof(EventInfo), NULL); if (NT_SUCCESS(Status)) { *ResourceState = (EventInfo.EventState == 1); return TRUE; } BaseSetLastNTError(Status); } else { SetLastError(ERROR_INVALID_PARAMETER); } return FALSE; }
BOOL WINAPI BaseCheckForVDM(IN HANDLE ProcessHandle, OUT LPDWORD ExitCode) { #if 0 // Unimplemented in BASESRV NTSTATUS Status; EVENT_BASIC_INFORMATION EventBasicInfo; BASE_API_MESSAGE ApiMessage; PBASE_GET_VDM_EXIT_CODE GetVdmExitCode = &ApiMessage.Data.GetVdmExitCode; /* It's VDM if the process is actually a wait handle (an event) */ Status = NtQueryEvent(ProcessHandle, EventBasicInformation, &EventBasicInfo, sizeof(EventBasicInfo), NULL); if (!NT_SUCCESS(Status)) return FALSE; /* Setup the input parameters */ GetVdmExitCode->ConsoleHandle = NtCurrentPeb()->ProcessParameters->ConsoleHandle; GetVdmExitCode->hParent = ProcessHandle; /* Call CSRSS */ Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, NULL, CSR_CREATE_API_NUMBER(BASESRV_SERVERDLL_INDEX, BasepGetVDMExitCode), sizeof(BASE_GET_VDM_EXIT_CODE)); if (!NT_SUCCESS(Status)) return FALSE; /* Get the exit code from the reply */ *ExitCode = GetVdmExitCode->ExitCode; #endif return TRUE; }
/* * @implemented */ BOOL WINAPI QueryMemoryResourceNotification( HANDLE ResourceNotificationHandle, PBOOL ResourceState ) { EVENT_BASIC_INFORMATION ebi; NTSTATUS Status; if(ResourceState != NULL) { Status = NtQueryEvent(ResourceNotificationHandle, EventBasicInformation, &ebi, sizeof(ebi), NULL); if(NT_SUCCESS(Status)) { *ResourceState = ebi.EventState; return TRUE; } SetLastErrorByStatus(Status); } else /* ResourceState == NULL */ { SetLastError(ERROR_INVALID_PARAMETER); } return FALSE; }
/* * propBasicQueryEvent * * Purpose: * * Set information values for Event object type * * If ExtendedInfoAvailable is FALSE then it calls propSetDefaultInfo to set Basic page properties * */ VOID propBasicQueryEvent( _In_ PROP_OBJECT_INFO *Context, _In_ HWND hwndDlg, _In_ BOOL ExtendedInfoAvailable ) { NTSTATUS status; ULONG bytesNeeded; HANDLE hObject; LPWSTR lpInfo; EVENT_BASIC_INFORMATION ebi; SetDlgItemText(hwndDlg, ID_EVENTTYPE, T_CannotQuery); SetDlgItemText(hwndDlg, ID_EVENTSTATE, T_CannotQuery); if (Context == NULL) { return; } // // Open Event object. // hObject = NULL; if (!propOpenCurrentObject(Context, &hObject, EVENT_QUERY_STATE)) { return; } RtlSecureZeroMemory(&ebi, sizeof(EVENT_BASIC_INFORMATION)); status = NtQueryEvent(hObject, EventBasicInformation, &ebi, sizeof(EVENT_BASIC_INFORMATION), &bytesNeeded); if (NT_SUCCESS(status)) { //Event type switch (ebi.EventType) { case NotificationEvent: lpInfo = TEXT("Notification"); break; case SynchronizationEvent: lpInfo = TEXT("Synchronization"); break; default: lpInfo = T_UnknownType; break; } SetDlgItemText(hwndDlg, ID_EVENTTYPE, lpInfo); //Event state switch (ebi.EventState) { case 0: lpInfo = TEXT("Nonsignaled"); break; case 1: lpInfo = TEXT("Signaled"); break; default: lpInfo = TEXT("UnknownState"); break; } SetDlgItemText(hwndDlg, ID_EVENTSTATE, lpInfo); } // // Query object basic and type info if needed. // if (ExtendedInfoAvailable == FALSE) { propSetDefaultInfo(Context, hwndDlg, hObject); } NtClose(hObject); }