Exemplo n.º 1
0
STDMETHODIMP CVideoDecOutputPin::GetCreateVideoAcceleratorData(const GUID *pGuid, LPDWORD pdwSizeMiscData, LPVOID *ppMiscData)
{
	HRESULT								hr						= E_UNEXPECTED;
	AMVAUncompDataInfo					UncompInfo;
	AMVACompBufferInfo					CompInfo[30];
	DWORD								dwNumTypesCompBuffers	= countof(CompInfo);
	CComQIPtr<IAMVideoAccelerator>		pAMVideoAccelerator		= GetConnected();
	DXVA_ConnectMode*					pConnectMode;

	if (pAMVideoAccelerator) {
		memcpy (&UncompInfo.ddUncompPixelFormat, &m_ddUncompPixelFormat, sizeof (DDPIXELFORMAT));
		UncompInfo.dwUncompWidth		= m_pVideoDecFilter->PictWidthRounded();
		UncompInfo.dwUncompHeight		= m_pVideoDecFilter->PictHeightRounded();
		hr = pAMVideoAccelerator->GetCompBufferInfo(&m_GuidDecoderDXVA1, &UncompInfo, &dwNumTypesCompBuffers, CompInfo);

		if (SUCCEEDED (hr)) {
			hr = m_pVideoDecFilter->CreateDXVA1Decoder (pAMVideoAccelerator, pGuid, m_dwDXVA1SurfaceCount);

			if (SUCCEEDED (hr)) {
				m_pVideoDecFilter->SetDXVA1Params (&m_GuidDecoderDXVA1, &m_ddUncompPixelFormat);

				pConnectMode					= (DXVA_ConnectMode*)CoTaskMemAlloc (sizeof(DXVA_ConnectMode));
				pConnectMode->guidMode			= m_GuidDecoderDXVA1;
				pConnectMode->wRestrictedMode	= m_pVideoDecFilter->GetDXVA1RestrictedMode();
				*pdwSizeMiscData				= sizeof(DXVA_ConnectMode);
				*ppMiscData						= pConnectMode;
			}
		}
	}


	return hr;
}
Exemplo n.º 2
0
STDMETHODIMP CStreamSwitcherInputPin::NonDelegatingQueryInterface(REFIID riid, void** ppv)
{
    return
        QI(IStreamSwitcherInputPin)
        IsConnected() && GetCLSID(GetFilterFromPin(GetConnected())) == __uuidof(NeroAudioDecoder) && QI(IPinConnection)
        __super::NonDelegatingQueryInterface(riid, ppv);
}
Exemplo n.º 3
0
HRESULT
BridgeSourceOutput::Active()
{
	LOG((TEXT("Source pin 0x%x active"), this));
	{
		CAutoLock lock(&m_csActive);
		m_bActive = true;
	}

	HRESULT hr = CBaseOutputPin::Active();
	if (IsConnected())
	{
        // always add the queue -- the slight inefficiency is outweighed
        // by the increased robustness against source pause/stop while render is paused.
		if (true)//m_bIncreasedBuffering)
		{
			m_pQueue = new COutputQueue(GetConnected(), &hr, true, false, 1, false);
            m_pQueue->SetPopEvent(m_evQueue);
		}
	}

	// safe to start delivery
	ReleaseSemaphore(m_hsemActive, 1, NULL);
	return hr;
}
Exemplo n.º 4
0
void UploadResults() {
    leds[0] = CRGB::Yellow;
    FastLED.show();

    uint16_t returncode;
    TurnOnFona();
    delay(1000);
    myfona.begin(4800);
    fona.begin(myfona);
    delay(3500);
    GetConnected();
    delay(3000);
    fona.enableGPRS(true);
    delay(3000);

    char url[200];
    uint16_t statuscode;
    int16_t length;
    sprintf(url, "%s%s%s%s", "http://api.ubirch.com/rp15/push?id=", userid, "&erg=", results);
    flushSerial();
    if (!fona.HTTP_GET_start(url, &statuscode, (uint16_t *) &length)) {
        Serial.println(F("Get Failed!"));
    }
    fona.HTTP_GET_end();


    delay(100);
    GetDisconnected();
    delay(1000);
    TurnOffFona();
    leds[0] = CRGB::Black;
    FastLED.show();
}
Exemplo n.º 5
0
int pgDatabase::GetIconId()
{
	if (GetConnected())
		return databaseFactory.GetIconId();
	else
		return databaseFactory.GetClosedIconId();
}
Exemplo n.º 6
0
int WINAPI
RealGetSystemMetrics(int nIndex)
{
  GetConnected();
//  FIXME("Global Server Data -> %x\n",gpsi);
  if (nIndex < 0 || nIndex >= SM_CMETRICS) return 0;
  return gpsi->aiSysMet[nIndex];
}
Exemplo n.º 7
0
HRESULT CBaseSplitterOutputPin::DeliverEndFlush()
{
	if(!ThreadExists()) return S_FALSE;
	HRESULT hr = IsConnected() ? GetConnected()->EndFlush() : S_OK;
	m_hrDeliver = S_OK;
	m_fFlushing = false;
	m_fFlushed = true;
	m_eEndFlush.Set();
	return hr;
}
Exemplo n.º 8
0
already_AddRefed<IMediaSeeking>
AudioSinkInputPin::GetConnectedPinSeeking()
{
  RefPtr<IPin> peer = GetConnected();
  if (!peer)
    return nullptr;
  RefPtr<IMediaSeeking> seeking;
  peer->QueryInterface(static_cast<IMediaSeeking**>(byRef(seeking)));
  return seeking.forget();
}
Exemplo n.º 9
0
HRESULT CBaseSplitterOutputPin::DeliverBeginFlush()
{
	m_eEndFlush.Reset();
	m_fFlushed = false;
	m_fFlushing = true;
	m_hrDeliver = S_FALSE;
	m_queue.RemoveAll();
	HRESULT hr = IsConnected() ? GetConnected()->BeginFlush() : S_OK;
	if(S_OK != hr) m_eEndFlush.Set();
	return(hr);
}
Exemplo n.º 10
0
void GestureRecognizer::ProcessCanvasUpdated()
{
	if (   m_InManipulation
		&& !GetConnected().empty())
	{
		// HACK: Using the first pointer is a hack
		// TODO: I should pass all connected pointers as a 'frame', they're all relevant
		// HACK: Disabled because this commit changed signature for ProcessManipulationUpdate() and I don't have access to InputEvent here...
		//m_Owner.ProcessManipulationUpdate((*GetConnected().begin())->GetPointerState());
	}
}
Exemplo n.º 11
0
HRESULT CLAVOutputPin::DeliverBeginFlush()
{
  DbgLog((LOG_TRACE, 20, L"::DeliverBeginFlush on %s Pin", CBaseDemuxer::CStreamList::ToStringW(m_pinType)));
  m_eEndFlush.Reset();
  m_fFlushed = false;
  m_fFlushing = true;
  m_hrDeliver = S_FALSE;
  m_queue.Clear();
  HRESULT hr = IsConnected() ? GetConnected()->BeginFlush() : S_OK;
  if(hr != S_OK) m_eEndFlush.Set();
  return hr;
}
Exemplo n.º 12
0
// Calls that CLIENT can make.
bool wxTCPConnection::Disconnect ()
{
  if ( !GetConnected() )
      return true;
  // Send the the disconnect message to the peer.
  m_codeco->Write8(IPC_DISCONNECT);
  m_sock->Notify(false);
  m_sock->Close();
  SetConnected(false);

  return true;
}
Exemplo n.º 13
0
// is this type acceptable to our downstream peer?
bool 
BridgeSourceOutput::CanDeliver(const CMediaType*pmt)
{
    bool bAccept = true;        // if not connected, anything is acceptable
    if (IsConnected())
    {
        HRESULT hr = GetConnected()->QueryAccept(pmt);
        if (hr != S_OK)
        {
            IPinConnectionPtr pPC = GetConnected();
            if (pPC != NULL)
            {
                hr = pPC->DynamicQueryAccept(pmt);
            }
            if (hr != S_OK)
            {
                bAccept = false;
            }
        }
    }
    return bAccept;
}
Exemplo n.º 14
0
HRESULT CLAVOutputPin::DeliverEndFlush()
{
  DbgLog((LOG_TRACE, 20, L"::DeliverEndFlush on %s Pin", CBaseDemuxer::CStreamList::ToStringW(m_pinType)));
  HRESULT hr = IsConnected() ? GetConnected()->EndFlush() : S_OK;

  m_Parser.Flush();

  m_hrDeliver = S_OK;
  m_fFlushing = false;
  m_fFlushed = true;

  m_eEndFlush.Set();
  return hr;
}
Exemplo n.º 15
0
// dynamic switch with Video Renderer (to change allocated buffer size as well
// as format type
HRESULT 
BridgeSourceOutput::SwitchTo(const CMediaType* pmt)
{
    // must wait until queue is empty
    if (m_pQueue != NULL)
    {
        while (!m_pQueue->IsIdle())
        {
            m_evQueue.Wait();
        }
    }


    // now perform request
    HRESULT hr = GetConnected()->ReceiveConnection(this, pmt);
    LOG((TEXT("ReceiveConnection 0x%x"), hr));

    if (SUCCEEDED(hr))
    {
        SetMediaType(pmt);

        // for VMR, that's enough, but for old VR we need to re-commit the allocator
        m_pAllocator->Decommit();

        m_bUpstreamTypeChanged = true;
        ALLOCATOR_PROPERTIES prop;
        hr = m_pAllocator->GetProperties(&prop);
        if (SUCCEEDED(hr))
        {
            hr = DecideBufferSize(m_pAllocator, &prop);
            if (FAILED(hr))
            {
                LOG((TEXT("Allocator failure on ReceiveConnection 0x%x"), hr));
            }
        }

        if (SUCCEEDED(hr))
        {
            m_pInputPin->NotifyAllocator(m_pAllocator, false);
        }
        m_pAllocator->Commit();
    }
    return hr;
}
Exemplo n.º 16
0
HRESULT CBaseSplitterOutputPin::DeliverBeginFlush()
{
	m_eEndFlush.Reset();
	m_fFlushed = false;
	m_fFlushing = true;
	m_hrDeliver = S_FALSE;
	__try{
		m_queue.RemoveAll(); 
	}__except(EXCEPTION_EXECUTE_HANDLER) {  } //hr = S_FALSE;
	HRESULT hr = S_OK;
	__try{
		hr = IsConnected() ? GetConnected()->BeginFlush() : S_OK;
	}__except(EXCEPTION_EXECUTE_HANDLER) {  } //hr = S_FALSE;
	__try{
		if(S_OK != hr) m_eEndFlush.Set();
	}__except(EXCEPTION_EXECUTE_HANDLER) {  }

	return(hr);
}
Exemplo n.º 17
0
HRESULT 
BridgeSourceOutput::CompleteConnect(IPin *pReceivePin)
{
	// is our agreed type the same as the upstream sink?
	m_bUpstreamTypeChanged = false;
	CMediaType mt;
	GetStream()->GetSelectedType(&mt);
	if (mt != m_mt)
	{
		// we've changed the media type, so we cannot use the upstream
		// buffer size for our allocator negotiation
		m_bUpstreamTypeChanged = true;
	}

	// m_mt.GetSampleSize if type changed!!
	HRESULT hr = CBaseOutputPin::CompleteConnect(pReceivePin);
	if (SUCCEEDED(hr))
	{
		GetStream()->SetSelectedType(&m_mt);
	}

    if (SUCCEEDED(hr))
    {
        // are we connected to a ReceiveConnection-aware VR?
        // if so, we can accept changing video dimensions
        bool bRC = false;

        // check if it supports IPinConnection with current media type
        IPinConnectionPtr pPC = GetConnected();
        if (pPC != NULL)
        {
            HRESULT hrD = pPC->DynamicQueryAccept(&m_mt);
            if (SUCCEEDED(hrD))
            {
                bRC = true;
            }
        }
        LOG((TEXT("ReceiveConnection Aware: %s"), bRC?TEXT("true") : TEXT("false")));
        GetStream()->CanReceiveConnect(bRC);
    }
	return hr;
}
Exemplo n.º 18
0
// === IAMVideoAcceleratorNotify
STDMETHODIMP CVideoDecOutputPin::GetUncompSurfacesInfo(const GUID *pGuid, LPAMVAUncompBufferInfo pUncompBufferInfo)
{
	HRESULT			hr = E_INVALIDARG;

	if (SUCCEEDED (m_pVideoDecFilter->CheckDXVA1Decoder (pGuid))) {
		CComQIPtr<IAMVideoAccelerator>		pAMVideoAccelerator	= GetConnected();

		if (pAMVideoAccelerator) {
			pUncompBufferInfo->dwMaxNumSurfaces		= m_pVideoDecFilter->GetPicEntryNumber();
			pUncompBufferInfo->dwMinNumSurfaces		= m_pVideoDecFilter->GetPicEntryNumber();

			hr = m_pVideoDecFilter->FindDXVA1DecoderConfiguration (pAMVideoAccelerator, pGuid, &pUncompBufferInfo->ddUncompPixelFormat);
			if (SUCCEEDED (hr)) {
				memcpy (&m_ddUncompPixelFormat, &pUncompBufferInfo->ddUncompPixelFormat, sizeof(DDPIXELFORMAT));
				m_GuidDecoderDXVA1 = *pGuid;
			}
		}
	}
	return hr;
}
Exemplo n.º 19
0
bool 
BridgeSourceOutput::IsVideoRenderer()
{
    // get the downstream filter
    IPinPtr pPeer = GetConnected();
    PIN_INFO info;
    pPeer->QueryPinInfo(&info);
    IBaseFilterPtr pf(info.pFilter, 0);
    
    // the video renderer should support one of these
    IVideoWindowPtr pVW = pf;
    if (pVW != NULL)
    {
        return true;
    }
    IBasicVideoPtr pBV = pf;
    if (pBV != NULL)
    {
        return true;
    }
    return false;
}
Exemplo n.º 20
0
/*
 * Entry point for WebCit transaction
 */
