/// <summary> /// Returns buffer data /// </summary> public byte[] GetBuffer(int index) { // check object state if (_disposed) { throw new ObjectDisposedException(GetType().FullName); } // parameters validation if ((index < 0) || (index >= BuffersCount)) { throw new ArgumentOutOfRangeException("count"); } // get buffer descriptor IntPtr secBuffer = IntPtrHelper.Add(pvBuffers, index * SSPINative.SecBuffer.Size); // return buffer int size = MarshalHelper.ReadInt32(secBuffer, typeof(SSPINative.SecBuffer), "BufferSize"); if (size > 0) { return(MarshalHelper.ReadBytes(secBuffer, typeof(SSPINative.SecBuffer), "pvBuffer", size)); } else { return(null); } }
private void Init(IntPtr pkgInfo) { _capabilities = MarshalHelper.ReadInt32(pkgInfo, typeof(SSPINative.SecPkgInfo), "Capabilities"); _version = MarshalHelper.ReadInt16(pkgInfo, typeof(SSPINative.SecPkgInfo), "Version"); _RPCID = MarshalHelper.ReadInt16(pkgInfo, typeof(SSPINative.SecPkgInfo), "RPCID"); _maxToken = MarshalHelper.ReadInt32(pkgInfo, typeof(SSPINative.SecPkgInfo), "MaxToken"); _name = MarshalHelper.ReadString(pkgInfo, typeof(SSPINative.SecPkgInfo), "Name"); _comment = MarshalHelper.ReadString(pkgInfo, typeof(SSPINative.SecPkgInfo), "Comment"); }
internal AccessControlEntry(IntPtr pAce) { // parameters validation if (pAce == IntPtr.Zero) { throw new ArgumentNullException("pAce"); } // read ACE properties _aceType = (AccessControlEntryType)MarshalHelper.ReadByte(pAce, typeof(SecurityNative.ACE), "AceType"); _aceFlags = (AccessControlEntryFlags)MarshalHelper.ReadByte(pAce, typeof(SecurityNative.ACE), "AceFlags"); _accessMask = (AccessMask)MarshalHelper.ReadInt32(pAce, typeof(SecurityNative.ACE), "AccessMask"); // read SID IntPtr pSid = IntPtrHelper.Add(pAce, Marshal.OffsetOf(typeof(SecurityNative.ACE), "SidStart")); Trustee = new SecurityIdentifier(pSid, true); }