public EventLogReader(EventLogQuery eventQuery, EventBookmark bookmark) {

            if (eventQuery == null)
                throw new ArgumentNullException("eventQuery");

            string logfile = null;
            if (eventQuery.ThePathType == PathType.FilePath)
                logfile = eventQuery.Path;

            this.cachedMetadataInformation = new ProviderMetadataCachedInformation(eventQuery.Session, logfile, 50 );

            //explicit data
            this.eventQuery = eventQuery;

            //implicit
            this.batchSize = 64;
            this.eventsBuffer = new IntPtr[batchSize];

            //
            // compute the flag.
            //
            int flag = 0;

            if (this.eventQuery.ThePathType == PathType.LogName)
                flag |= (int)UnsafeNativeMethods.EvtQueryFlags.EvtQueryChannelPath;
            else
                flag |= (int)UnsafeNativeMethods.EvtQueryFlags.EvtQueryFilePath;

            if (this.eventQuery.ReverseDirection)
                flag |= (int)UnsafeNativeMethods.EvtQueryFlags.EvtQueryReverseDirection;

            if (this.eventQuery.TolerateQueryErrors)
                flag |= (int)UnsafeNativeMethods.EvtQueryFlags.EvtQueryTolerateQueryErrors;

            EventLogPermissionHolder.GetEventLogPermission().Demand();

            handle = NativeWrapper.EvtQuery(this.eventQuery.Session.Handle,
                this.eventQuery.Path, this.eventQuery.Query,
                flag);

            EventLogHandle bookmarkHandle = EventLogRecord.GetBookmarkHandleFromBookmark(bookmark);

            if (!bookmarkHandle.IsInvalid) {
                using (bookmarkHandle) {
                    NativeWrapper.EvtSeek(handle, 1, bookmarkHandle, 0, UnsafeNativeMethods.EvtSeekFlags.EvtSeekRelativeToBookmark);
                }
            }
        }
        public EventLogWatcher(EventLogQuery eventQuery, EventBookmark bookmark, bool readExistingEvents) {

            if (eventQuery == null)
                throw new ArgumentNullException("eventQuery");

            if (bookmark != null)
                readExistingEvents = false;

            //explicit data
            this.eventQuery = eventQuery;
            this.readExistingEvents = readExistingEvents;

            if (this.eventQuery.ReverseDirection)
                throw new InvalidOperationException();

            this.eventsBuffer = new IntPtr[64];
            this.cachedMetadataInformation = new ProviderMetadataCachedInformation(eventQuery.Session, null, 50);
            this.bookmark = bookmark;
        }
Example #3
0
 public EventLogReader(EventLogQuery eventQuery, EventBookmark bookmark)
 {
     if (eventQuery == null)
     {
         throw new ArgumentNullException("eventQuery");
     }
     string logfile = null;
     if (eventQuery.ThePathType == PathType.FilePath)
     {
         logfile = eventQuery.Path;
     }
     this.cachedMetadataInformation = new ProviderMetadataCachedInformation(eventQuery.Session, logfile, 50);
     this.eventQuery = eventQuery;
     this.batchSize = 0x40;
     this.eventsBuffer = new IntPtr[this.batchSize];
     int flags = 0;
     if (this.eventQuery.ThePathType == PathType.LogName)
     {
         flags |= 1;
     }
     else
     {
         flags |= 2;
     }
     if (this.eventQuery.ReverseDirection)
     {
         flags |= 0x200;
     }
     if (this.eventQuery.TolerateQueryErrors)
     {
         flags |= 0x1000;
     }
     EventLogPermissionHolder.GetEventLogPermission().Demand();
     this.handle = NativeWrapper.EvtQuery(this.eventQuery.Session.Handle, this.eventQuery.Path, this.eventQuery.Query, flags);
     EventLogHandle bookmarkHandleFromBookmark = EventLogRecord.GetBookmarkHandleFromBookmark(bookmark);
     if (!bookmarkHandleFromBookmark.IsInvalid)
     {
         using (bookmarkHandleFromBookmark)
         {
             NativeWrapper.EvtSeek(this.handle, 1L, bookmarkHandleFromBookmark, 0, Microsoft.Win32.UnsafeNativeMethods.EvtSeekFlags.EvtSeekRelativeToBookmark);
         }
     }
 }
 public void Seek(EventBookmark bookmark)
 {
 }
 public void Seek(EventBookmark bookmark, long offset)
 {
 }
 public EventLogReader(EventLogQuery eventQuery, EventBookmark bookmark)
 {
   Contract.Requires(eventQuery.Session != null);
 }
Example #7
0
 public void Seek(EventBookmark bookmark)
 {
     Seek(bookmark, 0);
 }
Example #8
0
 public EventLogWatcher(EventLogQuery eventQuery, EventBookmark bookmark)
     : this(eventQuery, bookmark, false)
 {
 }