void session_loop(void)
{
	int xhttp;
	StrBuf *Buf;
	
	/*
	 * We stuff these with the values coming from the client cookies,
	 * so we can use them to reconnect a timed out session if we have to.
	 */
	wcsession *WCC;
      
	WCC= WC;
	WCC->upload_length = 0;
	WCC->upload = NULL;
	WCC->Hdr->nWildfireHeaders = 0;

	if (WCC->Hdr->HR.ContentLength > 0) {
		if (ReadPostData() < 0) {
			return;
		}
	}

	Buf = NewStrBuf();
	WCC->trailing_javascript = NewStrBuf();

	/* Convert base64-encoded URL's back to plain text */
	if (!strncmp(ChrPtr(WCC->Hdr->this_page), "/B64", 4)) {
		StrBufCutLeft(WCC->Hdr->this_page, 4);
		StrBufDecodeBase64(WCC->Hdr->this_page);
		http_redirect(ChrPtr(WCC->Hdr->this_page));
		goto SKIP_ALL_THIS_CRAP;
	}

	/* If there are variables in the URL, we must grab them now */
	if (WCC->Hdr->PlainArgs != NULL)
		ParseURLParams(WCC->Hdr->PlainArgs);

	/* If the client sent a nonce that is incorrect, kill the request. */
	if (havebstr("nonce")) {
		if (verbose)
			syslog(LOG_DEBUG, "Comparing supplied nonce %s to session nonce %d", 
			       bstr("nonce"), WCC->nonce
				);
		if (ibstr("nonce") != WCC->nonce) {
			syslog(LOG_INFO, "Ignoring request with mismatched nonce.");
			hprintf("HTTP/1.1 404 Security check failed\r\n");
			hprintf("Content-Type: text/plain\r\n");
			begin_burst();
			wc_printf("Security check failed.\r\n");
			end_burst();
			goto SKIP_ALL_THIS_CRAP;
		}
	}

	/*
	 * If we're not connected to a Citadel server, try to hook up the connection now.
	 */
	if (!WCC->connected) {
		if (GetConnected()) {
			hprintf("HTTP/1.1 503 Service Unavailable\r\n");
			hprintf("Content-Type: text/html\r\n");
			begin_burst();
			wc_printf("<html><head><title>503 Service Unavailable</title></head><body>\n");
			wc_printf(_("This program was unable to connect or stay "
				"connected to the Citadel server.  Please report "
				"this problem to your system administrator.")
			);
			wc_printf("<br>");
			wc_printf("<a href=\"http://www.citadel.org/doku.php/"
				"faq:generalquestions:webcit_unable_to_connect\">%s</a>",
				_("Read More...")
			);
			wc_printf("</body></html>\n");
			end_burst();
			goto SKIP_ALL_THIS_CRAP;
		}
	}

	/*
	 * If we're not logged in, but we have authentication data (either from
	 * a cookie or from http-auth), try logging in to Citadel using that.
	 */
	if (	(!WCC->logged_in)
		&& (StrLength(WCC->Hdr->c_username) > 0)
		&& (StrLength(WCC->Hdr->c_password) > 0)
	) {
		long Status;

		FlushStrBuf(Buf);
		serv_printf("USER %s", ChrPtr(WCC->Hdr->c_username));
		StrBuf_ServGetln(Buf);
		if (GetServerStatus(Buf, &Status) == 3) {
			serv_printf("PASS %s", ChrPtr(WCC->Hdr->c_password));
			StrBuf_ServGetln(Buf);
			if (GetServerStatus(Buf, NULL) == 2) {
				become_logged_in(WCC->Hdr->c_username,
						 WCC->Hdr->c_password, Buf);
			} else {
				/* Should only display when password is wrong */
				WCC->ImportantMsg = NewStrBufPlain(ChrPtr(Buf) + 4, StrLength(Buf) - 4);
				authorization_required();
				FreeStrBuf(&Buf);
				goto SKIP_ALL_THIS_CRAP;
			}
		}
		else if (Status == 541) {
			WCC->logged_in = 1;
		}
	}

	xhttp = (WCC->Hdr->HR.eReqType != eGET) &&
		(WCC->Hdr->HR.eReqType != ePOST) &&
		(WCC->Hdr->HR.eReqType != eHEAD);

	/*
	 * If a 'go' (or 'gotofirst') parameter has been specified, attempt to goto that room
	 * prior to doing anything else.
	 */
	if (havebstr("go")) {
		int ret;
		if (verbose)
			syslog(LOG_DEBUG, "Explicit room selection: %s", bstr("go"));
		ret = gotoroom(sbstr("go"));	/* do quietly to avoid session output! */
		if ((ret/100) != 2) {
			if (verbose)
				syslog(LOG_DEBUG, "Unable to change to [%s]; Reason: %d", bstr("go"), ret);
		}
	}
	else if (havebstr("gotofirst")) {
		int ret;
		if (verbose)
			syslog(LOG_DEBUG, "Explicit room selection: %s", bstr("gotofirst"));
		ret = gotoroom(sbstr("gotofirst"));	/* do quietly to avoid session output! */
		if ((ret/100) != 2) {
			syslog(LOG_INFO, "Unable to change to [%s]; Reason: %d", bstr("gotofirst"), ret);
		}
	}

	/*
	 * If we aren't in any room yet, but we have cookie data telling us where we're
	 * supposed to be, and 'go' was not specified, then go there.
	 */
	else if ( (StrLength(WCC->CurRoom.name) == 0) && ( (StrLength(WCC->Hdr->c_roomname) > 0) )) {
		int ret;

		if (verbose)
			syslog(LOG_DEBUG, "We are in '%s' but cookie indicates '%s', going there...",
			       ChrPtr(WCC->CurRoom.name),
			       ChrPtr(WCC->Hdr->c_roomname)
		);
		ret = gotoroom(WCC->Hdr->c_roomname);	/* do quietly to avoid session output! */
		if ((ret/100) != 2) {
			if (verbose)
				syslog(LOG_DEBUG, "COOKIEGOTO: Unable to change to [%s]; Reason: %d",
				       ChrPtr(WCC->Hdr->c_roomname), ret);
		}
	}

	if (WCC->Hdr->HR.Handler != NULL) {
		if (	(!WCC->logged_in)
			&& ((WCC->Hdr->HR.Handler->Flags & ANONYMOUS) == 0)
			&& (WCC->serv_info != NULL)
			&& (WCC->serv_info->serv_supports_guest == 0)
		) {
			display_login();
		}
		else {
			if ((WCC->Hdr->HR.Handler->Flags & AJAX) != 0) {
				begin_ajax_response();
			}
			WCC->Hdr->HR.Handler->F();
			if ((WCC->Hdr->HR.Handler->Flags & AJAX) != 0) {
				end_ajax_response();
			}
		}
	}
	/* When all else fails, display the default landing page or a main menu. */
	else {
		/* 
		 * ordinary browser users get a nice login screen, DAV etc. requsets
		 * are given a 401 so they can handle it appropriate.
		 */
		if (!WCC->logged_in)  {
			if (xhttp) {
				authorization_required();
			}
			else {
				display_default_landing_page();
			}
		}
		/*
		 * Toplevel dav requests? or just a flat browser request? 
		 */
		else {
			if (xhttp) {
				dav_main();
			}
			else {
				display_main_menu();
			}
		}
	}

SKIP_ALL_THIS_CRAP:
	FreeStrBuf(&Buf);
	fflush(stdout);
}
Exemplo n.º 21
0
DWORD CLAVOutputPin::ThreadProc()
{
  std::string name = "CLAVOutputPin " + std::string(CBaseDemuxer::CStreamList::ToString(m_pinType));
  SetThreadName(-1, name.c_str());

  m_hrDeliver = S_OK;
  m_fFlushing = m_fFlushed = false;
  m_eEndFlush.Set();
  bool bFailFlush = false;

  while(1) {
    Sleep(1);

    DWORD cmd;
    if(CheckRequest(&cmd)) {
      cmd = GetRequest();
      Reply(S_OK);
      ASSERT(cmd == CMD_EXIT);
      return 0;
    }

    size_t cnt = 0;
    do {
      Packet *pPacket = NULL;

      // Get a packet from the queue (scoped for lock)
      {
        CAutoLock cAutoLock(&m_queue);
        if((cnt = m_queue.Size()) > 0) {
          pPacket = m_queue.Get();
        }
      }

      // We need to check cnt instead of pPacket, since it can be NULL for EndOfStream
      if(m_hrDeliver == S_OK && cnt > 0) {
        ASSERT(!m_fFlushing);
        m_fFlushed = false;

        // flushing can still start here, to release a blocked deliver call
        HRESULT hr = pPacket ? DeliverPacket(pPacket) : DeliverEndOfStream();

        // .. so, wait until flush finished
        m_eEndFlush.Wait();

        if(hr != S_OK && !m_fFlushed) {
          DbgLog((LOG_TRACE, 10, L"OutputPin::ThreadProc(): Delivery failed on %s pin, hr: %0#.8x", CBaseDemuxer::CStreamList::ToStringW(GetPinType()), hr));
          if (!bFailFlush && hr == S_FALSE) {
            DbgLog((LOG_TRACE, 10, L"OutputPin::ThreadProc(): Trying to revive it by flushing..."));
            GetConnected()->BeginFlush();
            GetConnected()->EndFlush();
            bFailFlush = true;
          } else {
            m_hrDeliver = hr;
          }
          break;
        }
      } else if (pPacket) {
        // in case of stream switches or other events, we may end up here
        SAFE_DELETE(pPacket);
      }
    } while(cnt > 1 && m_hrDeliver == S_OK);
  }
  return 0;
}
Exemplo n.º 22
0
/*
 * @implemented
 */
