public void ConfirmCredentials(bool confirm)
        {
            new UIPermission(UIPermissionWindow.SafeSubWindows).Demand();

            Win32Native.CredUIReturnCodes result = Win32Native.CredUIConfirmCredentialsW(this.target, confirm);

            if (result != Win32Native.CredUIReturnCodes.NO_ERROR &&
                result != Win32Native.CredUIReturnCodes.ERROR_NOT_FOUND &&
                result != Win32Native.CredUIReturnCodes.ERROR_INVALID_PARAMETER)
            {
                throw new InvalidOperationException(TranslateReturnCode(result));
            }
        }