protected Gate?fail(ValidString reason = null) { #if !AL_OPTIMIZE logData = new LogData(this, target, reason); #endif return(null); }
protected Gate?Bypass(ValidString reason = null) { #if !AL_OPTIMIZE SetLogData(target, reason); #endif return(null); }
public void FormatUnsignedTest() { string input = "-111"; int expected = 111; Assert.AreEqual(expected, ValidString.FormatUnsigned(input)); }
protected Gate?cont(ValidString reason = null) { StatusRef.hold = status.cont(); #if !AL_OPTIMIZE SetLogData(target, reason); #endif return(null); }
private void button1_Click(object sender, EventArgs e) { double temp; if (validTextBox1.Type == TypeValid.SDecimal) { temp = ValidString.ToDouble(validTextBox1.Text, 'S'); MessageBox.Show("La temperatura fue de " + temp); } else { MessageBox.Show("Dato: " + validTextBox1.Text); } }
public void MultipleFormatUnsignedTest() { string[] input = { "111", "q111", "111q", "1q1q1" }; int assert = 111; bool passed = true; foreach (string x in input) { if (ValidString.FormatUnsigned(x) != assert) { passed = false; } } Assert.AreEqual(true, passed); }
private void validTextBox1_Validating(object sender, CancelEventArgs e) { int age; double price; if (validTextBox1.Type == TypeValid.Numeric) { if (comboBox1.SelectedIndex == 1 && validTextBox1.Text.Length != 10) { validTextBox1.MsgError.SetError(validTextBox1, "La cedula solo puede ser de 10 dígitos."); e.Cancel = true; } else if (comboBox1.SelectedIndex == 2) { age = Convert.ToInt32(validTextBox1.Text); if (validTextBox1.Text.Length != 3) { validTextBox1.MsgError.SetError(validTextBox1, "La edad solo puede ser de 3 digitos"); e.Cancel = true; } if (!(age >= 1 && age <= 110)) { validTextBox1.MsgError.SetError(validTextBox1, "La edad debe estar en el rango de 1 al 110."); e.Cancel = true; } } } else if (validTextBox1.Type == TypeValid.Decimal) { price = ValidString.ToDouble(validTextBox1.Text); if (!(price >= 1 && price <= 5000)) { validTextBox1.MsgError.SetError(validTextBox1, "El precio debe estar en el rango de 1 a 5000 USD."); e.Cancel = true; } } }
public static pending done(ValidString reason = null) => _done;
protected Gate Eval(ValidString reason = null) => new Gate(this, new LogData(this, ".", reason));
public static pending cont(ValidString reason = null, [P] S p = "", [M] S m = "", [L] int l = 0) => Lg.Pending(pending._cont, reason, p, m, l);
protected Gate done(ValidString reason = null) { return(new Gate(this, new LogData(this, ".", reason))); }
public static failure fail(ValidString reason = null, [P] S p = "", [M] S m = "", [L] int l = 0) => Lg.Failure(reason, p, m, l);
public static loop cont(ValidString reason = null, [P] S p = "", [M] S m = "", [L] int l = 0) => Lg.Forever(reason, p, m, l);
[Test] public void Implicit() { LogString s = ((LogString)null) && "Foo"; ValidString v = s; }
/// <summary> /// The LookupPrivilegeDisplayName method is invoked to map the name /// of a privilege into a display text string in the caller's language. /// </summary> /// <param name="handleInput">Contains policy handle obtained from OpenPolicy/OpenPolicy2 </param> /// <param name="name">It is for validating the privilege name passed in </param> /// <param name="privilegeName">Contains privilege name </param> /// <param name="displayName">Out param contains valid or invalid /// display text of the passed in privilegename </param> /// <returns>Returns Success if the method is successful /// Returns AccessDenied if the caller does not have the permissions to /// perform this operation /// Returns InvalidHandle if the passed in is a valid object handle /// Returns InvalidParameter if one or more of the supplied parameters was invalid /// Returns NoSuchPrivilege if the privilege luid is not recognized by the server</returns> public ErrorStatus LookupPrivilegeDisplayName( int handleInput, ValidString name, string privilegeName, out ValidString displayName) { _RPC_UNICODE_STRING?inputPrivilegeName = new _RPC_UNICODE_STRING(); _RPC_UNICODE_STRING inputPrivilegeName1 = new _RPC_UNICODE_STRING(); _RPC_UNICODE_STRING?outputPrivilegeName = new _RPC_UNICODE_STRING(); Hashtable htPrivilegeNameNLUID = new Hashtable(); short shortClientLanguage = 0, shortClientSystemDefaultLanguage = 0; ushort?ushortLanguageReturned = 0; utilities.privilegeInformation(ref htPrivilegeNameNLUID); inputPrivilegeName1 = (_RPC_UNICODE_STRING)inputPrivilegeName; if (name == ValidString.Invalid) { shortClientLanguage = 9; utilities.nameOfPrivilege(PrivilegeType.InValid, ref inputPrivilegeName1); inputPrivilegeName1.Length = (ushort)((2 * inputPrivilegeName1.Buffer.Length) + 1); inputPrivilegeName1.MaximumLength = (ushort)(inputPrivilegeName1.Length + 2); } else if (stPolicyInformation.PHandle != handleInput) { shortClientLanguage = 9; utilities.nameOfPrivilege(PrivilegeType.Valid, ref inputPrivilegeName1); utilities.inValidHandle(); } else if (!htPrivilegeNameNLUID.ContainsValue(privilegeName)) { shortClientLanguage = 9; utilities.nameOfPrivilege(PrivilegeType.NoSuchPrivilege, ref inputPrivilegeName1); } else if ((uintAccessMask & ACCESS_MASK.POLICY_LOOKUP_NAMES) != ACCESS_MASK.POLICY_LOOKUP_NAMES) { utilities.nameOfPrivilege(PrivilegeType.Valid, ref inputPrivilegeName1); shortClientLanguage = 9; } else { shortClientLanguage = 9; utilities.nameOfPrivilege(PrivilegeType.Valid, ref inputPrivilegeName1); } inputPrivilegeName = inputPrivilegeName1; uintMethodStatus = lsadClientStack.LsarLookupPrivilegeDisplayName( PolicyHandle.Value, inputPrivilegeName, shortClientLanguage, shortClientSystemDefaultLanguage, out outputPrivilegeName, out ushortLanguageReturned); displayName = (outputPrivilegeName == null) ? ValidString.Invalid : ValidString.Valid; if (name == ValidString.Invalid) { #region MS-LSAD_R823 Site.CaptureRequirementIfAreEqual <uint>( (uint)ErrorStatus.InvalidParameter, (uint)uintMethodStatus, "MS-LSAD", 823, @"In LsarLookupPrivilegeDisplayName method server MUST return STATUS_INVALID_PARAMETER if One or more of the supplied parameters was invalid."); #endregion } else if (stPolicyInformation.PHandle != handleInput) { lsadClientStack.LsarDeleteObject(ref PolicyHandle); PolicyHandle = utilities.tempPolicyHandle; #region MS-LSAD_R814 Site.CaptureRequirementIfAreEqual <uint>( (uint)ErrorStatus.InvalidHandle, (uint)uintMethodStatus, "MS-LSAD", 814, @"In LsarLookupPrivilegeDisplayName method,If PolicyHandle is not a valid context handle to the policy object, the server MUST return STATUS_INVALID_HANDLE."); #endregion } else if ((uintAccessMask & ACCESS_MASK.POLICY_LOOKUP_NAMES) != ACCESS_MASK.POLICY_LOOKUP_NAMES) { #region MS-LSAD_R815 Site.CaptureRequirementIfAreEqual <uint>( (uint)ErrorStatus.AccessDenied, (uint)uintMethodStatus, "MS-LSAD", 815, @"In PolicyHandle parameter of LsarLookupPrivilegeDisplayName method ,server MUST verify that the caller has POLICY_LOOKUP_NAMES access and return STATUS_ACCESS_DENIED otherwise"); #endregion } else if (!htPrivilegeNameNLUID.ContainsValue(privilegeName)) { #region MS-LSAD_R817 Site.CaptureRequirementIfAreEqual <uint>( (uint)ErrorStatus.NoSuchPrivilege, (uint)uintMethodStatus, "MS-LSAD", 817, @"In LsarLookupPrivilegeDisplayName method , If the entry cannot be located, the server MUST return STATUS_NO_SUCH_PRIVILEGE."); #endregion } else { htPrivilegeNameNLUID.Clear(); #region MS-LSAD_R822 Site.CaptureRequirementIfAreEqual <uint>( (uint)ErrorStatus.Success, (uint)uintMethodStatus, "MS-LSAD", 822, @"In LsarLookupPrivilegeDisplayName method server MUST return STATUS_SUCCESS if request is successfully completed."); #endregion #region MS-LSAD_R816 Site.CaptureRequirementIfAreEqual <uint>( (uint)ErrorStatus.Success, (uint)uintMethodStatus, "MS-LSAD", 816, @"In LsarLookupPrivilegeDisplayName method server MUST locate the entry with the same name in the data store (RPC_UNICODE_STRING)."); #endregion #region MS-LSAD_R521 Site.CaptureRequirementIfAreEqual <uint>( (uint)ErrorStatus.Success, (uint)uintMethodStatus, "MS-LSAD", 821, @"In LsarLookupPrivilegeDisplayName method , If neither ClientLanguage nor ClientSystemDefaultLanguage can be found, the server MUST return the description in the server's own language."); #endregion } return((ErrorStatus)uintMethodStatus); }
public static status cont(ValidString reason = null, [P] S p = "", [M] S m = "", [L] int l = 0) => log?Lg.Status(_cont, reason, p, m, l) : _cont;
public status this[ValidString reason] => this;
public static status fail(ValidString reason = null, [P] S p = "", [M] S m = "", [L] int l = 0) => log?Lg.Status(_fail, reason, p, m, l) : _fail;
public static status done(ValidString reason = null, [P] S p = "", [M] S m = "", [L] int l = 0) => log?Lg.Status(_done, reason, p, m, l) : _done;
public status Via(ValidString reason = null, [P] string path = "", [M] string member = "", [L] int line = 0) => log?Lg.Status(this, reason, path, member, line) : this;
public status this[ValidString reason] => log ? new status(this, new LogTrace(trace.scope, trace.next, reason)) : this;
/// <summary> /// The LookupPrivilegeValue method is invoked to map the name of a privilege /// into a locally unique identifier (luid) by which it is known on the server. /// The locally unique value of the privilege can then be used in subsequent calls /// to other methods, such as LsarAddPrivilegesToAccount. /// </summary> /// <param name="handleInput">Contains policy handle obtained from OpenPolicy/OpenPolicy2 </param> /// <param name="name">It is for validating the privilege name passed in </param> /// <param name="privilegeName">Contains privilege name </param> /// <param name="luid">Out param contains valid or invalid /// luid of the passed in privilege name </param> /// <returns>Returns Success if the method is successful /// Returns AccessDenied if the caller does not have the permissions to /// perform this operation /// Returns InvalidHandle if the passed in is a valid object handle /// Returns InvalidParameter if one or more of the supplied parameters was invalid /// Returns NoSuchPrivilege if the privilege name is not recognized by the server</returns> public ErrorStatus LookupPrivilegeValue( int handleInput, ValidString name, string privilegeName, out PrivilegeLUID luid) { _RPC_UNICODE_STRING inputPrivilegeName = new _RPC_UNICODE_STRING(); Hashtable htPrivilegeNameNLUID = new Hashtable(); _LUID?outputPrivilegeLUID = new _LUID(); utilities.privilegeInformation(ref htPrivilegeNameNLUID); if (name == ValidString.Invalid) { utilities.nameOfPrivilege(PrivilegeType.InValid, ref inputPrivilegeName); inputPrivilegeName.Length = (ushort)((2 * inputPrivilegeName.Buffer.Length) + 1); inputPrivilegeName.MaximumLength = (ushort)(inputPrivilegeName.Length + 2); } else if (stPolicyInformation.PHandle != handleInput) { utilities.nameOfPrivilege(PrivilegeType.Valid, ref inputPrivilegeName); utilities.inValidHandle(); } else if ((uintAccessMask & ACCESS_MASK.POLICY_LOOKUP_NAMES) != ACCESS_MASK.POLICY_LOOKUP_NAMES) { utilities.nameOfPrivilege(PrivilegeType.Valid, ref inputPrivilegeName); } else if (!htPrivilegeNameNLUID.ContainsValue(privilegeName)) { utilities.nameOfPrivilege(PrivilegeType.NoSuchPrivilege, ref inputPrivilegeName); } else { utilities.nameOfPrivilege(PrivilegeType.Valid, ref inputPrivilegeName); } uintMethodStatus = lsadClientStack.LsarLookupPrivilegeValue( PolicyHandle.Value, inputPrivilegeName, out outputPrivilegeLUID); luid = (outputPrivilegeLUID.Value.HighPart == 0 & outputPrivilegeLUID.Value.LowPart == 0) ? PrivilegeLUID.Invalid : PrivilegeLUID.Valid; if (name == ValidString.Invalid) { #region MS-LSAD_R807 Site.CaptureRequirementIfAreEqual <uint>( (uint)ErrorStatus.InvalidParameter, (uint)uintMethodStatus, "MS-LSAD", 807, @"In LsarLookupPrivilegeValue method server MUST return STATUS_INVALID_PARAMETER if One or more of the supplied parameters was invalid."); #endregion } else if (stPolicyInformation.PHandle != handleInput) { #region MS-LSAD_R804 Site.CaptureRequirementIfAreEqual <uint>( (uint)ErrorStatus.InvalidHandle, (uint)uintMethodStatus, "MS-LSAD", 804, @"In LsarLookupPrivilegeValue method,If PolicyHandle is not a valid context handle to the policy object, the server MUST return STATUS_INVALID_HANDLE."); #endregion lsadClientStack.LsarDeleteObject(ref PolicyHandle); PolicyHandle = utilities.tempPolicyHandle; } else if ((uintAccessMask & ACCESS_MASK.POLICY_LOOKUP_NAMES) != ACCESS_MASK.POLICY_LOOKUP_NAMES) { #region MS-LSAD_R805 Site.CaptureRequirementIfAreEqual <uint>( (uint)ErrorStatus.AccessDenied, (uint)uintMethodStatus, "MS-LSAD", 805, @"In PolicyHandle parameter of LsarLookupPrivilegeValue method, server MUST verify that the caller has POLICY_LOOKUP_NAMES access and return STATUS_ACCESS_DENIED otherwise"); #endregion } else if (!htPrivilegeNameNLUID.ContainsValue(privilegeName)) { #region MS-LSAD_R806 Site.CaptureRequirementIfAreEqual <uint>( (uint)ErrorStatus.NoSuchPrivilege, (uint)uintMethodStatus, "MS-LSAD", 806, @"In LsarLookupPrivilegeValue method , If the value in the Name argument is not recognized by the server, the server MUST fail the request with STATUS_NO_SUCH_PRIVILEGE"); #endregion } else { htPrivilegeNameNLUID.Clear(); #region MS-LSAD_R808 if ((uint)ErrorStatus.Success == (uint)uintMethodStatus) { Site.CaptureRequirement( "MS-LSAD", 808, @"In LsarLookupPrivilegeValue method server MUST return STATUS_SUCCESS if request is successfully completed."); } #endregion } return((ErrorStatus)uintMethodStatus); }
public static loop cont(ValidString reason = null) => _cont;
public static impending cont(ValidString reason = null) => _cont;
public static action @void(ValidString reason = null, [P] S p = "", [M] S m = "", [L] int l = 0) => Lg.Action(reason, p, m, l);
/// <summary> /// The LookupPrivilegeName method is invoked to map the luid of a privilege /// into a string name by which it is known on the server. /// </summary> /// <param name="handleInput">Contains policy handle obtained from OpenPolicy/OpenPolicy2 </param> /// <param name="luid">It is for validating the privilege luid passed in </param> /// <param name="privilegeLuid">Contains privilege luid </param> /// <param name="privilegeName">Out param contains valid or invalid /// privilegeName of the passed in privilege luid </param> /// <returns>Returns Success if the method is successful /// Returns AccessDenied if the caller does not have the permissions to /// perform this operation /// Returns InvalidHandle if the passed in is a valid object handle /// Returns InvalidParameter if one or more of the supplied parameters was invalid /// Returns NoSuchPrivilege if the privilege luid is not recognized by the server</returns> public ErrorStatus LookupPrivilegeName( int handleInput, PrivilegeLUID luid, string privilegeLuid, out ValidString privilegeName) { _RPC_UNICODE_STRING?outputPrivilegeName = new _RPC_UNICODE_STRING(); _RPC_UNICODE_STRING outputComparePrivilegeName = new _RPC_UNICODE_STRING(); _LUID[] inputPrivilegeLUID = new _LUID[1]; Hashtable htPrivilegeNameNLUID = new Hashtable(); string nameOfPrivilege = string.Empty; char[] charNameOfPrivilege = new char[25]; bool isEqual = false; nameOfPrivilege = PrivilegeName; charNameOfPrivilege = nameOfPrivilege.ToCharArray(); outputComparePrivilegeName.Buffer = new ushort[nameOfPrivilege.Length]; Array.Copy(charNameOfPrivilege, outputComparePrivilegeName.Buffer, charNameOfPrivilege.Length); outputComparePrivilegeName.Length = (ushort)(2 * outputComparePrivilegeName.Buffer.Length); outputComparePrivilegeName.MaximumLength = (ushort)(outputComparePrivilegeName.Length + 2); utilities.privilegeInformation(ref htPrivilegeNameNLUID); if (luid == PrivilegeLUID.Invalid) { utilities.valuesOfLUID(PrivilegeLUID.Invalid, ref inputPrivilegeLUID); inputPrivilegeLUID[0].LowPart = 56; inputPrivilegeLUID[0].HighPart = 0; } else if (stPolicyInformation.PHandle != handleInput) { utilities.valuesOfLUID(PrivilegeLUID.Valid, ref inputPrivilegeLUID); utilities.inValidHandle(); } else if ((uintAccessMask & ACCESS_MASK.POLICY_LOOKUP_NAMES) != ACCESS_MASK.POLICY_LOOKUP_NAMES) { utilities.valuesOfLUID(PrivilegeLUID.Valid, ref inputPrivilegeLUID); } else if (!htPrivilegeNameNLUID.ContainsKey(privilegeLuid)) { utilities.valuesOfLUID(PrivilegeLUID.NotPresentLuid, ref inputPrivilegeLUID); } else { utilities.valuesOfLUID(PrivilegeLUID.Valid, ref inputPrivilegeLUID); } uintMethodStatus = lsadClientStack.LsarLookupPrivilegeName( PolicyHandle.Value, inputPrivilegeLUID[0], out outputPrivilegeName); if (outputPrivilegeName != null) { isEqual = utilities.CheckTheRpcStrings(outputPrivilegeName.Value, outputComparePrivilegeName); if (isEqual) { privilegeName = ValidString.Valid; } else { privilegeName = ValidString.Invalid; } } else { privilegeName = (outputPrivilegeName == null) ? ValidString.Invalid : ValidString.Valid; } if (!(luid == PrivilegeLUID.Invalid)) { if (stPolicyInformation.PHandle != handleInput) { #region MS-LSAD_R809 Site.CaptureRequirementIfAreEqual <uint>( (uint)ErrorStatus.InvalidHandle, (uint)uintMethodStatus, "MS-LSAD", 809, @"In LsarLookupPrivilegeName method ,If PolicyHandle is not a valid context handle to the policy object, the server MUST return STATUS_INVALID_HANDLE"); #endregion lsadClientStack.LsarDeleteObject(ref PolicyHandle); PolicyHandle = utilities.tempPolicyHandle; } else if ((uintAccessMask & ACCESS_MASK.POLICY_LOOKUP_NAMES) != ACCESS_MASK.POLICY_LOOKUP_NAMES) { #region MS-LSAD_R810 Site.CaptureRequirementIfAreEqual <uint>( (uint)ErrorStatus.AccessDenied, (uint)uintMethodStatus, "MS-LSAD", 810, @"In PolicyHandle parameter of LsarLookupPrivilegeName method, server MUST verify that the caller has POLICY_LOOKUP_NAMES access and return STATUS_ACCESS_DENIED otherwise."); #endregion } else if (!htPrivilegeNameNLUID.ContainsKey(privilegeLuid)) { #region MS-LSAD_R811 Site.CaptureRequirementIfAreEqual <uint>( (uint)ErrorStatus.NoSuchPrivilege, (uint)uintMethodStatus, "MS-LSAD", 811, @"In LsarLookupPrivilegeName method,If the LUID in the Value argument is not recognized by the server, the server MUST fail the request with STATUS_NO_SUCH_PRIVILEGE"); #endregion } else { htPrivilegeNameNLUID.Clear(); #region MS-LSAD_R813 Site.CaptureRequirementIfAreEqual <uint>( (uint)ErrorStatus.Success, (uint)uintMethodStatus, "MS-LSAD", 813, @"In LsarLookupPrivilegeName method server MUST return STATUS_SUCCESS if request is successfully completed."); #endregion } } return((ErrorStatus)uintMethodStatus); }
public static Active.Core.status status(this bool self, ValidString reason = null) => self ? Active.Core.status._done : Active.Core.status._fail;
public static X status(this bool self, ValidString reason = null, [P] string path = "", [M] string member = "", [L] int line = 0) => X.log ? Lg.Status(self ? X._done : X._fail, reason, path, member, line) : self ? X._done : X._fail;
public static impending doom(ValidString reason = null) => _doom;
public static impending doom (ValidString reason = null, [P] S p = "", [M] S m = "", [L] int l = 0) => Lg.Impending(impending._fail, reason, p, m, l);