public static extern uint NtQueryMutant( [In] IntPtr MutantHandle, [In] MutantInformationClass MutantInformationClass, [Out] out MutantBasicInformation MutantInformation, [In] int MutantInformationLength, [Out][Optional] out int ReturnLength );
private void UpdateInfo() { MutantBasicInformation basicInfo = _mutantHandle.BasicInformation; labelCurrentCount.Text = basicInfo.CurrentCount.ToString(); labelAbandoned.Text = basicInfo.AbandonedState.ToString(); // Windows Vista and above have owner information. if (OSVersion.IsAboveOrEqual(WindowsVersion.Vista)) { MutantOwnerInformation ownerInfo = _mutantHandle.OwnerInformation; if (ownerInfo.ClientId.ProcessId != 0) { labelOwner.Text = ownerInfo.ClientId.GetName(true); } else { labelOwner.Text = "N/A"; } labelLabelOwner.Visible = true; labelOwner.Visible = true; } else { labelLabelOwner.Visible = false; labelOwner.Visible = false; } }