Example #9
0
 public EventLogReader(EventLogQuery eventQuery, EventBookmark bookmark)
 {
     Contract.Requires(eventQuery.Session != null);
 }
Example #10
0
 public void Seek(EventBookmark bookmark)
 {
 }
 public void Seek(EventBookmark bookmark) {
     Seek(bookmark, 0);
 }
 public EventLogWatcher(EventLogQuery eventQuery, EventBookmark bookmark, bool readExistingEvents)
 {
   Contract.Ensures(!eventQuery.ReverseDirection);
 }
 public EventLogWatcher(EventLogQuery eventQuery, EventBookmark bookmark)
 {
   Contract.Ensures(!eventQuery.ReverseDirection);
 }
Example #14
0
        public void Seek(EventBookmark bookmark, long offset)
        {
            if (bookmark == null)
                throw new ArgumentNullException("bookmark");

            SeekReset();
            using (EventLogHandle bookmarkHandle = EventLogRecord.GetBookmarkHandleFromBookmark(bookmark))
            {
                NativeWrapper.EvtSeek(_handle, offset, bookmarkHandle, 0, UnsafeNativeMethods.EvtSeekFlags.EvtSeekRelativeToBookmark);
            }
        }
Example #15
0
 public void Seek(EventBookmark bookmark, long offset)
 {
     throw new NotImplementedException();
 }
Example #16
0
 public EventLogReader(EventLogQuery eventQuery, EventBookmark bookmark)
 {
     throw new NotImplementedException();
 }
Example #17
0
 public void Seek(EventBookmark bookmark)
 {
     this.Seek(bookmark, 0L);
 }
 public EventLogWatcher(EventLogQuery eventQuery, EventBookmark bookmark)
     : this(eventQuery, bookmark, false) {
 }
Example #19
0
 public void Seek(EventBookmark bookmark, long offset)
 {
     if (bookmark == null)
     {
         throw new ArgumentNullException("bookmark");
     }
     EventLogPermissionHolder.GetEventLogPermission().Demand();
     this.SeekReset();
     using (EventLogHandle handle = EventLogRecord.GetBookmarkHandleFromBookmark(bookmark))
     {
         NativeWrapper.EvtSeek(this.handle, offset, handle, 0, Microsoft.Win32.UnsafeNativeMethods.EvtSeekFlags.EvtSeekRelativeToBookmark);
     }
 }
Example #20
0
 public void Seek(EventBookmark bookmark, long offset)
 {
 }
 internal static EventLogHandle GetBookmarkHandleFromBookmark(EventBookmark bookmark)
 {
     if (bookmark == null)
     {
         return EventLogHandle.Zero;
     }
     return NativeWrapper.EvtCreateBookmark(bookmark.BookmarkText);
 }
Example #22
0
 public void Seek(EventBookmark bookmark)
 {
     this.Seek(bookmark, 0L);
 }
        public EventLogReader(EventLogQuery eventQuery, EventBookmark bookmark)
        {
            if (eventQuery == null)
            {
                throw new ArgumentNullException("eventQuery");
            }

            string logfile = null;

            if (eventQuery.ThePathType == PathType.FilePath)
            {
                logfile = eventQuery.Path;
            }

            _cachedMetadataInformation = new ProviderMetadataCachedInformation(eventQuery.Session, logfile, 50);

            // explicit data
            _eventQuery = eventQuery;

            // implicit
            _batchSize    = 64;
            _eventsBuffer = new IntPtr[_batchSize];

            //
            // compute the flag.
            //
            int flag = 0;

            if (_eventQuery.ThePathType == PathType.LogName)
            {
                flag |= (int)UnsafeNativeMethods.EvtQueryFlags.EvtQueryChannelPath;
            }
            else
            {
                flag |= (int)UnsafeNativeMethods.EvtQueryFlags.EvtQueryFilePath;
            }

            if (_eventQuery.ReverseDirection)
            {
                flag |= (int)UnsafeNativeMethods.EvtQueryFlags.EvtQueryReverseDirection;
            }

            if (_eventQuery.TolerateQueryErrors)
            {
                flag |= (int)UnsafeNativeMethods.EvtQueryFlags.EvtQueryTolerateQueryErrors;
            }

            _handle = NativeWrapper.EvtQuery(_eventQuery.Session.Handle,
                                             _eventQuery.Path, _eventQuery.Query,
                                             flag);

            EventLogHandle bookmarkHandle = EventLogRecord.GetBookmarkHandleFromBookmark(bookmark);

            if (!bookmarkHandle.IsInvalid)
            {
                using (bookmarkHandle)
                {
                    NativeWrapper.EvtSeek(_handle, 1, bookmarkHandle, 0, UnsafeNativeMethods.EvtSeekFlags.EvtSeekRelativeToBookmark);
                }
            }
        }
Example #24
0
 public EventLogWatcher(EventLogQuery eventQuery, EventBookmark bookmark, bool readExistingEvents)
 {
     throw new NotImplementedException();
 }