/// <summary> /// Decode specified buffer from specified index, with specified count /// of bytes, into the instance of current class. /// </summary> /// <param name="buffer">The specified buffer.</param> /// <param name="index">The specified index from beginning of buffer.</param> /// <param name="count">The specified count of bytes to be decoded.</param> internal override void DecodeBuffer(byte[] buffer, int index, int count) { NativePacCredentialInfo = PacUtility.MemoryToObject <PAC_CREDENTIAL_INFO>(buffer, index, count); int headerLength = sizeof(uint) + sizeof(uint); // This is vary length member without pre-defined calculate method. // Need to decode manually. NativePacCredentialInfo.SerializedData = new byte[count - headerLength]; Buffer.BlockCopy(buffer, index + headerLength, NativePacCredentialInfo.SerializedData, 0, count - headerLength); }
/// <summary> /// Decode specified buffer from specified index, with specified count /// of bytes, into the instance of current class. /// </summary> /// <param name="buffer">The specified buffer.</param> /// <param name="index">The specified index from beginning of buffer.</param> /// <param name="count">The specified count of bytes to be decoded.</param> internal override void DecodeBuffer(byte[] buffer, int index, int count) { NativeUpnDnsInfo = PacUtility.MemoryToObject <UPN_DNS_INFO>(buffer, index, count); upn = ReadUtf16String( buffer, index + NativeUpnDnsInfo.UpnOffset, NativeUpnDnsInfo.UpnLength); dnsDomain = ReadUtf16String( buffer, index + NativeUpnDnsInfo.DnsDomainNameOffset, NativeUpnDnsInfo.DnsDomainNameLength); UpdateOffsetLength(); }
/// <summary> /// Construct an instance of current class by decoding specified bytes. /// </summary> /// <param name="buffer">The specified bytes.</param> internal PacType(byte[] buffer) { NativePacType = PacUtility.MemoryToObject <PACTYPE>(buffer); pacInfoBuffers = new PacInfoBuffer[NativePacType.Buffers.Length]; for (int i = 0; i < NativePacType.Buffers.Length; ++i) { if (NativePacType.Buffers[i].cbBufferSize > 0) { PacInfoBuffers[i] = PacInfoBuffer.DecodeBuffer( NativePacType.Buffers[i], buffer); } else { PacInfoBuffers[i] = null; } } }
/// <summary> /// Decode specified buffer from specified index, with specified count /// of bytes, into the instance of current class. /// </summary> /// <param name="buffer">The specified buffer.</param> /// <param name="index">The specified index from beginning of buffer.</param> /// <param name="count">The specified count of bytes to be decoded.</param> internal override void DecodeBuffer(byte[] buffer, int index, int count) { NativePacSignatureData = PacUtility.MemoryToObject <PAC_SIGNATURE_DATA>(buffer, index, count); }
public _NTLM_SUPPLEMENTAL_CREDENTIAL GetNtlmCredential() { return(PacUtility.MemoryToObject <_NTLM_SUPPLEMENTAL_CREDENTIAL>(Credentials, 0, Credentials.Length)); }
/// <summary> /// Decode specified buffer from specified index, with specified count /// of bytes, into the instance of current class. /// </summary> /// <param name="buffer">The specified buffer.</param> /// <param name="index">The specified index from beginning of buffer.</param> /// <param name="count">The specified count of bytes to be decoded.</param> internal override void DecodeBuffer(byte[] buffer, int index, int count) { NativePacClientInfo = PacUtility.MemoryToObject <PAC_CLIENT_INFO>(buffer, index, count); }