internal void ReadSni(DbAsyncResult asyncResult, TdsParserStateObject stateObj) { if ((this._parser.State != TdsParserState.Broken) && (this._parser.State != TdsParserState.Closed)) { IntPtr zero = IntPtr.Zero; RuntimeHelpers.PrepareConstrainedRegions(); try { uint num; if (!this._parser.AsyncOn) { num = SNINativeMethodWrapper.SNIReadSync(stateObj.Handle, ref zero, TdsParserStaticMethods.GetTimeoutMilliseconds(stateObj.TimeoutTime)); if (num == 0) { stateObj.ProcessSniPacket(zero, 0); } else { this.ReadSniError(stateObj, num); } } else { stateObj._asyncResult = asyncResult; RuntimeHelpers.PrepareConstrainedRegions(); try { } finally { stateObj.IncrementPendingCallbacks(); num = SNINativeMethodWrapper.SNIReadAsync(stateObj.Handle, ref zero); if ((num != 0) && (0x3e5 != num)) { stateObj.DecrementPendingCallbacks(false); } } if (num == 0) { stateObj._asyncResult.SetCompletedSynchronously(); stateObj.ReadAsyncCallback(ADP.PtrZero, zero, 0); } else if (0x3e5 != num) { this.ReadSniError(stateObj, num); } } } finally { if (zero != IntPtr.Zero) { SNINativeMethodWrapper.SNIPacketRelease(zero); } } } }