コード例 #1
0
ファイル: Helpers.cs プロジェクト: pirenga/CVE-2020-1206-POC
        /// <summary>
        /// Asyncpoll Response is filled in the Response structure and returned.
        /// </summary>
        /// <param name="asyncPtr"></param>
        /// <returns></returns>
        public static _FRS_ASYNC_RESPONSE_CONTEXT GetAsyncResponse(_FRS_ASYNC_RESPONSE_CONTEXT_POINTER asyncPtr)
        {
            _FRS_ASYNC_RESPONSE_CONTEXT asyncResponse = new _FRS_ASYNC_RESPONSE_CONTEXT();

            asyncResponse.status                    = asyncPtr.status;
            asyncResponse.sequenceNumber            = asyncPtr.sequenceNumber;
            asyncResponse.result.versionVectorCount = asyncPtr.result.versionVectorCount;
            asyncResponse.result.epoqueVectorCount  = asyncPtr.result.epoqueVectorCount;
            asyncResponse.result.vvGeneration       = asyncPtr.result.vvGeneration;
            long asyncaddress  = 0;
            long asyncaddress1 = 0;

            asyncaddress = (long)asyncPtr.result.versionVector;
            asyncResponse.result.versionVector = new _FRS_VERSION_VECTOR[asyncResponse.result.versionVectorCount];
            byte[] b = new byte[16];


            for (int i = 0; i < asyncResponse.result.versionVectorCount; i++)
            {
                for (int j = 0; j < 16; j++)
                {
                    b[j]         = Marshal.ReadByte((IntPtr)asyncaddress);
                    asyncaddress = asyncaddress + 1;
                }
                asyncResponse.result.versionVector[i].dbGuid = new Guid(b);
                asyncResponse.result.versionVector[i].low    = (ulong)(Marshal.ReadInt64((IntPtr)asyncaddress));
                asyncaddress = asyncaddress + sizeof(ulong);
                asyncResponse.result.versionVector[i].high = (ulong)(Marshal.ReadInt64((IntPtr)asyncaddress));
                asyncaddress = asyncaddress + sizeof(ulong);
            }
            _FRS_EPOQUE_VECTOR epoqueVector = new _FRS_EPOQUE_VECTOR();

            asyncaddress1 = (long)asyncPtr.result.epoqueVector;
            for (int i = 0; i < asyncResponse.result.epoqueVectorCount; i++)
            {
                asyncResponse.result.epoqueVector[i] = (_FRS_EPOQUE_VECTOR)Marshal.PtrToStructure(asyncPtr.result.epoqueVector, typeof(_FRS_EPOQUE_VECTOR));
                asyncaddress1 += Marshal.SizeOf(epoqueVector);
            }
            return(asyncResponse);
        }
コード例 #2
0
 public static extern uint FRS2AsyncPoll(System.IntPtr bindingHandle, System.Guid connectionId, out _FRS_ASYNC_RESPONSE_CONTEXT_POINTER response);//out IntPtr response);//