public int RasConnectionNotification(IntPtr hRasConn, SafeHandle hEvent, RASCN dwFlags) { var stopwatch = Stopwatch.StartNew(); var result = AttachedObject.RasConnectionNotification(hRasConn, hEvent, dwFlags); stopwatch.Stop(); var callEvent = new PInvokeInt32CallCompletedTraceEvent { DllName = RasApi32Dll, Duration = stopwatch.Elapsed, MethodName = nameof(RasConnectionNotification), Result = result }; callEvent.Args.Add(nameof(hRasConn), hRasConn); callEvent.Args.Add(nameof(hEvent), hEvent); callEvent.Args.Add(nameof(dwFlags), dwFlags); LogVerbose(callEvent); return(result); }
public static extern int RasConnectionNotification( IntPtr hRasConn, SafeHandle hEvent, RASCN dwFlags);
public int RasConnectionNotification(IntPtr hRasConn, ISafeHandleWrapper hEvent, RASCN dwFlags) { return(SafeNativeMethods.RasConnectionNotification(hRasConn, hEvent.UnderlyingHandle, dwFlags)); }
public int RasConnectionNotification(IntPtr hRasConn, SafeHandle hEvent, RASCN dwFlags) { return(SafeNativeMethods.RasConnectionNotification(hRasConn, hEvent, dwFlags)); }
private void RegisterCallback(IntPtr handle, Action <RasConnectionEventArgs> callback, RASCN changeNotification) { var stateObject = new RasConnectionNotificationStateObject(); IRegisteredCallback registeredCallback = null; try { registeredCallback = callbackFactory.Create(callbackHandler.OnCallback, stateObject); if (registeredCallback == null) { throw new InvalidOperationException("The factory did not register a callback."); } var ret = rasApi32.RasConnectionNotification(handle, registeredCallback.Handle, changeNotification); if (ret != SUCCESS) { throw exceptionPolicy.Create(ret); } stateObject.RegisteredCallback = registeredCallback; stateObject.Callback = callback; stateObject.NotificationType = changeNotification; notifications.Add(changeNotification, stateObject); } catch (Exception) { registeredCallback?.Dispose(); throw; } }