示例#1
0
STDMETHODIMP
HXExternalResourceManager::Init()
{
    HX_RESULT rc = GetHXXResPlugin();

    if(HXR_OK == rc)
    {
	// get language and res directory preferences/reg entries
	if (HXR_OK == m_pContext->QueryInterface(IID_IHXPreferences,
						(void**)&m_pPrefs) &&
	    HXR_OK == m_pContext->QueryInterface(IID_IHXRegistry, 
						(void**)&m_pRegistry))
	{
	    IHXBuffer* pBuffer = NULL;
	    CHXString strTemp;
	    strTemp.Format("%s.%s",HXREGISTRY_PREFPROPNAME, "LangID");
	    if(HXR_OK == m_pRegistry->GetStrByName(strTemp, pBuffer))
	    {
		const char* pActualLangID = (const char*)pBuffer->GetBuffer();
		m_ulLanguageID = strtol(pActualLangID, NULL, 10);
		HX_RELEASE(pBuffer);
	    }

            const char* pPath = NULL;
            // Get the plugin directory from the Dll Access Paths
            if (GetDLLAccessPath() &&
                (pPath = GetDLLAccessPath()->GetPath(DLLTYPE_PLUGIN)) &&
                *pPath)
            {
                UINT32 ulBufLen = strlen(pPath) + 1 + strlen(EXT_RES_DIR) + 1;
                m_pExternalResDir = new char[ulBufLen];
                SafeStrCpy(m_pExternalResDir, pPath, ulBufLen);
                if (m_pExternalResDir[strlen(m_pExternalResDir)-1] != OS_SEPARATOR_CHAR)
                {
                    SafeStrCat(m_pExternalResDir, OS_SEPARATOR_STRING, ulBufLen);
                }

                SafeStrCat(m_pExternalResDir, EXT_RES_DIR, ulBufLen);
                rc = LoadResourceFiles();
            }

	}
    }

    return rc;
}
HRESULT RegisterWithGDEventFramework() {
  CComPtr<IGoogleDesktopRegistrar> registrar;
  HRESULT hr = registrar.CoCreateInstance(L"GoogleDesktop.Registrar");

  if (SUCCEEDED(hr)) {
    CComBSTR our_guid(CONSOLE_PLUGIN_GUID);

    WCHAR icon_path[_MAX_PATH + 1] = {0};
    ATLVERIFY(::GetModuleFileNameW(NULL, icon_path, _MAX_PATH - 2) != 0);
    SafeStrCat(icon_path, L"@0", _MAX_PATH+1);

    CComSafeArray<VARIANT> description;
    ATLVERIFY(SUCCEEDED(description.Create(8)));
    VARIANT* props = reinterpret_cast<VARIANT*>(description.m_psa->pvData);

    for (DWORD i = 0; i < description.GetCount(); ++i) {
      props[i].vt = VT_BSTR;
    }

    props[0].bstrVal = ::SysAllocString(L"Title");
    props[1].bstrVal = ::SysAllocString(L"Console Events");
    props[2].bstrVal = ::SysAllocString(L"Description");
    props[3].bstrVal = ::SysAllocString(L"Outputs events from Google Desktop to the console");
    props[4].bstrVal = ::SysAllocString(L"Icon");
    props[5].bstrVal = ::SysAllocString(icon_path);
    props[6].bstrVal = ::SysAllocString(L"Homepage");
    props[7].bstrVal = ::SysAllocString(L"http://desktop.google.com");

    VARIANT desc;
    desc.vt = VT_ARRAY | VT_VARIANT;
    desc.parray = description;

    hr = registrar->StartComponentRegistration(our_guid, desc);

    if (SUCCEEDED(hr)) {
      CComPtr<IUnknown> unknown;
      hr = registrar->GetRegistrationInterface(CComBSTR(L"GoogleDesktop.EventRegistration"),
                                               &unknown);
      ATLASSERT(SUCCEEDED(hr));

      CComQIPtr<IGoogleDesktopRegisterEventPlugin> event_registration(unknown);
      if (event_registration != NULL) {
        long cookie = 0;
        hr = event_registration->RegisterPlugin(our_guid, &cookie);
        if (SUCCEEDED(hr)) {
          hr = registrar->FinishComponentRegistration();

          if (SUCCEEDED(hr)) {
            hr = StoreRegistrationCookie(cookie);
          }
        }
      }
    }
  }

  return hr;
}
示例#3
0
/****************************************************************************
 *  Method:
 *    CMP4ADecoder::OS_BuildLibName
 */
HXBOOL CMP4ADecoder::OS_BuildLibName(const char* pLibName, 
				   char *pOSLibName, 
				   UINT32 ulBufLen)
{
    HXBOOL bRetVal = FALSE;

    if (pOSLibName && pLibName)
    {
#if defined(HELIX_FEATURE_AUTOUPGRADE)
        // Copy the base file name into the AU String (just
	// in case we need it)
	SafeStrCpy(m_szAUStr, pLibName, MAX_LIBNAME_SIZE);
#endif /* #if defined(HELIX_FEATURE_AUTOUPGRADE) */

	SafeStrCpy(pOSLibName, pLibName, MAX_LIBNAME_SIZE);
	// Now append the filename suffix
	SafeStrCat(pOSLibName, z_dllSuffix, ulBufLen);

	bRetVal = TRUE;
    }

    return bRetVal;
}