LRESULT
WINAPI
CallNextHookEx(
  HHOOK Hook,  // Windows NT/XP/2003: Ignored.
  int Code,
  WPARAM wParam,
  LPARAM lParam)
{
  PCLIENTINFO ClientInfo;
  DWORD Flags, Save;
  PHOOK pHook, phkNext;
  LRESULT lResult = 0;

  GetConnected();

  ClientInfo = GetWin32ClientInfo();

  if (!ClientInfo->phkCurrent) return 0;
  
  pHook = DesktopPtrToUser(ClientInfo->phkCurrent);

  if (!pHook->phkNext) return 0; // Nothing to do....

  phkNext = DesktopPtrToUser(pHook->phkNext);

  if ( phkNext->HookId == WH_CALLWNDPROC ||
       phkNext->HookId == WH_CALLWNDPROCRET)
  {
     Save = ClientInfo->dwHookData;
     Flags = ClientInfo->CI_flags & CI_CURTHPRHOOK;
// wParam: If the message was sent by the current thread/process, it is
// nonzero; otherwise, it is zero.
     if (wParam) ClientInfo->CI_flags |= CI_CURTHPRHOOK;
     else        ClientInfo->CI_flags &= ~CI_CURTHPRHOOK;

     if (phkNext->HookId == WH_CALLWNDPROC)
     {
        PCWPSTRUCT pCWP = (PCWPSTRUCT)lParam;

        NtUserMessageCall( pCWP->hwnd,
                           pCWP->message,
                           pCWP->wParam,
                           pCWP->lParam, 
                          (ULONG_PTR)&lResult,
                           FNID_CALLWNDPROC,
                           phkNext->Ansi);
     }
     else
     {
        PCWPRETSTRUCT pCWPR = (PCWPRETSTRUCT)lParam;

        ClientInfo->dwHookData = pCWPR->lResult;

        NtUserMessageCall( pCWPR->hwnd,
                           pCWPR->message,
                           pCWPR->wParam,
                           pCWPR->lParam, 
                          (ULONG_PTR)&lResult,
                           FNID_CALLWNDPROCRET,
                           phkNext->Ansi);
     }
     ClientInfo->CI_flags ^= ((ClientInfo->CI_flags ^ Flags) & CI_CURTHPRHOOK);
     ClientInfo->dwHookData = Save;
  }
  else
     lResult = NtUserCallNextHookEx(Code, wParam, lParam, pHook->Ansi);

  return lResult;
}
Exemplo n.º 23
0
MatchResult GestureRecognizer::MatchEventQueue(InputEventQueue::FilteredQueue & UnreservedEvents)
{
	auto InputEventIterator = UnreservedEvents.begin();
	auto & InputEvent = **InputEventIterator;

#if 1
	// If the pointer is not connected to this GR (meaning a failed HitTest), return failed match
	// DEBUG: Is this the right way to go about it? Or a temporary hack? Figure it out.
	if (   nullptr != InputEvent.m_Pointer
		&& GetConnected().end() == GetConnected().find(InputEvent.m_Pointer)
		&& nullptr == dynamic_cast<TypingModule *>(&m_Owner))		// HACK!! (To enable TypingModule to work, i.e. get input while not being pointed to)
	{
		m_InManipulation = false;		// HACK: Not sure if this is the best way of doing it

		return MatchResult();
	}
#else
	Vector2n GlobalPosition(InputEvent.m_PreEventState.GetAxisState(0).GetPosition(), InputEvent.m_PreEventState.GetAxisState(1).GetPosition());
	//printf("Global Pos %d, %d.\n", GlobalPosition.X(), GlobalPosition.Y());
	if (/*   !m_InManipulation
		&& */!static_cast<Widget &>(m_Owner).IsHit(static_cast<Widget &>(m_Owner).GlobalToParent(GlobalPosition))
		&& (   nullptr != InputEvent.m_Pointer
			&& GetConnected().end() == GetConnected().find(InputEvent.m_Pointer)))
	{
		return MatchResult();
	}
#endif

// DEBUG: I don't think the following is neccessary anymore, so I will try just setting Hit to true at all times and see if that breaks anything. If not, might as well remove this (unneccessary?) check
#if 0
	Vector2n GlobalPosition(InputEvent.m_PreEventState.GetAxisState(0).GetPosition(), InputEvent.m_PreEventState.GetAxisState(1).GetPosition());
	auto Hit = static_cast<Widget &>(m_Owner).IsHit(static_cast<Widget &>(m_Owner).GlobalToParent(GlobalPosition));
	/*if (!Hit) {
		std::cout << "OMGGG LOOK HERE!!!! Hit IS false\n";
	}*/
#else
	auto Hit = true;
#endif

	MatchResult Match;
	if (m_RecognizeDoubleTap && (Match = MatchDoubleTap2(UnreservedEvents, InputEventIterator)).AnySuccess())
	{
		if (2 == Match.Status)
		{
			m_Owner.ProcessDoubleTap(InputEvent, Vector2n((*InputEventIterator)->m_PostEventState.GetAxisState(0).GetPosition(), (*InputEventIterator)->m_PostEventState.GetAxisState(1).GetPosition()));
		}
	}
	else if (m_RecognizeTap && (Match = MatchTap2(UnreservedEvents, InputEventIterator)).AnySuccess())
	{
		if (2 == Match.Status)
		{
			m_Owner.ProcessTap(InputEvent, Vector2n((*InputEventIterator)->m_PostEventState.GetAxisState(0).GetPosition(), (*InputEventIterator)->m_PostEventState.GetAxisState(1).GetPosition()));
		}
	}
	else if (m_RecognizeManipulationTranslate && (Match = MatchManipulationBegin(UnreservedEvents, InputEventIterator, m_InManipulation, Hit, m_RecognizeManipulationTranslateButtonId)).AnySuccess())
	{
		if (2 == Match.Status)
		{
			m_InManipulation = true;
			m_Owner.ProcessManipulationBegin(InputEvent);
		}
	}
	else if (m_RecognizeManipulationTranslate && (Match = MatchManipulationUpdate(UnreservedEvents, InputEventIterator, m_InManipulation)).AnySuccess())
	{
		if (2 == Match.Status)
		{
			m_Owner.ProcessManipulationUpdate(InputEvent);
		}
	}
	else if (m_RecognizeManipulationTranslate && (Match = MatchManipulationEnd(UnreservedEvents, InputEventIterator, m_InManipulation, m_RecognizeManipulationTranslateButtonId)).AnySuccess())
	{
		if (2 == Match.Status)
		{
			m_Owner.ProcessManipulationEnd(InputEvent);
			m_InManipulation = false;
		}
	}
	else if (ProcessShortcuts(InputEvent))
	{
		Match.Status = 2;
		Match.Events.push_back(*InputEventIterator);
	}
	else if (ProcessEventHandledTEST(InputEvent))
	{
		Match.Status = 2;
		Match.Events.push_back(*InputEventIterator);
	}

	return Match;
}
Exemplo n.º 24
0
void pgDatabase::ShowTreeDetail(ctlTree *browser, frmMain *form, ctlListView *properties, ctlSQLBox *sqlPane)
{
	if (Connect() == PGCONN_OK)
	{
		// Set the icon if required
		UpdateIcon(browser);

		// Add child nodes if necessary
		if (browser->GetChildrenCount(GetId(), false) == 0)
		{
			wxLogInfo(wxT("Adding child object to database %s"), GetIdentifier().c_str());

			if (settings->GetDisplayOption(_("Catalogs")))
				browser->AppendCollection(this, catalogFactory);
			if (settings->GetDisplayOption(_("Casts")))
				browser->AppendCollection(this, castFactory);
			if (settings->GetDisplayOption(_("Extensions")) && GetConnection()->BackendMinimumVersion(9, 1))
				browser->AppendCollection(this, extensionFactory);
			if (settings->GetDisplayOption(_("Foreign Data Wrappers")) && GetConnection()->BackendMinimumVersion(8, 4))
				browser->AppendCollection(this, foreignDataWrapperFactory);
			if (settings->GetDisplayOption(_("Languages")))
				browser->AppendCollection(this, languageFactory);
			if (settings->GetDisplayOption(_("Synonyms")) && connection()->EdbMinimumVersion(8, 0))
				if (!GetConnection()->BackendMinimumVersion(8, 4))
					browser->AppendCollection(this, synonymFactory);
			if (settings->GetDisplayOption(_("Schemas")))
				browser->AppendCollection(this, schemaFactory);
			if (settings->GetDisplayOption(_("Slony-I Clusters")))
				browser->AppendCollection(this, slClusterFactory);

			wxString missingFKsql = wxT("SELECT COUNT(*) FROM\n")
			                        wxT("   (SELECT tgargs from pg_trigger tr\n")
			                        wxT("      LEFT JOIN pg_depend dep ON dep.objid=tr.oid AND deptype = 'i'\n")
			                        wxT("      LEFT JOIN pg_constraint co ON refobjid = co.oid AND contype = 'f'\n")
			                        wxT("     WHERE \n");
			if (connection()->BackendMinimumVersion(9, 0))
				missingFKsql += wxT("tgisinternal\n");
			else
				missingFKsql += wxT("tgisconstraint\n");

			missingFKsql += wxT("     AND co.oid IS NULL\n")
			                wxT("     GROUP BY tgargs\n")
			                wxT("    HAVING count(1) = 3) AS foo");
			missingFKs = StrToLong(connection()->ExecuteScalar(missingFKsql));
		}
	}

	GetServer()->iSetLastDatabase(GetName());

	if (properties)
	{
		// Setup listview
		CreateListColumns(properties);

		properties->AppendItem(_("Name"), GetName());
		properties->AppendItem(_("OID"), NumToStr(GetOid()));
		properties->AppendItem(_("Owner"), GetOwner());
		properties->AppendItem(_("ACL"), GetAcl());
		if (!GetPath().IsEmpty())
			properties->AppendItem(_("Path"), GetPath());

		// We may not actually be connected...
		if (GetConnection() && GetConnection()->BackendMinimumVersion(8, 0))
		{
			properties->AppendItem(_("Tablespace"), GetTablespace());
			properties->AppendItem(_("Default tablespace"), GetDefaultTablespace());
		}
		properties->AppendItem(_("Encoding"), GetEncoding());

		if (GetConnection() && GetConnection()->BackendMinimumVersion(8, 4))
		{
			properties->AppendItem(_("Collation"), GetCollate());
			properties->AppendItem(_("Character type"), GetCType());
		}

		properties->AppendItem(_("Default schema"), defaultSchema);

		properties->AppendItem(_("Default table ACL"), m_defPrivsOnTables);
		properties->AppendItem(_("Default sequence ACL"), m_defPrivsOnSeqs);
		properties->AppendItem(_("Default function ACL"), m_defPrivsOnFuncs);

		size_t i;
		wxString username;
		wxString varname;
		wxString varvalue;
		for (i = 0 ; i < variables.GetCount() ; i++)
		{
			wxStringTokenizer tkz(variables.Item(i), wxT("="));
			while (tkz.HasMoreTokens())
			{
				username = tkz.GetNextToken();
				varname = tkz.GetNextToken();
				varvalue = tkz.GetNextToken();
			}

			if (username.Length() == 0)
			{
				properties->AppendItem(varname, varvalue);
			}
			else
			{
				// should we add the parameters for the username?
				// I don't think so
				// but if we want this, how will we display that?
			}
		}
		properties->AppendYesNoItem(_("Allow connections?"), GetAllowConnections());
		properties->AppendYesNoItem(_("Connected?"), GetConnected());
		if (GetConnection() && GetConnection()->BackendMinimumVersion(8, 1))
		{
			wxString strConnLimit;
			strConnLimit.Printf(wxT("%ld"), GetConnectionLimit());
			properties->AppendItem(_("Connection limit"), strConnLimit);
		}
		properties->AppendYesNoItem(_("System database?"), GetSystemObject());
		if (GetMissingFKs())
			properties->AppendItem(_("Old style FKs"), GetMissingFKs());
		if (!GetSchemaRestriction().IsEmpty())
			properties->AppendItem(_("Schema restriction"), GetSchemaRestriction());
		properties->AppendItem(_("Comment"), firstLineOnly(GetComment()));

		if (!GetLabels().IsEmpty())
		{
			wxArrayString seclabels = GetProviderLabelArray();
			if (seclabels.GetCount() > 0)
			{
				for (unsigned int index = 0 ; index < seclabels.GetCount() - 1 ; index += 2)
				{
					properties->AppendItem(seclabels.Item(index), seclabels.Item(index + 1));
				}
			}
		}
	}
	if (form && GetCanHint() && !hintShown)
	{
		ShowHint(form, false);
	}
}
Exemplo n.º 25
0
DWORD CBaseSplitterOutputPin::ThreadProc()
{
    SetThreadName(DWORD(-1), "CBaseSplitterOutputPin");
    m_hrDeliver = S_OK;
    m_fFlushing = m_fFlushed = false;
    m_eEndFlush.Set();

    // fix for Microsoft DTV-DVD Video Decoder - video freeze after STOP/PLAY
    bool iHaaliRenderConnect = false;
    CComPtr<IPin> pPinTo = this, pTmp;
    while (pPinTo && SUCCEEDED(pPinTo->ConnectedTo(&pTmp)) && (pPinTo = pTmp)) {
        pTmp = nullptr;
        CComPtr<IBaseFilter> pBF = GetFilterFromPin(pPinTo);
        if (GetCLSID(pBF) == CLSID_DXR) { // Haali Renderer
            iHaaliRenderConnect = true;
            break;
        }
        pPinTo = GetFirstPin(pBF, PINDIR_OUTPUT);
    }
    if (IsConnected() && !iHaaliRenderConnect) {
        GetConnected()->BeginFlush();
        GetConnected()->EndFlush();
    }

    for (;;) {
        Sleep(1);

        DWORD cmd;
        if (CheckRequest(&cmd)) {
            m_hThread = nullptr;
            cmd = GetRequest();
            Reply(S_OK);
            ASSERT(cmd == CMD_EXIT);
            return 0;
        }

        int cnt = 0;
        do {
            CAutoPtr<Packet> p;

            {
                CAutoLock cAutoLock(&m_queue);
                if ((cnt = m_queue.GetCount()) > 0) {
                    p = m_queue.Remove();
                }
            }

            if (S_OK == m_hrDeliver && cnt > 0) {
                ASSERT(!m_fFlushing);

                m_fFlushed = false;

                // flushing can still start here, to release a blocked deliver call

                HRESULT hr = p
                             ? DeliverPacket(p)
                             : DeliverEndOfStream();

                m_eEndFlush.Wait(); // .. so we have to wait until it is done

                if (hr != S_OK && !m_fFlushed) { // and only report the error in m_hrDeliver if we didn't flush the stream
                    // CAutoLock cAutoLock(&m_csQueueLock);
                    m_hrDeliver = hr;
                    break;
                }
            }
        } while (--cnt > 0);
    }
}
Exemplo n.º 26
0
void TextFileWidget::NotifyExternalChange(bool OverrideLiveToggle)
{
	for (auto ConnectionWidget : GetConnected()) {
		ConnectionWidget->NotifyChange(OverrideLiveToggle);
	}
}