/// <summary> /// Is this a __deref_out single element pointer /// </summary> /// <returns></returns> /// <remarks></remarks> public bool IsDerefOut() { if (_preList.Count != 0 || _itemList.Count != 1 || _postList.Count != 4) { return(false); } // Get the item part SalEntrySet found = FindItem(SalEntryType.NotNull, SalEntryType.ElemWritableTo); if (found == null || !StringComparer.Ordinal.Equals("1", found.FindEntry(SalEntryType.ElemWritableTo).Text)) { return(false); } // Validate first level found = FindPost(SalEntryType.ElemReadableTo); if (found == null || !StringComparer.Ordinal.Equals("1", found.FindEntry(SalEntryType.ElemReadableTo).Text)) { return(false); } // Able to dereference the element if (FindPost(SalEntryType.Deref, SalEntryType.NotNull) == null) { return(false); } found = FindPost(SalEntryType.Deref, SalEntryType.ElemWritableTo); if (found == null || !StringComparer.Ordinal.Equals("1", found.FindEntry(SalEntryType.ElemWritableTo).Text)) { return(false); } found = FindPost(SalEntryType.Deref, SalEntryType.Valid, SalEntryType.Deref, SalEntryType.NotReadOnly); if (found == null) { return(false); } return(true); }
/// <summary> /// Is this an optional out byte bufffer /// /// __out_bcount_opt(sizeArg) /// </summary> /// <param name="sizeArg"></param> /// <returns></returns> /// <remarks></remarks> public bool IsOutByteBufferOptional(ref string sizeArg) { if (_preList.Count != 0 || _itemList.Count != 1 || _postList.Count != 1) { return(false); } SalEntrySet sizeBuf = FindItem(SalEntryType.NotNull, SalEntryType.ByteWritableTo); if (FindPost(SalEntryType.Valid, SalEntryType.Deref, SalEntryType.NotReadOnly, SalEntryType.ExceptThat, SalEntryType.MaybeNull) == null || sizeBuf == null) { return(false); } sizeArg = sizeBuf.FindEntry(SalEntryType.ByteWritableTo).Text; return(true); }
/// <summary> /// Is this an in/out byte buffer /// /// __inout_bcount(size) /// </summary> /// <param name="sizeArg"></param> /// <returns></returns> /// <remarks></remarks> public bool IsInOutByteBuffer(ref string sizeArg) { if (_preList.Count != 1 || _itemList.Count != 1 || _postList.Count != 1) { return(false); } SalEntrySet sizeBuf = FindItem(SalEntryType.NotNull, SalEntryType.ByteWritableTo); if (FindPre(SalEntryType.Valid) == null || FindPost(SalEntryType.Valid, SalEntryType.Deref, SalEntryType.NotReadOnly) == null || sizeBuf == null) { return(false); } sizeArg = sizeBuf.FindEntry(SalEntryType.ByteWritableTo).Text; return(true); }
/// <summary> /// Is this an out parameter that is a buffer of elements /// /// __out_ecount(sizeArg) /// </summary> /// <param name="sizeArg"></param> /// <returns></returns> /// <remarks></remarks> public bool IsOutElementBuffer(out string sizeArg) { sizeArg = null; if (_preList.Count != 0 || _itemList.Count != 1 || _postList.Count != 1) { return(false); } SalEntrySet bufSet = FindItem(SalEntryType.NotNull, SalEntryType.ElemWritableTo); if (FindPost(SalEntryType.Valid, SalEntryType.Deref, SalEntryType.NotReadOnly) == null || bufSet == null) { return(false); } sizeArg = bufSet.FindEntry(SalEntryType.ElemWritableTo).Text; return(true); }
/// <summary> /// Is this an optional in byte buffer /// /// __in_bcount_opt(size) /// </summary> /// <param name="sizeArg"></param> /// <returns></returns> /// <remarks></remarks> public bool IsInByteBufferOptional(out string sizeArg) { sizeArg = null; if (_preList.Count != 3 || _itemList.Count != 0 || _postList.Count != 0) { return(false); } SalEntrySet bufSet = FindPre(SalEntryType.ByteReadableTo, SalEntryType.ExceptThat, SalEntryType.MaybeNull); if (FindPre(SalEntryType.Valid) == null || FindPre(SalEntryType.Deref, SalEntryType.ReadOnly) == null || bufSet == null) { return(false); } sizeArg = bufSet.FindEntry(SalEntryType.ByteReadableTo).Text; return(true); }
/// <summary> /// Is this a in element buffer /// /// __in_ecount(size) /// </summary> /// <param name="sizeArg"></param> /// <returns></returns> /// <remarks></remarks> public bool IsInElementBuffer(out string sizeArg) { sizeArg = null; if (_preList.Count != 3 || _itemList.Count != 0 || _postList.Count != 0) { return(false); } SalEntrySet bufSet = FindPre(SalEntryType.ElemReadableTo); if (FindPre(SalEntryType.Valid) == null || FindPre(SalEntryType.Deref, SalEntryType.ReadOnly) == null || bufSet == null) { return(false); } sizeArg = bufSet.FindEntry(SalEntryType.ElemReadableTo).Text; return(true); }
/// <summary> /// Is this an out byte bufffer which is partiaally readable /// /// __out_bcount_part(sizeArg, readableArg) /// </summary> /// <param name="sizeArg"></param> /// <returns></returns> /// <remarks></remarks> public bool IsOutPartByteBuffer(out string sizeArg, out string readableArg) { sizeArg = null; readableArg = null; if (_preList.Count != 0 || _itemList.Count != 1 || _postList.Count != 2) { return(false); } SalEntrySet sizeBuf = FindItem(SalEntryType.NotNull, SalEntryType.ByteWritableTo); SalEntrySet readBuf = FindPost(SalEntryType.ByteReadableTo); if (FindPost(SalEntryType.Valid, SalEntryType.Deref, SalEntryType.NotReadOnly) == null || sizeBuf == null || readBuf == null) { return(false); } sizeArg = sizeBuf.FindEntry(SalEntryType.ByteWritableTo).Text; readableArg = readBuf.FindEntry(SalEntryType.ByteReadableTo).Text; return(true); }
/// <summary> /// Is this an optional partially readable buffer /// /// __out_ecount_part_opt(sizeArg, readableArg) /// </summary> /// <param name="writableSize"></param> /// <param name="readableSize"></param> /// <returns></returns> /// <remarks></remarks> public bool IsOutPartElementBufferOptional(out string writableSize, out string readableSize) { writableSize = null; readableSize = null; if (_preList.Count != 0 || _itemList.Count != 1 || _postList.Count != 2) { return(false); } SalEntrySet sizeBuf = FindItem(SalEntryType.NotNull, SalEntryType.ElemWritableTo); SalEntrySet readBuf = FindPost(SalEntryType.ElemReadableTo, SalEntryType.ExceptThat, SalEntryType.MaybeNull); if (FindPost(SalEntryType.Valid, SalEntryType.Deref, SalEntryType.NotReadOnly) == null || sizeBuf == null || readBuf == null) { return(false); } writableSize = sizeBuf.FindEntry(SalEntryType.ElemWritableTo).Text; readableSize = readBuf.FindEntry(SalEntryType.ElemReadableTo).Text; return(true); }