示例#1
0
        /// <summary>
        /// The InspectionContext class constructor.
        /// </summary>
        /// <param name="handle">Inspection context received in the EventReceived event.</param>
        internal InspectionContext(IntPtr handle)
        {
            _handle = handle;

            IntPtr eventData = IntPtr.Zero;

            var ret = NativeApi.GetClientID(handle, out IntPtr clientID);

            if (ret != NativeApi.InspectionError.None)
            {
                throw ExceptionFactory.CreateException(ret);
            }

            ModuleID = Marshal.PtrToStringAnsi(clientID);

            ret = NativeApi.GetEventName(handle, out IntPtr eventName);
            if (ret != NativeApi.InspectionError.None)
            {
                throw ExceptionFactory.CreateException(ret);
            }

            EventName = Marshal.PtrToStringAnsi(eventName);

            ret = NativeApi.GetEventData(handle, out eventData);
            if (ret != NativeApi.InspectionError.None)
            {
                throw ExceptionFactory.CreateException(ret);
            }

            if (eventData != IntPtr.Zero)
            {
                EventData = new Bundle(new SafeBundleHandle(eventData, false));
            }
        }
示例#2
0
        /// <summary>
        /// The InspectionContext class constructor.
        /// </summary>
        /// <param name="handle">Inspection context received in the EventReceived event.</param>
        internal InspectionContext(IntPtr handle)
        {
            _handle = handle;

            var ret = NativeApi.GetClientID(handle, out string clientID);

            if (ret != NativeApi.InspectionError.None)
            {
                throw ExceptionFactory.CreateException(ret);
            }

            ModuleID = clientID;
        }